Table of Contents
Want to ace your Linux Interview?
Linux is a Unix-based operating system (OS) first released on 5 October 1991 by Linus Torvalds. It is considered more secure and faster than the windows. Its efficiency and high-speed performance make it the most used OS in the market. Linux’s average salary ranges from $107,805 to $179,000 making it one of the lucrative job options. So, if you are looking for a career in Linux or want to hone your existing skills, then you are at the right place to prepare for the interview with these Top 50 Linux Interview Questions. Also, check out the Operating system power user course offered online which is ideal for those wanting to build a successful career in this field
Top 50 Linux Interview Questions and Answers in 2022
Here we have compiled the 50 most common and important Linux Interview Questions and Answers which will be of immense help to excel in your interview.
These Linux Interview Questions are varied and cover a wide area from basic to advanced Linux concepts and therefore will be helpful to beginners as well as Linux professionals preparing for the interview. The Linux Interview Questions mentioned here cover all possible categories that fall in Linux like basic, admin, command, and technical.
Let us start with Linux Interview Questions for the beginner
1. What is Linux?
It is an open-source operating system based on Linux Kernel, which can run on different hardware platforms. It is designed to provide users with a free and low-cost operating system with a user-friendly environment.
2. State the difference between Linux and Unix?
While many people assume that Unix and Linux are synonyms, Linux is only a clone of Unix. Though they share some common features, there are also some key differences between them. Some major differences are
Linux |
Unix |
It is an operating system mainly used in computer hardware & software, game development, and more. |
It is an operating system mainly used in Intel, HP, internet servers, and more. |
Both paid and free distributors are available |
Different levels of Unix have different paid structure |
Linux OS is portable and can be used on different hard drives |
Unix OS is not portable |
Linux primarily uses GUI with an optional command-line interface |
Unix uses the command-line interface |
Linux is developed by a worldwide Linux community |
Unix is developed by AT&T developers |
Linux is used in phones, home-based PCs, developers, etc. |
Unix is used in mainframes, server systems, and workstations |
Linux offers two GUIs: KDE and Gnome. |
Here, the common desktop environment serves as a GUI. |
Linux has around 60-100 viruses listed till now |
Unix has around 85-120 viruses listed until now |
The file support system includes Ext2, Ext3, Ext4, Jfs, ReiserFS, Xfs, Btrfs, FAT, and NTFS. |
The file support system includes jfs, gpfs, hfs, ufs, and vxfs. |
Examples are Red Hat, Fedora, Kali Linux, Debian, Android, and Ubuntu. |
Examples: Solaris, OS X, All Linux. |
3. What are the basic components of Linux?
This is one of the most important, popularly asked Linux interview questions. The basic components of the Linux operating system are
Kernel– It is the core part of Linux and manages operations and hardware. It is a free and open-source software consisting of various modules and acts as an interface between software and hardware. The different types of kernels are
- Monolithic kernels
- Exo kernels
- Hybrid kernels
- Micro kernels
Shell- it is a Linux Interpreter and is used to execute commands
GUI- It stands for Graphic User Interface. This is another way for the user to interact with the system. But unlike CLI, GUI consists of Images, Buttons, and Text Boxes for interaction.
System Utilities- these are the software functions through which the user manages the computer
Application Programs-set of functions that are designed to do a set of tasks.
4. What is Linux Kernel?
It acts as a bridge between software and hardware and is considered to be the heart of the operating system. When Software requests the hardware, the kernel delivers the data between software and hardware.
It manages resources by providing an interface for user interaction. Most Android phones use Linux kernels.
5. Is it legal to edit Linux Kernel?
It is legal to edit Linux Kernel as it is released under the General Public License (General Public License). It can be modified and edited by the end users.
6. How many types of Shells are used in Linux?
There are 5 Shells used in Linux
C Shell (csh)– follows C like syntax and provides spelling correction and Job Control
Z Shell (Zsh)– it observes login/logout watching, startup files, closing comments, and file name generating
Korn Shell (ksh)– a high-level programming language shell
Bourne Again Shell (bash)– it defaults to most Linux distributions.
Friendly Interactive Shell (Fish)– provides special features like web-based configuration, fully scriptable with clean scripts, auto-suggestions, etc.
7. What is LILO?
LILO means Linux Loader, which is a boot loader that loads Linux Operating System into the main memory to begin execution. Most of the computers have boot loaders for certain versions of Windows or Mac OS and LILO is one such special boot loader you need to install if you want to use Linux OS. Moreover, it also allows fast booting of Linux OS.
It can function as either a master boot program or secondary boot program and executes various functions such as locating the kernel, loading memory, identifying other supporting programs, and starting the kernel.
8. What is BASH?
Bash is a Unix shell and command processor that was written by Brian Fox for the GNU project. It is an interpreted and not compiled process that can be run in the terminal window.
Bash is free software that allows users to write commands and cause actions. Moreover, it is also capable of reading commands from shell scripts.
9. What does Swap Space mean?
It is the additional space used by Linux while running concurrent programs when the RAM has no space to hold the programs. When the program runs, it resides in RAM, so the processor can fetch the data instantly. However, when you run more programs than the RAM can hold, then these are stored in the Swap Space and the processors can look for the data here.
It can be said that Swap Space is used as an extension of RAM by Linux.
10. What is CLI?
CLI stands for Command language Interpreter. It interacts with the computer program, wherein the user issues commands in the form of text lines. It also Interacts with the computer terminals where the interface accepts the text lines and converts them into a command to the operating system.
11. What is GUI?
GUI stands for Graphical User Interface. It utilizes the images and the icons which are clicked by the users to communicate with the system. It is a mixture of graphical and textual interaction that uses buttons, menus, message boxes, etc which makes it attractive and user-friendly.
12. What are the advantages and disadvantages of Open source?
Advantages |
Disadvantages |
· Completely open to the users making them download the file and change the code as and when they wish · Wide range of options for users with increased security |
· Difficulty to use · Liabilities and warranties · Compatibility issues · Hidden costs |
13. How will you open a command prompt when issuing a command?
You can launch your terminal by pressing CTRL+ALT+T or by giving terminal in the menu search bar.
14. What is the difference between BASH and DOS?
There are three major differences between BASH and DOS
BASH |
DOS |
The commands here are case-sensitive |
The commands here are not case-sensitive |
Here”(backslash) is used as an escape character and ‘/’ (forward slash) as a directory separator.
|
Here” (backslash) is used as a directory separator and ‘/’ (forward slash) as a command argument delimiter. |
It follows a naming convention- 8 characters for file name postfixed with 3 characters for the extension. |
It has no naming convention. |
15. What are inode and process id?
While inode is the unique name given by the operating system to each file, the process id is the unique id given to each process.
16. What are the Linux Directory Commands?
Linux has 5 main Directory Commands
pwd: shows the path of the current working directory.
Syntax: $ pwd
ls: it Lists all the files and directories in the present working directory.
Syntax: $ ls
cd: Used to change the present working directory.
Syntax: $ cd <path to new directory>
mkdir: Creates a new directory
Syntax: $ mkdir <name (and path if required) of new directory>
rmdir: Deletes a directory
Syntax: $ rmdir <name (and path if required) of directory>
17. What are the different types of modes used in vi editor?
vi editor (Visual Editor) is a default text editor that usually comes with most of the Linux OS. There are 3 basic types of modes used in vi editor which are as follows
Command Mode/Regular Mode- it is a default mode for the vi editors, which is used to type commands that usually perform particular or specific vi functions. Press [esc] to enter this mode from another mode (Insert mode) i.e., it lets you view the content.
Insertion Mode/Edit Mode– allows you to do text editing, or type text into a file. Press [esc] to enter this mode from another mode (command mode) i.e., it lets you delete or insert text or content.
Ex Mode/Replacement Mode- it generally executes files with different parameters. Press [:] to enter this mode i.e., it lets you overwrite content or text.
18. What is the method to exit from vi editors?
These are the commands used to exit from vi editors.
:wq – helps save the current work and exits the VI.
:q!- it exists from VI without saving current work.
19. What is the method used to delete information from a file in vi?
The commands that are used to delete information from a file in vi editors.
Command x deletes the current character.
While the Command dd deletes the current line.
20. What do you mean by daemons?
It is a computer program that runs backhand to provide functions that are in the base Operating System. Their main purpose is to handle periodic requests and then forward the requests to appropriate programs for execution.
21. Which are the process states in Linux?
The process states in Linux are:
Ready-where the process is created and is ready to run
Running-where the process is executed
Blocked/wait– where the process is waiting for input from the user
Terminated/Completed– where the process is completed execution or was terminated by the Operating System
Zombie: where the process gets terminated, but the information still exists in the process table.
22. What is the typical size for swap partitions under the Linux system?
The typical size for a swap partition under a Linux system must be twice the amount of physical memory or RAM available on the system.
Here are some of the Admin-based Linux Interview Questions
23. What is LVM and why is it necessary?
LVM (Logical Volume Management) is essentially a tool that provides logical volume management for the Linux kernel by making physical storage device management easier. It includes allocating disks, striping, mirroring, and resizing logical volumes and has advantages of increased abstraction, flexibility, and control.
It allows for flexible disk space management and is required to resize the size of the file system online. In Linux, the size of the LVM partition can be extended using the “lvextend” command and can be reduced using “lvreduce” commands, respectively.
24. What is meant by Latch?
It is a temporary storage device that is controlled by the timing signal and can store either 0 or 1. It comprises two stable states (high-output or 1, and low-output or 0) and is mainly utilized to store state information. A Latch can store one bit of data but it has to be powered on.
25. Mention the difference between Cron and Anacron
The differences between Cron and Anacron are
Cron |
Anacron |
It is used to execute tasks at a scheduled time |
It is used to execute tasks at certain intervals |
Works effectively on machines that run continuously. |
Works effectively on machines that are powered off for a day or week. |
Is a daemon |
Not a daemon |
Good for servers |
Good for desktops and laptops |
Used by anybody |
Used by super users |
Minimum granularity is in minutes |
Minimum granularity is only in days |
Executes scheduled commands. |
Execute commands periodically. |
26. What is the first process that is started by the kernel in Linux and what is its process id?
“init” is the first process started by the kernel in Linux and its process id is 1.
27. What is meant by INODE and Process Id?
INODE is a unique name given to each file by OS. Each inode has a unique inode number and it stores various information about files in Linux such as ownership, file size, file type, number of links, access mode, etc
Process Id (Identifier) is a unique Id given to each process and is used to uniquely identify an active process throughout the system until the process ends.
28. What are the three standard streams in Linux?
The Standard streams are mainly I/O (Input and Output) communication channels between a program and its environment. These are distributed across three standard streams and they are
Standard Input (stdin),
Standard Output (stdout), and
The Standard Error (stderr).
29. What is a Stateless Linux Server? What are its features?
It is a centralized server with no existing states on the working station. Its features are it stores prototypes, snapshots, and home directories
It uses LDAP, which has the information about which snapshot should run on which system
30. What is meant by Virtual desktop?
It is used as an alternative to minimize and maximize different windows on the current desktop. It helps you to open one or more programs on a clean slate rather instead of restoring all the programs needed.
Now, let’s look at some command-based Linux Interview Questions
31. What is the netstat command?
It is basically a networking tool being used for troubleshooting and configuration and to help display all network connections on a system. It checks whether various aspects of TCP/IP are working and what connections are present.
32. What command is used to check the default run level?
“/etc/inittab” is the command used to check the default run level
33. How to find where a file is stored in Linux?
The “locate” command is used to find the path to the file in Linux. For example, if you want to find the locations of a file name sample.txt, then the command to use would be:
$ locate sample.txt
34. What command is used in Linux to count the number of characters in a file?
“wc” is the command used that is used to count the number of characters in a file in Linux. Here “wc” stands for word count and is used to count the number of lines, words, and characters in a text file.
35. How to create a new user without logging on as a root user?
“su “command is used to create a new user without logging on as a root user
36. What file is used to automatically mount file systems?
In Linux, Fstab file is used to automatically mount file systems
37. Which command is used to delete a group in Linux?
The groupdel command deletes a group in Linux
38. How can Linux computers be turned into a router so that several machines may share a single Internet connection?
Yes by IP masquerading, we can turn a Linux computer into a router.
39. Why is pwd command used in Linux?
The pwd also called the print working directory command is one of the most used commands in Linux. It is used to write the full pathname of the current working directory starting from the root.
40. What is the command used in Linux to check the memory status?
The command mainly used to check memory status in Linux is “free”. Other commands used are:
“cat” command: used to display Linux memory information.
“vmstat” command: used to report statistics of virtual memory.
“top” command: used to check the memory usage
“htop” command: used to find the memory load of each process.
41. What is the command used to review boot messages?
“dmesg” is the command used to review boot messages
42. What does iptables command do in Linux?
Just like the network firewall, iptables command blocks or allows traffic on a Linux host. This command may prevent certain applications from receiving or transmitting requests.
43. What is the function of pushd command in Linux?
It puts the current dir on the stack so you can pop back to it.
Here are some network-based Linux Interview Questions
44. What is meant by Network bonding?
Network Bonding which is also known as NIC Teaming is a type of bonding that connects multiple network interfaces into a single interface. It improves performance and redundancy by increasing network throughput and bandwidth.
45. State the advantages of using NIC teaming?
The advantages of NIC teaming are
- Load balancing
- Failover
- Increased uptime
46. What is SSH? How to connect to a remote server via SSH?
SSH (Secure Shell) is a protocol that is used to securely connect to remote servers or systems and enables two systems to communicate. It transmits data over encrypted channels and is considered the most common way to have access to remote Linux servers. You need to own a domain name and IP address in order to connect to a remote server via SSH
47. What are the default ports used for DNS, SMTP, FTP, SSH, DHCP, and squid?
Default ports used for various services are
Service Port
DNS 53
FTP 20 (Data transfer), 21 (Connection established)
SSH 22
SMTP 25
DHCP 67/UDP (dhcp server), 68/UDP (dhcp client)
Squid 3128
48. State the difference between soft and hard mounting points.
In the soft mount, when the client fails to connect to the server, it shows an error report and closes the connection, while in the hard mount, on the client’s failure to access the server, the connection hangs and the server is accessed again when the system is up
49. What is samba? What is its use?
Samba is an open-source software suite that runs a number of different Operating systems such as OpenVMS, IBM, etc. It helps connect Linux machines to Microsoft network resources by providing Microsoft SMB support. Moreover, it also provides more secure, stable, fast file and print services for every client or user using SMB (Server Message Block) or CIFS (Central Server Message Block) protocol
50. What are the advantages of Linux
This is one of the most frequently asked Linux Interview Questions. A few important reasons why Linux is used are
Highly stable-runs fast is stable and does not lead to crashes
Security- is a dependable server that offers high security to the user. Using Linux on the system makes it easy to avoid viruses and malware
Easy to use– it is easy to operate and since all the variants of Linux have their own software repositories, it is easy to install into the system and can set automatic updation
Hardware Compatibility- it does not have any hardware restrictions and can be used on any hardware
Open source- can easily get the source code since it is under Free and Open Source Software(FOSS).
About Henry Harvin
Above we have provided you with the best possible Linux Interview questions to help you with your interview process. However, if you are planning to join online courses to learn more about Linux operating system, join the Operating system power user course offered by Henry Harvin, the renowned education institute
Why choose the Henry Harvin Operating System Power User course?
You can choose Henry Harvin and become a part of the Elite IT Service Management Academy of Henry Harvin and join the 3,00,000+ large Alumni Network Worldwide. Through this course, you will understand basic operating system abstractions, mechanisms, and their implementation. You will gain knowledge on how directories and files work in Windows and Linux OS, disk partitioning and virtual memory, explore process management, etc. Apart from this, you will also acquire skills like Powershell, Linux, Linux file systems & Command-Line Interface.
Additional benefits
In Henry Harvin, you get trained by the best in the industry with 13+ years of working experience. Their 9-in-1 course includes training, projects, internship, certification, placement, E-learning, boot camps, hackathons, and membership. Moreover, its 1-year Gold membership provides you with all these features mentioned here along with weekly 10+ job opportunities for up to 1 year on completion of the course.
Conclusion
Linux is more secure than windows and does not require Anti-virus programs. With its capacity to heavily encrypt and protect all of a computer’s data, it is becoming the most sought-after and popular operating system for servers. The above-mentioned Linux interview questions along with answers are all important and frequently asked in recent times. These will help you grasp the important topics related to Linux better and do well in your interviews. Good luck with your interview and when in doubt do revert back to the article again to know the most possible Linux Interview Questions with answers
FAQ’S
1. How popular is Linux?It is the most popular operating system. Most supercomputers run on it. Also, most of the servers that power the internet run on Linux. Even Android and ChromeOS run on the Linux kernel
2. What does Linux cost?Linux costs ZERO. Also, it is an Open Source which means that it’s not only free but you can also modify and change it according to your purpose.
3. Where shall I find help if I face a problem with Linux?There are plenty of spaces to find help. There are a lot of forms and wikis that help you out. Also, read articles related to Linux like Installation Guides, Software Reviews, etc which provide the solution to your problems
4. How secure is Linux?If not completely secure, it is one of the most secure operating systems available now. Viruses that exist for Linux are very few in number to matter much
5. How do I prepare for a Linux Interview?There are a lot of books and online resources available to help you with the process. However, to top it up, you can go through this article to know the most important Linux Interview Questions and answers