Tab
Auto-complete file and folder namesCtrl + A
Go to the beginning of the line you're currently typing onCtrl + E
Go to the end of the line you're currently typing onCtrl + U
Clear the line before the cursorCtrl + K
Clear the line after the cursorCtrl + W
Delete the word before the cursorCtrl + T
Swap the last two characters before the cursorEsc + T
Swap the last two words before the cursorCtrl + L
Clear the screenCtrl + C
Kill whatever you're runningCtrl + D
Exit the current shellOption + →
Move cursor one word forwardOption + ←
Move cursor one word backwardCtrl + F
Move cursor one character forwardCtrl + B
Move cursor one character backwardCtrl + Y
Paste whatever was cut by the last commandCtrl + Z
Puts whatever you're running into a suspended background processCtrl + _
Undo the last command
/
(Forward Slash): Top level directory.
(Single Period): Current directory..
(Double Period): Parent directory~
(Tilde): Home directorysudo [command]
Run command with the security privileges of the super usernano [file]
Opens the Terminal editoropen [file]
Opens a file[command] -h
Get help about a commandman [command]
Show the help manual of the command
cd
Home directorycd [folder]
Change directory, e.g. cd Documentscd ~
Home directorycd/
Root of the drivecd -
Previous directory or folder you last browsedpwd
Show your working directorycd..
Move up to the parent directorycd../..
Move up two levels
ls
Display the name of files and subdirectories in the directoryls -C
Force multi-column output of the listingls -a
List all entries including those with .(period) and ..(double * period)ls -1
Output the list of files in one entry per line formatls -F
Display a / (slash) immediately after each path that is a directory,* * (asterisk) after executable programs or scripts, and @ after a * symbolic linkls -S
Sort files or entries by sizels -l
List in a long format. Includes file mode, owner and group name, * date and time file was modified, pathname, and morels -lt
List the files sorted by time modified (most recent first)ls -lh
Long listing with human readable file sizes in KB, MB, or GBls -lo
List the file names with size, owner, and flagsls -la
List detailed directory contents, including hidden files
du
List usage for each subdirectory and its contentsdu -sh [folder]
Human readable output of all files in a directorydu -s
Display an entry for each specified filedu -sk* | sort -nr
List files and folders, totaling the size including * the subfolders. Replace sk* with sm* to list directories in MBdf -h
Calculate your system's free disk spacedf -H
Calculate free disk space in powers of 1,000 (as opposed to 1,024)
mkdir
Create new folder namedmkdir
-p /: Create nested foldersmkdir
<dir1> <dir2> <dir3>: Create several folders at * oncemkdir
"": Create a folder with a space in the filenamermdir
Delete a folder (only works on empty folders)rm -R
Delete a folder and its contentstouch
<file>: Create a new file without any extensioncp
<file> Copy a file to the foldercp
<file> <newfile>:Copy a file to the current foldercp
<file>~//<newfile>:Copy a file to the folder and rename * the copied filecp -R
<"new dir">:Copy a folder to a new folder with spaces in the * filenamecp -i
<file>Prompts you before copying a file with a warning * overwrite messagecp
<file1> <file2> <file3>/Users/Copy multiple files to * a folderrm
<file>:Delete a file (This deletes the file permanently; use * with caution.)rm -i
<file>:Delete a file only when you give confirmationrm -f
<file>:Force removal without confirmationrm
<file1> <file2> <file3>:Delete multiple files * without any confirmationmv
<file> <newfilename>:Move/renamemv
<file> Move a file to the folder, possibly by overwriting an * existing filemv -i
<file> Optional -i flag to warn you before overwriting the * filemv *.png
~/Move all PNG files from current folder to a different folder
Ctrl + R
:Search through previously used commandshistory n
:Shows the previous commands you've typed. Add a number to * limit to the last n items![value]
:Execute the last command typed that starts with a value!!:
Execute the last command typed
ls -ld:
Display the default permission for a home directoryls -ld/
Display the read, write, and access permission of a particular folderchmod 755
<file>:Change the permission of a file to 755chmod -R 600
Change the permission of a folder (and its contents) to 600chown
<user>:<group> <file>:Change the ownership of a file to user and group. Add -R to include folder contents
ps -ax
:Output currently running processes. Here, a shows processes from all users and x shows processes that are not connected with the Terminalps -aux
:Shows all the processes with %cpu, %mem, page in, PID, and commandtop
:Display live information about currently running processestop -ocpu -s 5
:Display processes sorted by CPU usage, updating every 5 secondstop -o rsize
:Sort top by memory usage
ping
<host>:Ping host and display statuswhois
<domain>:Output whois info for a domaincurl -O
<url/to/file>:Download file via HTTP, HTTPS, or FTPssh
<username>@<host>:Establish SSH connection to <host> with user <username>scp
<file><user>@<host>:/remote/path:Copy <file> to a remote <host>
brew doctor
:Check brew for potential problemsbrew install
<formula>:Install a formulabrew uninstall
<formula>:Uninstall a formulabrew list
:List all the installed formulasbrew search
:Display available formulas for brewingbrew upgrade
:Upgrade all outdated and unpinned brewsbrew update
:Fetch latest version of homebrew and formulabrew cleanup
:Remove older version of installed formulabrew tap homebrew/cask
:Tap the cask repository from GitHubbrew cask list
:List all installed casksbrew cask install
<cask>:Install the given caskbrew cask uninstall
<cask>:Uninstall the given cask
find -name
<"file">:Find all files named <file> inside . Use wildcards (*) to search for parts of filenamesgrep
"<text>" <file>:Output all occurrences of <text> inside <file> (add -i for case insensitivity)grep -rl
"<text>" Search for all files containing <text> inside
cat
<file>:Output the content of <file>less
<file>:Output the contents of <file> using the less command that supports pagination and morehead
<file>:Output the first 10 lines of <file>- <
cmd
> > > <file>:Appends the output of <cmd> to <file> - <
cmd
> > <file>:Direct the output of <cmd> into <file> - <
cmd1
>|
<cmd2
>:Direct the output of <cmd1> to <cmd2>