Linux Commands Cheatsheet



Linux Commands Cheatsheet

System Information

CommandDescription
uname -aDisplay Linux system information
topShow system resource usage and running processes
freeDisplay available memory and swap space
df -hShow disk space usage
du -shShow size of a directory
uptimeShow system uptime

User Management

CommandDescription
useraddCreate a new user
passwdSet user password
usermodModify user account
userdelDelete a user
suSwitch user
sudoExecute a command as a superuser
chownChange file ownership
chgrpChange file group ownership
chmodChange file permissions

File Management

CommandDescription
lsList directory contents
cdChange current directory
pwdPrint working directory
mkdirCreate a new directory
touchCreate a new empty file
cpCopy files or directories
mvMove or rename files or directories
rmRemove files or directories
lnCreate a symbolic link

Text Editing

CommandDescription
nanoSimple text editor
viAdvanced text editor
sedStream editor
grepSearch for a pattern in a file or input
awkText processing and pattern matching

Network Management

CommandDescription
pingCheck network connectivity
tracerouteShow the route packets take to a network host
netstatShow network connections and statistics
ifconfigConfigure network interfaces
routeShow or modify the IP routing table
iptablesConfigure firewall rules
sshSecurely connect to a remote system

Process Management

CommandDescription
psShow running processes
killTerminate a process
niceSet process priority
nohupRun a command that persists even if the terminal is closed
screenCreate a virtual terminal session
bgRun a command in the background
fgBring a command running in the background to the foreground
jobsList all background jobs

Package Management

CommandDescription
apt-getInstall or remove software packages
dpkgInstall or remove individual software packages
yumInstall or remove software packages (Red Hat-based systems)
rpmInstall or remove individual software packages (Red Hat-based systems)

System Administration

CommandDescription
cronSchedule recurring tasks
systemctlManage system services (systemd-based systems)
serviceManage system services (init-based systems)
hostnameSet or display the system hostname
dateDisplay or set the system date and time
rebootReboot the system
shutdownShut down the system
tarCreate or extract tar archives

Miscellaneous

CommandDescription
echoDisplay a message on the terminal
historyShow command history
clearClear the terminal screen
whoamiDisplay the current user name
unameShow system information
manShow the manual for a command
whichShow the location of a command
whereisShow the location of a command and its documentation
findSearch for files or directories
duShow disk usage of files or directories
idDisplay user and group information
timeMeasure the time it takes for a command