If you’re a developer, sysadmin, or just curious about Linux, this list is for you. It contains all the common questions asked in an interview for a Unix-like system administration or programming position that relates to Linux.
Linux is a Unix-like operating system that has been around for decades and was originally based on the Unix kernel. Linux is an open-source operating system, which means it is freely available and can be modified by anyone with the knowledge. And it’s not just for your desktop computer – Linux runs servers around the world.
Linux is used to power everything from our Android smartphones to web servers that keep everyday websites up and running. Linux powers supercomputers, the enterprise data centers of the world’s top tech companies, and everything in between. And even though this operating system might not be as well known as industry heavyweight Windows, Linux has been around for more than 27 years.
In the world of Linux, there are a set of commands that you will need to know in order to interact with your system. We are always going to talk about the most important commands, and how they work.
Linux, however, used to be the butt of jokes among the software elite. But today, Linux is at the forefront of innovation in operating systems. The Silicon Valley giants such as Google and Facebook use Linux for their clusters and data centers. So what happened?
As with any operating system, Linux administration is a substantial topic. It has the advantage of being open source and free to use, but like all computer systems, it can be difficult to learn how to administer it.
Linux Interview Questions From the Expect Interviewers
Q.1 What are the basic elements or components of Linux?
Linux generally consists of five basic elements or components as given below:
- Kernel: It is considered a core or main part of Linux and is generally responsible for all major activities of OS such as process management, device management, etc.
- System Library: These are special functions or programs with the help of which application programs or system utilities can access features of the kernel without any requirement of code. It is simply used to implement the functionality of the OS.
- System Utility: These are utility programs that are responsible to perform specialized and individual-level tasks. They are considered more liable and allow users to manage the computer.
- Hardware: It is physical hardware that includes items such as a mouse, keyboard, display, CPU, etc.
- Shell: It is an environment in which we can run our commands, shell scripts, and programs. It is an interface between user and kernel that hides all complexities of functions of the kernel from the user. It is used to execute commands.
Q.2 What is LILO?
LILO means Linux Loader is a boot loader that is used for the Linux operating system. Most of the Linux Operating systems use LILO, to boot the operating system into the main memory to start the operations.
Q.3 Why LVM is required?
LVM stands for Large Volume Management, it is a storage management device. Users can create, resize, and delete LVM partitions. It increases abstraction, flexibility, and control. LVM is used to gather existing storage devices into the group and allocate logical units.
Q.4 What are the different modes of Network bonding in Linux?
Different modes of Linux network bonding
- Mode-0(balance-rr): It is a default mode and based on the Round-Robin policy. It offers fault tolerance and load balancing features. It used a round-robin fashion to transmit the packets.
- Mode-1(active-backup): It is based on the Active Backup policy and only one slave will act in the band and another one will act when the others fail in the band. It also provides fault tolerance.
- Mode-2(balance-xor): It sets a xor mode between the source Mac address and destination Mac address to provide fault tolerance.
- Mode-3(broadcast): It is based on broadcast policy and transmitted everything in the slave interface. It also provides fault tolerance and can be used only for a particular purpose.
- Mode-4(802.3ad): It is a dynamic aggregation mode, it created aggregation groups which is having the same speed. It uses the transmit hashing method to select the slaves for outgoing traffic.
- Mode-5(balance-tlb): The outgoing traffic is according to the current load on the slave, and the incoming traffic is received by the slave. It is called an adaptive transmit load balancing mode.
- Mode-6(balance-alb): It is an adaptive load balancing mode. It does not require any switch support.
Q.5 What are the default ports used for SMTP, DNS, FTP, DHCP, SSH, and squid?
Details mentioned below
|FTP||20(Data Transfer) 21(Connections Established)|
|DHCP||68(dhcp client), 67(DHCP server)|
Q.6 How to remove a file or directory from the system in Linux?
rm command: The rm command is used to remove the directory or file specified on the command line. You need to be careful while removing any file or directory.
|rm filename||Removes single file.|
|rm filename1, filename2, filename 3||Removes multiple files.|
|rm * .pdf||Removes all pdf files in the current directory.|
|rm -i filename(s)||-i mean to confirm before deleting the file|
|rm -i filename(s)||Removes files without prompting|
|rm -fv *.txt||Remove all .txt files in the current directory without prompting|
Q.7 Explain rmdir command in Linux?
The rmdir is used to remove each directory specified on the command line.
rmdir [-p] [-v | –verbose] [–ignore-fail-on-non-empty] directories
Q.8 What is meant by PIPE in Linux?
It is a form of redirection that is used in Linux, it is used to combine more than two commands and the output of one command can take as input to the next command.
command_1 | command_2 | command_3 | …. | command_N
Q.9 What is Zombie Process?
It is a process whose execution is completed but even the information exists in the process table. It occurs for the child process because the parent process needs to read the child process status. Once it is completed using the wait system call, then the zombie process is removed from the process table. This is known as Zombie Process.
Q.10 Explain the features of Stateless Linux Server?
Features of Stateless Linux Server
- Stores the prototype of every system.
- Stores the snapshot was taken.
- Stores the home directories.
- Uses LDAP, which contains the information about which snapshot should run on which system.
Q.11 How do you run a command for a limited time?
Use this command: timeout 10s ./script.sh
# Restart every 30 minutes
while true; do timeout 30m ./script.sh; done
Q.12 How do you run the command every time a file is modified?
Use this command to do:
while inotifywait -e close_write document.tex
Q.13 How do you list the contents of tar.gz and extract only one file?
use these commands:
- tar of file.tgz
- tar xf file.tgz filename
Q.14 How do you get the full path of a file in Linux?
Use this command: readlink -f file.txt
Q.15 How do you limit memory usage for commands?
- ulimit -Sv 1000 # 1000 KBs = 1 MB
2. ulimit -Sv unlimited # Remove limit
Q.16 What is the difference between Linux and Windows?
|Linux is available for FREE||It is paid software|
|It is an Open-Source operating system||It is not an open-source OS|
|Linux customization is possible||No customizations are available|
|It provides high-level security||Can’t defend virus and malware attacks unless until it is paid|
|Primary partitioning and logical partitioning available to boot||Booting is available while primary partitioning only|
|BackSlash separates directories||The forward slash separates directories|
|File names are case particular||Irrespective of the case while naming files|
Q.17 What is the df command in Linux?
Users can use the df command to troubleshoot disk space issues. Here df stands for display free disk space.
df Command Example:
Q.18 What is a du command in Linux?
du command in Linux is used to retrieve more detailed information about which files use the disk space in a directory.
du Command Example:
- $ du -sh /var/log/*
- 1.8M /var/log/anaconda
- 384K /var/log/audit
- 4.0K /var/log/boot.log
- 0 /var/log/chrony
- 4.0K /var/log/cron
- 4.0K /var/log/maillog
- 64K /var/log/messages
Q.19 What is the env command in Linux?
env command allows users to set or print the environment variables. During troubleshooting, users can find it useful for checking if the wrong environment variable prevents your application from starting.
env Command Example:
Q.20 What is ps command in Linux?
The ps command displays process status. Use this ps command to determine a running application or confirm an expected process.
ps Command Example:
$ ps -ef
$ ps -ef | grep tomcat
Q.21 What is the grep command in Linux?
grep searches file patterns. If you are looking for a specific pattern in the output of another command, grep highlights the relevant lines. Use this grep command for searching log files, specific processes, and more.
$ cat tomcat.log | grep org. apache.Catalina.startup.Catalina.start
12-Jan-2018 17:08:35.542 INFO [main] org.apache.Catalina.startup.Catalina.start Server startup in 681 ms
Q.22 What is the cat command in Linux?
In Linux cat command concatenates and prints files. Users might issue cat to check the contents of your dependencies file or to confirm the version of the application that you have already built locally.
$ cat requirements.txt
Q.23 What is the tail command in Linux?
The tail command displays the last part of a file. Generally, users don’t need every logline to troubleshoot. Instead, you want to check what your logs say about the most recent request to your application.
$ tail -n 100 /var/log/httpd/access_log
Q.24 Why is Linux considered more secure than other operating systems?
Linux is an open-source operating system, nowadays it is rapidly growing in the technology market. We have a few reasons why Linux is more secure than other OS.
- The perk of accounts: Linux allows only a few users to access the system. Thus, the virus cannot attack the whole system, it may cause only a few files in the system.
- Strong Community: Linux users first accomplished the files before they open. So they can save their systems from vulnerabilities.
- Iptables: Iptables are used by Linux because it checks the security circle of the system.
- Different Working Environment: Linux system has different working environments like Linux Mint, Debian, Arch, and many more, these working environments protect from the virus.
- Recording in Linux: It maintains log history because later it can view the details of the system files easily.
- Few User: Linux users are less compared to others, due to this security will be more.
Q.25 Explain the work of the Ctrl+Alt+Del key combination on the Linux operating system?
In Linux, the Ctrl+Alt+Del key is used to restart the computer, and it does not display any confirmation message before rebooting the system.
Q.26 What is meant by internal commands and external commands?
- Internal Commands: Commands directly run by the shell are known as internal commands and there is no separate process to run the commands.
- External Commands: Commands which are run by the kernel are known as external commands and every single command has its own unique process id.
Q.27 Differentiate between BASH and DOS?
Difference between Bash and Dos
|Commands are case sensitive||commands are not case sensitive|
|Backward slash(/) represents directories separator||‘/’ represents command arguments|
|Forward slash ‘’ represents escape character||‘’ represents directories separator|
|Does not follow conventions naming in files||Follow naming convention in files|
Q.28 What are the features of the Linux operating system?
Following are the features of the Linux Operating System
- Portable: Software can work on different types of hardware in the same way. It can carry easily in pen drives and memory cards.
- Open Source: Source code available for free, and its community-based development project.
- Multi-User: Multiple users can use ram, applications and run programs at the same time.
- Multiprogramming: Multiple programs or applications can run at the same time.
- Shell: It has a special interpreter program where you can execute programs and commands of the system.
- Security: It provides authentication, authorization, and encryption to provide security to the data.
Q.29 Why do we use LINUX?
We are many reasons, in that few important reasons are listed out. Following are
- High Stability: It is very stable and does not lead to crashes, it runs fastly as it is when it is installed first.
- Security: It is a dependable server, that offers high security to the user. Using Linux on your system it is easy to avoid viruses and malware. The attacker cannot change any changes in the system until the user is logged in as the root user.
- Easy to Operate: Linux is easy to operate and we can install it easily onto the system because all the variants of Linux have their own software repositories. You can update the system periodically with just a few clicks or you can set automatic updation.
- Hardware Compatibility: Linux can use on any hardware, it doesn’t have any hardware restrictions. It uses efficiently all system resources.
- Open Source: The source code is available as it is under Free and Open Source Software(FOSS).
Q.30 Enlist some Linux distributors (Distros) along with their usage?
We have so many Linux Distributors, among them, we discuss a few important ones.
- Linux Mint: It is stable and robust. Linux Mint uses mate desktop and cinnamon.
- Debian: It stands for robustness, stability, and a well-oiled release cycle. It is user-friendly. Debian version 8 will be replaced by version 9.
- Ubuntu: It is available for both desktop and server editions and is based on Debian.
- openSUSE: It is a good choice for new users and existing users.
- Manjaro: It gives a pleasant experience for new and experienced users.
In a Nutshell
Linux is a type of operating system that runs on any computer effectively. Linux is not just free, it’s also open-source, which means that it has no restrictions on how its code can be used or modified.
We all know that Linux is software that helps one use and understand computers better. This article talks about how to carry out an interview for a person who is knowledgeable in Linux. Linux has been known for its stability and speed. A Linux interview question may be a good idea to help you decide whether it is the right operating system for your needs.
These Linux interview questions and answers article will give you some insight into what to expect when interviewing for a Linux position. You’ll find out more about the software, the history of the operating system, and what kind of certifications you might be able to get if you decide to go down that path!