Linux Commands for Developers
What You Will Learn
Linux is essential for deployment, debugging, cloud servers, containers, and CI/CD systems. This guide covers the commands developers use most.
Prerequisites
- Terminal access
- Basic file system knowledge
Concept Overview
Linux work usually involves navigating files, reading logs, managing permissions, checking processes, and debugging network issues.
Step-by-Step Explanation
Common command groups:
- Navigation:
pwd,ls,cd - Files:
cat,less,head,tail,cp,mv,rm - Search:
grep,find,rg - Permissions:
chmod,chown - Processes:
ps,top,kill - Networking:
curl,ping,ss - Services:
systemctl,journalctl
Code Example
sudo systemctl status nginx
sudo journalctl -u nginx --since "30 minutes ago"
ss -tulpn | grep ':80'
curl -I http://localhost
Real-World Use Cases
- Reading application logs
- Checking if a port is open
- Restarting a service
- Editing deployment files
- Debugging failed CI jobs
Best Practices
- Use
lessortailfor large logs. - Be careful with recursive delete commands.
- Learn permissions before changing them.
- Use
curl -Ito inspect HTTP headers. - Keep command history clean of secrets.
Common Mistakes
- Running destructive commands from the wrong directory
- Giving
777permissions to solve every issue - Ignoring log files
- Not checking service status after deployment
- Pasting secrets into shell history
Interview Questions
- How do you check running processes?
- How do you check whether a port is listening?
- What does
chmod 755mean? - How do you follow a log file?
- What is the difference between
psandtop?
Summary
Linux confidence makes you better at backend, DevOps, Docker, AWS, and production debugging. Practice commands in real scenarios, not only from lists.