Terminal Commands

15 1 0
                                        

In the previous chapter you learned about using the command line (terminal). Now you will learn about all basic commands every Linux user knows. There is a cheat sheet in Appendix A. Let's start:

1. pwd

The terminal is like a grand file explorer. You can switch from directory to directory and edit files. The command pwd shows your current path (location) in your computer. Example: Input: "pwd" Output: "/home/username/Documents"

2. ls

The next step is to list all the files and folders in your current directory. To do that, run ls. Example: Input: "ls" Output: "text.txt   test.py   my_doc.docx"

3. cd

To navigate through the computer, you need cd. Cd means "change directory" and the correct usage is: "cd [your folder]". Example: cd Downloads

Another important thing about cd is the "..". The dubble dot means "go back one folder". So if you do "cd ..", you will go back one level. The slash is used to seperate the directories.                    So "cd /home/username/.." leads you to home.

4. find

Find searches for files in a directory recursively (so every file will be listen, even if it is deeper in a subfolder). Example: "find ~"

5. mkdir

Mkdir means "make directory" and make a folder. It's that simple. Example: "mkdir MyFolder"

6. touch

Touch makes a new file in your current directory. Example: "touch MyFile"

7. echo

Echo takes the input and puts in in the output. Example: echo "Hello World"

8. exit

The exit command is simply used if you want to close the terminal. No more, no less.

9. rm

This command is used when files get deleted. It can be a very dangerous command, so handle it with care. Usage: rm [your file]. You will learn later how to remove an entire directory.


Be aware that the command line is case-sensitive. So PWD will not be recognised as a command, and will produce an error. Spaces in filenames are not possible, so it will be recognised as two files. The terminal is very strict in syntax.

Linux for dummiesWhere stories live. Discover now