Cheat Sheets are in BETA. Give us your feedback.

The Command Line

The command line allows a user to navigate the filesystem and run built-in programs or custom scripts. In Unix, the command line interface is called Bash, and the shell prompt is the $.


ls List

The shell command ls is used to list the contents of directories. If no arguments are given, it will list the contents of the current working directory.

$ ls Desktop resume.pdf photo.png

pwd Print Working Directory

The shell command pwd displays the file path from the root directory to the current working directory.

$ pwd /Users/sonny/Downloads

cd Change Directory

The shell command cd can be used to move throughout the filesystem of a computer. It accepts a variety of arguments:

  • Full file paths.
  • Names of children of the current directory.
  • .. the parent of the current directory.
$ cd some-directory $ cd ..

mkdir Make Directory

The shell command mkdir can be used to make a new directory in the filesystem according to its argument. If a file path is given, the new directory will be placed at the end. Otherwise, it will create a new directory in the current working directory with the name given.

$ mkdir new-directory $ ls old-directory new-directory

touch Create New File

The shell command touch creates a new file in the current working directory with the name provided.

$ touch secret-file.txt