To create a file an editor is a must to write programs. Here you will be having VI editor to use.
VI editor works in three modes, out of which you only need two to learn.
Insert Mode (enter by pressing ‘i‘)
Command Mode (enter by pressing ‘ESC‘)
Saving a file needs a command to execute. Like to save a file, first press ‘ESC‘ then type ‘:wq‘ (this will be visible in left down corner)
vi 7001_aakash_01.c -> (Press ‘i’)->(Write your program)->(Press ‘ESC‘)-><type ‘:wq‘)
Edit a file: To edit a file simply type the same command vi 7001_aakash_01.c, if the is already present it will open the file otherwise it will create a new file.
Execute a file
To execute a file
First Compile the file: gcc 7001_aakash_01.c -o 7001_aakash_01
if there is any error it will show it, otherwise run the following command.
Run the output file: ./7001_aakash_01
See the output of the file
For More Reference: See below screenshots-
Insert Mode and Writing a ProgramSave and Quit after pressing ESCgcc compiler file compile process and execution