Javatpoint Logo
Javatpoint Logo

Top 62 Linux Interview Questions

Linux Interview Questions

A list of top frequently asked Linux interview questions and answers are given below.

Linux operating system internals

1) What is Linux? Discuss its features.

Linux is a UNIX based operating system. Linus Torvalds first introduced it. It is an open source operating system that was designed to provide free and a low-cost operating system for the computer users.

Linux is an open-source Unix-like computer OS that directly manages the resources and hardware of a system, like storage, memory, and CPU, and handles the communication between hardware and software. First, it was published on 5 October 1991 by Linus Torvalds for systems and is considered faster and more secure than Windows. It's freely distributable and is basically established around Linux Kernel. Additionally, it can be installed in notebooks, computers, laptops, mobiles, etc. Linux operating system flavors include Gentoo, SUSE Linux, Debian, Ubuntu, etc.

Some important aspects of the Linux operating system include:

Top 62 Linux Interview Questions
  • Adaptable and robust: Linux can work for prolonged times without crushing and is very much resistant to security threats.
  • Open-source and free: it is easily and freely available to everyone.
  • More secure: Linux is more secure because it offers security with authentication features, such as file system access control, security auditing, and password authentication.
  • Multiprogramming system: Multiple functions or an application can simultaneously run.
  • Application support: Linux includes its software repository, which is a storage location or place from where software can be redeemed so that users can get applications.
  • Graphical user interface: Linux offers an interface for users to collaborate with the system and permits to use of graphical user interface applications, like Firefox, VLC, etc.
  • Customized keywords: There are several different languages used across the world. Hence, Linux supports multiple language keyboard installation.

2) What is the difference between UNIX and Linux?

UNIX was originally started as a propriety operating system for Bell Laboratories, which later release their commercial version while Linux is a free, open source and a non-propriety operating system for the mass uses.

3) What is Linux Kernel? Discuss its functions.

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

Linux kernel is the primary component of the Linux operating system. Simply, it is a resource manager that works as a bridge between software and hardware. Its primary role is to handle hardware resources and is generally used to offer an interface for interaction. A Linux kernel is the initial program that's loaded whenever a system starts. Also, it is called low-level system software.

Its primary functions are as follows:

  1. Storage management
  2. Device management
  3. Process management
  4. Memory management
  5. Access management and use of several peripherals linked to the computer.

4) Is it legal to edit Linux Kernel?

Yes. You can edit Linux Kernel because it is released under General Public License (GPL) and anyone can edit it. It comes under the category of free and open source software.

5) What is LILO?

LILO is a boot loader for Linux. It is used to load the Linux operating system into the main memory to begin its operations. It is a bootloader that is used for loading Linux into memory and dawning the OS. Also, it is called a boat manager that offers a dual-boot of a system. It can work as either a secondary boot program or a master boot program that implements several functions, such as starting the kernel, loading memory, recognizing other supporting programs, and locating the kernel. We need to install a unique bootloader, i.e., LILO, if we wish to use Linux operating system because it permits Linux OS boot.

6) What is the advantage of open source?

Open source facilitates you to distribute your software, including source codes freely to anyone who is interested. So, you can add features and even debug and correct errors of the source code.

7) What are the basic components of Linux?

Just like other operating systems, Linux has all components like kernel, shells, GUIs, system utilities and application programs. Generally, Linux is composed of five components or elements, which are listed and explained as follows:

Top 62 Linux Interview Questions
  1. Kernel: It is the main or core Linux part and is generally liable for every major activity of the operating system, such as device management, process management, etc.
  2. System library: System libraries are unique programs or functions with which system utilities or application programs can access kernel features without code requirements. It is used for implementing the functionality of the operating system.
  3. System utility: System utilities are utility programs that are liable to perform individual-level and specialized tasks. These are considered more responsible and permit users to handle the system.
  4. Hardware: It's physical hardware that contains items like a CPU, display, keyboard, mouse, etc.
  5. Shell: It's an environment where we can execute our commands, programs, and shell scripts. It's an interface between the kernel and the user that hides every complexity of the kernel functions from the user.

8) What is the advantage of Linux?

Every aspect comes with additional features, and it provides a free downloading facility for all codes.

9) What do you mean by Linux Shell? Explain its types.

Linux Shell is called the user interface available between the kernel and the user. It is used to execute communication and commands with Linux operating system. Linux shell takes human-readable commands as input and transforms them into a language that is kernel understandable.

Different shell types are used on classic Linux systems, as mentioned below:

  1. Bourns Shell
  2. ZSH
  3. TCSH
  4. Bourns Again Shell or BASH
  5. Korn Shell or KSH
  6. C Shell or CSH

10) Name the Linux which is specially designed by the Sun Microsystems.

Solaris is the Linux of Sun Microsystems.

11) Name the Linux loader.

LILO is the Linux loader.

12) If you have saved a file in Linux. Later you wish to rename that file, what command is designed for it?

The 'mv' command is used to rename a file.

13) Write about an internal command.

The commands which are built in the shells are called as the internal commands.

14) Explain Process Id and INODE.

  1. Process Id: It's a unique Id provided to all processes. It is used to identify a running process uniquely throughout the computer until the process ends.
  2. INODE: It's a unique name provided to all files by the operating system. All inodes have a unique inode number in a file system. INODE stores many details about files, including the number of links, access mode, file type, file size, ownership, etc.

15) If the programmer wishes to execute an instruction at the specified time. Which command is used?

The 'at' command is used for the same.

16) Name some Linux variants.

Some of the Linux commands are:

  • CentOS
  • Ubuntu
  • Redhat
  • Debian
  • Fedora

17) What is Swap Space?

Swap space is used to specify a space which is used by Linux to hold some concurrent running program temporarily. It is used when RAM does not have enough space to hold all programs that are executing.

As its name implies, swap space is a space on the hard disk used when the RAM or physical memory amount is full. It's a replacement for physical memory. Its primary function is to replace disk space for memory when actual RAM doesn't have sufficient space to hold every program that is running, and more space is needed. In other words, it can be used as a RAM extension by Linux.

18) What is BASH?

BASH is a short form of Bourne Again SHell. It was a replacement to the original Bourne shell, written by Steve Bourne.

It is generally a command language interpreter. BASH was written for GNU OS by Brian Fox and can replace Bourne Shell. It is the same as Bourne Shell but contains some extra features like a command-line amendment that make it more convenient and easier to use. It's the default user shell on almost every Linux installation. Basically, it is a non-compiled and interpreted process that can also execute in the terminal window. Also, it is able to read commands in shell scripts.

19) What is the basic difference between BASH and DOS?

  • BASH commands are case sensitive while DOS commands are not case sensitive.
  • DOS follows a convention in naming files. In DOS, 8 character file name is followed by a dot and 3 characters for the extension. BASH doesn't follow such convention.

20) What is a root account?

The root account is like a system administrator account. It provides you full control of the system. You can create and maintain user accounts, assign different permission for each account, etc.

21) What is GUI and CLI?

GUI: GUI stands for Graphical User Interface. It is a human-computer interface that permits users to collaborate with electronic devices through visual indicators and graphical icons. The use of these graphical icons or elements makes it convenient for the user to collaborate with the system. It's visually intuitive and permits higher productivity. It uses the images and the icons which are clicked by the users to communicate with the system. It is more attractive and user-friendly because of the use of the images and icons.

CLI: CLI stands for Command Line Interface. It is a command-line program that takes text as input to run the tasks of the OS. It permits users to enter declarative commands to give instructions to the system to perform operations. It needs less memory than other interfaces, and it doesn't need Windows because a low-resolution monitor can also be used. It is an interface that allows users to type declarative commands to instruct the computer to perform operations.

22) Which popular office suite is available free for both Microsoft and Linux?

Open Office Suite is available free for both Microsoft and Linux. You can install it on both of them.

23) Suppose your company is recently switched from Microsoft to Linux and you have some MS Word document to save and work in Linux, what will you do?

Install Open Office Suite on Linux. It facilitates you to work with Microsoft documents.

24) What is SMTP?

SMTP stands for Simple Mail Transfer Protocol. It is an internet standard for mail transmission.

25) What is Samba? Why is it used?

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

26) What are the basic commands for user management?

  • last,
  • chage,
  • chsh,
  • lsof,
  • chown,
  • chmod,
  • useradd,
  • userdel,
  • newusers etc.

27) What is the maximum length for a filename in Linux?

255 characters.

28) Is Linux Operating system virus free?

No, there is no operating system till date that is virus free, but Linux is known to have less number of viruses.

29) Which partition stores the system configuration files in Linux system?

/stc partition.

30) Which command is used to uncompress gzip files?

gunzip command is used to uncompress gzip files.

31) Why do developers use MD5 options on passwords?

MD5 is an encryption method, so it is used to encrypt the passwords before saving.

32) What is a virtual desktop?

The virtual desktop is used as an alternative to minimizing and maximizing different windows on the current desktop. Virtual desktop facilitates you to open one or more programs on a clean slate rather than minimizing or restoring all the needed programs.

33) What is the difference between soft and hard mounting points?

In the soft mount, if the client fails to connect the server, it gives an error report and closes the connection whereas in the hard mount, if the client fails to access the server, the connection hangs; and once the system is up, it again accesses the server.

