Steps to Execute Programs in Ubuntu
1. Open Ubuntu in VirtualBox
Open Oracle VM VirtualBox
Double-click on Ubuntu (Powered Off).
Wait for Ubuntu to start.
2. Login
Enter the password:
impact
(Password must be in lowercase.)
3. Open Terminal
On the left side panel, click once on Terminal (gray color icon).
Maximize the terminal window.
You will see:
impact@ubuntu:~$
Writing the Program
4. Create and Open a C File
Type:
vi filename.c
Then press Enter.
Example:
vi program9.c
5. Enter Insert Mode
Press:
i
You will see:
-- INSERT --
at the bottom of the editor.
Now type the C program code.
Saving the Program
6. Save and Exit
Press:
Esc
(Insert mode will turn off.)
Type:
:wq
Press Enter.
w → Save
q → Quit
Now you are back to the terminal:
impact@ubuntu:~$
Compiling the Program
7. Compile the C Program
Type:
cc filename.c
Example:
cc program9.c
8. If Errors Occur
Open the file again:
vi filename.c
Press:
i
Make corrections, then save using:
:wq
Compile again until no errors are shown.
Running the Program
9. Execute the Program
Type:
./a.out
Example terminal:
impact@ubuntu:~$ ./a.out
The output will be displayed.
Installing Gnuplot (For Graphs)
10. Install Gnuplot
Type:
sudo apt install gnuplot
Press Enter.
If asked for password, type:
impact
and press Enter.
