Linux Interview Question with Answers

Linux Interview Question with Answers

Question: What is Linux?

Linux is the best-known and most-used open source operating system. As an operating
system, Linux is a software that sits underneath all of the other software on a computer,
receiving requests from those programs and relaying these requests to the computer’s

In many ways, Linux is similar to other operating systems such as Windows, OS X, or iOS
But Linux also is different from other operating systems in many important ways.
First, and perhaps most importantly, Linux is open source software. The code used to
create Linux is free and available to the public to view, edit, and—for users with the
appropriate skills—to contribute to.

Linux operating system is consist of 3 components which are as below:

Kernel: Linux is a monolithic kernel that is free and open source software that is
responsible for managing hardware resources for the users.

System Library: System Library plays a vital role because application programs
access Kernels feature using system library.

System Utility: System Utility performs specific and individual level tasks.

Question: What Is Difference Between Linux & Unix?

Unix and Linux are similar in many ways, and in fact, Linux was originally created to be
similar to Unix.

Both have similar tools for interfacing with the systems, programming tools, filesystem
layouts, and other key components.

However, Unix is not free. Over the years, a number of different operating systems have
been created that attempted to be “unix-like” or “unix-compatible,” but Linux has been the
most successful, far surpassing its predecessors in popularity.

Please Click on Download button to download this questions for your easy reference.

Question: What Is BASH?

BASH stands for Bourne Again Shell. BASH is the UNIX shell for the GNU operating
system. So, BASH is the command language interpreter that helps you to enter your input,
and thus you can retrieve information.
In a straightforward language, BASH is a program that will understand the data entered by
the user and execute the command and gives output.

Question: What Is CronTab?

The crontab (short for "cron table") is a list of commands that are scheduled to run at
regular time intervals on computer system. The crontab command opens the crontab for
editing, and lets you add, remove, or modify scheduled tasks.

The daemon which reads the crontab and executes the commands at the right time is
called cron. It's named after Kronos, the Greek god of time.
Command syntax
crontab [-u user] file
crontab [-u user] [-l | -r | -e] [-i] [-s]

Question: What Is Daemon In Linux?

A daemon is a type of program on Linux operating systems that runs unobtrusively in the
background, rather than under the direct control of a user, waiting to be activated by the
occurrence of a specific event or condition.

Unix-like systems typically run numerous daemons, mainly to accommodate requests for
services from other computers on a network, but also to respond to other programs and to
hardware activity.

Examples of actions or conditions that can trigger daemons into activity are a specific time
or date, passage of a specified time interval, a file landing in a particular directory, receipt of
an e-mail or a Web request made through a particular communication line.

It is not necessary that the perpetrator of the action or condition be aware that a daemon
is listening, although programs frequently will perform an action only because they are
aware that they will implicitly arouse a daemon.

Question: What Is Process In Linux?

Daemons are usually instantiated as processes. A process is an executing (i.e., running)
instance of a program.

Processes are managed by the kernel (i.e., the core of the operating system), which
assigns each a unique process identification number (PID).

There are three basic types of processes in Linux:

-Interactive: Interactive processes are run interactively by a user at the command line.

-Batch: Batch processes are submitted from a queue of processes and are not associated
with the command line; they are well suited for performing recurring tasks when system
usage is otherwise low.

-Daemon: Daemons are recognized by the system as any processes whose parent
process has a PID of one.

Please Click on Download button to download this questions for your easy reference.

Question: What Is CLI In Linux?

CLI (Command Line Interface) is a type of human-computer interface that relies solely on
textual input and output.

That is, the entire display screen, or the currently active portion of it, shows
only characters (and no images), and input is usually performed entirely with a keyboard.

Questions: What Is Linux Kernel?

A kernel is the lowest level of easily replaceable software that interfaces with the hardware
in your computer.

It is responsible for interfacing all of your applications that are running in “user mode” down
to the physical hardware, and allowing processes, known as servers, to get information
from each other using inter-process communication (IPC).

There are three types of Kernals

Microkernel: A microkernel takes the approach of only managing what it has to: CPU,
memory, and IPC. Pretty much everything else in a computer can be seen as an accessory
and can be handled in user mode.

Monolithic Kernel: Monolithic kernels are the opposite of microkernels because they
encompass not only the CPU, memory, and IPC, but they also include things like device
drivers, file system management, and system server calls.

Hybrid Kernel: Hybrid kernels have the ability to pick and choose what they want to run in
user mode and what they want to run in supervisor mode. Because the Linux kernel is
monolithic, it has the largest footprint and the most complexity over the other types of
kernels. This was a design feature which was under quite a bit of debate in the early days
of Linux and still carries some of the same design flaws that monolithic kernels are inherent
to have.

Question: What Is Partial Backup In Linux?

Partial backup refers to selecting only a portion of file hierarchy or a single partition to back

Question: What Is Root Account?

The root account a system administrator account. It provides you full access and control of
the system.

Admin can create and maintain user accounts, assign different permission for each account.

Question: What Is Difference Between Cron and Anacron?

One of the main differences between cron and anacron jobs is that cron works on the
system that are running continuously.

While anacron is used for the systems that are not running continuously.

1. Other difference between the two is cron jobs can run every minute, but anacron jobs
can be run only once a day.

2. Any normal user can do the scheduling of cron jobs, but the scheduling of anacron
jobs can be done by the superuser only.

3. Cron should be used when you need to execute the job at a specific time as per the
given time in cron, but anacron should be used in when there is no any restriction for
the timing and can be executed at any time.

4. If we think about which one is ideal for servers or desktops, then cron should be used
for servers while anacron should be used for desktops or laptops.

Please Click on Download button to download this questions for your easy reference.

Question: What Is Linux Loader?

Linux Loader is a boot loader for Linux operating system. It loads Linux into into the main
memory so that it can begin its operations.

Question: What Is Swap Space?

Swap space is the amount of physical memory that is allocated for use by Linux to hold
some concurrent running programs temporarily.

This condition usually occurs when Ram does not have enough memory to support all
concurrent running programs.

This memory management involves the swapping of memory to and from physical storage.

Question: What Are Linux Distributors?

There are around six hundred Linux distributors. Let us see some of the important ones

UBuntu: It is a well known Linux Distribution with a lot of pre-installed apps and easy
to use repositories libraries. It is very easy to use and works like MAC operating

Linux Mint: It uses cinnamon and mate desktop. It works on windows and should be
used by newcomers.

Debian: It is the most stable, quicker and user-friendly Linux Distributors.

Fedora: It is less stable but provides the latest version of the software. It has
GNOME3 desktop environment by default.

Red Hat Enterprise: It is to be used commercially and to be well tested before
release. It usually provides the stable platform for a long time.

Arch Linux: Every package is to be installed by you and is not suitable for the

Question: Why Do Developers Use MD5?

MD5 is an encryption method so it is used to encrypt the passwords before saving.

Question: What Are File Permissions In Linux?

There are 3 types of permissions in Linux

Read: User can read the file and list the directory.

Write: User can write new files in the directory.

Execute: User can access and run the file in a directory.

Question: Memory Management In Linux?

It is always required to keep a check on the memory usage in order to find out whether the
user is able to access the server or the resources are adequate. There are roughly 5
methods that determine the total memory used by the Linux.

This is explained as below

Free command: This is the most simple and easy to use the command to check
memory usage. For example: ‘$ free –m’, the option ‘m’ displays all the data in MBs.
/proc/meminfo: The next way to determine the memory usage is to read
/proc/meminfo file. For example: ‘$ cat /proc/meminfo’

Vmstat: This command basically lays out the memory usage statistics. For example:
‘$ vmstat –s’.

Top command: This command determines the total memory usage as well as also
monitors the RAM usage.

Htop: This command also displays the memory usage along with other details.

Please Click on Download button to download this questions for your easy reference.

Question: Granting Permissions In Linux?

