100% found this document useful (1 vote)
3K views

Linux Commands Cheat Sheet

This document provides a cheat sheet of common Linux commands organized into categories such as hardware information, searching, file commands, system management, disk usage, file transfer, process related, file compression, package installation, and network management. It lists commands like ls, df, free, grep, find, du, ps, top, kill, yum, ifconfig, netstat and their basic functions.

Uploaded by

Anand
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
100% found this document useful (1 vote)
3K views

Linux Commands Cheat Sheet

This document provides a cheat sheet of common Linux commands organized into categories such as hardware information, searching, file commands, system management, disk usage, file transfer, process related, file compression, package installation, and network management. It lists commands like ls, df, free, grep, find, du, ps, top, kill, yum, ifconfig, netstat and their basic functions.

Uploaded by

Anand
Copyright
© © All Rights Reserved
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 1

Linux Commands Cheat Sheet

Hardware Information Searching File Commands System Management and Info Disk Usage

dmesg Show bootup messages grep [pattern] [file] Search for a pattern in a file ls List files in the directory uname -r Show system information df -h Show free space on system

cat /proc/cpuinfo Show CPU information grep -r [pattern] [directory] Search a pattern recursively ls -a List files, include hidden files uname -a Show kernel release info df -l Show free nodes on system

free -h Show free and used memory locate [name] Search for files & directories pwd Show current directory uptime Show uptime length/avg. load fdisk -l Disk partition types and sizes

lshw Hardware configuration info find [/location] -name [x] List items beginning with [x] mkdir [name] Create a directory hostname Show system hostname du -ah Show disk usage for all files

lsblk Block devices info find [/location] -size [+100M] List items larger than 100MB rm [file] Remove a file hostname -l Show system IP address du -sh Show disk usage for current
directory
lspci -tv Tree-diagram of PCI devices rm -r [directory] Recursively remove directory last reboot Show reboot history
findmnt Show target mount point
lsusb -tv Tree-diagram of USB devices File Transfer rm -rf [directory] Force remove directory date Show current time and date
mount [device] [mount_point] Mount a device
dmidecode Show BIOS hardware info cp [file1] [file2] Copy file1 to file2 timedatectl Manage the system clock
scp [file.txt] [server/tmp] Create a tar file from a file
hdparm -i /dev/[disk] Show disk data info cp -r [directory1] [directory2] Copy directory1 to directory2 cal Show current day and month
rsync -a [/location] [/backup/] Sync the contents of a
location with the backup Variables
hdparm -tT /dev/[disk] Disk read speed test mv [filename1] [filename2] Rename a file whoami Show the current user
directory
badblocks -s /dev/[disk] Unreadable blocks test ln -s [/path/file] [link] Create symbolic link to file finger [username] Show user information let "[variable]=[value]" Assign integer value to var

touch [file] Create a new file ulimit [flags] [limit] View or limit system resources export [variable] Export a Bash variable
Process Related
File Compression more [file] Show file contents shutdown [hh:mm] Schedule a system shut down declare [variable]="[value]" Declare a Bash variable

ps Show active process snapshot head [file] Show first 10 lines of a file shutdown now Shut down immediately set List variables and functions
tar cf [file.tar] [file] Create a tar file from a file
pstree Show processes as a tree tail [file] Show last 10 lines of a file modprobe [module-name] Add a new kernel module echo $[variable] Display value of the variable
tar xf [file.tar] Extract archived file
pmap Show process memory usage gpg -c [file] Encrypt a file
tar czf [file.tar.gz] Create a gzip tar file
top Show all running processes gpg [file.gpg] Decrypt a file
gzip [file] Create a gz compressed file Network Management Shell Command Management
kill [process_id] Kill the process by ID wc Count words/lines/bytes
ip addr show Show IP addresses alias [alias]='[command]' Create command alias
pkill [process_name] Kill the process by name ls | xargs wc Words/lines/bytes in directory
Package Installation ip address add [ip] Assign IP address to interface watch -n [interval] [command] Set interval to run a command
killall [process_name] Kill all processes by name cut -d[delimiter] [file] Cut file section and print
ifconfig Show all network interfaces sleep [interval] && [command] Postpone command execution
yum search [keyword] Find a package by a keyword bg List background processes [data] | cut -d[delimiter] Cut data section and print
netstat -pnltu Show active listening ports at [hh:mm] Schedule a job
yum info [package] Package info & summary fg Most recent suspended job to awk '[pattern] {print $0}' [file] Print lines matching a pattern
foreground
netstat -nutlp Show tcp and udp ports man [command] Display command manual
yum install [package.rpm] Install a package with YUM shred -u [file] Overwrite and delete a file
fg [job] Bring [job] to foreground
whois [domain] Show domain information history Print command history
dnf install [package.rpm] Install a package with DNF diff [file1] [file2] Compare two files
lsof List files opened by processes
dig [domain] Show domain's DNS info
rpm -i [package.rpm] Install a local rpm package source [file] Compile from source code
trap "[commands]" [signal] Execute command on signal
rpm -e [package.rpm] Remove an rpm package
dig -x [host] Domain reverse lookup Keyboard Shortcuts
[command] | tee [file] Store command output to a
wait Pause terminal until process >/dev/null file, skip terminal output dig -x [ip] IP address reverse lookup
apt install [package] Install a package with APT completes Ctrl + C Kill current process
host [domain] IP lookup for a domain
tar zxvf [source_code.tar.gz] Install software from source nohup [command] & Run a process in background Ctrl + Z Stop process (can be resumed)
cd [source_code] code Users and Groups hostname -l Show local IP address
./configure Ctrl + W Cut the word before the cursor
make
wget [file_url] Download a file from url
make install File Permission id Show active user details
Ctrl + U Cut part of the line before the
curl -O [file_url] Download a file from url cursor
last Show last system logins
chmod 777 [file] File read, write, execute
nslookup [domain] Show domain information Ctrl + K Cut part of the line after the
SSH Login permissions to everyone who Show who is logged in
cursor

chmod 755 [file] Full permission to owner, w Show logged users and activity
Ctrl + Y Paste from clipboard
ssh [user]@[host] Connect to host as user read permissions for others
Directory Navigation
groupadd [group] Add a new group
Ctrl + R Recall last command
ssh [host] Connect to host via port 22 chmod 766 [file] Full permission to owner,
read and write for others adduser [user] Add a new user cd .. Move up one level Ctrl + O Run the recalled command
ssh -p [port] [user]@[host] Use a non-default port
chown [user] [file] Change file ownership usermod -aG [group] [user] Add user to group cd Change directory to $HOME Ctrl + G Exit command history
telnet [host] Connect to Telnet via port 23
chown [user]:[group] [file] Change file owner and group userdel [user] Delete a user cd [/location] Change to a specified !! Repeat the last command
directory
usermod Modify user information
exit Log out of the session

chgrp [group] [directory] Change directory group

You might also like