The IT industry depends heavily on Linux. So, if you are trying to get into one of the IT industry positions, you need to be good at Linux. Furthermore, as someone trying to get a position, it is essential to impress the interviewer with your knowledge, where interview preparations come in.
To help you in your search for top Linux interview questions, you have come to the right place. This article will list the top 25 Linux interview questions and answer them. However, our answers are mostly for reference purposes, and you are encouraged to research and create your understanding of the subject matter. By doing so, you can cope with other questions and even answer stuff that requires deep knowledge.
Psst. Hint..you can use FOSSLinux as the home of Linux to learn everything about Linux!
Preparing for an interview is always a good thing as it gives you the edge over existing candidates and helps you cope with the anxiety that comes with interviews.
Open source is at the top when it comes to the development environment for small and medium businesses. In fact, enterprises are also deeply invested in the ecosystem. One of the core components of the ecosystem is Linux. In the job report created by The Linux Foundation, Linux seems to sit nicely at a 46% demand curve. Their report also found that the Cloud/Container Technologies saw a much higher demand at 75%. According to the report, 74% of hiring manager says that Linux is one of the most in-demand skills.
If you are actively looking for a job as a Linux administrator or developer, the following guide should help you get a peek into the kind of questions you expect during the interview.
Linux Interview Questions
So, let’s get started with Linux interview questions without any delay.
1. Tell us about your understanding of Linux.
Linux is a Unix-based open-source operating system. Linux Torvalds was the man who invented Linux. It is free-to-use and is based on the Linux kernel. As it is free, it is mainly aimed at systems where users do not want to spend money to get paid operating system solutions such as macOS and Windows.
Multiple distros build no kernel and provide a customized personal experience to the users. Also, Linux can run on popular hardware created by different popular manufacturers, including HP, Intel, SPARC, IBM, and so on!
The mascot for Linux is Tux — a penguin figure.
2. What does Linux Kernel do? Also, can you edit it on your own legally?
Linux kernel is at the core of the Linux operating system. The word kernel refers to the core of the operating system. In this case, the Linux kernel also means the same. The kernel handles the interaction with the hardware and the user commands. Users can also interact directly with the kernel using the terminal and directly interact with the system.
Also, as the Linux kernel is open-source, anyone can download it and edit it without permission. Linux is released under the General Public License(GPL), which means it can be modified and edited according to the user’s needs or requirements. If you are curious, you can constantly fiddle with the kernel and customize it based on your needs.
3. Tell us the difference between Unix and Linux.
One of the main differences between these two is its cost. Linux is open-source and free of cost, whereas Unix has a cost associated with it. There are also different iters of cost associated with the UNIX as well.
Another big difference between them is the target audience. Linux is cleaner and easy to use, and hence can be used by anyone interested in its ecosystem. On the other hand, Unix is best used in workstations, mainframes, and managing internet servers.
The GUI for Linux includes Gnome and KDE, whereas Unix offers a familiar desktop environment. Also, updates for Linux are faster compared to Unix.
4. What is Kdump?
Kdump is a Linux mechanism to capture the crash dumps when the system handles an error and crashes. The crash dumps can also be created when a kernel panic occurs.
The Linux administrator can store the crash dump on the local file system or use a remote file system.
The primary use of the Kdump is to analyze the cause of the crash and then use that information to fix the problem.
5. What is Linux Loader(LILO)?
LILO or the Linux Loader is the boot loader for Linux. The boot loader enables the operating system to load and start its execution into the memory. Like other popular operating system boot loaders, LILO works similarly, including macOS and Windows. However, they are all different in their way.
LILO also initiates BIOS to test the whole system and ensure that everything is working as intended. Once BIOS checks everything, it transfers the control to the Master Boot Record. Once done, the LILO captures the whole control and loads the Linux OS for use. The whole process is fast and ensures that the operating system loads as fast as possible.
6. Tell us about the Linux basic component.
There are five basic components of the Linux operating system. These include the kernel, shell, GUI, System utilities, and application programs.
- Kernel: It is the core of the Linux OS, which manages the connection between the hardware and the users.
- GUI: The Graphical User Interface(GUI) is the interface to the system that the user uses to interact with the different sections’ operating system.
- Shell: Shell executes commands on Linux as an interpreter.
- Application Programs: The application programs are designed to offer functionality on a specific task(s).
- System Utilities: Finally, we have system utilities that handle computer functionalities and can be used by the user.
7. Why do you want to use Linux?
Note: This is a tricky question, and the answer is from a broader perspective, even when the interviewer has aimed directly.
You can share the Linux features here. One of the main reasons you can highlight is its open-source nature. This is why it is widely used in the industry, as it doesn’t require licensing fees in most cases. The ability of Linux to run on old computers also makes it a great choice for most users.
Linux is also secure, which makes it ideal for most businesses. Lastly, it also offers access to an amazing community where you can access easy fixes, live chat, and forums.
8. What is Automounter? Is Automounter required?
Automounter is a Linux operating system service that handles the local file system’s mounting and remote file system. The service automounts the required image when needed by the system. This means that the system doesn’t need to keep mounting the drive even when needed. The autofs automounter service only mounts the file system when needed.
9. How to enable password policies?
Password policies ensure that passwords are strong and the users follow them to create long and hard to crack passwords. To enable password policy in Linux, you need to use PAM. It stands for Pluggable Authentication Module. To update the password policy, you need to edit the “/etc/pam.d/system-auth” file on RHEL and Centos.
10. Tell us about Swap Space.
Swap space is the additional memory amount allocated by Linux to run concurrent running programs when needed.
To ensure optimal performance and usage, Swap space is created temporarily during its usage. Once done, the RAM is made fully accessible to the other programs. Also, Swap space is mainly used when RAM doesn’t have enough space to run the programs.
11. What is a virtual desktop?
A virtual desktop is a way to manage windows in a separate space. This solves the problem of managing the windows when they are too many. Users can use virtual desktops to improve productivity.
A virtual desktop can also run on remote servers, bringing more benefits, including cost savings, efficient energy usage, data integrity, fewer compatibility, and centralized administration.
12. What is the Root account?
The root account is the system administrator account. Using the root account, you can make any changes to the system to fully control it. Also, the root account is the default operating account for the Linux operating system. The root account should create user accounts, assign permissions to those accounts, and manage them.
13. What are Shells in Linux? Also, tell us about their types.
Shell in Linux is designed to give commands from the users via a terminal or keyboard and then present it to the operating system such that the action can be performed.
Linux offers good Shell options; however, some are more popular than others. The most common Shells include:
- bash: bash stands for Bourne Again Shell. The most common type of Shell comes preloaded with Linux distributions.
- ksh: ksh stands for Korn Shell. It is a high-level programming language shell aimed at system administrators and programmers.
- zsh: The zsh shell is the Z Shell, which provides unique features including closing comments, startup files, filename generating, and so on
- csh: csh shell stands for C Shell, which offers C like syntax.
14. What commands can you use to check the memory consumed by Linux?
You can use many commands to check memory usage in Linux. Some of the most commonly used ones include:
- free -m
15. What is Master Boot Record?
Master Boot Record(MBR) detects the bootable device. It contains 512 bytes of data. It can contain the GRUB2/GRUB boot loader, which can load into memory when needed. The three main portions of the MBR include the following:
- First 446 bytes which contain primary boot loader information
- Next 64 bytes, which contain partition table information
- The last 2 bytes contain the MBR validation check
16. Explain Runlevel in Linux.
Runlevel in Linux defines the mode in which the Linux operating system is running. Out of the box, Linux offers seven different Runlevels, and each one of them has its purpose.
- 0, halt: The run level is used to halt systems, i.e., shutting down the system.
- 1, S, single: It is a single user mode runlevel.
- 2: The 2 runlevel offers a basic multi-user mode. The mode runs without NFS.
- 3: It is a text-based full multi-user mode with access to the network.
- 4: It is an unused or no user experimental mode.
- 5: It is a GUI_based multi-user mode.
- 6, reboot: This runlevel ensure system reboot.
To check the default runlevel, you can check the “/etc/inittab” file. It contains the Sysvinit system, which is used to boot into a specific runlevel.
17. What is GUI?
GUI stands for Graphical user interface. The graphical user interface offers an interactive and user-friendly interface to the users. The users get access to icons and images, making it easy for them to navigate through different options provided by the operating system.
GUI offers advantages for some users; however, it can also pose disadvantages to some. The advantages including easy navigation, intuitive interface, easy to do complex tasks as they are illustrated better, and improved productivity.
In terms of disadvantages, the end-user may not explore the operating system in the best possible way as they will have less control. A GUI can slow them down for power users as they can utilize the keyboard more efficiently than a mouse. Lastly, GUI is resource hungry.
18. What are the different file permission in Linux?
Linux offers three types of permissions which can be accessed by owners including, ‘Group,’ ‘User,’ and ‘Others.’ These include the following:
- Read: The read permissions allow the users to open and read the contents of the file. The user can also list the directory contents for files with the read permission.
- Write: The write permission allows the user to modify the file content. The user can opt to add or delete the file content. They can also rename the file within the directory level.
- Execute: The execute permission can execute any file in the directory. The execute permission is also required to run a file.
19. What is a Shell script?
A shell script is a script that can be executed for the shell. The script is handy when it comes to extending multiple commands one after another. This way, the Shell scripts can help automate certain tasks and are very useful for development and administration.
20. What makes Linux more secure compared to other operating systems?
Linux is more secure than other operating systems due to its open-source licensing. This means that hundreds of developers work on the code and make it secure compared to other operating systems which are developed in a closed ecosystem. Apart from it being open source, other reasons make Linux more secure. The reasons include
- Better user management that ensures low-level restrictions. This way, viruses fail to attack local files or folders and ensure that the damage is restricted in the best possible way.
- Programs can also be permissioned before they are installed, ensuring better security measures.
- Linux comes with a powerful auditing system.
- Linux gives access to detailed logs, making it easy for administrators or security experts to figure out unauthorized access or other permissions violations.
21. What is pwd?
pwd is a handy command. It stands for Print Working Directory(PWD). It lets you print the path of the directory in which you use the command. The directory path shows from the root.
If you type $pwd in the command line interface, you will see the full path starting from the root. It also supports two flags -L and -P, making the path return in the symbolic and actual path.
22. What are the common Linux troubleshooting and networking commands?
Linux is a modern operating system that offers all networking features. So, you can use Linux both externally and internally to send and receive information. The System administrator needs to take care of the network configuration and troubleshoot properly. They use Linux commands to quickly check the different aspects of the operating system, including troubleshooting.
Some of the common troubleshooting commands include:
- Hostname: to view the hostname IP address and domain. It is also used to set the hostname.
- ifconfig: enables the administrator to manipulate and display network interfaces and routes.
- tracepath: traces the hops required by the packet to reach the destination.
- Route: shows and edit IP routing table
- mtr: track path and ping into one command
- netstat: display routing tables, network connections, and interface statistics
- Dig: query DNS name servers
- Ping: to figure out the readability of remote server or not
23. What are daemons?
With Daemons, the operating system can run a background process that cannot run natively on the operating system. System administrators can utilize Daemons to run background services. This means that the users cannot interact with the services, making them more secure. In short, Daemon is a secure approach to handling periodic requests.
24. What is the maximum filename length for Linux?
The Linux user can name a file 255 characters at maximum. If the user exceeds the character limit, the terminal will throw an error. Also, the length is calculated, including filename and pathname.
25. What are the environmental variables?
Environmental variables let you set global settings for Linux programs and shell’s function.
This leads us to the end of our top 25 Linux Interview Questions. These are in no way exhaustive. Also, the interview questions can change depending on the position you are applying for. So, if you are applying for a high-level Linux job, the interview questions might not be helpful for you.
So, what do you think about the interview questions that we listed? Did you take an interview recently? What other questions did they ask you? Please do share, and let other readers know!
> The Linux user can name a file 255 characters at maximum. In case the user exceeds the character limit, the terminal will throw an error. Also, the length is calculated, including filename and pathname.
$ mkdir -p 1234567_10_234567_20/234567_30_234567_40/234567_50_234567_60_234567_70_234567_80_234567_90_23456_100_23456_110_23456_120_23456_130_23456_140_23456_150_23456_160_23456_170_23456_180_23456_190_23456_200_23456_210_23456_220_23456_230_23456_240_23456_250_23456_260
$ touch 1234567_10_234567_20/234567_30_234567_40/234567_50_234567_60_234567_70_234567_80_234567_90_23456_100_23456_110_23456_120_23456_130_23456_140_23456_150_23456_160_23456_170_23456_180_23456_190_23456_200_23456_210_23456_220_23456_230_23456_240_23456_250_23456_260/file
$ ls -l 1234567_10_234567_20/234567_30_234567_40/234567_50_234567_60_234567_70_234567_80_234567_90_23456_100_23456_110_23456_120_23456_130_23456_140_23456_150_23456_160_23456_170_23456_180_23456_190_23456_200_23456_210_23456_220_23456_230_23456_240_23456_250_23456_260/file
-rw-r–r– 1 user user 0 Nov 20 15:02 1234567_10_234567_20/234567_30_234567_40/234567_50_234567_60_234567_70_234567_80_234567_90_23456_100_23456_110_23456_120_23456_130_23456_140_23456_150_23456_160_23456_170_23456_180_23456_190_23456_200_23456_210_23456_220_23456_230_23456_240_23456_250_23456_260/file
$ realpath 1234567_10_234567_20/234567_30_234567_40/234567_50_234567_60_234567_70_234567_80_234567_90_23456_100_23456_110_23456_120_23456_130_23456_140_23456_150_23456_160_23456_170_23456_180_23456_190_23456_200_23456_210_23456_220_23456_230_23456_240_23456_250_23456_260/file | wc
1 1 278
You should not assume the 255 character limit. There are kernel, shell and file system dependent limits with APIs to look them up a run time. All of them a arbitrary.