34) Does the Alt+Ctrl+Del key combination work in Linux?

Yes, it works like windows.

35) What are the file permissions in Linux?

There are 3 types of permissions in Linux OS that are given below:

  • Read: User can read the file and list the directory.
  • Write: User can write new files in the directory.
  • Execute: User can access and run the file in a directory.

36) What are the modes used in VI editor?

Visual Editor or VI editor is a default text editor that comes with almost every Linux operating system. There are three different types of modes utilized in the VI editor, as mentioned below:

  • Regular Mode or Command Mode: For the VI editor, it's the default mode. It's used for typing commands that perform specific or particular vi functions. To input this mode from other modes, one must click [esc]. It lets us see the content.
  • Edit Mode or Insertion Mode: It permits us to type text in a file or perform text editing. To input this mode from other modes, one must click [esc]. It lets us insert or delete content or text.
  • Replacement Mode or Ex Mode: It is used to store the files and implementation of the commands. It runs files with distinct parameters. To input this mode, one must click [:]. It lets us overwrite text or content.

37) How to exit from vi editors?

The following commands are used to exit from vi editors.

  1. :wq saves the current work and exits the VI.
  2. :q! exits the VI without saving current work.

38) How to delete information from a file in vi?

The following commands are used to delete information from vi editors.

  1. x deletes a current character.
  2. dd deletes the current line.

39) How to create a new file or modify an existing file in vi?

  1. vi filename

40) What are the Linux user mode types?

Two Linux user modes are available, which are as follows:

  • GUI
  • Command Line

41) What are the Process States?

Linux process is a kind of process that can be in several distinct states. The process comes in these states from start to end. In Linux, the process states are mentioned below:

Top 62 Linux Interview Questions
  1. New/Ready: A new process is made and is ready to execute.
  2. Running: The process is being run.
  3. Blocked/Wait: The process waits for input through the user, and if it does not have resources to execute, such as input, file locks, and memory, it can remain in a blocked or waiting state.
  4. Completed/Terminated: The process has been terminated by the operating system or finished the execution.
  5. Zombie: The process is aborted, but information related to the process is still available and is available within the process table.

42) What is the typical swap partition size in the Linux System?

It should be double the amount of RAM or physical memory available in the system.

43) What is the name of the file that's used to mount file systems automatically?

The fstab file is the file that's used to mount file systems automatically.

44) What do you mean by LVM, and why it's important?

Logical Volume Management, or LVM, is a tool that offers the management of logical volume for the Linux kernel. It's simply being introduced to enable physical storage device management convenient. Also, it features allocating disks, resizing, mirroring, and striping logical volumes.

Its primary benefits are enhanced abstraction, control, and flexibility. It permits extensible disk space management. It is needed to online resize the file system. The LVM partition size can be increased with the "lvextend" command and decreased with the "lvreduce" command in Linux.

45) Define the "/proc" file system.

A proc file system is a virtual or pseudo file system that offers an interface to the data structure of the kernel. Generally, it contains useful details about processes that are currently running. Also, it can be used to modify a few kernel parameters during execution or runtime.

46) What are the daemons?

Daemons are also called the background process. They are a long-running program of Linux that executes in the background. They don't have any controlling terminal; hence they execute in the background. Daemons are the process starts when the computer is bootstrapped and ends or terminates only when the computer is shut down. It's simply the form of increasing the base OS functionality. It provides many functions that aren't available in OS.

47) What is the name of the daemon that can control the print spooling process?

The line printing daemon can control the print spooling process.

48) What do you mean by a Zombie Process?

In Linux, a Zombie Process is also known as a dead or defunct process. It is a process that has completed the execution, but its access remains inside the process table. Usually, it happens because of insufficient correspondence between child and parent processes. This process appears for the child process due to the parent process requires reading the child process's status. This process is deleted from the process table once it is finished with the wait system call.

49) What is the difference between an anacron and a cron?

  • Anacron: In Linux, anacron is a program used to run tasks at some intervals. It works on machines effectively that are powered off in a week or day.
  • Cron: In Linux, cron is a program used to run tasks at an expected time. It works on machines effectively that continuously run.
Anacron Cron
It's not a daemon. It's a daemon.
Only it can be utilized by super users. It can be expected by normal users.
It's ideal for laptops and desktops. It's ideal for servers.
It doesn't suppose the system to execute 24*7. It supposes the system to run 24*7.
The minimum granularity of an anacron is in days only. The minimum granularity of a cron is in minutes.
It periodically executes commands. It executes scheduled commands.

50) What do you mean by load average under Linux?

