Skip to content

Instantly share code, notes, and snippets.

@dvlden
Last active September 8, 2018 05:08
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dvlden/ce366f1204c281f46466 to your computer and use it in GitHub Desktop.
Save dvlden/ce366f1204c281f46466 to your computer and use it in GitHub Desktop.
I tried to simplify all the keystrokes / shortcuts and common terminal commands that I use daily myself... I hope it helps anyone, spent too much time writing this.

Don’t be afraid of Terminal on any OS, let me simplify things for you! I’ve been using Terminal a lot lately, yet I remember the time when I was entirely afraid of even typing anything in it...

Whenever I needed something on my Mac, that required Terminal commands, I had a tough time figuring what does it mean, how does it work; especially when it's a very long one. Well, it was worth it, not just copy/pasting the command, seeing it works and continuing with my day.


Key Representation

VISUAL KEY DESCRIPTIVE KEY
Command
Control
Option
Shift
Caps lock
Return
Enter
Delete / Backspace
Escape
Tab

Keystrokes / Shortcuts

KEYSTROKES DESCRIPTION
A Jump to start of the current line
E Jump to the end of the current line
Q Clears the current line
L Clears the window
K Truncates the window
D Deletes character at current cursor position
U Cuts current line
W Cuts one word backwards; Uses some special chars as delimiter
Y Paste whatever was cut (with one of two previous commands)
H Same action as backspace key
C Terminate previous command or any running processes
D Exit current shell when no process is running, or send EOF to a the running process
Z Puts whatever you are running into a suspended background process
T Swap the last two characters before the cursor position
F Move cursor position one character forward
B Move cursor position one character backward
F Move cursor one word forward
F Move cursor one word backward
T Swap the last two words before the cursor position
Auto-complete files and folder names
R Search through previous commands

Common Commands

COMMAND DESCRIPTION
ls List directory contents
cd Change directory
mkdir Make directories
mkfile Create a file
cp Copy files
mv Move files
rm Remove directory entries
open Open files and directories
sudo Execute a command as another user
clear Clear the terminal screen
touch Change file access and modification times
sips Scriptable image processing system

Build-In Editors

COMMAND DESCRIPTION
nano Nano's ANOther editor, an enhanced free Pico clone
vim Vi IMproved, a programmers text editor

Helpers

COMMAND DESCRIPTION
!! Repeats previous command
[COMMAND] > [FILE] Writes output into a file
[COMMAND] >> [FILE] Appends output to a file
[COMMAND] < [FILE] Reads file content
HINT: to learn more about each command and its flags, use man [COMMAND] command, and it will display all details about specific command and each flag it has...
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment