Show Menu
Cheatography

Linux Commands Cheat Sheet by

A few commands to make it easier to browse through the logs.

Search commands

grep -a "­search term" "File Name"
Search the file for your search term.
grep -a "­search term" "File Name" -A3
Search for the search time and view 3 lines after.
grep -a "­search term" "File Name" -B7
Search for the search time and view 7 lines before.
grep -a "­search term" "File Name" -C2
Search for the search time and view 2 lines before and after.
grep -a "­search term" *
Search all files in the current folder for your search term.
tail -100 "File Name"
List the last 100 lines of the file.
tail -F "File Name"
List the lines in the log as they are written.
head -50 "File Name"
List the first 100 lines of the file.
cat "File Name"
List all lines, oldest to newest in the file.
tac "File Name"
List all lines, newest to oldest in the file.

Navigation through folders

ls
List files in the current folder.
pwd
Show the current folder name.
"­folder name"
Enter the folder (if you can see the folder with "­ls")
cd ..
Go up a folder.
cd
Go all the way up to the main folder.

Other Shortcuts

Ctrl+C
Stop the current command (if there's an issue, try this).
Ctrl+I­nsert
Copy selected text.
Shift+­Insert
Paste copied text.
Tab
Attempt to finish the current command being typed.
   
 

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
          Bash/ZSH Shourtcuts Cheat Sheet
          bash Shortcuts Cheat Sheet