4.3. How to Do Stuff in the Terminal

4.3.2. Basic Commands

There are many commands you can use in the terminal to move through the filesystem of your computer and projects.

Basic Terminal Commands

Command

Result

ls

Lists all files and folders in the current directory.

cd <new-directory>

cd stands for change directory. Navigates from the current directory to new-directory.

pwd

Print working directory. Prints the path of the current directory.

mkdir <new-folder>

Make directory. Creates new-folder inside the current directory.

touch <new-file>

Creates a file called new-file in the current directory.

rm <old-file>

Removes old-file 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 previous 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.

Note

  1. rm will permanently remove items from the computer and cannot be undone.

  2. Git bash does not support man. Instead, <command> --help provides a scaled down alternative.

Beyond these basic commands, there are some shortcuts if you don’t want to type out the full name of a directory or simply can’t remember it.

Directory Shortcuts

Shortcut

Where it goes

~

The Home directory

.

The current directory

..

The parent directory of the current directory

For an in-depth tutorial of how to use a CLI to move through your daily life, refer to the terminal commands tutorial.

4.3.3. Check Your Understanding

Question

What line in a CLI indicates that the terminal is ready?

  1. prompt

  2. command

  3. shell

  4. There isn’t a line that does that.

Question

Which shortcut takes you to the parent directory?

  1. .

  2. ~

  3. ..