Author: Vicky Builds
50 Essential Linux Commands Every Developer Should Know in 2026
Linux remains the backbone of modern development, powering everything from cloud servers to embedded systems. Whether you're deploying applications, managing containers, or automating workflows, mastering the command line is non-negotiable. This guide covers 50 essential Linux commands—from basics to advanced—with practical examples for developers in 2026.
Table of Contents
- File Operations
- Directory Navigation
- System Monitoring
- Networking
- Package Management
- Process Management
- File Permissions
- Text Processing
- Archiving & Compression
- Advanced Tools
File Operations
1. ls – List Files
List files and directories in the current folder.
ls # Basic list
ls -l # Detailed list (permissions, owner, size)
ls -a # Show hidden files (dotfiles)
ls -lh # Human-readable file sizes (KB, MB, GB)
2. cat – Display File Content
Print the contents of a file to the terminal.
cat file.txt
3. touch – Create Empty Files
Create one or more empty files.
touch newfile.txt
4. rm – Remove Files/Directories
Delete files or directories permanently (use with caution!).
rm file.txt # Delete a file
rm -r directory/ # Delete a directory recursively
rm -f file.txt # Force delete (no confirmation)
rm -i file.txt # Prompt before deleting
5. cp – Copy Files/Directories
Copy files or directories from one location to another.
cp file.txt /path/to/destination/ # Copy a file
cp -r directory/ /path/to/destination/ # Copy a directory recursively
6. mv – Move/Rename Files
Move files or rename them.
mv oldname.txt newname.txt # Rename a file
mv file.txt /path/to/destination/ # Move a file
7. find – Search for Files
Search for files by name, type, or modification time.
find /path -name "*.txt" # Find all .txt files
find /path -type f -mtime -7 # Find files modified in the last 7 days
find /path -size +10M # Find files larger than 10MB
8. grep – Search Text Patterns
Search for text patterns within files.
grep "error" logfile.txt # Search for "error" in a file
grep -r "pattern" /path/ # Recursively search in directories
grep -i "pattern" file.txt # Case-insensitive search
9. head / tail – View File Snippets
View the beginning or end of a file.
head -n 10 file.txt # Show first 10 lines
tail -n 10 file.txt # Show last 10 lines
tail -f logfile.txt # Follow (live update) a log file
10. wc – Count Words, Lines, Characters
Count lines, words, and characters in a file.
wc file.txt # Line, word, and character count
wc -l file.txt # Only line count
wc -w file.txt # Only word count
Directory Navigation
11. pwd – Print Working Directory
Display the current directory path.
pwd
12. cd – Change Directory
Navigate between directories.
cd /path/to/directory # Change to a specific directory
cd ~ # Go to home directory
cd .. # Move up one directory
cd - # Return to previous directory
13. mkdir – Create Directories
Create new directories.
mkdir newdir # Create a single directory
mkdir -p parent/child # Create nested directories
14. rmdir – Remove Empty Directories
Delete empty directories.
rmdir empty_dir/ # Remove an empty directory
15. tree – Display Directory Structure
Show a tree-like structure of directories and files.
tree # Show current directory structure
tree -L 2 # Limit depth to 2 levels
System Monitoring
16. top / htop – Monitor Processes
View real-time system processes, CPU, and memory usage.
top # Basic process viewer (pre-installed)
htop # Enhanced version (install with `sudo apt install htop`)
17. df – Disk Space Usage
Check disk space usage for all mounted filesystems.
df -h # Human-readable format (KB, MB, GB)
18. du – Directory Space Usage
Estimate file and directory space usage.
du -sh /path/to/directory # Summary of directory size
du -h --max-depth=1 # Size of subdirectories (1 level deep)
19. free – Memory Usage
Display memory (RAM) and swap usage.
free -h # Human-readable format
20. uptime – System Uptime
Show how long the system has been running.
uptime
Networking
21. ping – Test Network Connectivity
Check connectivity to a server or website.
ping google.com
22. curl – Transfer Data via URLs
Download files or interact with APIs.
curl https://example.com # Fetch webpage content
curl -O https://example.com/file.zip # Download a file
23. wget – Download Files
Download files from the web.
wget https://example.com/file.zip
24. ifconfig / ip – Network Interfaces
View network interface configurations.
ifconfig # Older systems
ip a # Modern replacement
25. netstat / ss – Network Statistics
Display network connections, routing tables, and interface statistics.
netstat -tuln # List listening ports (TCP/UDP)
ss -tuln # Modern replacement
Package Management
26. apt (Debian/Ubuntu) – Package Manager
Install, update, and remove packages.
sudo apt update # Update package lists
sudo apt upgrade # Upgrade installed packages
sudo apt install nginx # Install a package
sudo apt remove nginx # Remove a package
27. yum (RHEL/CentOS) / dnf (Fedora)
sudo yum install nginx # RHEL/CentOS
sudo dnf install nginx # Fedora
28. snap – Universal Package Manager
Install snaps (containerized software packages).
sudo snap install spotify
29. flatpak – Sandboxed Applications
Install and run sandboxed apps.
flatpak install flathub com.spotify.Client
Process Management
30. ps – List Running Processes
View active processes.
ps aux # List all processes
ps -ef | grep nginx # Filter processes by name
31. kill – Terminate Processes
Stop a process by its PID.
kill 1234 # Gracefully terminate process ID 1234
kill -9 1234 # Forcefully kill process
32. pkill – Kill Processes by Name
Terminate processes by name.
pkill nginx # Kill all processes named "nginx"
33. bg / fg – Background/Foreground Jobs
Manage background and foreground jobs.
ctrl + Z # Suspend a process
bg # Resume suspended job in the background
fg # Bring job to the foreground
34. jobs – List Background Jobs
View currently running background jobs.
jobs
File Permissions
35. chmod – Change File Permissions
Modify file permissions (read, write, execute).
chmod 755 script.sh # Give owner rwx, others rx
chmod +x script.sh # Make file executable
36. chown – Change Ownership
Change the owner and group of a file/directory.
sudo chown user:group file.txt
37. umask – Set Default Permissions
Define default permissions for new files.
umask 022 # Default permissions for new files (755 for dirs, 644 for files)
Text Processing
38. sed – Stream Editor
Edit text streams (find/replace).
sed 's/old/new/g' file.txt # Replace "old" with "new" globally
39. awk – Pattern Scanning
Process structured text (e.g., logs, CSV).
awk '{print $1}' file.txt # Print first column
40. sort – Sort Lines
Sort lines in a file.
sort file.txt # Sort alphabetically
sort -n file.txt # Sort numerically
sort -r file.txt # Reverse order
41. uniq – Remove Duplicate Lines
Filter duplicate lines (often used with sort).
sort file.txt | uniq # Sort and remove duplicates
42. cut – Extract Sections from Files
Extract specific columns or fields.
cut -d',' -f1 file.csv # Extract first column (comma-delimited)
Archiving & Compression
43. tar – Archive Files
Create or extract .tar archives.
tar -cvf archive.tar /path/to/files # Create archive
tar -xvf archive.tar # Extract archive
tar -czvf archive.tar.gz /path/ # Compress with gzip
44. gzip / gunzip – Compress/Decompress
Compress or decompress .gz files.
gzip file.txt # Compress
gunzip file.txt.gz # Decompress
45. zip / unzip – ZIP Archives
Create or extract .zip files.
zip archive.zip file1 file2 # Create ZIP
unzip archive.zip # Extract ZIP
Advanced Tools
46. cron – Schedule Tasks
Automate commands at specific times.
crontab -e # Edit cron jobs
# Example: Run script daily at 3 AM
0 3 * * * /path/to/script.sh
47. rsync – Remote File Sync
Sync files/directories locally or over SSH.
rsync -avz source/ user@remote:/destination/
48. ssh – Secure Shell
Connect to remote machines securely.
ssh user@hostname # Connect to a remote server
ssh -p 2222 user@hostname # Custom port
49. scp – Secure Copy
Copy files over SSH.
scp file.txt user@remote:/path/to/destination
50. tmux – Terminal Multiplexer
Manage multiple terminal sessions.
tmux new -s mysession # Start a new session
tmux ls # List sessions
tmux attach -t mysession # Reattach to a session
Bonus: Aliases for Efficiency
Add these to your ~/.bashrc or ~/.zshrc to save time:
# Shortcuts
alias ll='ls -alF'
alias la='ls -A'
alias gs='git status'
alias ga='git add'
alias gc='git commit -m'
# Safety nets
alias rm='rm -i' # Prompt before deletion
alias cp='cp -i' # Prompt before overwrite
alias mv='mv -i' # Prompt before overwrite
Final Tips
-
Use
manfor Help:man command(e.g.,man ls) displays the manual page. -
Tab Completion: Press
Tabto auto-complete commands/paths. -
History: Use
historyto view past commands and!nto repeat command #n. -
Pipes (
|): Chain commands (e.g.,cat file.txt | grep "error"). -
Redirects: Save output to a file with
>(overwrite) or>>(append).
ls -l > filelist.txt
Why Master These Commands?
- Cloud & DevOps: Essential for managing servers (AWS, GCP, Azure).
- Containers: Docker, Kubernetes, and CI/CD pipelines rely on Linux.
- Automation: Scripting repetitive tasks saves hours.
- Debugging: Logs, processes, and network tools are indispensable.
What’s your go-to Linux command? Share in the comments!
~vickybuilds
Top comments (0)