Command | Description |
---|---|
Ctrl + A | Jump to beginning of line |
Ctrl + E | Jump to end of line |
Ctrl + U | Delete text before cursor |
Ctrl + K | Delete text after cursor |
Ctrl + W | Delete word before cursor |
Ctrl + T | Swap last two characters before cursor |
Esc + T | Swap last two words before cursor |
Ctrl + R | Search through previous commands |
Ctrl + L | Clear screen (or Cmd + K) |
Ctrl + C | Kill current process |
Ctrl + D | Exit shell |
Command | Description |
---|---|
cd | Move into home directory |
cd dir | Move into directory |
ls | List files |
ls -l | List files with details |
ls -a | List hidden files |
ls -lh | List files with human-readable file size |
ls -R | List files recursively |
sudo command | Run command as admin |
open file | Open file |
open . | Open current directory |
top | Display active processes |
clear | Clear screen |
Command | Description |
---|---|
history n | Display last n commands |
Ctrl + R | Search through previous commands |
!* | Use arguments from previous command |
!$ | Use last argument from previous command |
Esc + . | Print arguments from previous command |
!value | Run previous command starting with value |
!! | Run previous command |
Command | Description |
---|---|
touch file | Create empty file |
pwd | Print full path of current directory |
cat file | Print file to screen |
rm file | Remove file |
rm -i file | Remove file with confirmation |
rm -f file | Remove file without confirmation |
cp file file | Copy file (original → copy) |
cp file dir | Copy file into directory |
mv file file | Rename file (old → new) |
Command | Description |
---|---|
mkdir dir | Create directory |
mkdir -p dir/dir | Create subdirectory |
rmdir dir | Remove empty directory |
rm -R dir | Remove directory with contents |
Command | Description |
---|---|
more | Print to screen in chunks |
> file | Write to file |
>> file | Append to file |
< file | Read from file |
Command | Description |
---|---|
[command] -h | Print help |
[command] --help | Print help |
[command] help | Print help |
man [command] | View manual |
whatis [command] | Print description |
Adapted from: https://github.com/0nn0/terminal-mac-cheatsheet