CLI Cheat Sheet
Navigating the File System
| command | definition |
|---|---|
pwd | print working directory |
ls | list files and directories |
cd | change directory |
Working with Files and Directories
| Command | Description |
|---|---|
mkdir | make a new directory |
rmdir | remove a directory |
touch | create a new file |
rm | remove a file |
mv | move a file or directory |
cp | copy 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