Master the 50 most important Linux commands with examples. From file navigation to process management — the commands every Linux user needs.
File Operations
| Command | Description | Example |
|---|
ls | List directory contents | ls -la |
cd | Change directory | cd /var/log |
pwd | Print working directory | pwd |
cp | Copy files | cp file.txt /backup/ |
mv | Move/rename files | mv old.txt new.txt |
rm | Remove files | rm -rf /tmp/cache/ |
mkdir | Create directory | mkdir -p a/b/c |
find | Search for files | find / -name "*.log" |
locate | Quick file search | locate nginx.conf |
touch | Create empty file | touch file.txt |
Text Processing
| Command | Description | Example |
|---|
cat | Display file contents | cat /etc/hosts |
less | Paginate file output | less /var/log/syslog |
head | Show first lines | head -n 20 file.txt |
tail | Show last lines | tail -f /var/log/app.log |
grep | Search text patterns | grep -i "error" log.txt |
awk | Text processing | awk '{print $1}' file |
sed | Stream editor | sed 's/old/new/g' file |
wc | Count lines/words | wc -l file.txt |
sort | Sort lines | sort -u file.txt |
uniq | Remove duplicates | `sort file |
Permissions & Ownership
| Command | Description | Example |
|---|
chmod | Change permissions | chmod 755 script.sh |
chown | Change owner | chown user:group file |
sudo | Run as superuser | sudo apt update |
su | Switch user | su - root |
Process Management
| Command | Description | Example |
|---|
ps | List processes | `ps aux |
top | Process monitor | top |
htop | Interactive monitor | htop |
kill | Terminate process | kill -9 1234 |
bg | Resume in background | bg %1 |
fg | Bring to foreground | fg %1 |
nohup | Run after logout | nohup ./script.sh & |
systemctl | Manage services | systemctl status nginx |
Networking
| Command | Description | Example |
|---|
ip | Network configuration | ip addr show |
ss | Socket statistics | ss -tlnp |
curl | HTTP requests | curl -I https://example.com |
wget | Download files | wget https://example.com/file.zip |
ping | Test connectivity | ping google.com |
traceroute | Trace packet path | traceroute google.com |
nmap | Network scanner | nmap -sV 192.168.1.0/24 |
ssh | Remote login | ssh user@192.168.1.10 |
System Information
| Command | Description | Example |
|---|
df | Disk usage | df -h |
du | Directory size | du -sh /var |
free | Memory usage | free -m |
uname | System info | uname -a |
uptime | System uptime | uptime |
journalctl | View logs | journalctl -u nginx |
Package Management
| Command | Description | Example |
|---|
apt | Debian/Ubuntu packages | sudo apt install nginx |
yum | CentOS/RHEL packages | yum install httpd |
dnf | Modern Fedora packages | dnf install git |
snap | Snap packages | snap install code --classic |
Master these 50 commands and you'll handle 95% of daily Linux tasks. Practice them in a real terminal — repetition builds muscle memory.