Welcome to QAFlow! Ask questions and get answers from our community.
Technology

Linux Commands Cheat Sheet: 50 Commands Every Developer Needs

admin
Apr 13, 2026 · 5.5K views · 2 min read

Whether you're managing servers, developing software, or just getting started with Linux, these 50 commands will cover 90% of your daily needs.

File & Directory Operations

# Navigation
pwd                    # Print working directory
cd /path/to/dir        # Change directory
cd ~                   # Go to home directory
cd -                   # Go to previous directory

# Listing
ls -la                 # List all files with details
ls -lh                 # Human-readable file sizes
tree -L 2              # Directory tree (2 levels deep)

# File Operations
cp source dest         # Copy file
cp -r dir1 dir2        # Copy directory recursively
mv old new             # Move or rename
rm file                # Delete file
rm -rf directory       # Delete directory (careful!)
mkdir -p a/b/c         # Create nested directories
touch newfile.txt      # Create empty file

File Content

cat file.txt           # Display entire file
less file.txt          # Paginated view (q to quit)
head -20 file.txt      # First 20 lines
tail -20 file.txt      # Last 20 lines
tail -f log.txt        # Follow file in real-time
wc -l file.txt         # Count lines
diff file1 file2       # Compare files

Search & Find

# Find files
find . -name "*.js"                  # Find by name
find . -type f -size +100M           # Files over 100MB
find . -mtime -7                     # Modified in last 7 days

# Search content
grep "pattern" file.txt              # Search in file
grep -r "TODO" --include="*.py" .    # Recursive search
grep -n "error" log.txt              # Show line numbers
grep -c "error" log.txt              # Count matches

Process Management

ps aux                 # All running processes
ps aux | grep node     # Find specific process
top                    # Real-time process monitor
htop                   # Better process monitor
kill PID               # Terminate process
kill -9 PID            # Force kill
jobs                   # List background jobs
bg / fg                # Background / foreground

Networking

curl https://api.example.com         # HTTP request
curl -X POST -d "data" url           # POST request
wget https://example.com/file.zip    # Download file
ping google.com                      # Test connectivity
netstat -tulpn                       # Open ports
ss -tulpn                            # Modern port listing
ip addr show                         # Network interfaces

Disk & Memory

df -h                  # Disk usage by partition
du -sh *               # Size of each item in directory
du -sh . --max-depth=1 # Folder sizes
free -h                # Memory usage
lsblk                  # Block devices

User & Permissions

chmod 755 file         # Set permissions (rwxr-xr-x)
chmod +x script.sh     # Make executable
chown user:group file  # Change ownership
whoami                 # Current user
sudo command           # Run as root

Text Processing

sort file.txt          # Sort lines
sort -u file.txt       # Sort unique
uniq                   # Remove duplicates
cut -d"," -f1,3 data   # Extract columns
awk '{print $1}' file  # Print first column
sed 's/old/new/g' file # Find & replace
tr 'A-Z' 'a-z'        # Transform characters

Compression

tar -czf archive.tar.gz dir/   # Create .tar.gz
tar -xzf archive.tar.gz        # Extract .tar.gz
zip -r archive.zip dir/         # Create .zip
unzip archive.zip               # Extract .zip

Pro Tips

# Command history
history                # Show command history
Ctrl+R                 # Search history
!!                     # Repeat last command
!$                     # Last argument of previous command

# Piping & Redirection
command > file         # Output to file (overwrite)
command >> file        # Append to file
command 2>&1           # Redirect stderr to stdout
command1 | command2    # Pipe output to next command

Bookmark this page! You'll find yourself coming back to this reference again and again.

admin
295 rep 22 posts

No bio yet.

Comments (0)
Login to leave a comment.

No comments yet. Be the first!

About Author
admin
295 rep 22 posts

No bio available.

View Profile
Subscribe to Newsletter

Get the latest posts delivered to your inbox