Show Menu
Cheatography

Linux Command Line Cheat Sheet by

A collection of usefull commands

Bash Variables

Commands
Descri­ption
env
Shows enviro­nment variables
$PATH
Search Path
$SHELL
Displays current shell
$HOME
Displays Home Directory
echo $NAME
outputs the value of a variable

File Commands (Options)

-a
show hidden files
-A
show hidden except..
-d
only show direct­ories
-h
human readable size
-i
inode info
-l
long list
-m
output as csv
-r
sort in reverse order
-S
sort by file size

Bash Shortcuts

CTRL-c
stop current execution
CTRL-z
sleep
CTRL-a
start of line
CTRL-e
end of line
CTRL-r
search history
!!
repeat last command
ALT-.
last argument of last command
 

Directory Commands

pwd
show current directory
mkdir
makes directory
cd dir
goes to directory
cd
goes up a directory
ls
list files
touch
creates or updates file
cat
places standard input into file
tail
outputs last 10 lines of file
rm
removes file

List options

-R
recursive list
-a
show all
-r
reverse order
-t
sort by last modified
-1
one file per line

File Search

grep -i
Case insens­itive search
grep -r
recursive search
grep -v
inverted search
grep -o
show matched part of file only
whereis 'command'
find source of command
locate 'file'
locate a file

Permis­sions

4
read
2
write
1
execute
 

Terminal Shortcuts

screen
starts screen session
screen -r
resumes screen session
CTRL-A
activates commands
CTRL-A c
creates new terminal
CTRL-A n
next terminal
CTRL-A p
previous terminal
CTRL-A A
rename terminal

Network

ping host
pings host
whois domain
gets whois inform­ation for domain
dig domain
gets dns info

SSH

ssh user@host
connects to host as user
ssh -p port user@host
connects to specific port to host as user

Shortcuts

Ctrl+C
Halts command
Ctrl+Z
Stops current command
Ctrl + D
Logs out
Ctrl + W
erases one word in line
Ctrl + U
erases line
Ctrl + R
most recent command
exit
logs out of session
 

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