Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991, by Linus Torvalds. Linux is typically packaged in a Linux distribution.

Basic System Commands

exitClose / exit from a from terminal
xkillAfter right click on any window to close
poweroffTurn off the system using terminal
rebootRestart the system using terminal

File Commands

lsList files in current directory
ls -lList files in long format
ls -aList all files including hidden files
pwdPrint working directory
cdChange directory
cd ..Change directory to parent directory
cd ~Change directory to home directory
cd -Change directory to previous directory
mkdirCreate directory
mkdir -pCreate directory and parent directories
touchCreate file
cpCopy file
cp -rCopy directory
mvMove file
mv -rMove directory
rmRemove file
rm -rRemove directory
rm -fForce remove file
rm -rfForce remove directory

File Permissions

chmodChange file permissions
chmod 777Change file permissions to 777
chmod u+xChange file permissions to executable for user
chmod g+xChange file permissions to executable for group

Privilege Escalation

sudo -lList sudo permissions
sudo -uRun command as another user
sudo -iRun shell as another user
sudo !!Run previous command as root
suRun shell as another user


ssh user@hostConnect to remote host
ssh -p port user@hostConnect to remote host on specific port
ssh-copy-idCopy SSH key to remote host
ssh-keygenGenerate SSH key

System Info

unamePrint system information
uname -aPrint all system information
uname -rPrint kernel release
uname -mPrint machine hardware name
hostnamePrint system hostname
hostname -IPrint all IP addresses
hostname -iPrint IP address
datePrint system date and time
calPrint calendar
uptimePrint system uptime
whoamiPrint current user
wPrint who is logged in
fingerPrint information about user
idPrint effective user and group id
groupsPrint all groups current user is in
lastPrint last logged in users
lastlogPrint when users last logged in
freePrint free and used memory
dfPrint disk usage
duPrint file space usage
du -hPrint file space usage in human readable format
manPrint manual page (exit with q)
topGet all running procsee & hardware consumptions


Ctrl + aGo to the beginning of the line you are currently typing on
Ctrl + eGo to the end of the line you are currently typing on
Ctrl + uClear the line before the cursor position. If you are at the end of the line, clears the entire line.
Ctrl + kClear the line after the cursor position. If you are at the beginning of the line, clears the entire line.
Ctrl + wDelete the word before the cursor.
Ctrl + rLet you search through previously used commands.
Ctrl + lClears the Screen, similar to the clear command.
Ctrl + cKill whatever you are running.
Ctrl + dExit the current shell.
Ctrl + zPuts whatever you are running into a suspended background process. fg restores it.
Ctrl + sStop output to the screen (for long running command).
Ctrl + qAllow output to the screen (for long running command).
Ctrl + xUse the arrow keys to navigate through the command line history.
Ctrl + _Undo.
Ctrl + Alt + TOpen terminal using keyboard
Ctrl + Shift + NOpen new terminal window
Ctrl + Shift + TOpen new tab in terminal
Ctrl + Shift + CCopy selected text from terminal
Ctrl + Shift + VPaste any coppied text in terminal

// Also press up & down arrow respectively to get the former & latter executed commands in a terminal .

Text Editors

nanoNano is a simple text editor for Unix-like computer operating systems.
vim fileVim is a highly configurable text editor built to enable efficient text editing.
vi fileVi is a screen-oriented text editor originally created for the Unix operating system.
emacs fileEmacs is a family of text editors that are characterized by their extensibility.


tar -xvf file.tarExtract tar file
tar -cvf file.tar directoryCreate tar file
tar -tvf file.tarList contents of tar file
tar -xvzf file.tar.gzExtract tar.gz file
tar -cvzf file.tar.gz directoryCreate tar.gz file
tar -tvzf file.tar.gzList contents of tar.gz file
tar -xvjf file.tar.bz2Extract tar.bz2 file
tar -cvjf file.tar.bz2 directoryCreate tar.bz2 file
tar -tvjf file.tar.bz2List contents of tar.bz2 file
unzip file.zipExtract zip file
zip directoryCreate zip file
zip -r directoryCreate zip file recursively
unrar x file.rarExtract rar file
rar a file.rar directoryCreate rar file

Disk Usage

dfShow disk usage
duShow file space usage
du -hShow file space usage in human readable format
du -aShow file space usage for all files
du -sShow summarized file space usage
du -shShow summarized file space usage in human readable format
du -cShow summarized file space usage with grand total
fdisk -lShow all disk partitions
fdisk /dev/sdaShow disk partitions for /dev/sda
mountShow mounted filesystems
grep pattern fileSearch for pattern in file
grep -r pattern directoryRecursively search for pattern in directory
grep -v pattern fileInvert match, print non-matching lines
grep -l pattern filePrint only filenames with matches
grep -i pattern fileIgnore case distinctions
grep -r -i pattern directoryRecursively search for pattern in directory, ignoring case
locate fileFind file
find / -name fileFind file in /
find / -name file -type fFind only files in /


ifconfigConfigure a network interface
ifconfig -aConfigure all network interfaces
ifconfig eth0Configure eth0 network interface
iwconfigGet information for WiFi adapters
nmcli networking offTurn off network connections
nmcli networking onTurn on network connections
systemctl stop NetworkManagerTurn off network connections
systemctl start NetworkManagerTurn on network connections
systemctl restart NetworkManagerRestart network connectionss
whois domainGet whois information for domain
dig domainGet DNS information for domain
dig -x hostGet DNS information for host
host domainGet DNS information for domain
host -t mx domainGet MX records for domain
hostname -IGet all IP addresses
hostname -iGet IP address


hmove cursor left
jmove cursor down
kmove cursor up
lmove cursor right
gggo to the first line of the document
Ggo to the last line of the document
zzcenter cursor on screen
0jump to the start of the line


CTRL+OWrite the current file to disk
CTRL+XClose the current file buffer / Exit from Nano
CTRL+RInsert another file into the current one
ALT+<Switch to the previous file buffer
ALT+>Switch to the next file buffer
ALT+DCount the number of words, lines, and characters
CTRL+LRefresh (redraw) the current screen


treeIt will display the contents of the working directory recursively showing sub-directories and files
tree -aDisplay also the hidden files
tree -fDisplay contents with the full path prefix
tree -dDisplay only the subdirectories
tree -dfDisplay subdirectories with their paths
tree -L 2Specifying depth of the directory
tree -P*Display only those files that match the pattern
tree --duReports the size of each element
tree -JOutputs the directory tree as an JSON formatted array
tree -o direc_tree.txtRedirect the tree’s output to filename