Show Menu
Cheatography

Linux Cheat Sheet by

Bash Shortcuts

CTRL+C
Stop Current Command
CTRL+Z
Sleep Current Foreground Command
CTRL+A
Move Cursor to Start of the Line
CTRL+E
Move Cursor to End of the Line
CTRL+U
Cut from Start of Line to Cursor
CTRL+K
Cut from End of Line to Cursor
CTRL+R
Search Through Command History
bg
Send Last Sleep Command to Background (output will be printed to screen)
fg
Bring Last Background Command to Foreground
!!
Repeat Last Command
!abc
Run the Last Command with the String Starting with abc
!abc:p
Print the Last Command with the String Starting abc
^abc&123
Run the Previous Command, Replacing abc with 123
 

Bash Commands

date
Show System Data
uptime
Show System Uptime

Command Lists

cmd1;cmd2
Run cmd1 then cmd2
cmd1 && cmd2
Run cmd1 then if succes­sful, run cmd2
cmd &
Run Command in the Background (Output will be Printed to the Screen)
cmd1 | cmd2
Run cmd1 and then run cmd2 Based on the Results of cmd1. This can be Repeated and is called "­pip­ing­".
 

Search

find /dir/ -name name*
Find Files Starting with name Under the /dir/ Directory
find /dir/ -user name
Find Files Owned by the Username under the /dir/ Directory
find /dir/ -mmin num
Find Files Modified Less than num Minutes ago in the /dir/ Directory
grep pattern files
Search for Lines in the file which Match the Pattern
grep -l pattern files
Search for Lines in the File which Match the Pattern (Case Insens­itive)
grep -v pattern files
Search for Lines in the File which don't Match the Pattern
cut -d " " -f "­1"
cut is used to only display the parts of a line you are interested in. In this example, the delimiter is a space, (-d “ “) and we are only interested in the first entry, (-f “1”). You can select multiple entries by separating with a comma, (-f “1,2,3”)
 

Directory Operations

pwd
Print Working Directory
mkdir name
Make Directory in current Directory
cd dir
Change Directory to dir
ls
List files and Direct­ories
ls -a
List Files and Direct­ories Including Hidden
ls -R
List Files and Direct­ories Recurs­ively
ls -r
List Files and Direct­ories in Reverse Order
ls -l
List Files and Direct­ories Showing more Detail
ls -1
List Files and Direct­ories 1 Per Line
ls -m
List Files and Direct­ories comma seperated
ls -!
List Files and Direct­ories Quoted Output
 

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

          Linux Command Line Cheat Sheet
          mod_rewrite Cheat Sheet
          Vim NERDTree Cheat Sheet