Linux interview questions and answers

Linux Interview Questions

These Linux questions have been designed for various interviews, competitive exams and entrance tests. We have covered questions on both basic and advanced concepts which will help you improve your skills to face interview questions on Linux.

Who are these Linux interview questions designed for?

All the Linux Administrators, Linux Technical Architects, Linux network security engineers, Linux specialists, Linux Developer etc. will find these questions extremely useful. All freshers, BCA, BE, BTech, MCA and college students wanting to make a career in Linux will be highly benefited by these questions.

Linux interview questions topics

This section covers Linux topics like - components of Linux, Linux Kernel, root account, root directory, Telnet, file ownership in Linux, Linux Loader or LILO, soft and hard mounting, find and locate command etc.

1. What is Linux? Why do we use Linux?

Linux is a UNIX based open source operating system that was designed to provide free and a low-cost operating system.

Here are reasons why you should use Linux:

i.) Linux is an open source operating system where programmers have the freedom to view and modify the source code.

ii.) It is completely free. Businesses can use the software free of cost and save money substantially.

iii.) Updating a Linux system is easy. The system can be updated without rebooting it.

iv.) It is very stable and is not prone to crashes.

v.) It is highly secured and much less vulnerable to viruses compared to Windows

vi.) It is super lightweight compared to Windows. You can install Linux even on old hardware.

vii.) It has great Community Support through various forums.

Video : Linux Interview Questions and Answers - For Freshers and Experienced

2. What is the difference between Unix and Linux?

Unix is a proprietary operating system. It was developed by Bell Labs research center. Unix OS is not a freeware and therefore its source code is not available. It is mostly used in companies and institutions that can employ high-end computer systems.

Linux is not Unix but it is a Unix-like operating system that is derived from Unix. Linux is a free, open source, lightweight and a non-propriety operating system. It is compatible with a variety of hardware.

Difference between Linux and Unix

i.) Linux is an open-source operating system and the source code is freely available to its Users.

The Source Code of Unix is not available for the general public.

ii.) Linux can be freely distributed and downloaded. There are priced versions also, but they are not costly.  

Unix is not free and different flavors of Unix have different cost structures.

iii.) Linux is economical, lightweight and doesn’t require high-end hardware.

Unix requires more specific hardware. So, Unix Installation is comparatively costlier.

iv.) Users of Linux operating system could be anyone including home users, developers, computer enthusiasts etc.

Unix was basically developed for mainframes, servers and workstations except OSX, which is designed for everyone.

v.) Different Versions of Linux are: Ubuntu, Debian, OpenSuse, Redhat etc.

Different Versions of Unix are: AIX, HP-UX, BSD, Irix, etc.

vii.) Linux can be installed on a wide variety of hardware such as Mobile Phones, Desktops, tablets, video game consoles etc.

Unix is mainly used in Internet Server, Mainframes and High-End Computers.

viii.) Linux was developed by an active Linux Community worldwide.

Unix was developed by AT&T Corporation's Bell Laboratories Developers.

3. What are the basic components of Linux?

Linux operating system basically consists of 3 components:

Kernel: It is the core part and is responsible for all major activities of Linux operating system. It consists of various modules and interacts directly with the underlying hardware.

System Library: These are special functions using which application programs access Kernel’s features.

System Utility: These programs are responsible for performing individual and specialized functions.

4.  What is Linux Kernel? Is it legal to edit Linux Kernel?

Linux Kernel is low-level system software that manages the hardware resources for the users. It provides an interface for user-level interaction.

Yes. You can edit Linux Kernel because it is released as 'Open Source' under General Public Licence (GPL).

5. Why is Linux considered as more secure than other operating systems?

Linux is considered as more secure because of the following reasons:

i.) Linux users don't have root access, they have lower access rights. In case of any virus attack, the virus can access only local files and folders and the system will remain safe.

ii.) All Linux accesses are recorded to log files. These logs can be reviewed to determine possible security breaches such as failed login attempts etc.

iii.) Linux comes with Iptables, an extremely flexible firewall utility that allows Linux administrators to manage incoming and outgoing traffic.

6. What is grep command?

Grep stands for 'global regular expression print'. It is a search command that makes use of pattern-based searching. It makes use of options and parameters that are specified along with the command line.

For example: Suppose we need to locate the phrase "Tutorialride.com" in HTML file named as "educational-websites.html". Then the command will be as follows:

$ grep "Tutorialride.com" educational-websites.html

The grep command outputs the entire matching line to the terminal.

7. What is a "root account"?

A root account is like a systems administrator account that allows you full control of the system. Using this, you can create and maintain user accounts and assign different permissions to each account.

Root Account is the default account every time you install Linux.

8. What is a root directory?

Root directory is the parent directory of the hierarchy that contains all other directories and files on the system. It is represented by a forward slash '/'.

9. Why should you avoid Telnet to administer a Linux system remotely?

Telnet utility helps you to connect to a remote Linux computer and work on it.

Telnet uses most insecure method for communication. It sends data including usernames and passwords across the network in plain text format without any encryption. So, one can sniff the packets to get that important information.

10. What is file ownership in Linux? How do we change ownership of a file in Linux?

Linux uses file ownership for security.

Every file and directory in Linux has three types of owners:

User - User is the owner of the file. A user is the one who creates the file.

Group - Every user is part of a certain group(s). A group consists of several users and all have same access permission for a file.

Other - Any user who has access to a file but not part of the user or group,falls in the category of other.

Command chown is used to change the owner of the file.

Syntax:

chown<newOwner><fileName>

11. How many types of permissions does a file have in Linux?

All the three owners (user owner, group, others) in the Linux system have three types of permissions defined

Read (r): This permission gives the authority to open and read a file.

Write (w): The write permission on a file allows modifying the contents of a file. The write permission on a directory allows adding, removing and renaming files in the directory.

Execute (x): The executable permission allows running the file. In Linux, you can't execute a program unless execute permission is set.  

12. What is a Linux Loader or LILO?

LILO stands for Linux Loader, the most popular boot loader for Linux. It loads Linux into memory and start the operating system.

LILO handles the following tasks:

i.) Locating Linux kernel

ii.) Identifying other supporting programs and loading them in the memory

iii.) Starting Kernel

13. What is a swap space? What are its advantages?

The swap space is a memory space that comes into play when the RAM doesn’t have enough memory to hold all programs that are currently executing. In such cases, the inactive memory pages are moved to swap space to free RAM.

14. What is the difference between soft and hard mounting points?

The NFS mount options such as Hard mount and Soft mount options define how the NFS client should handle NFS server failure.

Suppose NFS filesystem mount is a soft mount.And in case NFS client fails to get any response from the NFS server due to any crash or failure of NFS server, the client reports an error without waiting for a response from the NFS server. But this method could lead to data corruption or data loss. So, this is not a recommended option to use.

When a NFS filesystem mount is a hard mount, the NFS client will repeatedly retry to contact the server until it receives a response. Once the server is back online, the program will continue execution from the same point where it was stuck during the server crash. Hence,there won’t be any chance of data loss.