linux interview questions answers

Linux Interview Questions and Answers

Linux is a techie’s favorite as it is the fastest and most powerful operating system in the world.

Linux is an open-source operating system that directly manages hardware resources of a system as memory, storage, CPU, and manages the communication between software and hardware effectively.

Linux was released by Linus Torvalds on 5th October 1991 for computers and it becomes popular as it is more secure and faster than Windows operating systems.

We have prepared Linux Interview Questions and Answers for the learners to have a clear idea about the technical rounds of top companies.

  1. What are the important features of Linux OS?

Linux has the following features for its users

  • Free and open-source
  • Robust and adaptable
  • More secure with authentication
  • Multiprogramming system
  • Application support
  • Customized keywords for languages
  • Graphical User Interface
  1. Explain the fundamental components of Linux

Linux has five basic components or elements as follows:

Kernel: It is a core part of Linux and it is generally responsible for all important activities of Operating Systems like process management, device management, etc.

System Library: They are special programs and functions that help on which application programs or system utilities to access kernel features without any coding requirement. It is used to implement the functionalities of the operating systems.

System Utility: They are utility programs responsible for performing individual and specialized tasks. They are more liable and enable users to manage the computer.

Hardware: It is physical elements that include a mouse, display, keyboard, CPU, etc.

Shell: It is a platform in which we can run our commands, programs, and shell scripts. It is an interface between user and kernel that hides all complications of functions of the kernel from the user and it is used to execute commands.

  1. Explain kernel and its functions

A kernel is the main component of Linux OS and it is a resource manager that serves as a bridge between software and hardware.

Its primary goal is to manage hardware resources for users and it is used to provide an interface for user-level interaction.

A kernel is the first program that is located whenever a computer system begins. It is known as low-level system software. Following are the functions of the kernel

  1. Define BASH

BASH stands for Bourne Again Shell which is a command language interpreter. Brain Fox for GNU OS has written BASH and it can be used in Bourne Shell.

It includes additional features like command-line editing to make it easier and more convenient to use.

It is the default user shell on Linux installations and it is an interpreted and non-compiled process that can also run in the terminal window. BASH is also capable of reading commands from shell scripts.

  1. What are the two modes available in Linux?

Linux has two types of modes as Command-line and Graphical User Interface (GUI).

  1. Define LILO

LILO is the acronym for Linux Loader which is a bootloader for Linux used to load Linux into memory and start the operating system.

It is also known as a boot manager to facilitate a dual boot of a computer and it can function as either a master boot program or secondary boot program and performs various functions such as locating kernel, loading memory, identifying supporting programs, and starting the kernel.

Linux OS required to be the installation of a special bootloader like LILO for it as it enables a fast boot of the Linux operating system.

  1. Define the Process States in Linux

Linux process can be in several various states and the process enters these states from starting to end. The various process states of Linux are as follows

  • New/Ready: A new process is created and ready to run in this state
  • Running: The processing will be executed in this state
  • Blocked / Wait: The process is waiting for input from the user in this state and if there are no resources to run such as file locks, memory, input, etc then it will remain in a waiting state or blocked state.
  • Terminated / Completed: The process has completed the execution or terminated by the OS in this state.
  • Zombie: The process will be terminated in this state but information regarding the process will be available in the process table.
  1. Define Swap Space

Swap space is a space on a hard disk used when the amount of physical memory or RAM becomes full.

It will be considered a substitute for physical memory and its main function is to substitute disk space for RAM when real RAM doesn’t have enough space to hold all programs that are running then more space will be required.

As a whole, Swap Space is used as an extension of RAM in Linux.

  1. Explain Shell and its types

Linux Shell is a user interface between user and kernel. It is used to execute commands and communication with Linux OS and Linux Shell is a program used by users for executing commands.

It accepts human-readable commands as input and translates them into kernel understandable language.

There are various types of Shells used on typical Linux systems such as CSH (C Shell), KSH (Korn Shell), BASH (Bourne Again Shell), TCSH, ZSH, and Bourne Shell.

  1. List various types of modes used in the VI editor

VI Editor stands for Visual Editor which is a default text editor that usually comes with most of the Linux OS. There are three types of modes used in the VI editor as given below

  • Command Mode/Regular Mode: It is the default mode for the VI editors and it is used to type commands that perform specific vi functions. To enter this mode from another mode (Insert Mode), one should press [esc]. It allows users to view the content.
  • Insertion Mode/Edit Mode: It allows users to do text editing or type text into a file. We must press [esc] to enter this mode from command mode or another mode. It allows users to delete or insert text or content.
  • Ex Mode/Replacement Mode: It is used to store the files and execute the commands and it executes files with various parameters. One should press [:] to enter this mode. It allows users to overwrite text or content.
  1. What is the maximum length for a filename in Linux?

