Linux Commands We Use Every Single Day

A practical guide to the essential Linux commands that make daily development a breeze.

Published: February 28, 2024

As developers, the terminal is our second home. While graphical interfaces are great for many things, absolutely nothing beats the raw speed and power of the Linux command line. Over the years, I've noticed that while there are thousands of commands available, a very small subset accounts for 99% of my daily usage.

Here is a practical, no-nonsense guide to the Linux commands I actually reach for every single day.

The Essentials

grep (Global Regular Expression Print)

Finding things inside files is a constant necessity. grep is the undisputed king of text search.

Code
# Search for a specific string in a file
grep "error" /var/log/syslog
 
# Search recursively through a directory, ignoring case sensitivity
grep -ri "api_key" ./src
 
# Show context (2 lines before and after the match)
grep -C 2 "function init" main.js

find

When you need to find files rather than content, find is your best friend. It's incredibly powerful when combined with execution flags.

Code
# Find all .log files modified in the last 7 days
find /var/logs -name "*.log" -mtime -7
 
# Find and delete all node_modules folders (use with extreme caution!)
find . -name "node_modules" -type d -exec rm -rf {} +

tail and less

Viewing logs is a daily chore for backend developers. tail -f lets you watch a log file update in real-time.

Code
# Watch a log file continuously as new lines are added
tail -f /var/log/nginx/access.log
 
# View only the last 100 lines of a massive file
tail -n 100 app.log

When you need to scroll through a large file, less is infinitely better than cat because it doesn't load the entire file into memory and allows for two-way scrolling and searching.

Text Manipulation

awk

awk is basically a full programming language for text processing, but I primarily use it to extract specific columns from structured command output.

Code
# Print only the 2nd column (e.g., process IDs) from the output of ps
ps aux | awk '{print $2}'

sed (Stream Editor)

Perfect for quick, automated find-and-replace operations across multiple files without opening an editor.

Code
# Replace 'foo' with 'bar' globally in a file
sed -i 's/foo/bar/g' config.txt

System Resources

htop / top

When your machine sounds like an airplane taking off, you need to know what's eating your CPU. htop is a visually appealing, interactive process viewer that makes it easy to spot and kill rogue processes.

df and du

Essential for managing disk space when a server randomly runs out of storage.

Code
# Show overall disk usage on all mounted filesystems (human readable)
df -h
 
# See exactly which folders are taking up the most space in the current directory
du -sh * | sort -hr

Networking

curl

Testing APIs from the command line is significantly faster than opening Postman for simple requests.

Code
# Fetch HTTP headers only (great for checking if a site is up)
curl -I https://api.github.com
 
# Send a POST request with a JSON payload
curl -X POST -H "Content-Type: application/json" -d '{"name":"test"}' http://localhost:3000/api

lsof

Ever tried to start a development server and got the dreaded Address already in use error? lsof to the rescue.

Code
# Find exactly what process is listening on port 8080
lsof -i :8080

Conclusion

You don't need to be a bash wizard writing 50-line shell scripts to be highly productive in the terminal. Mastering just these core commands will significantly speed up your workflow, server management, and debugging processes. The next time you reach for a GUI tool, try to see if you can accomplish the task with these commands instead!