10 Essential Linux Commands Every Developer Should Know

Whether you work on a Mac, Linux server, or Windows with WSL, these ten commands will dramatically boost your productivity. Each command is covered with real-world developer use cases, not just theory.

Linux Terminal Bash CLI DevOps

Why Linux Command-Line Skills Matter

Nearly every production server runs Linux. CI/CD pipelines, Docker containers, cloud VMs — they all expose a bash shell. Even if you develop on Windows or macOS, you will eventually need to SSH into a server, read logs, or automate a deployment script. The developers who can move fluidly in a terminal are consistently faster at debugging, deployment, and infrastructure tasks.

This guide covers the ten commands that appear most often in real developer workflows, with practical examples beyond the typical "hello world" usage you find in textbooks.

1 grep — Search Text Like a Pro

grep searches for patterns in files or piped input. It is indispensable for searching log files, source code, and config files.

# Find all lines containing "ERROR" in a log file
grep -n "ERROR" /var/log/app.log

# Search recursively through all .js files for a function name
grep -r "handleSubmit" src/ --include="*.js"

# Show 3 lines of context before and after each match
grep -n -B 3 -A 3 "NullPointerException" app.log

The -n flag prints line numbers, -r searches recursively, and -i ignores case. Combine grep with pipes to filter the output of other commands in real-time.

2 find — Locate Files by Any Attribute

find searches for files and directories based on name, type, size, modification time, permissions, or any combination thereof.

# Find all Python files modified in the last 24 hours
find . -name "*.py" -mtime -1

# Find files larger than 100MB
find /var -size +100M -type f

# Delete all .pyc compiled files recursively
find . -name "*.pyc" -delete

Use -exec to run a command on every result: find . -name "*.log" -exec rm {} \;

3 curl — Make HTTP Requests from the Terminal

curl transfers data to or from a server using various protocols. Developers use it to test APIs, download files, and debug HTTP requests.

# Test a REST API endpoint
curl -s https://api.example.com/users | jq .

# POST JSON data
curl -X POST https://api.example.com/login \
  -H "Content-Type: application/json" \
  -d '{"email":"user@example.com","password":"secret"}'

# Download a file and save it
curl -L https://example.com/file.tar.gz -o file.tar.gz

4 ssh — Secure Remote Access

ssh connects to remote machines securely. You will use it daily for server management, deployments, and accessing cloud instances.

# Connect to a remote server
ssh user@192.168.1.100

# Connect using a specific SSH key
ssh -i ~/.ssh/id_rsa ec2-user@3.14.159.26

# Forward a remote port to your local machine (useful for databases)
ssh -L 5432:localhost:5432 user@remote-server

5 awk — Process Structured Text

awk excels at processing delimited text like CSV files, logs with consistent columns, and command output. It is a mini programming language in itself.

# Print the 2nd column of a space-delimited file
awk '{print $2}' data.txt

# Sum values in a CSV column
awk -F',' '{sum += $3} END {print "Total:", sum}' sales.csv

# Print lines where the 5th column exceeds 1000
awk '$5 > 1000' access.log

6 sed — Stream Edit Files

sed performs search-and-replace operations on text streams. It is ideal for making automated edits to configuration files in scripts.

# Replace "localhost" with "production-db" in a config file
sed -i 's/localhost/production-db/g' config.yml

# Delete blank lines from a file
sed '/^$/d' input.txt

# Extract lines 10 through 20
sed -n '10,20p' large-file.log

7 ps & kill — Monitor and Control Processes

ps shows running processes. Combined with grep and kill, it lets you find and terminate stuck or runaway processes.

# Find all Node.js processes
ps aux | grep node

# Kill a process by PID
kill -9 12345

# Kill all processes matching a name
pkill -f "python app.py"

8 tar — Archive and Extract Files

tar creates and extracts archive files. It is commonly used for backups, distributing source code, and working with deployment artifacts.

# Create a gzip-compressed archive
tar -czf backup.tar.gz /var/www/html

# Extract an archive to a specific directory
tar -xzf release.tar.gz -C /opt/app

# List contents without extracting
tar -tzf archive.tar.gz

9 chmod & chown — Manage File Permissions

Correct file permissions are a security requirement on every server. chmod sets permissions and chown sets ownership.

# Make a script executable
chmod +x deploy.sh

# Set strict permissions on an SSH key (required by SSH)
chmod 600 ~/.ssh/id_rsa

# Give the web server user ownership of the web directory
chown -R www-data:www-data /var/www/html

10 tail & less — Read Log Files Efficiently

tail -f streams a file in real-time as it grows — essential for watching application logs during debugging. less lets you scroll large files without loading them entirely into memory.

# Stream a log file in real-time
tail -f /var/log/nginx/access.log

# Stream multiple files simultaneously
tail -f /var/log/app/*.log

# Open a large log file for scrolling (press q to quit)
less /var/log/syslog

Putting It All Together

The real power of these commands comes from combining them in pipelines. Here is a real-world example: find all unique IP addresses that generated 404 errors in an nginx log in the last hour:

grep "404" /var/log/nginx/access.log | \
  awk '{print $1}' | \
  sort | \
  uniq -c | \
  sort -rn | \
  head -20

That single pipeline uses grep, awk, sort, uniq, and head — five commands chained together to produce a sorted frequency table of offending IP addresses in seconds.

Related Snippets