The maximum length for a filename is 255 bytes in Linux OS.

  1. Define Virtual Desktop

Virtual Desktop is a feature in Linux that enables users to utilize the desktop beyond the physical limits of the screen.

It creates a virtual screen to expand the limitation of the normal screen. There are two different ways can be implemented Virtual Desktop

Switching Desktop: Users can create discrete virtual desktops to execute programs in switching desktops.

Here, every virtual desktop will act as an individual desktop and the programs running on each of these desktops is available only to the users who are using the specific desktop.

Oversized Desktop: It doesn’t offer a discrete virtual desktop but it enables the user to pan and scroll around the desktop that it was bigger than the physical screen.

  1. Explain Daemons

A daemon is a computer program that runs as a background process to offer functions that might not be available in the base Operating System.

Daemons are usually used to execute services in the background without directly being in control of interactive users.

The reason for daemons is to manage periodic requests and forward the requests to proper programs for execution.

  1. What are the various modes of vi editor?

There are three various modes of vi editor

  • Regular/Command Mode that allows users to view the content
  • Insertion/Edit Mode that allows users to delete or insert content
  • Replacement Mode that allows users to overwrite content
  1. Define permission in Linux

There are three kinds of permission in Linux such as read, write, and execute.

Read allows a user to open and read the file, write allows users to open and edit the file, and execute allows a user to execute the file.

The user can change the permission of a file or a directory using the chmodCommand.

Symbolic mode and absolute mode are using the chmod command.

Symbolic Mode:

The general syntax to change permission in Symbolic mode is as follows

$ chmod <target>(+/-/=) <permission><filename>

Where, <permission> can be r: read; w:write; x:execute.

<target> can be u:user; g:group; o:other; a:all

‘+’ is used to add permission, ‘-‘ is used to remove permission, and ‘=’ is used to set the permission


Setting permission for the user to read, write, and execute. Setting permission for the group to read and execute. Setting permission for others to only read.

$ chmod u = rwx, g = rx, o =r filename

Absolute Mode:

The absolute mode follows octal representation and following is the syntax for absolute mode

$ chmod <permission> filename

The leftmost digit is for the user, the middle digit is for the group, and the rightmost digit is for all

The following table explains the meaning of digits that are used along with their effects.

Absolute Mode
0No Permission
1Execute permission–x
2Write permission-w-
3Execute and write permission: 1 (execute) + 2 (write) = 3-wx
4Read permissionr–
5Read and execute permission: 4 (read) + 1 (execute) = 5r-x
6Read and write permission: 4(read) + 2 (write) = 6rw-
7All permissions: 4 (read) + 2 (write)+ 1 (execute) = 7rwx


Setting permission for a user with reading, write, and execute, group members to read and execute, and others to only read. Following is the command

$ chmod 754 filename

  1. Define inode and process id

The process id is the unique id given to each process while the inode is the unique name given by the operating system to each file.

  1. List the various Directory Commands of Linux

There are five major directory commands in Linux

  • pwd is the command used to display the path of the present working directory. Syntax: $ pwd
  • ls command is used to list all the files and directories in the present working directory. Syntax: $ls
  • cd is used to change the present working directory. Syntax: $ cd <path to new directory>
  • mkdir is used to create a new directory. Syntax: $mkdir<name (and path if required) of new directory>.
  • rmdir is used to delete a directory. Syntax: $ rmdir <name (and path if required) of new directory>.
  1. Define LVM

LVM stands for Logical Volume Management and is a tool to provide logical volume management for the Linux Kernel.

It is used to make physical storage device management easier and it consists of allocating disks, mirroring, striping, and resizing logical volumes.

The main advantages of LVM are flexibility, increased abstraction, and control. It allows for flexible disk management and it is required to resize the size of the file system online.

In Linux, the size of the LVM will be extended using the “lvextend” command and it can be reduced using “lvreduce” commands respectively.

  1. Explain the “/proc” file system

Proc file system is a virtual or pseudo-file system that offers an interface to the kernel data structure.

It includes useful information about processes that are running currently.

It will be used to change kernel parameters at runtime or during execution. It controls the information center for the kernel.

All files under this directory will be named virtual files.

  1. Differentiate cron and anacron

Cron is a program in Linux used to execute tasks at a scheduled time and it works effectively on machines that run continuously.

Anacron is also a program in Linux used to execute tasks at particular intervals and it works effectively on machines that are powered off during a day or week.

Differentiate cron and anacron
Cron is a DaemonAnacron is not a daemon
Scheduled by any normal userScheduled only by super users
Ideal for serversIdeal for desktops and laptops
Expect the system to run 24 * 7Don’t expect the system to run 24 * 7
Minimum granularity is in minutesMinimum granularity is only in days
Used to execute scheduled commandsUsed to execute commands periodically
  1. Explain load average

Load average is the average system load on Linux servers being calculated over a given period.

The load average of Linux servers will be found using “top” and “uptime” commands.

It is used to keep track of system resources and it is represented by a decimal number starting at 0.00. It tells the user the load that the system has been under currently.

  1. Define Network Bonding with its advantages

Network bonding is also known as NIC teaming used to connect multiple network interfaces into a single interface for improving the performance and redundancy by increasing network throughput and bandwidth. This NIC teaming has the following advantages

  • Load balancing
  • Failover
  • Increased uptime
  1. Name the network bonding modes of Linux

Following are the network bonding modes in Linux

  • Mode-0 (balance-RR) is the default mode based on the round-robin policy. It provides fault tolerance and load balancing.
  • Mode-1 (active-backup) is based on an active-backup policy. Only one node will respond or work at the time of failure of other nodes.
  • Mode-2 (balance-xor) sets an XOR (exclusive-or) for providing load balancing and fault tolerance.
  • Mode-3 (broadcast) is based on the broadcast policy that sets a broadcast mode for offering fault tolerance and is used for specific purposes.
  • Mode-4 (802.3ad) is based on IEEE 802.3ad standard and it is also known as Dynamic Link Aggregation mode. It sets an IEEE 802.3ad dynamic link aggregation mode to create aggregation groups for sharing the same speed and duplex settings.
  • Mode-5 (balance – TLB) is Adaptive TLB (Transmit Load Balancing) for setting TLB mode for fault tolerance and load balancing. Traffic will be loaded based on each slave of the network in this mode.
  • Mode-6 (balance – alb) is also known as Adaptive Load Balancing for setting ALB mode for fault tolerance and load balancing and it doesn’t require any special switch support.
  1. List the ports used for DNS, SMTP, FTP, SSH, DHCP, and Squid
  • DNS service is using port no.53
  • SMTP service is using port no.25
  • The FTP service is using port no.20 for data transfer and port no.21 for connection establishment
  • The SSH service is using port no.22
  • DHCP service is using port no.67/UDP for DHCP server and 68/UDP for DHCP client.
  • Squid service is using port no.3128
  1. Differentiate Soft and Hard Links

Hard Links are considered a mirror copy of the original file while soft links are considered a symbolic link to the original file.

Hard links share the same inode number and soft links share different inode numbers.

Hard links contain the original contents of the files and soft links will not contain the actual contents but they contain the location of the original file.

In hard links, any changes made to the original file will reflect in the other files directly but any changes or updates made to the soft link will reflect in the original files and hard links directly.

Hard links are not used for linking directories while soft links are used for linking directories. Hard links are faster but soft links are slower.

  1. What are the three standard streams in Linux?

Standard streams in Linux have based on I/O (Input and Output) communication channels between a program and its environment. Input and output in the Linux platform are distributed over three standard streams and they are as follows

  • Standard input (stdin)
  • Standard output (stdout)
  • Standard Error (stderr)
  1. Define the Ping Command

Ping in Linux stands for Packet Internet Groper is the command that is used for checking the connection status between source and destination.

This is used to check whether a network is available and if the host is reachable or not.

It is also used to troubleshoot various connectivity issues and verify connectivity at an IP level to a second TCP/IP device and name resolution.

We can use the Ping command to test both the computer name and IP address of the particular computer machine.

  1. Define Samba with its advantages

Samba is an open-source software suite and it runs several different operating systems such as OpenVMS, IBM, etc.

It is used to connect Linux machines to Microsoft network resources by providing Microsoft SMB support.

It offers more secure, fast, and stable file and print services for every client or user SMB (Server Message Block) or CIFS (Central Server Message Block).

  1. What is the usage of the env command?

The ‘env’ command is a shell command used to print a list of current environmental variables.

Here, the “env” command stands for the environment and it can also run another process in another environment without any modification of the current environment.

It enables us to run programs in a modified and it is used by shell scripts to launch the correct interpreter.

It is also useful for checking if wrong environment variables prevent the application from starting during troubleshooting.’




HOME =/root

DB_NAME = test

PATH = /usr/local/bin:/usr/local/sbin

LAND = C.UTF = 8


PWD = /

DB_URI = mongodb://database:27017/test

  1. Explain Pipe in Linux

A pipe is a form of redirection in Linux used to send the output of one command to another command for further processing.

It takes the output from one command and uses it as an input for another and it provides asynchronous execution of commands with a help of buffered I/O routines.


Linux is the popular operating system used by numerous top companies for fastening the development, testing, debugging, and deploying processes.

It is the top choice of global companies as it provides more security to the applications and services stored in their machines.

The above “Linux Interview Questions and Answers” are useful for the aspirants who wish to enter the Linux environment.

Learn the Best Linux Course in Chennai at Softlogic Systems to gain expertise on the concepts with complete hands-on exposure.

Leave a Comment