Top 15 Most Asked Linux Interview Questions With Answer
A list of top frequently asked Linux interview questions and answers are given below.
BASH is short for Bourne Again SHell. It was written by Steve Bourne as a replacement to the original Bourne Shell (represented by /bin/sh). It combines all the features from the original version of Bourne Shell, plus additional functions to make it easier and more convenient to use. It has since been adapted as the default shell for most systems running Linux.
3) What is Linux Kernel?
The Linux Kernel is a low-level systems software whose main role is to manage hardware resources for the user. It is also used to provide an interface for user-level interaction.
4) What is LILO?
LILO is a boot loader for Linux.
It is used mainly to load the Linux operating system into main memory so that
it can begin its operations.
5) What are the basic components of Linux?
The basic
components of Linux are:
Kernel: It is the core component of the Operating
System that manages operations and hardware.
Shell: Shell is a Linux interpreter which is used
to execute commands.
GUI: GUI stands for Graphical User Interface
which is another way for a user to interact with the system. But unlike CLI,
GUI consists of Images, Buttons, Text boxes for interaction.
System Utilities: These are the software functions that allows
the user to manage the computer.
Application Programs: Software programs or set of
functions designed to accomplish a specific task.
6) Which are the Shells used in Linux?
The most common Shells used in Linux are
bash: Bourne Again Shell is the default
for most of the Linux distributions
ksh: Korn Shell is a high-level
programming language shell
csh: C Shell follows C like syntax and
provides spelling correction and Job Control
zsh: Z Shell provides some unique
features such as filename generation, startup files, login/logout watching,
closing comments etc.
fish: Friendly Interactive Shell provides some
special features like web-based configuration, auto-suggestions, fully
scriptable with clean scripts
7)
What are daemons?
A daemon is a computer program that runs as a
background process to provide functions that might not be available in the base
Operating System. Daemons are usually used to run services in the background
without directly being in control of interactive users. The purpose of Daemons
are to handle periodic requests and then forward the requests to appropriate
programs for execution.
8) What are the process states in Linux?
The process states are as follows:
Ready: The process is created and is ready to run
Running: The process is being executed
Blocked or wait: Process is waiting for input from the user
Terminated or Completed: Process
completed execution, or was terminated by the Operating System
Zombie: Process terminated, but the
information still exists in the process table.
9) What command would you use to
check how much memory is being used by Linux?
You can use any of the following commands:
free -m
vmstat
tophtop
10) Explain
file permission in Linux.
There are 3 kinds of permission in Linux:
Read: Allows a user to open and read
the file
Write: Allows a user to open and modify
the fileExecute: Allows a user to run the file.
11) 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.
12) What is umask?
unmask stands for user file creation mode.
When the user creates any file, it has default file permissions. So, unmask
will specify few restrictions to the newly created file (it controls the file
permissions).
umask [-S] [mask]
13) How to lock a user account in Linux?
Locking user account is done for the security
purpose so that unauthorized users cannot log in. So, we have a few ways to
lock the user account. Some of them are below.
Lock or disable the password using passwd
command.
Expire the user account using usermod command
or chage command.
Changing the shell using nologin command (
/sbin/nologin ).
14) What is
ps command in Linux?
The ps command displays the current process status of the system. And
it displays the processes id’s with some other related data also.
Syntax: Ps [options]
Ex:
[root@rhe17~]# ps
PID TTY TIME CMD
12330 pts/0 00:00:00 bash
21621 pts/0 00:00:00 ps
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