Here are Linux interview questions for DevOps with answers. These are commonly asked in real interviews and explained clearly.
Linux interview questions for DevOps with answers
1. What is Linux?
Linux is an open-source operating system based on the Unix architecture. It is widely used in servers, cloud platforms, and DevOps environments because of its stability, security, and flexibility.
2. What are the main components of Linux?
- Kernel – Core part that manages hardware and processes
- Shell – Interface to interact with the system
- File System – Organizes data
- Utilities – Commands and tools for daily operations
3. What is the difference between Linux and Unix?
Unix is a proprietary operating system, while Linux is open-source and freely available. Linux is inspired by Unix but developed independently.
4. What is a shell?
A shell is a command-line interface that allows users to communicate with the operating system using commands.
5. What are some common Linux distributions?
- Ubuntu
- CentOS / Rocky Linux
- Debian
- Red Hat Enterprise Linux (RHEL)
File System & Commands
6. What is the Linux file system structure?
Linux follows a hierarchical structure starting from / (root directory). Important directories:
/home– User files/etc– Configuration files/var– Logs and variable data/bin– Essential commands
7. Difference between cp, mv, and rm?
cp→ Copy filesmv→ Move or rename filesrm→ Delete files
8. How do you check disk usage?
df -h→ Shows disk spacedu -sh→ Shows folder size
9. What is an inode?
An inode stores metadata about a file, such as size, permissions, and ownership, but not the file name.
10. What is the use of grep?
grep is used to search for patterns in files or output.
Example:
bash
grep "error" logfile.txt
Permissions & Users
11. What are file permissions in Linux?
There are three types:
- Read (r)
- Write (w)
- Execute (x)
For:
- Owner
- Group
- Others
12. What is chmod?
Used to change file permissions.
Example:
bash
chmod 755 file.sh
13. What is chown?
Used to change file ownership.
Example:
bash
chown user:group file.txt
14. How do you create a user?
bash
useradd username
passwd username
Process & System Management
15. How do you check running processes?
bash
ps -ef
top
16. What is PID?
Process ID – a unique number assigned to each running process.
17. How do you kill a process?
bash
kill PID
kill -9 PID
18. What is a daemon?
A daemon is a background service (e.g., SSH, cron).
Networking (Important for DevOps)
19. How to check the IP address?
bash
ip a
20. What is the difference between ping and curl?
ping→ Checks connectivitycurl→ Fetches data from a URL
21. How do you check open ports?
bash
netstat -tuln
ss -tuln
22. What is SSH?
Secure Shell is used to connect to remote servers securely.
Storage & Disk Management
23. What is LVM?
Logical Volume Manager allows flexible disk management (resize, snapshots).
24. Difference between a hard link and a soft link?
- Hard link → Points to the same inode
- Soft link → Shortcut to file
DevOps-Focused Linux Questions
25. What is cron?
Cron is used to schedule tasks.
Example:
bash
* * * * * /script.sh
26. What is systemd?
systemd is a system and service manager used to start and manage services.
27. How do you check logs?
bash
/var/log/
journalctl
28. What is a package manager?
A tool used to install and manage software.
Examples:
apt(Ubuntu)yum/dnf(RHEL)
29. What is an environment variable?
A variable that defines system behavior.
Example:
bash
echo $PATH
30. What is a pipeline in Linux?
It allows passing the output of one command to another.
Example:
bash
cat file.txt | grep "error"
Also read about Unix Operating System Commands For Interview With Examples
Scenario-Based Questions (Very Important)
31. Disk is full. What will you do?
- Check usage (
df -h) - Find large files (
du -sh *) - Clean logs (
/var/log) - Remove unused files
32. Service is not starting. How to troubleshoot?
- Check status (
systemctl status) - View logs (
journalctl -xe) - Verify config files
33. Server is slow. What will you check?
- CPU (
top) - Memory (
free -m) - Disk (
iostat) - Processes
34. How do you monitor logs in real time?
bash
tail -f logfile
35. How do you find a file in Linux?
bash
find / -name filename
DevOps Real-World Scenarios
36. Application is slow. What will you check?
- CPU →
top - Memory →
free -m - Disk I/O →
iostat - Logs
37. Server is unreachable. What will you do?
- Check network
- Ping server
- Check the SSH service
- Verify firewall rules
38. Disk suddenly full. Root cause?
- Logs growing
- Large files
- Docker images
- Temporary files
39. How do you find large files?
bash
du -ah / | sort -rh | head -20
40. How do you handle zombie processes?
- Identify using
ps aux - Kill the parent process
Containers & DevOps Integration
41. How does Linux support Docker?
- Namespaces → isolation
- Cgroups → resource limits
- Union FS → layered filesystem
42. What are namespaces?
They isolate:
- Processes
- Network
- Filesystem
- Users
43. What are cgroups?
Control CPU, memory, and I/O usage of processes.
Advanced Troubleshooting
44. What tools do you use for debugging?
strace→ system callslsof→ open filesnetstat→ networktcpdump→ packet capture
45. How do you debug a crashed service?
- Check logs
- Run in debug mode
- Check dependencies
- Use
journalctl
Also read about Linux Shell Scripting For DevOps Interview Questions Guide
