Linux Command Line Tools
Last Updated: Nov 30, 2023
This post introduces you to the most basic command line tools you need to know for the class.
How to open a terminal: ctrl+alt+t
How to copy/paste in a terminal: ctrl+shift+c/ctrl+shift+v
Copy the commands below and paste into the terminal, then hit ENTER to see similar result:
- How to check where we are at in current terminal:
$ pwd
For example:
xssun@ROB-STAFF-10U:~$ pwd /home/xssun
- Here
/home/xssun
is current directory we are at
- Here
- How to create a new folder and confirm the creation:
# create a new folder $ mkdir new_folder # list directory contents $ ls
For example:
xssun@ROB-STAFF-10U:~$ mkdir parent_folder xssun@ROB-STAFF-10U:~$ ls Desktop Downloads parent_folder Public Documents Music Pictures Videos
- How to navigate to certain folder:
$ cd destination_folder
For example:
xssun@ROB-STAFF-10U:~$ cd parent_folder/ xssun@ROB-STAFF-10U:~/parent_folder$ pwd /home/xssun/parent_folder
- More about nagivation:
# move to home directory $ cd ~ # move to parent directory $ cd ..
- In filesystems, we use the double dot (..) to access the parent directory, whereas the single dot (.) represents the current directory.
- How to remove a file/folder:
$ rm the_file $ rm -r the_folder
- The
-r
option stands for recursive. When used withrm
, it recursively deletes all the files and subdirectories within the specified directory, starting from the deepest level and moving up.
For example:
xssun@ROB-STAFF-10U:~$ rm -r parent_folder/ xssun@ROB-STAFF-10U:~$ ls Desktop Downloads Public Documents Music Pictures Videos
- The