DevOps Linux Interview Prep: Questions, Answers, Code Examples

Andrei Dumitrescu
Andrei Dumitrescu
hero image

Looking to ace your DevOps interview, or perhaps just brush up on your Linux knowledge?

Well then, you’re in the right place!

In this guide, I share some of the most commonly asked Linux interview questions for DevOps Engineers - covering everything from basic Linux components, file system management, process management, command-line tools, to system optimization.

For each section, I've also included what the interviewer is trying to figure out when they ask you these questions, as well as sample answers for you to give them and tweak to your own experiences.

Better still, I’ve broken this down into just 15 questions over 3 sections: Beginner, Intermediate, and Advanced, so you can see how you compare and how many you can answer correctly.

So no need to try and memorize hundreds of questions! Just grab a coffee and a notepad, and let's dive in!

Sidenote: If you do find that you’re struggling with the questions in this guide, or perhaps feel that you could use some more training and want to build some more impressive projects for your portfolio, then check out my complete Linux DevOps / Sysadmin Course.

learn devops

I guarantee you that this is the most comprehensive and up-to-date DevOps Bootcamp that you can find to learn and master Linux, from scratch.

Not only do we cover the basics so you have a concrete foundation, but this course ensures that you’ll actually retain what you're learning by giving you the chance to apply Linux in real-world scenarios by configuring a Linux Server from scratch in the cloud!

This DevOps Bootcamp will take you from an absolute beginner in Linux to getting hired as a confident and effective Linux System Administrator.

With that out of the way, let’s get into the questions.

Beginner Linux Questions

#1. Can you explain what Linux is and its basic components? Also, what is LVM and why is it important?

Linux is an open-source operating system modeled on UNIX. It's essential for DevOps due to its stability, security, and flexibility.

The core components of Linux include:

  • Kernel: The core that interacts with hardware and manages resources
  • Shell: The user interface that interprets commands
  • Directory Structure: A hierarchical filesystem starting from the root ("/")
  • Daemons: Background processes for services like printing and networking

LVM, or Logical Volume Manager, provides flexibility in managing disk space. It allows easier resizing and moving of filesystems without service interruption, improved storage utilization, and easier backups.

This is particularly useful in dynamic environments where storage needs can change frequently.

Why would the interviewer ask you about this?

They want to assess your understanding of Linux's core components and the practical benefits of LVM, before diving deeper.

So a good answer might be something like:

"Linux is an open-source OS modeled on UNIX. Its core components include the Kernel, Shell, Directory Structure, and Daemons. LVM, although optional, is highly recommended as it allows flexible management of disk space, making it easier to resize and move filesystems without interruptions."

2. What are inodes and what data do they store?

Inodes are fundamental to understanding how Linux manages files. An inode is a data structure that stores metadata about a file, excluding its name and data.

The fields in an inode include:

  • File type (regular, directory, link)
  • Permissions
  • Owner and group owner
  • File size
  • Access, change, and modification times
  • Hard links count
  • Pointers to data blocks

Inodes are used whenever the system needs to access file metadata, so understanding inodes helps in tasks like file recovery, performance tuning, and understanding filesystem limits.

Why would the interviewer ask you about this?

They want to gauge your understanding of the filesystem internals and your ability to troubleshoot related issues.

So a good answer might be something like:

"An inode is a data structure storing metadata about a file, such as type, permissions, owner, size, and pointers to data blocks. However, it doesn't store the file's name or data. Understanding inodes is crucial for tasks like file recovery and performance tuning."

3. How would you find where a particular file is located in a Linux system?

Locating files efficiently is a key skill in system administration.

There are a few methods, but I recommend using either the find or plocate commands for this purpose.

For example:

find / -name testfile searches the entire filesystem, while find . -name testfile searches the current directory.

Why would the interviewer ask you about this?

They are checking your familiarity with essential command-line tools and your ability to troubleshoot. Because as you might guess, quickly locating files helps in troubleshooting and managing system resources.

Assuming they ask this question, a good answer might be something like:

"I would use the find or plocate command. For instance, find / -name testfile searches the entire filesystem, while find . -name testfile searches the current directory."

They may even ask you why you would choose this method, so let’s cover that in a little more detail.

4. Why use plocate and not locate?

plocate is a more modern alternative to locate and offers several advantages, especially in terms of performance and efficiency.

It’s designed to be faster and more efficient, especially on large filesystems, and uses a more compact index format, which can speed up both the indexing process and the search operation.

NMot only that, but it efficiently handles the indexing of very large numbers of files, making it suitable for modern systems with extensive file collections.

Why would the interviewer ask you about this?

They want to see your knowledge of modern tools and your ability to choose the most efficient solutions for file location tasks.

So a good answer might be something like:

"I would choose plocate over locate because it is designed to be faster and more efficient, especially on large filesystems. It uses a more compact index format, which speeds up both indexing and search operations.

This makes it particularly useful for modern systems with extensive file collections."

5. How would you delete empty files from a directory?

Managing and cleaning up files is crucial for maintaining system performance, and helps maintain an organized filesystem and optimizes storage usage.

You can use the find command to locate and delete empty files.

What to learn more about commands? Check out my Linux commands cheatsheet here.

For example

find /path -type f -empty -delete

However, if deletion fails, it may be due to insufficient permissions or write protection.

Why would the interviewer ask you about this?

They want to see your knowledge of filesystem maintenance and your approach to handling permissions issues.

So a good answer might be something like:

"To delete empty files, I use the find command with -empty and -delete options, like find /path -type f -empty -delete. If deletion fails, I check permissions using ls -l."

6. What is the purpose of the ps command in Linux, and how would you use it in system monitoring and process management?

The ps command in Linux is a tool for process monitoring and management.

It provides information about currently running processes, including their PIDs, CPU usage, and memory usage, which is crucial information for understanding system performance and troubleshooting issues.

Why would the interviewer ask you about this?

They want to assess your ability to monitor and manage processes effectively - key skills of any sysadmin.

So a good answer might be something like:

"The ps command in Linux is used to display information about running processes. It provides details such as process IDs (PIDs), CPU usage, memory usage, and more.

For example, ps aux gives a detailed view of all running processes, which is essential for system monitoring and process management."

Intermediate Linux Questions

7. Can you explain what a virtual desktop is in the context of Linux and how you have utilized it in your previous roles?

Virtual Desktops enhance workspace organization and multitasking, by allowing users to switch between multiple desktops, each with its own set of applications and windows.

The benefits include better organization, reduced distractions, and increased productivity. This feature is also useful for separating different tasks, such as coding, monitoring, and communication.

Why would the interviewer ask you about this?

They want to understand your efficiency and productivity strategies, and will ask you questions around this.

So a good answer might be something like:

"A Virtual Desktop helps to organize your workspace. I use it to manage tasks like coding, monitoring, and communication separately, which reduces distractions and increases productivity."

8. What are the different file and folder permissions in Linux and how would you modify these permissions?

Understanding permissions is critical for system security and user access management.

In Linux, file permissions include

  • read (r)
  • write (w)
  • execute (x)
  • for user (u)
  • group (g), and
  • others (o)

To change permissions, you use the chmod command. For instance, chmod u+rwx file.txt gives the user read, write, and execute permissions.

Why would the interviewer ask you about this?

They want to assess your understanding of Linux security and access management.

So a good answer might be something like:

"In Linux, file permissions include read (r), write (w), and execute (x) for user (u), group (g), and others (o). To change permissions, use the chmod command, e.g., chmod u+rwx file.txt to give the user read, write, and execute permissions."

9. How and why would you change ownership of a file?

Proper ownership management ensures security and proper access. You use the chown command to change file ownership. For example, chown user1 file.txt changes the ownership of file.txt to user1.

However, only the root user can change file ownership. This is necessary for maintaining proper access control and user management.

Why would the interviewer ask you about this?

They want to verify your knowledge of user management and system security, ensuring you understand how to manage permissions and access effectively.

So a good answer might be something like:

"To change file ownership, use the chown command, e.g., chown user1 file.txt. Only the root user can change ownership, which ensures proper security and access control."

10. How would you differentiate between a process and a thread in a Linux environment, and why is this difference significant?

Processes and threads are fundamental concepts in Linux, crucial for performance and resource management.

  • A process is an independent block of instructions with its own memory space and environment settings
  • A thread is a subset of a process sharing the same memory space, used for concurrent task execution.

Knowing the difference helps in program design, system troubleshooting, and efficient resource allocation.

Why would the interviewer ask you about this?

They want to understand your grasp of system architecture and concurrent processing.

So a good answer might be something like:

"In Linux, a process is an independent block of instructions that the system executes, while a thread is a segment of a process that can execute concurrently with other segments.

Threads within the same process share the same memory space and resources, making them lightweight and quicker to create and destroy. Knowing the difference is essential for tasks like program design, system troubleshooting, and resource allocation."

Advanced Linux Questions

11. As a DevOps Engineer, how would you manage resource allocation for different users and processes in a Linux system?

You can use the ulimit command to set user-level limits on system resources, such as maximum file size, CPU time, and memory usage.

But, for more granular control, you can use Control Groups (cgroups) to limit, account for, and isolate resource usage for groups of processes.

Why would the interviewer ask you about this?

Efficient resource management ensures optimal system performance and stability. So, they want to evaluate your resource management strategies and familiarity with Linux tools.

A good answer might be something like:

"I would use Linux's built-in resource management tools to control and manage resource allocation.

For instance, using the ulimit command, I can set soft and hard limits on resources per user basis, limiting how much of a system's resources a user can consume.

For more granular control, I might use cgroups to set resource usage limits per process."

12. How might you use the nice and renice commands in managing process priorities in Linux?

In Linux, the nice and renice commands are fundamental in managing process priorities.

  • nice allows us to start a process with a specified priority
  • While renice allows us to change the priority of an already running process

renice is particularly useful in a multithreaded environment where we need to prioritize more critical tasks over others.

Why would the interviewer ask you about this?

They want to see your knowledge of process management and prioritization.

So a good answer might be something like:

"In Linux, the nice command is used to start a process with a specific priority, and renice is used to change the priority of an existing process. These tools help manage system performance by ensuring critical tasks receive the necessary CPU time over less critical ones."

