Lab
Preparation
- Download the chrome extension for SSH (link)
- Login to the lab by typing “ssh “
- then paste this “student@35.232.213.76″
Execution
- To execute the program in the lab it is a must to remember few commands.
- File naming convention:
- <last4digitofregistrationno>_firstname_programno.c
- Like Registration No: 205237001, Name: Aakash Singh
- File Name: 7001_aakash_01.c, 7001_aakash_02.c, 7001_aakash_03.c
- Create a file with the name and programno
- 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 Program
Save and Quit after pressing ESC
gcc compiler file compile process and execution