Skip to main content

CLI Cheat Sheet

Section in the Lesson

commanddefinition
pwdprint working directory
lslist files and directories
cdchange directory

Working with Files and Directories

Section in the Lesson

CommandDescription
mkdirmake a new directory
rmdirremove a directory
touchcreate a new file
rmremove a file
mvmove a file or directory
cpcopy a file or directory

Keyboard Shortcuts (5 minutes)

The next three points are handy shortcuts that prevent you from having to backspace a bunch to erase the previous command.

CTRL + C

Cancel whatever you were typing before, or exit the currently running program. Abort!

The up and down arrows

Cycle through previous commands

Tab completion

When typing a command that has a file or path as an argument, like cd, type only the first few letters and hit the TAB key.

More Terminal Keyboard shortcuts

In the long term, reduce your reliance on the mouse. More Bash keyboard shortcuts:

COMMAND + K Clear the Terminal window

OPTION + <arrow> Move cursor by word

CTRL + A Go to beginning of line

CTRL + E Go to end of line

CTRL + K Kill line to end

CTRL + U Kill line to beginning

CTRL + Y Paste whatever was killed using Ctrl+K or Ctrl+U

Nifty Navigation Command:

$ cd - toggle previous directory

There are also video tutorials made by GA here