13. How do you configure IP addressing and set up a firewall in a Linux system?

Configuring IP addresses and setting up firewalls are fundamental tasks for managing network settings and security in a Linux system.

For example

For static IP assignment, the ip command is used.

ip addr add 192.168.1.10/24 dev eth0 assigns the IP address 192.168.1.10 to the eth0 interface. Whereas for dynamic assignment, you configure the interface to use DHCP.

For firewall setup, iptables is a common command-line utility used to set up, maintain, and inspect the tables of IP packet filter rules. For example, iptables -A INPUT -p tcp --dport 22 -m conntrack --ctstate NEW,ESTABLISHED -j ACCEPT allows incoming SSH traffic.

Why would the interviewer ask you about this?

They want to assess your ability to manage network settings and security, which is crucial for DevOps roles.

You can pretty much just tell them the same information as above when asked.

"To configure IP addresses, I use the ip command for static assignment, such as ip addr add 192.168.1.10/24 dev eth0.

For dynamic assignment, I configure the interface to use DHCP.

For firewall setup, I use iptables, for example, iptables -A INPUT -p tcp --dport 22 -m conntrack --ctstate NEW,ESTABLISHED -j ACCEPT to allow incoming SSH traffic."

14. How do you troubleshoot network connectivity issues in a Linux system?

Several tools are available for this, such as ping for testing network connectivity, traceroute for tracing the route that packets take, and netstat for network statistics.

Why would the interviewer ask you about this?

Troubleshooting network connectivity issues is a regular task when managing Linux servers. They want to evaluate your problem-solving skills and knowledge of networking commands.

So a good answer might be something like:

"There are several commands in Linux for network troubleshooting.

One of the most basic commands is the ping command, which can verify if the network and the host are reachable. The traceroute command is also useful as it shows the path a packet takes to reach the host. Moreover, netstat is another powerful command used to display a variety of network-related information.

For example, netstat -tuln would list all TCP and UDP ports that are listening for connections."

15. What is shell scripting, and how have you used it in your previous roles?

Shell scripting is a feature of Linux that allows you to automate tasks.

A shell script is simply a file containing a series of commands. The shell reads this file and carries out the commands as they are listed.

So in essence, shell scripting is basically writing a series of commands for the shell to execute. It can then use this to automate repetitive tasks, save time, and avoid errors.

Why would the interviewer ask you about this?

They want to assess your ability to automate tasks and your proficiency in scripting, which are important for efficiency in DevOps tasks.

So a good answer might be something like:

"In my previous roles, I've used shell scripting to automate various tasks. For example, I wrote a script to back up certain directories on our server every night using tar and scp commands. This automation saved time and reduced the risk of errors compared to performing the task manually."

Obviously adjust this response to you rown experience, but you get the idea.

So what's next?

And there you have it - 15 of the most common DevOps interview questions and answers, with regards to using Linux.

Navigating a Linux environment is a crucial part of a DevOps Engineer's role, so make sure to brush up on these before your interview - just in case.

Remember though, the goal is to not only memorize these example answers but truly understand the concepts and how they apply in real-world scenarios. I know I gave some placeholder answer examples, but make sure to go through and tweak these for your own experiences.

This way you’ll be able to share even more details and context, and show you really know what you’re talking about.

P.S.

How did you do? Did you nail all 15 questions? If so, it might be time to move from studying to actively interviewing!

Didn't get them all? Got tripped up on a few? Don't worry; I'm here to help.

Like I said earlier, if you find that you’re struggling with the questions in this guide, or perhaps feel that you could use some more training and want to build some more impressive projects for your portfolio, then check out my complete Linux DevOps / Sysadmin Course.

learn devops

Not only do I cover the basics so you have a concrete foundation, but this course ensures that you’ll actually retain what you're learning by letting you apply Linux in real-world scenarios.

You get hands-on experience by configuring a Linux Server from scratch in the cloud, as well as quizzes and challenges at the end of each section.

Plus, once you join, you'll have the opportunity to ask questions in our private Discord community from me, other students and other working DevOps professionals, as well as access to every other course in our library!


If you join or not, I just want to wish you the best of luck with your interview. And if you are a member, let me know how it goes over in the DevOps channel!

More from Zero To Mastery

How to Become a DevOps Engineer: Step-By-Step Guide preview
Popular
How to Become a DevOps Engineer: Step-By-Step Guide

With 400,000+ jobs available and $120,000+ / year salaries, now is the perfect time to become a DevOps Engineer! Here's your step-by-step guide (with all the resources you need to go from complete beginner to getting hired).

4 Tips To Keep Your Tech Skills Up To Date preview
Popular
4 Tips To Keep Your Tech Skills Up To Date

Tech moves at a crazy pace, and it's easy to be left behind. Here are 4 tried and tested tips to not only stay up to date but get ahead of the curve!

A Beginners Guide To Computer Networking preview
A Beginners Guide To Computer Networking

Are you a budding DevOps Engineer or Cybersecurity Analyst? Learn the basics of networking, including key concepts like network topologies, OSI model, and more.