This section will help you refresh your Linux knowledge for the interview, but not just that.
Also, it helps to learn about Linux in various sections.
There is a magic word called Operating System (OS) that helps you use your laptop or desktop or server or mobile, without which nothing can work.
It manages all hardware resources and enables communication between hardware and software.
There are many operating systems like Linux, Unix, Windows and Mac, but Linux is better than others because of its efficiency and fast performance.
The proven example is that Linux runs on the world’s top 500 supercomputers.
- Suggested Read: Part-2: 25 Basic Linux Interview Questions & Answers
In this guide, you’ll learn the basic Linux interview questions and answers.
Q.1) What’s Linux?
Linux is a Unix-based open source multitasking and multiuser computer operating system. It was created by Linus Torvalds and released on September 17, 1991.
It supports different hardware manufactured by Intel, HP, IBM, Cisco, Dell, Lenovo and Supermicro.
Q.2) What’s UNIX?
UNIX is a multitasking and multiuser proprietary computer operating system developed by Bell Labs Research Center and released in November 1971. It was later converted into different commercial versions.
Q.3) What’s Kernel?
Kernel is heart of the operating system. It is the main component of the Linux operating system (OS), and is the core interface between the computer’s hardware and its processes.
It manages resources between the hardware and processes by controlling them.
Q.4) What’s Shell or Bash?
Shell is a command-line interpreter that provides the interface between the user and the operating system.
Bash refers to the Bourne Again shell, which is the default shell used in Linux, but you can use other shells if you needed.
Q.5) What’s BIOS
BIOS refers to a Basic Input/Output System, is a firmware (Power-On Self-Test (POST)) used to perform hardware initialization during the boot process.
This became a legacy boot because the BIOS did not evolve and improve over time. Also, it has more serious limitations.
Q.6) What’s UEFI Boot?
UEFI stands for Universal Extended Firmware Interface, which replaces traditional BIOS in systems due to lack of improvement and limitations on it.
It uses the GUID Partition Table (GPT) and maintains a list of valid boot volumes called EFI Service Partitions.
During the POST process, the UEFI firmware scans all bootable storage devices attached to the system to find an EFI service partition to boot.
Q.7) What’s MBR?
MBR stands for Master Boot Record, which contains 512 bytes and details are below. Normally, the MBR detects a bootable device and loads the GRUB/GRUB2 boot loader into memory.
This contains three portions:
- 1st 446 bytes: Primary boot loader information
- Next 64 bytes: Partition table information
- Last 2 bytes: It perform mbr validation check
Q.8) What’s Bootloader?
The bootloader loads the “vmlinuz” kernel image file into memory and extracts the contents of the initrd/initramfs image file into a temporary, memory-based file system (tmpfs).
- LILO: LILO stands for Linux Loader, is a boot loader for Linux and the default boot loader for most Linux distributions for years before GRUB was introduced.
- GRUB: GRUB stands for GRand Unified Bootloader, is a boot loader that allows users to choose different operating systems when you have more than one OS on your computer. Additionally, it allows you to select a different kernel to boot the system.
- GRUB2: GRUB2 stands for “GRand Unified Bootloader, Version 2”. GRUB1 is now considered legacy and has been replaced with GRUB2 in most modern distributions, mainly designed to provide flexibility and performance to today’s operating systems.
Q.9) What’s initrd?
initrd stands for Initial RAM Disk. This is an initial or temporary root file system that is loaded before the actual root file system is available.
For Initrd, a “ramdev” block device was created. This is a RAM based block device that uses memory instead of disks. It contains the image of a file system, so the driver must be compiled into the kernel to enable it.
Q.10) What’s initramfs?
initramfs stands for Initial RAM file system used on modern Linux operating systems. This is an initial or temporary root file system that is mounted before the actual root file system is available.
For initramfs, this is directly linked to “tmpfs”. tmpfs does not require a driver, it is always in the kernel, so no additional drivers and devices are needed.
Q.11) What is Runlevel in Linux?
A runlevel is one of the mode that a Unix-based operating system runs in.
The “/etc/inittab” file contains the default runlevel information for the SysVinit system, which is used to boot the Linux system into the specific runlevel.
Once the specified runlevel is identified, it starts all other processes and applications in the background according to the run level.
There are 7 different run levels in the Linux system for different purposes (run level 0-6). The details are given below.
|Run Level||Short Description|
|0, halt||Halt System (To shut down the system)|
|1, S, single||Single user mode|
|2||Basic multi user mode without NFS|
|3||Full Multi User with Network (text based)|
|4||Experimental (No User or Unused)|
|5||Multi user mode with Graphical User Interface|
|6, reboot||To Reboot a System|
Q.12) What are Target Units in Linux?
Systemd has a concept of targets, which serves a purpose like runlevels, but operates slightly differently. Each target is named instead of numbers and is intended to serve a specific purpose.
The “/etc/systemd/system/default.target” file contains the default target information for the systemd system, which is used to boot the system into the corresponding target.
Once the specified target is identified, it starts all other processes and applications in the background according to the target.
Below is the available target for Linux (there are seven targets from zero to six). The details are given below.
|Target Units||Short Description|
|runlevel0.target, poweroff.target, systemctl halt||Halt System (Shut down and power off)|
|runlevel1.target, rescue.target||Single User Mode|
|runlevel.target, multi-user.target||Full Multi User with Network (text based)|
|runlevel5.target, graphical.target||Multi user mode with Graphical User Interface|
|runlevel6.target, reboot.target, systemctl reboot||Shut down and reboot the system|
Q.13) What is Linux System Manager and How to Identify it?
System Manager is the first process started by the kernel during system boot.
It holds the process ID (PID) of 1. It will continue to run in the background until the system is shut down.
Below are three system administrators that are widely used in Linux.
- System V (Sys V): System V (Sys V) is one of the first and traditional init system for Unix like operating system.
- Upstart: Upstart is an event-based replacement for the /sbin/init daemon.
- systemd: systemd is a new init system and system manager that has been adapted by most Linux distributions instead traditional SysVinit systems.
You can easily identify the system manager by running ps command on your system.
# ps -p1 | grep "init\|upstart\|systemd" 1 ? 00:18:09 systemd
Q.14) What is a Command-line Interface (CLI) in Linux?
CLI stands for Command Line Interface. This is a text-based interface, called Linux Terminal, that allows the user to type in any Linux commands that need to be executed by the operating system.
CLI is very powerful and easy for NIX guys because most Linux server operating systems only runs with CLI.
Q.15) What is a Graphical User Interface (GUI) in Linux?
GUI refers to the graphical user interface. It’s like the Windows operating system, which comes with a graphical user interface where you can easily search and open any applications you need.
Linux operating systems offer a wide range of desktop environments (DE) such as GNOME, Cinnamon, KDE, XFCE, and Deepin.
Q.16) What’s Swap Space?
Swap space on Linux is used when the amount of physical memory (RAM) is filled. When the physical RAM is full, the inactive pages in the memory are moved to the swap space.
This enables the computer to run the application continuously, but is not considered a replacement for high RAM.
Swap space is located on hard drives, so it does not process a request like RAM.
You can identify the current swap space utility on Linux using the free command.
# free -m
Navigate to the following articles to create swap space on Linux.
Q.17) What is FileSystem in Linux?
FS is short for file system, which is used to organize files on the system. On the other hand, the file system controls how data is stored and retrieved from disk.
Each file system has two control modules, one containing the file system information and the other containing the inode information.
Inode (metadata) contains information about individual files and directories (file name, file types, permissions, owner name, group name, size, timestamps, elimination time, hard link and soft link, location, etc.)
The inode number is also called the index number, which contains the above parameters.
Linux supports multiple file system types such as ext, ext2, ext3, ext4, hpfs, iso9660, JFS, minix, msdos, ncpfs nfs, ntfs, proc, Reiserfs, smb, sysv, umsdos, vfat, XFS, xiafs,.
Q.18) What is the Linux File system Hierarchy Standard (FHS)
File System Hierarchy Standard (FHS) Defines the structure of file systems on the Linux operating system.
Everything in Linux is a file, you can modify it whenever needed, but make sure you are making the right changes.
If you make a mistake, this can lead to other problems as well, if you make changes to the configuration file, take a backup, and it allows you to replace it if something goes wrong.
The root directory “/” is the primary directory of the entire Linux file system hierarchy, containing all other directories and files. Make a note
/ and the
/root is different.
Q.19) What’s Single User Mode?
Single user mode, also referred to as maintenance mode, allows a super user to recover/repair the system from problems that cannot be resolved in a multi-user environment or system boots, but does not function properly or you cannot log in to it.
It uses runlevel 1 in the SysVinit system whereas runlevel1.target or rescue.target in systemd system.
It only enable few services and minimal functionality to repair the system. This method is most useful if you want to run fsck to fix corrupted file systems or reset a forgotten root password or change the “/etc/fstab” file.
Q.20) What is a Process in Linux?
A process is a running instance of a program. The init or systemd is always the first process in the system and the ancestor of all other processes.
Q.21) What is a Process ID (PID) in Linux?
PID refers to a process ID, commonly used by most operating system kernel, such as Linux, Unix, MacOS, and Windows.
This is a unique ID that is automatically assigned to each process when it is created.
The default maximum value of PIDs is 32,768 on 32-bit systems, but can be set to any value up to 2^22 (approximately 4 million) on 64-bit systems.
Q.22) What is Parent Process (PPID) in Linux?
A parent process is a process that has created one or more child processes. Each child process is given a Parent Process ID (PPID), and the parent process kills the child when it completes the process.
Q.23) What is an Inode in Linux?
Inode is an index node or index number, is a data structure on a Linux file system that stores information about a file and directory.
File systems typically have two parts: metadata and real data.
Each file contains an inode that contains metadata about the file. Each file in the file system has a unique inode number. It is guaranteed that inode numbers are unique to a file system only.
Inode stores the following information about a file.
- Size of the file
- Device ID
- User ID (UID)
- Group ID (GID)
- Information about permissions (read, write, execute, etc)
- File access privileges (owner, group and others)
- Time stamps information such as file access, file modification, file deletion and inode number change.
- Information about soft links and hard links
- Location of the file on the file system
Q.24) Purpose of /tmp Partition
The “/tmp” directory is a directory used to hold temporary files (or session files) when the application is running.
This is particularly useful in many user environments, where unprivileged users will have access to read/write data to /tmp.
It is linked to a special file system called tmpfs. This is a virtual file system and the operating system automatically loads the /tmp mount point when the system boots.
Temporary files are automatically deleted by the application when they are finished.
The /tmp directory is cleaned by default during system startup or reboot.
If you want to clean up the contents of the /tmp directory on Linux, go to the following articles.
Q.25) What is a Daemon in Linux?
The daemon is a program on a Unix-like operating system that runs in the background and has no interaction with the user.
For example, the daemon that handles the Apache web server functionality is httpd.