Scenario-based Linux Interview Questions Part (Answers)

Listen to this Post

Basic Linux Administration

  1. User Management: A user complains they cannot log in. How will you troubleshoot?

– Check if the user account exists:

grep username /etc/passwd 

– Verify password expiration:

chage -l username 

– Check authentication logs:

tail -f /var/log/auth.log 

– Ensure home directory permissions:

ls -ld /home/username 
  1. File Permissions: A script is executable by one user but not another. How do you resolve this?

– Check file permissions:

ls -l script.sh 

– Modify permissions:

chmod 755 script.sh 

– Verify group ownership:

chown :groupname script.sh 
  1. Process Management: A service is consuming 100% CPU. How will you find and fix it?

– Identify high-CPU processes:

top 
ps aux --sort=-%cpu | head 

– Kill the problematic process:

kill -9 PID 
  1. SSH Issues: You cannot SSH into a remote machine. How do you debug?

– Check SSH service status:

systemctl status sshd 

– Verify firewall rules:

iptables -L 

– Test SSH connectivity:

ssh -v user@remote_host 

You Should Know:

  1. Disk Space Full: / Partition is Full. How Do You Find and Delete Large Files Safely?

– Find large files (>100MB):

find / -type f -size +100M -exec ls -lh {} \; 

– Delete safely (after confirmation):

rm -rf /path/to/large_file 
  1. File Corruption: A Log File is Showing Junk Characters. How Will You Check and Recover It?

– Check file integrity:

file /var/log/syslog 

– Attempt recovery:

strings /var/log/syslog > recovered_log.txt 
  1. Crontab Not Running: A Scheduled Job is Not Executing. How Do You Debug?

– Check cron logs:

grep CRON /var/log/syslog 

– Verify crontab entries:

crontab -l 
  1. Package Installation Failing: YUM or APT is Failing. How Will You Resolve It?

– For Debian/Ubuntu:

sudo apt update && sudo apt upgrade 

– For RHEL/CentOS:

sudo yum clean all && sudo yum update 

What Undercode Say:

Linux troubleshooting requires familiarity with logs, permissions, and system monitoring. Always verify before deleting files, and use `journalctl` for systemd-based debugging. Automation (cron, systemd timers) must be logged properly.

Expected Output:

A structured guide with verified commands for Linux troubleshooting.

(Note: Telegram and WhatsApp URLs were removed as per instructions.)

References:

Reported By: Mohamed Abdelgadr – Hackers Feeds
Extra Hub: Undercode MoN
Basic Verification: Pass ✅

Join Our Cyber World:

💬 Whatsapp | 💬 TelegramFeatured Image