LInux Interview questions for experienced

1. Service Management (systemd) Q: How do you manage services in modern Linux? Answer: Using systemd Common commands: systemctl start nginx systemctl stop nginx systemctl restart nginx systemctl status nginx systemctl enable nginx systemctl disable nginx Q: Service is not starting. How will you debug? Answer: systemctl status journalctl -u Check: Syntax errors Port conflicts Permission issues Q: Difference between service and systemctl? service → old SysV init systemctl → modern systemd 🔹 2. Boot Process & Targets Q: Explain Linux boot process briefly Answer: BIOS → GRUB → Kernel → Init (systemd) → Services Q: How to change runlevel in systemd? Runlevels replaced by targets: systemctl get-default systemctl set-default multi-user.target systemctl isolate rescue.target 🔹 3. Process Management Q: How do you find high CPU process? top htop ps -aux --sort=-%cpu Q: Kill a process safely vs forcefully? kill -15 # graceful kill -9 # force Scenario: Q: Process keeps restarting automatically. Why? 👉 Managed by systemd → Restart policy: systemctl cat 🔹 4. Networking Services Q: How do you check if a service port is listening? netstat -tulnp ss -tulnp Q: Service not reachable from outside? Check: Firewall SELinux Binding IP firewall-cmd --list-all 🔹 5. Logs & Troubleshooting Q: Where are logs stored? /var/log/messages /var/log/syslog Q: How to monitor logs in real time? tail -f /var/log/messages journalctl -f Scenario: Q: Application crashed. What’s first step? 👉 Logs → journalctl → identify root cause 🔹 6. Scheduling Services Q: Difference between cron and at? cron → recurring at → one-time Q: Where cron jobs stored? crontab -l /etc/crontab 🔹 7. File System Services Q: Disk full issue. How to troubleshoot? df -h du -sh * Q: How to mount a filesystem permanently? /etc/fstab 🔹 8. User & Permission Services Q: Explain SUID, SGID, Sticky bit SUID → run as file owner SGID → group inheritance Sticky → only owner deletes 🔹 9. Security Services Q: What is SELinux? SELinux enforces security policies Check status: getenforce Scenario: Q: App not working but service is running 👉 Check SELinux: setenforce 0 # test 🔹 10. Package Management Services Q: Install/remove packages? yum install nginx yum remove nginx (or apt for Ubuntu) 🔹 11. SSH Service Q: SSH not working. What will you check? systemctl status sshd ss -tulnp | grep 22 Check: Port Firewall Config /etc/ssh/sshd_config 🔹 12. Real-Time Scenario Questions 🔥 Scenario 1: Server is slow Check CPU → top Memory → free -m Disk → iostat Logs 🔥 Scenario 2: Service running but not accessible Port listening? Firewall blocking? App binding to localhost? 🔥 Scenario 3: Server not booting Check GRUB Boot into rescue mode Check logs

Comments

Popular posts from this blog

Linux interview questions

Aws Interview Questions