System administrator or the owner of the file can grant permissions using the ‘chmod’ command.

Following symbols are used while writing permissions
chmod +x

Question: What Are Directory Commands In Linux?

Here are few important directory commands in Linux

pwd: It is a built-in command which stands for ‘print working directory’. It displays
the current working location, working path starting with / and directory of the user.
Basically, it displays the full path to the directory you are currently in.

Is: This command list out all the files in the directed folder.

cd: This stands for ‘change directory’. This command is used to change to the
directory you want to work from the present directory. We just need to type cd
followed by the directory name to access that particular directory.

mkdir: This command is used to create an entirely new directory.

rmdir: This command is used to remove a directory from the system.

Question: What Is Shell Script In Linux?

In the simplest terms, a shell script is a file containing a series of commands.

The shell reads this file and carries out the commands as though they have been entered
directly on the command line.

The shell is somewhat unique, in that it is both a powerful command line interface to the
system and a scripting language interpreter.

As we will see, most of the things that can be done on the command line can be done in
scripts, and most of the things that can be done in scripts can be done on the command

We have covered many shell features, but we have focused on those features most often
used directly on the command line.

The shell also provides a set of features usually (but not always) used when writing

Question: Which Tools Are Used for Reporting Statistics In Linux?

Some of the popular and frequently used system resource generating tools available on the
Linux platform are :

·   vmstat
·  netstat
·  iostat
·  ifstat
·  mpstat.

These are used for reporting statistics from different system components such as virtual
memory, network connections and interfaces, CPU, input/output devices and more.

Question: What Is Dstat In Linux?

dstat is a powerful, flexible and versatile tool for generating Linux system resource
statistics, that is a replacement for all the tools mentioned in above question.

It comes with extra features, counters and it is highly extensible, users with Python
knowledge can build their own plugins.

Features of dstat:

1. Joins information from vmstat, netstat, iostat, ifstat and mpstat tools
2. Displays statistics simultaneously
3. Orders counters and highly-extensible
4. Supports summarizing of grouped block/network devices
5. Displays interrupts per device
6. Works on accurate timeframes, no timeshifts when a system is stressed
7. Supports colored output, it indicates different units in different colors
8. Shows exact units and limits conversion mistakes as much as possible
9. Supports exporting of CSV output to Gnumeric and Excel documents

Question: what are different Types Of Processes In Linux?

There are fundamentally two types of processes in Linux:

Foreground processes (also referred to as interactive processes) – these are
initialized and controlled through a terminal session. In other words, there has to be a
user connected to the system to start such processes; they haven’t started
automatically as part of the system functions/services.

Background processes (also referred to as non-interactive/automatic processes) –
are processes not connected to a terminal; they don’t expect any user input.

Please Click on Download button to download this questions for your easy reference.

Question: How to Create Processes In Linux?

A new process is normally created when an existing process makes an exact copy of itself
in memory. The child process will have the same environment as its parent, but only the process ID number is different.

There are two conventional ways used for creating a new process in Linux:

Using The System() Function – this method is relatively simple, however, it’s
inefficient and has significantly certain security risks.

Using fork() and exec() Function – this technique is a little advanced but offers
greater flexibility, speed, together with security.

Question: Creation Of Processes In Linux?

Because Linux is a multi-user system, meaning different users can be running various
programs on the system, each running instance of a program must be identified uniquely
by the kernel.

And a program is identified by its process ID (PID) as well as it’s parent processes ID
(PPID), therefore processes can further be categorized into:

Parent processes – these are processes that create other processes during runtime.
Child processes – these processes are created by other processes during run-time.

Question: What Is Init Process Linux?

lnit process is the mother (parent) of all processes on the system, it’s the first program that
is executed when the Linux system boots up; it manages all other processes on the
system. It is started by the kernel itself, so in principle it does not have a parent process.
The init process always has process ID of 1. It functions as an adoptive parent for all
orphaned processes.

