30 commonly asked questions with complete, interview-ready answers
Organized into 10 beginner, 10 intermediate, and 10 senior-level questions. Senior questions include practical production troubleshooting scenarios.
Linux is an open-source operating system that manages hardware resources and provides an environment to run applications and services. In DevOps, we commonly use Linux because it is stable, secure, lightweight, and supports automation. Most cloud servers, including AWS EC2 instances, run Linux distributions such as Ubuntu, Amazon Linux, and Red Hat Enterprise Linux. We also use Linux to run Docker containers, Kubernetes worker nodes, CI/CD pipelines, web servers, and databases.
Unix is an older operating system originally developed at Bell Labs, whereas Linux is an open-source, Unix-like operating system created by Linus Torvalds. Both have similar command-line interfaces, file systems, and process management concepts. Linux is open-source and available in distributions such as Ubuntu, Debian, and Red Hat Enterprise Linux. It is widely used in DevOps because of its flexibility, community support, and compatibility with cloud-native tools.
I regularly use Linux commands to navigate directories, manage files, monitor processes, and troubleshoot servers.
| Command | Purpose |
|---|---|
pwd |
Displays the current directory |
ls -l |
Lists files with permissions |
cd |
Changes the directory |
mkdir |
Creates a directory |
touch |
Creates an empty file |
cp |
Copies files |
mv |
Moves or renames files |
rm |
Removes files |
cat / less |
Reads file contents |
grep |
Searches for patterns |
find |
Searches for files |
df -h |
Checks disk space |
free -h |
Checks memory usage |
top |
Monitors processes |
For example, I use df -h to check disk usage and top or htop to monitor running processes.
Linux follows a hierarchical file system structure that starts from the root directory, represented by /. Important directories include:
| Directory | Purpose |
|---|---|
/ |
Root directory |
/home |
User home directories |
/root |
Home directory of the root user |
/etc |
Configuration files |
/var |
Frequently changing data |
/var/log |
System and application logs |
/tmp |
Temporary files |
/usr |
User applications and utilities |
/bin |
Essential user commands |
/sbin |
System administration commands |
/opt |
Optional third-party software |
/dev |
Device files |
/proc |
Virtual filesystem with process and kernel information |
For example, when investigating application logs, I usually check /var/log or the application's configured log directory.
An absolute path specifies the complete location of a file or directory starting from the root directory /. A relative path specifies the location based on the current working directory. For example, /home/ubuntu/app/config.yaml is an absolute path, whereas app/config.yaml is a relative path. In shell scripts and CI/CD pipelines, I prefer absolute paths when the execution directory may change because they make file references more predictable.
Linux file permissions control who can read, write, or execute a file or directory. Read (r) allows reading, write (w) allows modification, and execute (x) allows execution of a file or access to a directory. Permissions are assigned to the user who owns the file, its group, and others.
For example, running: