Linux Commands Cheatsheet

Linux Commands Cheatsheet

System Information

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

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

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

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

Network Management

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

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

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

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


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