16.5. How to Do Stuff in the Terminal

There are many commands we can use in the terminal to move through the filesystem of our computers. The list below shows some of the common actions programmers take.

Clicking on a link in the table will lead to a tutorial on how to use that command.

Basic Terminal Commands
Command Result
ls Lists all files and folders in the current directory.
cd directory_path Change directory. Navigates from the current directory to the new directory_path.
pwd Print working directory. Prints the path of the current directory.
mkdir folder_name Make directory. Creates folder_name inside the current directory.
touch new_filename Creates a file called new_filename in the current directory.
rm file_name Removes file_name from the current directory.
man command Manual. Prints to the screen the manual pages for the command. This includes the proper syntax and a description of how that command works.
clear Empties the terminal window of old commands and output.
cp source_path target_path Copies the file or directory at source_path and puts it in the target_path.
mv source_path target_path Moves the file or directory at source_path from its current location to target_path.


  1. rm permanently deletes items from the computer. This action cannot be undone.
  2. Git Bash does not support man. Instead, command --help provides a similar result.

Beyond these basic commands, there are some shortcuts we can use in place of typing out a full path or directory name.

Directory Shortcuts
Shortcut Where it goes
~ The Home directory
. The current directory
.. The parent directory of the current directory


If we type the first few letters of a directory name and tap the Tab key, the terminal will often automatically complete the name for us!

$ ls
homework       really_long_directory_name
README.md      docs
$ cd re  <-- Tap the Tab key
$ cd really_long_directory_name  <-- Presto!

16.5.1. Check Your Understanding


Which terminal command deletes a file completely from the computer?

  1. cp
  2. rm
  3. mv
  4. del


Which shortcut takes you to the parent directory?

  1. ..
  2. ~
  3. .