As its name implies, load average is the system average loaded on Linux servers being measured over a given time. The Linux server's load average can be detected using "uptime" and "top" commands. Also, it is used to record the system resources.

51) What is the Shell Script?

As its name implies, Shell Script is a script mainly written for the shell. The script describes the programming language being used to manage applications. It permits the execution of distinct commands entered inside the shell. Generally, it helps us to make complex programs, including functions, loops, and conditional statements.

52) What is the name of the first process initiated by the kernel, and what is the process id of it in Linux?

"init" is the first process initiated by the kernel, and 1 is the process id of it.

Linux Networking

53) What are /etc/hosts and /etc/resolv.conf files in Linux?

  • /etc/hosts: This file translates or maps any domain name or hostname to its corresponding IP address.
  • /etc/resolv.conf: This file configures DNS name servers because it includes the information of the name server, i.e., information of our DNS server. Then, the DNS server resolves the IP address hostname.

54) What is Network bonding in Linux?

Network bonding is also called NIC teaming. It is a kind of bonding that connects two or more network interfaces to a single interface. Usually, it improves redundancy and performance generally by increasing network bandwidth and throughput.

55) What are the types of network bonding?

There are several network bonding modes which are mentioned as follows:

  • Mode-0 (balance-rr): Mode-0 is the default mode, and it works according to the round-robin policy. It provides features like load balancing and fault tolerance.
  • Mode-1 (active-backup): It works according to the active-backup policy. Only a single node works or responds during the failure of another node.
  • Mode-2 (balance-xor): This mode sets an exclusive-or (XOR) mode for offering fault tolerance and load balancing.
  • Mode-3 (broadcast): It works according to the broadcast policy. This mode configures a broadcast mode for offering fault tolerance and can be only used for specific goals.
  • Mode-4 (802.3ad): It is also called Dynamic Link Aggregation mode. It works according to the IEEE 802.3ad standard. It configures an IEEE 802.3ad dynamic link aggregation mode and makes aggregation groups that distribute similar duplex and speed settings.
  • Mode-5 (balance-tlb): It is also called Adaptive Transmit Load Balancing (TLB). It configures TLB mode for load balancing and fault tolerance.
  • Mode-6 (balance-alb): It is also called Adaptive Load Balancing. It configures ALB mode for load balancing and fault tolerance. It does not need unique switch support.

55) What are the default ports for squid, DHCP, SSH, FTP, SMTP, and DNS?

Default ports for several services are below:

Servers Default Ports
squid 3128
DHCP 68/UDP (dhcp client), 68/UDP (dhcp server)
SSH 22
FTP 21 (Connection established), 22 (Data transfer)
DNS 53

56) What is the difference between Hard and Soft links?

  1. Soft Links: Soft links are also known as a symbolic link. These are files that generally point to other files. It doesn't include data within the target file and points to other entries anywhere inside the file system. We can use the below command to create the soft links:
  1. Hard Links: Hard links are special files that point to a similar underlying inode. It can be known as an extra name for an old file in Linux OS. We can use the below command to create the hard links:
Soft Link Hard Link
It's a symbolic link to the actual file. It uses a mirror copy of the actual file.
Usually, it shares distinct inode numbers. Usually, it shares similar inode numbers.
It doesn't include the original contents but includes the original file location. It includes the original contents.
Any modifications or changes made to this link will reflect the actual file and its hard links directly. Any modifications made to the actual file will reflect other files directly.
It links directories. It can't link directories.
They are slower than hard links. They are faster than soft links.

57) What are the three standard streams under Linux?

In Linux, standard streams are I/O communication channels among a program and its environment. In the Linux environment, input and output are distributed around three standard streams, which are mentioned below:

  • stdin (Standard Input)
  • stdout (Standard Output)
  • stderr (Standard Error)

Linux Commands

58) Explain the netstat command.

Network statics or netstat command is a networking tool for configuration and troubleshooting. It shows every network connection on the system. It offers a way to inspect whether several TCP/IP aspects are running and what connections are available.

59) Define the ping command.

Packet Internet Groper aur ping command checks the connection status between the destination and source. In other words, this command checks whether a network is present and if the host is attainable. We can use the ping command to check both the IP address and name of the system.

60) Name the command used to see the default run level.

The "/etc/inittab" command is used to see the default run level.

61) Name the command used to see the size of the directory or file.

The "du" command is used to see the size of the directory or file. The disk usage or du command checks disk usage information of directories and files on a system. Also, it is used to show directory and file sizes in a recursive manner.

62) Name the command used to calculate the characters in a file.

The "wc" command is used to calculate the characters in a file. The word count or wc command is used for counting the number of characters, words, and lines in any text file.

You may also like:

Learn Latest Tutorials


Trending Technologies

B.Tech / MCA