Linux is a powerful, versatile, and widely used operating system that forms the backbone of modern tech infrastructure, powering everything from personal workstations to enterprise servers. Driven by a robust command-line interface, Linux provides an extensive suite of commands designed to handle everything from file management and process control to network configuration and system administration.
Mastering these essential commands enables users to navigate directories, manipulate files efficiently, perform system maintenance, and manage network connections with confidence.
Linux Administrator Commands Cheat Sheet
Linux File Permissions: Read, Write and Execute
| Linux Operating System Commands Cheat Sheet |
|---|
|
ls • Description: List files and directories in a directory • Example: ls /home
|
|
cd • Description: Change directory • Example: cd Documents
|
|
pwd • Description: Print the current working directory • Example: pwd
|
|
mkdir • Description: Create a new directory • Example: mkdir myFolder
|
|
rmdir • Description: Remove a directory • Example: rmdir myFolder
|
|
rm • Description: Remove files or directories • Example: rm file.txt
|
|
cp • Description: Copy files and directories • Example: cp file.txt newfile.txt
|
|
mv • Description: Move or rename files and directories • Example: mv file.txt /home/user/
|
|
touch • Description: Create a new file • Example: touch myfile.txt
|
|
cat • Description: Display the contents of a file • Example: cat file.txt
|
|
more • Description: Display file content one page at a time • Example: more file.txt
|
|
less • Description: Display file content with backward navigation • Example: less file.txt
|
|
head • Description: Display the first few lines of a file • Example: head file.txt
|
|
tail • Description: Display the last few lines of a file • Example: tail file.txt
|
|
grep • Description: Search for a specific pattern in a file • Example: grep "keyword" file.txt
|
|
find • Description: Search for files or directories • Example: find /home -name myfile.txt
|
|
chmod • Description: Change permissions of a file or directory • Example: chmod 755 file.txt
|
|
chown • Description: Change ownership of a file or directory • Example: chown user file.txt
|
|
chgrp • Description: Change group ownership of a file or directory • Example: chgrp group file.txt
|
|
ssh • Description: Connect to a remote server using SSH • Example: ssh username@hostname
|
|
scp • Description: Copy files between local and remote servers • Example: scp file.txt username@hostname:/remote/path
|
|
tar • Description: Compress or extract files using tar • Example: tar -czvf archive.tar.gz file1 file2
|
|
gzip • Description: Compress files • Example: gzip file.txt
|
|
gunzip • Description: Decompress files • Example: gunzip file.txt.gz
|
|
wget • Description: Download files from the web • Example: wget http://example.com/file.txt
|
|
curl • Description: Transfer data from or to a server • Example: curl -O http://example.com/file.txt
|
|
ping • Description: Test network connectivity • Example: ping google.com
|
|
ifconfig • Description: Display network interface configuration • Example: ifconfig
|
|
netstat • Description: Display network connections and statistics • Example: netstat -a
|
|
ps • Description: Display currently running processes • Example: ps aux
|
|
top • Description: Monitor system processes and resource usage • Example: top
|
|
kill • Description: Terminate a process • Example: kill PID
|
|
uname • Description: Display system information • Example: uname -a
|
|
df • Description: Display disk space usage • Example: df -h
|
|
du • Description: Estimate file and directory space usage • Example: du -sh /path
|
|
history • Description: Display command history • Example: history
|
|
man • Description: Display the manual page for a command • Example: man ls
|
|
info • Description: Display detailed information about a command • Example: info tar
|
|
alias • Description: Create an alias for a command • Example: alias ll='ls -l'
|
|
su • Description: Switch user or become superuser • Example: su root
|
|
sudo • Description: Run a command with superuser privileges • Example: sudo apt-get update
|
| Advanced Linux Operations & Troubleshooting Quick Reference |
|---|
|
System & Hardware Information • cat /etc/os-release – Display Linux distribution and OS version info• uname -r – Show current kernel version• uname -a – Show complete kernel, architecture, and system details• hostnamectl – View hostname, hypervisor, OS, and kernel configuration• lscpu – Check CPU architecture and core details• free -h – Check total and available RAM (human-readable)• lsblk – View block devices, hard drives, and partitions
|
|
Disk Space & Storage Management • df -h – Check available and used disk space on file systems• du -sh * – Check disk space consumed by files and folders in current directory• ls -lh – List files with detailed permissions, sizes, and modification dates
|
|
Networking & IP Configuration • ip a or ip addr show – Display network interfaces and IP addresses• ip link show – View network interfaces along with MAC addresses• hostname -I – Quickly print the host IP address• ip route – Show default gateway and routing table• ping -c 4 google.com – Test network connectivity with a packet count
|
|
Process Management • ps aux – List all currently running processes on the system• ps aux | grep [process_name] – Search for a specific running process• top or htop – Monitor real-time system resource usage and processes• kill [PID] – Gracefully terminate a process by its Process ID• kill -9 [PID] – Force-kill an unresponsive process
|
|
Services & Daemons • systemctl status [service_name] – Check the current status of a service• systemctl start / stop / restart [service_name] – Control service state• systemctl enable / disable [service_name] – Configure service auto-start on boot• systemctl list-units --type=service --state=running – List all active running services• service --status-all – List legacy init services and statuses
|
|
Ports & Network Connections • ss -tuln – List open listening ports and associated services (modern replacement for netstat)• netstat -tuln – Display open ports and their listening states• ss -p – Show processes holding specific network ports open
|
|
Log Monitoring & Troubleshooting • tail -f /var/log/syslog (or /var/log/messages) – Stream system logs in real time• journalctl -u [service_name] -e – View systemd journal logs for a specific service• dmesg | tail – Check kernel ring buffer logs for hardware or driver errors
|
|
Date, Time & Uptime • date – Show current system date, time, and time zone• uptime – Check how long the system has been running and load averages• timedatectl status – View detailed time zone and NTP synchronization status
|
|
Advanced Performance & Resource Troubleshooting • vmstat 1 5 – Report virtual memory statistics, CPU activity, and system bottlenecks (refreshes every 1s, 5 times)• iostat -xz 1 – Monitor real-time disk I/O utilization, throughput, and latency per device• sar -u 1 3 – Check historical and real-time CPU utilization metrics• iftop or nethogs – Monitor real-time bandwidth usage broken down by individual network connections or processes• strace -p [PID] -s 1024 – Trace system calls and signals being executed by a running process in real time
|
|
Advanced Storage, LVM & File System Repair • lvs / vgs / pvs – Display Logical Volume Manager (LVM) logical volumes, volume groups, and physical volumes• resize2fs /dev/mapper/... – Dynamically resize an ext2/ext3/ext4 file system to fill available LVM space• fdisk -l or parted -l – List all disk partition tables and sector alignments• tune2fs -l /dev/sda1 – View file system superblock details, mount counts, and block sizes• fsck -y /dev/sdX1 – Force-check and automatically repair a corrupted unmounted file system
|
|
Advanced Networking, Packet Capture & Routing • tcpdump -i eth0 -nnvvs 0 'port 80' – Capture and inspect raw network packets passing through an interface• traceroute -n google.com – Trace the complete network packet routing path and latency hops to a destination• nslookup or dig +trace domain.com – Perform deep DNS resolution lookups and trace recursive name servers• iptables -L -n -v --line-numbers or nft list ruleset – Inspect active firewall rules, packet counters, and chain policies• sysctl -a – View and modify live kernel networking and security parameters
|
|
Advanced Process Tuning & Security Debugging • renice -n 10 -p [PID] – Adjust the scheduling priority of a running process• ulimit -a – Display user-level resource limits (open files, max processes, stack size)• lsof -i :80 – Identify precisely which process or user is occupying a specific network port• getenforce – Check Security-Enhanced Linux (SELinux) enforcement status• auditctl -l – Inspect active Linux Audit framework rules tracking file access and system calls
|

