Skip to content

Instantly share code, notes, and snippets.

@austinlparker
Last active November 8, 2022 11:23
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 austinlparker/9202767 to your computer and use it in GitHub Desktop.
Save austinlparker/9202767 to your computer and use it in GitHub Desktop.
A quick reference to some common or useful terminal commands. (Works with most Linux distributions and MacOS X)
===============================================================================
Terminal Command Quick Reference
===============================================================================
================================== ==================================
Shortcuts Navigation
================================== ==================================
ctrl + L Clear Terminal ls -a List all files/folders
ctrl + D Logout ls -l List all (Detail View)
ctrl + A Cursor to line start cd <dir> Change to <dir>
ctrl + E Cursor to line end cd ~/ Go to home directory
shift + PgUp/Dn Scroll Up/Down cd .. Go up one directory
tab Auto-Complete (to go up multiple times, ../../ )
!! Repeat Last Command pwd Print current directory
================================== ==================================
File Manipulation Data Manipulation
================================== ==================================
cat <file> Show contents grep <text> <f> Search for text
mkdir <dir> Create directory sort Sort file content
cp <f1> <f2> Copy file wc Word count
cp -R <d1> <d2> Copy directory cut Cut part of file
mv <file> <dest> Move File more info @ man sort
rm <file> Delete file man grep
rm -r <dir> Delete directory man cut
================================== ==================================
System Tools Misc. Tools
================================== ==================================
date View date&time compress files -
<cmd> & Execute cmd in bg tar -zcvf <archive>.tar.gz <dir>
jobs Display bg commands uncompress files -
fg Move bg proc. to fg tar -zcvf <archive>.tar.gz <dir>
w View who is logged in command chaining -
ps -ef See all processes <cmd> | <cmd2> | <cmd3>
top Dynamic process list ex: ps -ef | grep 'python'
kill -9 <pid> Force kill process sudo <cmd> Run <cmd> as root
sudo halt Shuts down computer ssh <user>@<host> Connect to host
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment