Linux Cheat Sheet - Simple Cheat Sheet - Linux Cheat Sheets
Linux Cheat Sheet - Simple Cheat Sheet - Linux Cheat Sheets
This cheat sheet will help you using Linux. Linux is the best-known and most-
used open-source operating system. As an operating system, Linux is software that
sits underneath all of the other software on a computer, receiving requests from
those programs and relaying these requests to the computer’s hardware.
uname -a
uname -r
uname -s
https://simplecheatsheet.com/tag/linux-cheat-sheet/ 1/26
8/3/22, 3:08 AM Linux Cheat Sheet - Simple Cheat Sheet | Linux Cheat Sheets
uname -v
uname -n
uname --m
uname -p
uname -i
uname -o
cat /etc/redhat-release
uptime
hostname
hostname -I
last reboot
Up ↑
https://simplecheatsheet.com/tag/linux-cheat-sheet/ 2/26
8/3/22, 3:08 AM Linux Cheat Sheet - Simple Cheat Sheet | Linux Cheat Sheets
date
cal
whoami
sudo lshw
lshw -short
lscpu
lsblk
lsblk -a
Up ↑
https://simplecheatsheet.com/tag/linux-cheat-sheet/ 3/26
8/3/22, 3:08 AM Linux Cheat Sheet - Simple Cheat Sheet | Linux Cheat Sheets
# CTRL Key
Up ↑
https://simplecheatsheet.com/tag/linux-cheat-sheet/ 4/26
8/3/22, 3:08 AM Linux Cheat Sheet - Simple Cheat Sheet | Linux Cheat Sheets
https://simplecheatsheet.com/tag/linux-cheat-sheet/ 5/26
8/3/22, 3:08 AM Linux Cheat Sheet - Simple Cheat Sheet | Linux Cheat Sheets
# Miscellaneous
env
echo $NAME
# Set $NAME to value Up ↑
https://simplecheatsheet.com/tag/linux-cheat-sheet/ 6/26
8/3/22, 3:08 AM Linux Cheat Sheet - Simple Cheat Sheet | Linux Cheat Sheets
export NAME=value
$PATH
# Home directory
$HOME
# Current shell
$SHELL
ls -a
# Recursive list
ls -R
# Reverse order
ls -r
ls --color
ls -d
ls -F
Up ↑
https://simplecheatsheet.com/tag/linux-cheat-sheet/ 7/26
8/3/22, 3:08 AM Linux Cheat Sheet - Simple Cheat Sheet | Linux Cheat Sheets
ls -i
ls -t
ls -S
ls -s
ls -l
ls -la
ls -lh
ls -ls
ls -1
# Comma-separated output
ls -m
# Quoted output
Up ↑
https://simplecheatsheet.com/tag/linux-cheat-sheet/ 8/26
8/3/22, 3:08 AM Linux Cheat Sheet - Simple Cheat Sheet | Linux Cheat Sheets
ls -Q
ls -X
dmesg
lscpu
lshw -short
hwinfo --short
# Lists out all the PCI buses and details about the devices connected to them
lspci
lsusb
# Lists out the scsi/sata devices like hard drives and optical drives
lsscsi
Up ↑
# Display CPU information
https://simplecheatsheet.com/tag/linux-cheat-sheet/ 9/26
8/3/22, 3:08 AM Linux Cheat Sheet - Simple Cheat Sheet | Linux Cheat Sheets
cat /proc/cpuinfo
cat /proc/meminfo
dmidecode
hdparm -i /dev/sda
badblocks -s /dev/sda
lsblk
# Reports various partitions, their mount points and the used and available space
on each
df -H
mount | column -t
# Filter out only those file systems that you want to see
# Check the amount of used, free and total amount of RAM on system with the
free command. Up ↑
https://simplecheatsheet.com/tag/linux-cheat-sheet/ 10/26
8/3/22, 3:08 AM Linux Cheat Sheet - Simple Cheat Sheet | Linux Cheat Sheets
free -m
# CPU information
cat /proc/cpuinfo
# Memory information
cat /proc/meminfo
# Linux/kernel information
cat /proc/version
top
vmstat 1
mpstat 1
iostat 1
lsof
Up ↑
https://simplecheatsheet.com/tag/linux-cheat-sheet/ 11/26
8/3/22, 3:08 AM Linux Cheat Sheet - Simple Cheat Sheet | Linux Cheat Sheets
lsof -u user
tcpdump -i eth0
netstat -a | more
# Finding the exact process and high used disk read/writes of the processes
iotop
# Display free and used memory ( -h for human-readable, -m for MB, -g for GB)
free -h
watch df -h
id
# Display the last users who have logged onto the system
last
Up ↑
# To show all the users who were present at a specified time
https://simplecheatsheet.com/tag/linux-cheat-sheet/ 12/26
8/3/22, 3:08 AM Linux Cheat Sheet - Simple Cheat Sheet | Linux Cheat Sheets
# Find the details of a recent login of all users or of a given user as follows
lastlog
who
groupadd groupname
# Create an account named kim, with a comment of “Kim Kardashian” and create
the user’s home directory
userdel john
ifconfig -a
https://simplecheatsheet.com/tag/linux-cheat-sheet/ 13/26
8/3/22, 3:08 AM Linux Cheat Sheet - Simple Cheat Sheet | Linux Cheat Sheets
ethtool eth0
ethtool -i eth0
ethtool -S eth0
ethtool -a eth0
# Blink LED
ethtool -p eth0
whois domain
ping host
# Network Connections
watch ss -tp
netstat -nutlp
# TCP connections
netstat -ant
# UDP Connections
Up ↑
https://simplecheatsheet.com/tag/linux-cheat-sheet/ 14/26
8/3/22, 3:08 AM Linux Cheat Sheet - Simple Cheat Sheet | Linux Cheat Sheets
netstat -anu
netstat -tulpn
dig domain
host domain
hostname -i
hostname -I
wget http://domain.com/filename
tar xf archive.tar
https://simplecheatsheet.com/tag/linux-cheat-sheet/ 15/26
8/3/22, 3:08 AM Linux Cheat Sheet - Simple Cheat Sheet | Linux Cheat Sheets
# Updating a Package
# List a Package
Up ↑
https://simplecheatsheet.com/tag/linux-cheat-sheet/ 16/26
8/3/22, 3:08 AM Linux Cheat Sheet - Simple Cheat Sheet | Linux Cheat Sheets
rpm -i package.rpm
ssh host
ssh user@host
ssh-keygen
ssh-keygen -t rsa
ssh-copy-id hostname_or_IP
Up ↑
https://simplecheatsheet.com/tag/linux-cheat-sheet/ 17/26
8/3/22, 3:08 AM Linux Cheat Sheet - Simple Cheat Sheet | Linux Cheat Sheets
df -h
df -i
# Shows the file system’s complete disk usage even if the Available field is 0
df -a
fdisk -l
# Display disk usage for all files and directories in human readable format
du -ah
du -sh
# Shows the disk usage along with each block’s filesystem type (e.g., xfs, ext2, etc.)
df -T
Up ↑
https://simplecheatsheet.com/tag/linux-cheat-sheet/ 18/26
8/3/22, 3:08 AM Linux Cheat Sheet - Simple Cheat Sheet | Linux Cheat Sheets
# Go up a directory
cd ..
cd
cd /etc
pwd
mkdir dir
# List files
ls
locate name
https://simplecheatsheet.com/tag/linux-cheat-sheet/ 19/26
8/3/22, 3:08 AM Linux Cheat Sheet - Simple Cheat Sheet | Linux Cheat Sheets
find /home/ -mmin number
# Search for pattern in files
grep -i
# Recursive search
grep -r
# Inverted search
grep -v
grep -o
whereis command
Up ↑
https://simplecheatsheet.com/tag/linux-cheat-sheet/ 20/26
8/3/22, 3:08 AM Linux Cheat Sheet - Simple Cheat Sheet | Linux Cheat Sheets
ps
ps -ef
top
htop
kill pid
killall processname
pkill processname
program &
bg Up ↑
https://simplecheatsheet.com/tag/linux-cheat-sheet/ 21/26
8/3/22, 3:08 AM Linux Cheat Sheet - Simple Cheat Sheet | Linux Cheat Sheets
fg
fg n
ls -al
pwd
# Create a directory
mkdir directory
# Create file1
touch file1
less file1
file file1
https://simplecheatsheet.com/tag/linux-cheat-sheet/ 22/26
8/3/22, 3:08 AM Linux Cheat Sheet - Simple Cheat Sheet | Linux Cheat Sheets
rm file
rm -r directory
rm -f file
rm -rf directory
cp file1 file2
# Rename or move file1 to file2
mv file1 file2
ln -s /path/to/file linkname
# Create an empty file or update the access and modification times of file1.
touch file1
head file1
tail file1
tail -F file1
Up ↑
https://simplecheatsheet.com/tag/linux-cheat-sheet/ 23/26
8/3/22, 3:08 AM Linux Cheat Sheet - Simple Cheat Sheet | Linux Cheat Sheets
# Copy all files and directories recursively from server to the current system’s
/tmp folder.
# Synchronize /home to /backups/home
Up ↑
Table of contents
https://simplecheatsheet.com/tag/linux-cheat-sheet/ 24/26
8/3/22, 3:08 AM Linux Cheat Sheet - Simple Cheat Sheet | Linux Cheat Sheets
https://simplecheatsheet.com/tag/linux-cheat-sheet/ 25/26
8/3/22, 3:08 AM Linux Cheat Sheet - Simple Cheat Sheet | Linux Cheat Sheets
©
2022 Simple Cheat Sheet < https://simplecheatsheet.com/>
Privacy Policy < https://simplecheatsheet.com/privacy-policy/>
Up ↑
https://simplecheatsheet.com/tag/linux-cheat-sheet/ 26/26