0% found this document useful (0 votes)
149 views7 pages

1.2) Introduction About Editors - Turbo, Vi, Emacs, Dev C++, Turbo C Editor

The document summarizes several Linux commands: (1) man provides manual descriptions of commands, (2) mkdir creates directories, (3) pwd shows the present working directory, (4) cat displays or appends file contents, (5) cp copies files, (6) mv moves/renames files, (7) ls lists directory contents, (8) rmdir removes empty directories, (9) rm removes files, (10) tty prints the terminal name, and (11) who lists logged in users. Examples are provided for each command's syntax and usage.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
149 views7 pages

1.2) Introduction About Editors - Turbo, Vi, Emacs, Dev C++, Turbo C Editor

The document summarizes several Linux commands: (1) man provides manual descriptions of commands, (2) mkdir creates directories, (3) pwd shows the present working directory, (4) cat displays or appends file contents, (5) cp copies files, (6) mv moves/renames files, (7) ls lists directory contents, (8) rmdir removes empty directories, (9) rm removes files, (10) tty prints the terminal name, and (11) who lists logged in users. Examples are provided for each command's syntax and usage.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 7

1.

2) Introduction about Editors –Turbo, Vi, Emacs, Dev C++, CodeBlocks IDE
Turbo C Editor:
Turbo C is a discontinued Integrated Development Environment and compiler for the C
programming language from Borland. First introduced in 1987, it was noted for its integrated
development environment, small size, fast compile speed, comprehensive manuals and low
price.
• For opening a new file: Go to File menu -> New -> filename.c
• For saving a new file : File menu -> Save
• For Compiling: press the keys Alt + F9
• For Running: press the keys Ctrl + F9
Vi Editor:
Vi (or visual editor) is a powerful and helpful full screen editor that is always available on
UNIX systems. Vi is particularly useful if you write programs and scripts.

Syntax: vi filename.c

Vi editor has three modes


• Command mode
• Insert mode
• Exit mode
The command mode:
once a file is open, you are in the command mode. From command mode, you can:
• invoke insert mode
• issue editing commands
• move cursor to a different position in the file
• save and exit the current version of the file
Insert mode:

In insert mode you can enter new text in the file. Press Esc key to exit insert mode and return
to command mode. The following commands invoke insert mode:

• a Append after cursor


• A Append at end of line
• i Insert before cursor
• I Insert at beginning of line
• r Replace character under cursor
• O Open a new line above current line
Last line mode:
The last vi mode is known as vi last line mode. The following commands invoke exit mode:
• :q to quit (short for :quit)
• :q! to quit without saving
• :wq to write and quit
• :wq! to write and quit even if file has only read permission
• :x to write and quit
• :qa to quit all (short for :quit all)

Emacs Editor:
Emacs is another editor available in UNIX. Like vi, emacs is a screen editor.
Unike vi, emacs is not an insertion mode editor, meaning that any character typed in emacs is
automatically inserted into the file, unless it includes a command prefix

• To open a file: emacs filename.c


• To save file press F10 and press f for file menu and then press s for saving file
• To quit file press F10 and press f for file menu and then press q to exit from emacs
editor
• Compile: cc filename.c
• Execution: . /a.out

Dev-C++:
Dev-C++ allows you to write, compile and run a C or C++ program. Dev-C++, developed
by Bloodshed Software, is a fully featured graphical IDE (Integrated Development
Environment), which is able to create Windows or console-based C/C++ programs using the
MinGW compiler system.
Create/add source file(s):
You can add empty source files one of two ways:
Go to the "File" menu and select "New Source File" (or just press CTRL+N) OR
Go to the "Project" menu and select "New File"
Save:
Dev-C++ will not ask for a filename for any new source file until you attempt to: Compile.
Save the project. Save the source file.
Compile :
Once you have entered all of your source code, you are ready to compile.
Go to the "Execute" menu and select "Compile"
Execute :
You can now run your program.
Go to the "Execute" menu, choose "Run".

CodeBlocks IDE:
Code::Blocks is a powerful IDE for creating, compiling, executing and debugging C/C++
programs. Code::Blocks is a cross-platform IDE that supports compiling and running
multiple programming languages.
Steps:
1. Open CodeBlocks IDE and create a new file. Click on File → New → File
2. From the New form template window select C/C++ source and click Go button
3. Select your language from C/C++ source window and click Next button.
4. Give name to your file and specify the location.
5. Write and save your first C program. Press Ctrl + S to save.
6.To compile and run a C program, click Build → Build and run to compile and build your C
program, alternatively use the shortcut key F9.
Experiment-1: Introduction to C Programming

1.1) Basic Linux Commands


Linux is the best-known and most-used open source operating system. As an operating
system, Linux is software that sits underneath all of the other software on a computer,
receiving requests from those programs and relaying these requests to the computer’s
hardware.

1. Command name: man

Description: It provides the manual description about the given command

Syntax: man <command name>

Example:

[root@localhost ~]$ ls

a.txt nalini.txt aditya.txt

2.Command name: mkdir

Description: It is used to create a directory

Syntax: mkdir <directoryname>

Example:

[root@localhost ~]$ mkdir aditya

3.Command name: pwd

Description: It shows the present working directory

Syntax: pwd

Example:

[root@localhost aditya]$ cd cse

[root@localhost saiaditya]$ pwd

/home/root/aditya/cse

4.Command name: cat.

Description: The purpose of this command is


(a)To create a file

(b)To display the contents present in the file

(c)To append a new content to the already existing content in a file

(a)Syntax: cat > <filename.extension>

Example:

[root@localhost aditya]$ cat > sri.txt

Welcome

To c programming lab

(b)Syntax: cat <filename.extension>

Example:

[root@localhost aditya]$ cat sri.txt

Welcome

To c programming lab

(c)Syntax: cat >> <filename.extension>

Example:

[root@localhost aditya]$ cat >> sri.txt

Aditya engineering college

[root@localhost aditya]$ cat sri.txt

Welcome

To c programming lab

Aditya engineering college

5.Command name: cp

Description: It copies the contents from source file to destination file

Syntax: cp <sourcefilename> <destinationfilename>


Example:

[root@localhost aditya]$ cp sri.txt siri.txt

[root@localhost aditya]$ cat siri.txt

Welcome

To c programming lab

Aditya engineering college

6.Command name: mv

Description: It moves the contents from source file to destination file(rename)

Syntax: mv <sourcefilename> <destinationfilename>

Example:

[root@localhost aditya]$ mv sri.txt nk.txt

[root@localhost aditya]$ cat nk.txt

Welcome

To c programming lab

Aditya engineering college

[root@localhost aditya]$ cat sri.txt

File doesnot exist

7.Command name: ls

Description: list directory contents

Syntax: ls filename

Example:

[root@localhost ~]$ ls vinod

Add.c cosx.c file1.c abc.c fact.c Armstrong.c

8.Command name: rmdir


Description: It is used to remove a directory

Syntax: rmdir <directoryname>

Example:

[root@localhost ~]$ rmdir aditya

9. Command name: rm

Description: It is used to remove files

Syntax: rm <filename>

Example:

[root@localhost ~]$ rm nk

10. Command name: tty

Description: Print the file name of the terminal connected to standard input

Syntax: tty

[root@localhost ~]$ tty

/dev/pts/76

11. Command name: who

Description: Print information about users who are currently logged in.

Syntax: who

[root@localhost ~]$ who

You might also like