Show Menu
Cheatography

Linux Cheat Sheet by

Linux

Terminal Shortcuts

Common Shorcuts
CTRL L = Clear the terminal
SHIFT Page Up/Down = Go up/down the terminal head = from the top
CTRL A = Cursor to start of line
CTRL E = Cursor TO end of line
CTRL U = Delete left of the cursor
CTRL K = Delete right of the cursor
CTRL W = Delete word on the left of the cursor
CTRL Y = Paste (after CTRL U,K or W)
TAB = auto completion of file or command
TAB TAB = shows you the options of commands
!! = repeat last command
CTRL Z = stops the current

Basic navigation

Finding you way
ls -a = list all files and folders
ls <fo­lde­rNa­me> = list files in folder
ls -lh = Detailed list, Human readable
ls -l *.jpg = list jpeg files only
ls -lh <fi­leN­ame> = Result for file only
cd <fo­lde­rNa­me> = change directory
if folder name has spaces use “ “
cd / = go to root
cd .. = go up one folder
pwd = print working directory
man <co­mma­nd> = shows manual
 

File Manipu­lation

make ,copy ,move ,delete commands
cat <file name > show content of the file
mkdir = create new folder
mkdir <na­me>
cp = copy and rename a file
cp -R = copy and rename a file
mv <txt file name> <fo­lde­rna­me>
= move a file to a folder
mv <fo­lde­rna­me> <fo­lde­rna­me> = move folder into another folder
mv <txt filena­me> <txt filena­me>= rename file
rm <fi­len­ame­>= delete file or files
with rm <fi­len­ame> <fi­len­ame­1>...
rm -i <fi­len­ame> = ask for confir­mation on each file
touch <fi­len­ame> = create or update a file

File Manipu­lation continued

editing or viewing files
head -n <#o­fli­nes> <txt fileNa­me>= writes the no of lines of the file (from the top) to the screen
tail -n <#o­fli­nes> <txt fileNa­me> = writes the no of lines of the file (from the bottom) to the screen
less <txt fileNa­me> = wtites the contents of a file onto the screen one page at a time;use space bar to continue
more <txt fileNa­me> = wtites the contents of a file onto the screen.
 

File Manipu­lation continued1

search commands
grep <te­xtu­wan­tto­sea­rch> <fi­leN­ame> = search for text in file
grep -i = Ignores upperc­ase­/lo­wercase when searching
grep -v = displays lines that do not match
grep -n = puts a line number in front of each matching line number
grep -c = prints the total count of the matched lines
grep -r <te­xt> <fo­lde­rNa­me>/ =
search for file names
with occurrence of the text
       
 

Comments

No comments yet. Add yours below!

Add a Comment

Your Comment

Please enter your name.

    Please enter your email address

      Please enter your Comment.

          Related Cheat Sheets

          VBA for Excel Cheat Sheet
          tmux - terminal multiplexer Keyboard Shortcuts
          The Basics of Accounting Cheat Sheet