Why important ? ● You must know how to: ○ Create a file ○ Create a folder ○ Delete a file ○ Delete a folder ○ Show current Path ○ Navigate through folders ○ Show content in folder ○ Show content in file ○ Copy a File/Folder ○ Compile a C program ○ Execute a C program
First of all, open the linux Terminal Command: Ctrl + Alt + T
In the Linux Terminal, Type: touch name_of_file.extension Examples: ● touch hello.txt ● touch cs256.pdf ● touch code.c
In the Linux Terminal, Type: mkdir name_of_folder Examples: ● mkdir home ● mkdir CS
In the Linux Terminal, Type: rm name_of_file.extension Examples: ● rm hello.txt ● rm cs256.pdf ● rm code.c
In the Linux Terminal, Type: rm -rf name_of_file.extension Examples: ● rm -rf home ● rm -rf CS
In the Linux Terminal, Type: pwd
In the Linux Terminal, Type: ● To navigate ○ cd path_of_folder ● To return to previous folder ○ cd .. ● To return to main page(Desktop) ○ cd Examples: ● cd Desktop/Download ( To go to the Downloads folder) ● cd ..
In the Linux Terminal, Type: ● For folder ○ ls or ls name_of_folder ● For file ○ cat name_of_file Examples: ● ls Desktop ● cat hello.txt
Command: → ~ means home directory . means current directory ● File ○ cp src dest ● Folder ○ cp -r src dest Examples: ● File: ○ cp /u1/junk/shakespeare.txt ~ ● Folder ○ cp -r /u1/junk/MST .
In the Linux Terminal, Type: gcc name_of_file.extension Examples: ● gcc test.c
In the Linux Terminal, Type: ./a.out
● Create a folder named cs256_linux ● Go to cs256_linux folder ● Create a file named my_file.txt ● Copy the content of file from “/u1/junk/shakespeare.txt“ to your my_file.txt ● Show the content of the file ● Delete the file my_file.txt ● Copy folder from “/u1/junk/MST” to your cs256_linux folder ● Delete the folder cs256_linux
Recommend
More recommend