This session focuses on how Linux commands are used in real-world troubleshooting and interview scenarios.
By the end of this session, students should be able to:
- Troubleshoot Linux servers
- Analyze logs
- Check services and processes
- Diagnose CPU, Memory, Disk, and Network issues
- Answer common Linux interview confidently
An application is down.
How would you troubleshoot it?
Always think like an administrator:
Service
↓
Logs
↓
Process
↓
Port
↓
Resources
↓
Network
↓
Fix Root Cause
Scenario 1: Application is Down
Users report that the application is inaccessible.
Approach
Check Service
systemctl status nginx
Check Logs
journalctl -u nginx -n 50
tail -f /var/log/nginx/error.log
Check Process
ps -ef | grep nginx
Check Listening Port
ss -tulnp
Restart Service
systemctl restart nginx
Answer
I would first verify the service status,
check logs for errors,
confirm the process is running,
verify the application port,
and then identify and resolve the root cause.
Scenario 2: Disk Full
The production server shows 100% disk usage.
Check Filesystem Usage
df -h
Find Large Directories
du -sh /*
Find Large Files
find / -type f -size +500M
Check Log Growth
du -sh /var/log/*
Answer
I would identify the filesystem,
locate large files/directories,
analyze log growth,
and clean up unnecessary data after validation.
Scenario 3: High CPU Usage
CPU utilization is constantly above 90%.
Check CPU Usage
top
Find High CPU Process
ps aux --sort=-%cpu
Inspect Process
ps -ef | grep PID
Answer
I would identify the process consuming CPU,
investigate why it is consuming resources,
review application logs,
and then decide whether a restart or fix is required.
Scenario 4: High Memory Usage
Commands
free -h
top
ps aux --sort=-%mem
Answer
I would determine which process is consuming memory,
verify whether it is expected behavior,
check for memory leaks,
and review logs before restarting the application.
Scenario 5: Website Not Opening
Check Service
systemctl status nginx
Check Port
ss -tulnp
Check Firewall
ufw status
Test Locally
curl localhost
Troubleshooting Flow
Service
↓
Port
↓
Firewall
↓
Network
Scenario 6: SSH Not Working
Verify Connectivity
ping SERVER_IP
Verify SSH Service
systemctl status sshd
Verify Port 22
ss -tulnp | grep 22
Verify Firewall
ufw status
Answer
I would verify network connectivity,
check the SSH service,
confirm port 22 is listening,
and verify firewall rules.
Scenario 7: User Cannot Access a File
Check Permissions
ls -l file.txt
Check User Details
id username
Fix Ownership
chown user:group file.txt
Fix Permissions
chmod 644 file.txt
Answer
I would first verify ownership,
then permissions,
and finally confirm the user belongs to the correct group.
Scenario 8: Service Not Starting After Reboot
Check Status
systemctl status myapp
Enable Service
systemctl enable myapp
Verify
systemctl is-enabled myapp
Answer
The service may not be enabled for startup.
I would verify and enable it using systemctl.
Scenario 9: Log Analysis
Search Errors
grep ERROR application.log
Count Errors
grep ERROR application.log | wc -l
Recent Errors
tail -100 application.log | grep ERROR
Answer
Logs provide the most valuable troubleshooting information.
I always review logs before making changes.
Most Important Linux Commands
File Management
ls
cd
pwd
cp
mv
rm
cat
less
tail
Search
grep
find
awk
sed
Permissions
chmod
chown
Processes
ps
top
kill
Monitoring
free -h
df -h
du -sh
Networking
ip a
ping
curl
ss
Services
systemctl
journalctl
Top Interview
- Difference between Hard Link and Soft Link
- Difference between cp and mv
- Difference between grep and find
- Difference between kill and kill -9
- What is chmod 777?
- What is umask?
- Difference between top and ps
- Difference between SCP and SFTP
- Difference between Cron and systemd
- How do you troubleshoot a down application?
Final Interview Formula
Whenever an interviewer asks:
Application is not working.
Use this answer:
1. Check Service Status
2. Review Logs
3. Verify Process
4. Verify Listening Port
5. Check CPU & Memory
6. Check Disk Usage
7. Verify Network Connectivity
8. Identify Root Cause
9. Apply Fix
10. Validate Service Recovery
