DEV Community

Vicky [TrixCyrus]
Vicky [TrixCyrus]

Posted on

50 Essential Linux Commands Every Developer Should Know in 2026

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

  1. File Operations
  2. Directory Navigation
  3. System Monitoring
  4. Networking
  5. Package Management
  6. Process Management
  7. File Permissions
  8. Text Processing
  9. Archiving & Compression
  10. 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)
Enter fullscreen mode Exit fullscreen mode

2. cat – Display File Content

Print the contents of a file to the terminal.

cat file.txt
Enter fullscreen mode Exit fullscreen mode

3. touch – Create Empty Files

Create one or more empty files.

touch newfile.txt
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

Directory Navigation

11. pwd – Print Working Directory

Display the current directory path.

pwd
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

13. mkdir – Create Directories

Create new directories.

mkdir newdir          # Create a single directory
mkdir -p parent/child # Create nested directories
Enter fullscreen mode Exit fullscreen mode

14. rmdir – Remove Empty Directories

Delete empty directories.

rmdir empty_dir/       # Remove an empty directory
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

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`)
Enter fullscreen mode Exit fullscreen mode

17. df – Disk Space Usage

Check disk space usage for all mounted filesystems.

df -h   # Human-readable format (KB, MB, GB)
Enter fullscreen mode Exit fullscreen mode

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)
Enter fullscreen mode Exit fullscreen mode

19. free – Memory Usage

Display memory (RAM) and swap usage.

free -h   # Human-readable format
Enter fullscreen mode Exit fullscreen mode

20. uptime – System Uptime

Show how long the system has been running.

uptime
Enter fullscreen mode Exit fullscreen mode

Networking

21. ping – Test Network Connectivity

Check connectivity to a server or website.

ping google.com
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

23. wget – Download Files

Download files from the web.

wget https://example.com/file.zip
Enter fullscreen mode Exit fullscreen mode

24. ifconfig / ip – Network Interfaces

View network interface configurations.

ifconfig       # Older systems
ip a           # Modern replacement
Enter fullscreen mode Exit fullscreen mode

25. netstat / ss – Network Statistics

Display network connections, routing tables, and interface statistics.

netstat -tuln   # List listening ports (TCP/UDP)
ss -tuln       # Modern replacement
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

27. yum (RHEL/CentOS) / dnf (Fedora)

sudo yum install nginx   # RHEL/CentOS
sudo dnf install nginx   # Fedora
Enter fullscreen mode Exit fullscreen mode

28. snap – Universal Package Manager

Install snaps (containerized software packages).

sudo snap install spotify
Enter fullscreen mode Exit fullscreen mode

29. flatpak – Sandboxed Applications

Install and run sandboxed apps.

flatpak install flathub com.spotify.Client
Enter fullscreen mode Exit fullscreen mode

Process Management

30. ps – List Running Processes

View active processes.

ps aux          # List all processes
ps -ef | grep nginx  # Filter processes by name
Enter fullscreen mode Exit fullscreen mode

31. kill – Terminate Processes

Stop a process by its PID.

kill 1234       # Gracefully terminate process ID 1234
kill -9 1234    # Forcefully kill process
Enter fullscreen mode Exit fullscreen mode

32. pkill – Kill Processes by Name

Terminate processes by name.

pkill nginx      # Kill all processes named "nginx"
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

34. jobs – List Background Jobs

View currently running background jobs.

jobs
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

36. chown – Change Ownership

Change the owner and group of a file/directory.

sudo chown user:group file.txt
Enter fullscreen mode Exit fullscreen mode

37. umask – Set Default Permissions

Define default permissions for new files.

umask 022   # Default permissions for new files (755 for dirs, 644 for files)
Enter fullscreen mode Exit fullscreen mode

Text Processing

38. sed – Stream Editor

Edit text streams (find/replace).

sed 's/old/new/g' file.txt   # Replace "old" with "new" globally
Enter fullscreen mode Exit fullscreen mode

39. awk – Pattern Scanning

Process structured text (e.g., logs, CSV).

awk '{print $1}' file.txt   # Print first column
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

41. uniq – Remove Duplicate Lines

Filter duplicate lines (often used with sort).

sort file.txt | uniq   # Sort and remove duplicates
Enter fullscreen mode Exit fullscreen mode

42. cut – Extract Sections from Files

Extract specific columns or fields.

cut -d',' -f1 file.csv   # Extract first column (comma-delimited)
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

44. gzip / gunzip – Compress/Decompress

Compress or decompress .gz files.

gzip file.txt      # Compress
gunzip file.txt.gz # Decompress
Enter fullscreen mode Exit fullscreen mode

45. zip / unzip – ZIP Archives

Create or extract .zip files.

zip archive.zip file1 file2   # Create ZIP
unzip archive.zip             # Extract ZIP
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

47. rsync – Remote File Sync

Sync files/directories locally or over SSH.

rsync -avz source/ user@remote:/destination/
Enter fullscreen mode Exit fullscreen mode

48. ssh – Secure Shell

Connect to remote machines securely.

ssh user@hostname   # Connect to a remote server
ssh -p 2222 user@hostname  # Custom port
Enter fullscreen mode Exit fullscreen mode

49. scp – Secure Copy

Copy files over SSH.

scp file.txt user@remote:/path/to/destination
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

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
Enter fullscreen mode Exit fullscreen mode

Final Tips

  1. Use man for Help: man command (e.g., man ls) displays the manual page.
  2. Tab Completion: Press Tab to auto-complete commands/paths.
  3. History: Use history to view past commands and !n to repeat command #n.
  4. Pipes (|): Chain commands (e.g., cat file.txt | grep "error").
  5. Redirects: Save output to a file with > (overwrite) or >> (append).
   ls -l > filelist.txt
Enter fullscreen mode Exit fullscreen mode

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)