You can use the pidof command to find the ID of a process:
# pidof systemd
# pidof top
# pidof httpd

Find Linux Process ID
To find the process ID and parent process ID of the current shell, run:
$ echo $$
$ echo $PPID

Question: What Are Different States Of A Processes In Linux?

During execution, a process changes from one state to another depending on its
environment/circumstances. In Linux, a process has the following possible states:

Running – here it’s either running (it is the current process in the system) or it’s
ready to run (it’s waiting to be assigned to one of the CPUs).

Waiting – in this state, a process is waiting for an event to occur or for a system
resource. Additionally, the kernel also differentiates between two types of waiting
processes; interruptible waiting processes – can be interrupted by signals and
uninterruptible waiting processes – are waiting directly on hardware conditions and
cannot be interrupted by any event/signal.

Stopped – in this state, a process has been stopped, usually by receiving a signal.
For instance, a process that is being debugged.

Zombie – here, a process is dead, it has been halted but it’s still has an entry in the
process table.

Question: How To View Active Processes In Linux?

There are several Linux tools for viewing/listing running processes on the system, the two
traditional and well known are ps and top commands:

1. ps Command
It displays information about a selection of the active processes on the system as shown
#ps -e ] head

2. top – System Monitoring Tool
top is a powerful tool that offers you a dynamic real-time view of a running system as shown
in the screenshot below:

3. glances – System Monitoring Tool
glances is a relatively new system monitoring tool with advanced features:

Question: How To Control Process?

Linux also has some commands for controlling processes such as kill, pkill, pgrep and
killall, below are a few basic examples of how to use them:
$ pgrep -u tecmint top
$ kill 2308
$ pgrep -u tecmint top
$ pgrep -u tecmint glances
$ pkill glances
$ pgrep -u tecmint glances

Question: Can We Send signals To Processes In Linux?

The fundamental way of controlling processes in Linux is by sending signals to them. There
are multiple signals that you can send to a process, to view all the signals run:

$ kill -l
List All Linux Signals

To send a signal to a process, use the kill, pkill or pgrep commands we mentioned earlier
on. But programs can only respond to signals if they are programmed to recognize those

And most signals are for internal use by the system, or for programmers when they write
code. The following are signals which are useful to a system user:

SIGHUP 1 – sent to a process when its controlling terminal is closed.

SIGINT 2 – sent to a process by its controlling terminal when a user interrupts the
process by pressing [Ctrl+C] .

SIGQUIT 3 – sent to a process if the user sends a quit signal [Ctrl+D] .
SIGKILL 9 – this signal immediately terminates (kills) a process and the process will

not perform any clean-up operations.

SIGTERM 15 – this a program termination signal (kill will send this by default).

SIGTSTP 20 – sent to a process by its controlling terminal to request it to stop
(terminal stop); initiated by the user pressing [Ctrl+Z] .

Question: How To Change Priority Of A Processes In Linux?

On the Linux system, all active processes have a priority and certain nice value. Processes
with higher priority will normally get more CPU time than lower priority processes.
However, a system user with root privileges can influence this with the nice and renice commands.

From the output of the top command, the NI shows the process nice value:
$ top
List Linux Running Processes
Use the nice command to set a nice value for a process. Keep in mind that normal users
can attribute a nice value from zero to 20 to processes they own. Only the root user can
use negative nice values.

To renice the priority of a process, use the renice command as follows:
$ renice +8 2687
$ renice +8 2103

Please Click on Download button to download this questions for your easy reference.



My Name is Ankur Jain and I am currently working as Automation Test Architect.I am ISTQB Certified Test Manager,Certified UI Path RPA Developer as well as Certified Scrum Master with total 12 years of working experience with lot of big banking clients around the globe.I love to Design Automation Testing Frameworks with Selenium,Appium,Protractor,Cucumber,Rest-Assured, Katalon Studio and currently exploring lot in Dev-OPS as well. I am currently staying in Mumbai, Maharashtra. Please Connect with me through Contact Us page of this website.

Previous Post
Next Post