Cheatography
https://cheatography.com
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 successful, 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 "piping". |
|
|
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 Insensitive) |
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 Directories |
ls -a |
List Files and Directories Including Hidden |
ls -R |
List Files and Directories Recursively |
ls -r |
List Files and Directories in Reverse Order |
ls -l |
List Files and Directories Showing more Detail |
ls -1 |
List Files and Directories 1 Per Line |
ls -m |
List Files and Directories comma seperated |
ls -! |
List Files and Directories Quoted Output |
|
Created By
Metadata
Favourited By
Comments
No comments yet. Add yours below!
Add a Comment
Related Cheat Sheets