Skip to content

Instantly share code, notes, and snippets.

@ryansechrest
Last active October 6, 2022 03:47
Show Gist options
  • Star 2 You must be signed in to star a gist
  • Fork 3 You must be signed in to fork a gist
  • Save ryansechrest/6bd6e72919dcac56e5d5 to your computer and use it in GitHub Desktop.
Save ryansechrest/6bd6e72919dcac56e5d5 to your computer and use it in GitHub Desktop.
Mac Terminal

Editor

Command Description
Control + A Jump to beginning of line
Control + E Jump to end of line
Control + U Delete text before cursor
Control + K Delete text after cursor
Control + W Delete word before cursor
Control + T Swap last two characters before cursor
Esc + T Swap last two words before cursor
Control + R Search through previous commands
Control + L Clear screen (or Command + K)
Control + C Kill current process
Control + D Exit shell

General

Command Description
open <file> Open file
open . Open current directory
top Display active processes
clear Clear screen

History

Command Description
history <number> Display last number commands
Control + 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

Miscellaneous

Command Description
sudo launchctl unload /System/Library/LaunchDaemons/ssh.plist Stop SSH service
sudo launchctl load -w /System/Library/LaunchDaemons/ssh.plist Start SSH service

Adapted from: https://github.com/0nn0/terminal-mac-cheatsheet

@mus-naj
Copy link

mus-naj commented Apr 14, 2016

Esc + F = Forward one word
Esc + B = Backward one word

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment