Common Terminal Commands

The $ in the commands below is used to signal the beginning of a command. You do not type the $ when using them.

ls

The ls command lists the contents of the current working directory. You'll see a listing of all the files and subdirectories within the current directory.
$ ls
Desktop
Downloads
Movies
Pictures
Documents
Library
Music
Public

cd

The cd command moves the terminal into another directory. You specify the name of the directory in the command.
$ ls
Desktop
Downloads
Movies
Pictures
Documents
Library
Music
Public
$ cd Music
$ ls
Absofacto
Bon Iver
Chet Baker
FKJ
Hans Zimmer
Jono McCleery
Masego
Olafur Arnalds

cd ..

The cd .. command moves up the parent directory - the directory that contains the current one.
$ pwd
/home/codeaesthetic/Music
$ cd ..
$ pwd
/home/codeaesthetic

pwd

The pwd command prints a path to the current working directory. You can use this if you forget where the terminal is.
$ pwd
/home/codeaesthetic
$ cd Documents
$ pwd
/home/codeaesthetic/Documents

mkdir

The mkdir command makes a new directory. You specify the name of the directory to create.
$ mkdir first_program
$ ls
first_program

echo

The echo command simply prints back whatever is written after it.
$ echo Are you a 1 or 0
Are you a 1 or 0
$ echo You were only born a month ago
You were only born a month ago

rm

The rm command, which stands for remove, can delete files. Be careful it deletes it immediately. There is no way to recover it.
$ ls
final.c draft.c
$ rm draft.c
$ ls
final.c