100 Essential Linux Commands Every Developer Must Know
Whether you are a developer, system administrator, or cybersecurity professional, mastering the Linux command line is non-negotiable. This guide covers the 100 most important commands with practical examples.
File and Directory Operations
# Navigation
pwd # Print current directory
ls -la # List all files with details
ls -lh # Human-readable file sizes
cd /path/to/dir # Change directory
cd ~ # Go to home directory
cd - # Go to previous directory
# Create / Delete
mkdir -p dir/sub/dir # Create nested directories
rmdir dirname # Remove empty directory
rm -rf dirname # Remove directory and contents (CAREFUL!)
touch filename.txt # Create empty file
cp -r source/ dest/ # Copy directory recursively
mv oldname newname # Move or rename
ln -s /target /link # Create symbolic link
File Viewing and Editing
cat file.txt # Display file content
less file.txt # Page through file (q to quit)
head -20 file.txt # Show first 20 lines
tail -20 file.txt # Show last 20 lines
tail -f /var/log/syslog # Follow log file in real time
grep "pattern" file # Search for pattern in file
grep -r "pattern" dir/ # Recursive search in directory
grep -i "pattern" file # Case-insensitive search
wc -l file.txt # Count lines in file
diff file1 file2 # Compare two files
sort file.txt # Sort lines alphabetically
sort -n file.txt # Sort numerically
uniq file.txt # Remove duplicate lines
cut -d',' -f1 file.csv # Extract first column from CSV
Process Management
ps aux # List all running processes
ps aux | grep nginx # Find specific process
top # Live process monitor
htop # Better process monitor (install first)
kill PID # Kill process by ID
kill -9 PID # Force kill process
killall nginx # Kill all processes by name
jobs # List background jobs
bg # Resume job in background
fg # Bring job to foreground
nohup command & # Run command immune to hangups
command & # Run command in background
File Permissions
chmod 755 file # rwxr-xr-x
chmod 644 file # rw-r--r--
chmod +x script.sh # Add execute permission
chmod -R 755 dir/ # Recursive permission change
chown user:group file # Change file owner
chown -R user dir/ # Recursive ownership change
ls -la # View permissions
umask 022 # Set default permissions
Networking Commands
ip addr # Show IP addresses (modern)
ifconfig # Show network interfaces (legacy)
ping -c 4 google.com # Ping with 4 packets
traceroute google.com # Trace network path
nslookup domain.com # DNS lookup
dig domain.com # Detailed DNS query
dig +short domain.com # Quick DNS answer
curl https://site.com # HTTP GET request
curl -I https://site.com # Headers only
wget https://file.zip # Download file
ss -tuln # Show open ports (modern)
netstat -tuln # Show open ports (legacy)
iptables -L # List firewall rules
ufw status # Check UFW firewall status
Disk and System
df -h # Disk usage (human readable)
du -sh dir/ # Directory size
du -sh * | sort -h # Sort directories by size
free -h # RAM usage
uptime # System uptime and load
uname -a # Kernel and OS info
lsb_release -a # Linux distribution info
lscpu # CPU information
lsblk # List block devices
mount | grep /dev # Show mounted filesystems
fdisk -l # List disk partitions (root)
Archiving and Compression
tar -czvf archive.tar.gz dir/ # Create compressed archive
tar -xzvf archive.tar.gz # Extract archive
tar -tzvf archive.tar.gz # List archive contents
zip -r archive.zip dir/ # Create ZIP
unzip archive.zip # Extract ZIP
gzip file.txt # Compress file
gunzip file.txt.gz # Decompress file
Package Management
# Debian/Ubuntu/Kali
sudo apt update # Update package list
sudo apt upgrade -y # Upgrade all packages
sudo apt install nginx # Install package
sudo apt remove nginx # Remove package
sudo apt autoremove # Remove unused packages
dpkg -l | grep nginx # Check if package installed
# CentOS/RHEL/AlmaLinux
sudo dnf update
sudo dnf install nginx
sudo dnf remove nginx
Bash Shortcuts
!! # Repeat last command
!nginx # Repeat last command starting with 'nginx'
Ctrl+R # Search command history
history | grep ssh # Search history for ssh commands
alias ll='ls -la' # Create command alias
echo # Print PATH variable
export VAR=value # Set environment variable
env # List all environment variables
Download our free Linux Commands Cheatsheet PDF from our Tools page — all 100 commands in a printable single-page reference card.