Show Menu
Cheatography

Linux Global Cheat Sheet (DRAFT) by

This is a draft cheat sheet. It is a work in progress and is not finished yet.

System

uname -a
Show linux system info
uname -r
Show kernel info
uptime
Show current uptime
whoami
logged as (User)
finger user
Show info about user
date
Show the current date and time
hostname
Show system host name
hostname -i
Show the IP address of the host

Disk/M­emory Usage

df -h
Show disk usage human readable
du -h
Show dir usage human readable
du -sh
Show dir usage summarized
du -ah
Show files & dirs human readable
free -h
Show memory and swap usage

Process

ps
Show currently active processes
ps aux | grep telnet
Find all process id relateted to telnet
kill pid
Kill process with mentioned pid id
killall proc
Kill all process named proc
pkill -u proces­sname
kill with proces­sname
pkill -9 -u USERNAME
Kill User session

screen

 

Insall from Source

./conf­igure
make
install
 

File Commands

pwd
Show current dir
cd dir
Change directory to dir
cd..
Go up a directory
mkdir dir
Create dir
mkdir -p foo/{b­ar,­lot­}/{­bam­,bim}
Creating subfolders
ls
List files and dirs
ls -la
List hidden files and dirs
ls -p
list files with indicators
ln -s /file /file
Create a symbolic link
less file
Outputs content of file moveable
cat text.txt
view text.txt
touch file
create a empty file
tail -f file
Follow content of output
gpg -c file
Encrypt file
gpg file.gpg
Decrypt file
strings
Extract text from binary files
diff file1 file2
Comparison 2 files
diff -s dir1 dir2
Comparison 2 dir
diff -uNr orgina­lfile correc­tedfile > file.diff
create Patch file

cp Copy command

cp file1 file2
Copy file1 to file2
cp * /dir
Copy everything to /dir
cp -r dir /dir
Copy dir reccus­ively to
dir with subfolders
cp -i fileA fileB
Prompted before overwrite to file
cp -l /file /file
Create a Hardlink

rm Remove command

rm file
Remove file
srm file
Securly removes file
rm -f file
Force remove file
rm -r dir
Remove dir recusivley
rm -rf dir
Recusivley force remove dir

mv Move command

mv file1 file2
Rename file1 to file2
mv file1 file2 /dir
Move file1 and file2 to /dir
mv * /dir
Move everthing to /dir
mv -i file1 file2
prompt before overwrite