| Command | Description | Example | Output |
|---|---|---|---|
| pwd | Show current directory | pwd | /home/user |
| ls | List directory contents | ls -l | drwxr-xr-x 2 user user 4096 ... |
| cd | Change directory | cd Documents | |
| mkdir | Create directory | mkdir project | |
| touch | Create empty file | touch file.txt | |
| rm | Remove file | rm file.txt | |
| rmdir | Remove empty directory | rmdir project | |
| cp | Copy files/directories | cp file.txt backup.txt | |
| mv | Rename/move files | mv backup.txt old.txt | |
| find | Search for files | find . -name "*.log" | ./app.log ./archive/error.log |
| Command | Description | Example | Output |
|---|---|---|---|
| cat | Concatenate/display files | cat file.txt | Contents of file.txt... |
| less | Paged file viewing | less largefile.txt | Paged content... |
| more | View file one screen at a time | more log.txt | First screen of content... |
| head | Show first lines | head -3 file.txt | First 3 lines of file.txt... |
| tail | Show last lines | tail -n 5 file.txt | Last 5 lines of file.txt... |
| nano | Text editor | nano newfile.txt | Edit interface opens |
| vi | Classic text editor | vi config.txt | vi editor interface |
| echo | Output text | echo "Hello" > greeting.txt | |
| tee | Redirect output to file | echo "Test" | tee log.txt | Test (and writes to log.txt) |
| od | Octal dump | od -c file.txt | Character display of file.txt... |
| Command | Description | Example | Output |
|---|---|---|---|
| truncate | Shrink/grow files | truncate -s 0 file.txt | |
| split | Split files into chunks | split -l 1000 log.txt | Creates xaa, xab... |
| join | Join lines of files | join file1.txt file2.txt | Merged lines... |
| dd | Convert/copy files | dd if=file of=copy bs=1M | Copies file to copy |
| ln | Create links | ln -s file.txt link.txt | Creates symbolic link |
| paste | Merge lines side-by-side | paste file1 file2 | Tab-separated columns... |
| fmt | Reformat paragraphs | fmt -w 40 file.txt | Formatted text... |
| comm | Compare sorted files | comm file1.txt file2.txt | Shows common/unique lines |
| expand/unexpand | Convert spaces/tabs | expand file.txt | Converts tabs to spaces |
| shred | Securely delete files | shred -u secret.txt | Overwrites then deletes |
| Command | Description | Example | Output |
|---|---|---|---|
| grep | Text search | grep "error" log.txt | Lines containing "error"... |
| find | Search files | find /etc -name "*.conf" | /etc/apache2/apache2.conf... |
| sed | Stream editor | sed 's/old/new/g' file.txt | Replaces "old" with "new" |
| awk | Text processing | awk '{print $1}' file.txt | First column of each line |
| cut | Extract columns | cut -d, -f2 data.csv | Second column of CSV |
| sort | Sort lines | sort file.txt | Alphabetically sorted lines |
| uniq | Remove duplicates | uniq -u log.txt | Unique lines only |
| file | Identify file type | file image.jpg | JPEG image data... |
| strings | Extract printable strings | strings binary | Human-readable text in binary |
| egrep | Extended regex grep | egrep "[0-9]+" file.txt | Lines with numbers... |
| Command | Description | Example | Output |
|---|---|---|---|
| chmod | Change permissions | chmod 755 script.sh | |
| chown | Change owner | chown user:group file.txt | |
| chgrp | Change group | chgrp developers project | |
| ls -l | List permissions | ls -l | -rw-r--r-- 1 user... |
| getfacl | Get access control lists | getfacl file.txt | ACL permissions... |
| setfacl | Set ACL permissions | setfacl -m u:guest:r file.txt | |
| umask | Show/create permissions | umask | 0022 |
| stat | Show file details | stat file.txt | Permissions: 644... |
| id | Show user/group IDs | id user | uid=1000(user) gid=1000... |
| groups | List user groups | groups user | user : user adm cdrom... |
| Command | Description | Example | Output |
|---|---|---|---|
| useradd | Create user | useradd newuser | |
| userdel | Delete user | userdel olduser | |
| passwd | Change password | passwd user | Password updated |
| usermod | Modify user | usermod -aG sudo user | |
| groups | List user groups | groups user | user : user sudo... |
| id | Show user IDs | id user | uid=1001(user) gid=1001... |
| su | Switch user | su root | Password prompt |
| sudo | Run as admin | sudo apt update | Password prompt |
| whoami | Show current user | whoami | user |
| w | Show logged in users | w | user tty1 12:34... |
| Command | Description | Example | Output |
|---|---|---|---|
| ps | Process status | ps aux | User PID %CPU %MEM... |
| top | Interactive process view | top | Dynamic process list |
| kill | Terminate process | kill 1234 | |
| pkill | Kill by name | pkill firefox | |
| killall | Kill all instances | killall process | |
| bg | Send job to background | bg %1 | [1]+ Process started |
| fg | Bring job to foreground | fg %1 | |
| jobs | List background jobs | jobs | [1]+ Running... |
| nohup | Run command immune to hangup | nohup script.sh & | |
| nice | Adjust priority | nice -n 19 ./process | Runs with lower priority |
| Command | Description | Example | Output |
|---|---|---|---|
| top | System monitor | top | CPU/memory/process list |
| htop | Enhanced top | htop | Interactive system view |
| free | Memory usage | free -h | Total: 7.7G used: 3.2G... |
| df | Disk space | df -h | /dev/sda1 234G 123G 111G... |
| du | Directory sizes | du -sh /var | 4.5G /var |
| iostat | IO statistics | iostat -x 1 3 | Per-disk performance stats |
| vmstat | System activity report | vmstat 2 | Memory/CPU/disk stats |
| sar | System activity reporting | sar -u 1 3 | CPU utilization over time |
| uptime | System load | uptime | 12:34:56 up 2 days... |
| mpstat | Per-CPU stats | mpstat -P ALL | CPU-specific usage |
| Command | Description | Example | Output |
|---|---|---|---|
| ip | Network configuration | ip a | 1: lo: <LOOPBACK> mtu 65536... |
| ifconfig | Show interfaces | ifconfig eth0 | inet 192.168.1.2... |
| ping | Test network connection | ping -c 4 google.com | 4 packets transmitted... |
| netstat | Network connections | netstat -tuln | TCP 0.0.0.0:80... |
| ss | Socket statistics | ss -tuln | TCP: 0.0.0.0:22... |
| nslookup | Domain lookup | nslookup example.com | Address 1: 93.184.216.34... |
| dig | Advanced DNS lookup | dig +short example.com | 93.184.216.34 |
| curl | Transfer data | curl -I https://example.com | HTTP/1.1 200 OK... |
| wget | Download files | wget https://example.com/file | 100% 12345 --00:00:01... |
| ssh | Secure shell | ssh user@server | Password prompt |
| Command | Description | Example | Output |
|---|---|---|---|
| apt-get | Debian/Ubuntu package manager | apt-get install nano | Selecting nano (2.0.6-1)... |
| apt | Modern apt frontend | apt update | Hit:1 http://archive.ubuntu.com... |
| rpm | RPM-based package management | rpm -q kernel | kernel-5.4.0-42-generic |
| dnf | Red Hat package manager | dnf install wget | Dependencies resolved... |
| pacman | Arch Linux package manager | pacman -S firefox | resolving dependencies... |
| rpm/yum | Red Hat tools | rpm -Uvh package.rpm | Preparing... ################################# [100%] |
| dpkg | Debian package installer | dpkg -i package.deb | Selecting previously unselected package... |
| emerge | Gentoo package manager | emerge -av sys-apps/procps | These sets of USE flags would be |
| zypper | OpenSUSE package manager | zypper install curl | Loading repository data... |
| snap | Universal package system | snap install hello-world | hello-world 6.4 from Canonical... |