Skip to content

Linux Commands Cheat Sheet

The commands used daily for filesystem navigation, permissions, processes, networking, storage, and service management on any Linux distribution.

Files & Directories

ls -lahList all files (incl. hidden) with sizes and permissions
cd -Switch to the previous working directory
cp -r src/ dest/Copy a directory recursively
mv old newRename or move a file/directory
rm -rf dir/Remove a directory and its contents (irreversible)
find / -name '*.log' -mtime -1Find .log files modified in the last day
du -sh */Show the disk usage of each subdirectory
ln -s target linknameCreate a symbolic link

Permissions & Ownership

chmod 755 file.shSet rwxr-xr-x (owner rwx, group/others r-x)
chmod u+x file.shAdd execute permission for the owner only
chown user:group fileChange owner and group of a file
chown -R user:group dir/Change ownership recursively
umask 022Set default permission mask for new files/directories
getfacl fileShow extended ACLs on a file

Processes & Services

ps aux | grep nginxFind running processes matching 'nginx'
top / htopLive CPU/memory usage per process
kill -9 PIDForce-kill a process by PID
systemctl status sshdShow a service's current status
systemctl restart nginxRestart a systemd-managed service
systemctl enable --now nginxEnable a service on boot and start it now
journalctl -u nginx -fFollow live logs for a specific service

Networking

ip aShow all network interfaces and their IP addresses
ss -tulnpShow listening TCP/UDP ports and owning processes
curl -I https://example.comFetch only the HTTP response headers
ping -c 4 hostSend 4 ICMP echo requests to a host
traceroute hostTrace the network path to a host
scp file user@host:/pathCopy a file to a remote host over SSH

Disk & Storage

df -hShow disk space usage for all mounted filesystems
lsblkList block devices and their mount points
mount /dev/sdb1 /mntMount a device to a directory
fdisk -lList partition tables on all disks
vgs / lvs / pvsList LVM volume groups / logical volumes / physical volumes

Package Management

apt update && apt upgradeRefresh package lists and upgrade (Debian/Ubuntu)
dnf install nginxInstall a package (RHEL/Rocky/Fedora)
dpkg -l | grep nginxCheck if a package is installed (Debian/Ubuntu)
rpm -qa | grep nginxCheck if a package is installed (RHEL family)

Related Articles

FAQ

Frequently Asked Questions

Yes — every cheat sheet on this site is free to view and download as a PDF, with no sign-up required.