Linux Interview Questions

Linux Interview Questions | Freshers & Experienced

  • Sharad Jaiswal
  • 16th Jul, 2021

About Linux

Linux is an open-source Unix-like operating system based on the Linux kernel, which was first released on September 17, 1991, by Linus Torvalds. practice best linux interview questions below for the best preparation of the Linux interview.

Key Features of Linux

Below are few major features of Linux




Open Source





Practice Best Linux Interview Questions;

Q1. How can you use the iptable firewall?

You can use the iptable firewall by using the following commands:

–A ––append – Add a rule to a chain (at the end).

–C ––check – Look for a rule that matches the chain’s requirements.

–D ––delete – Remove specified rules from a chain.

–F ––flush – Remove all rules.

–I ––insert – Add a rule to a chain at a given position.

–L ––list – Show all rules in a chain.

–N ––new–chain – Create a new chain.

–v ––verbose – Show more information when using a list option.

–X ––delete–chain – Delete the provided chain.


Q2. What is the name and path of the main system log file?

The name of the main system log is messages and the path is /var/log/messages. System log in which server/OS.

Q3. What is the minimum number of partitions you need to install Linux?

The minimum number of partitions you need to install Linux is only one.

Q4. What route command does in Linux?

In Linux, route command is used when you want to work with the IP/kernel routing table. It is mainly used to set up static routes to specific hosts or networks via an interface. It is used for showing or update the IP/kernel routing table.

Q5. How to see all mounted drives in Linux?

To see all mounted drives in Linux, you need to use any one of the following commands:

df command – Shoe file system disk space usage. 

mount command – Show all mounted file systems. 

/proc/mounts or /proc/self/mounts file – Show all mounted file systems.


Q6. What utility can you use to automate rotation of logs?

You can use logrotate command utility to make automate the rotation of the log. It allows automatic rotation, compression, removal, and mailing of log files.

Q7. Which is commands is used to delete directory with content in Linux?

The rm command with the recursive option, -r is the command used to delete a directory with all its content and including any subdirectories and files in Linux. Directories that are removed with the rmdir command cannot be recovered, nor can directories and their contents be removed with the rm -r command.

Q8. What command can you use to review boot messages?

The dmesg command is used to review boot messages. It displays the system messages contained in the kernel ring buffer and immediately after booting your computer, you will see the boot messages.

Q9. What are RPMs, what they do?

RPM stands for Red Hat Package Manager which is a default open source and most popular package management utility for Red Hat-based systems such as RHEL, CentOS, and Fedora. These tools allow system administrators and users to install, update, uninstall, query, verify and manage system software packages in Unix/Linux operating systems.

Q10. What is the difference between Tcp and Udp?

TCP - It stands for the Transmission control protocol which is a heavy-weight, connection-oriented protocol. It establishes a connection before transmitting data and should close the connection after transmitting the data. It provides extensive error-checking mechanisms. It is because it provides flow control and acknowledgment of data.

UDP- It stands for User datagram protocol which is a lightweight, Datagram oriented protocol. It doesn't contain any overhead for opening a connection, maintaining a connection, and terminating a connection. It has only the basic error checking mechanism using checksums.

Q11. How can you display the Disk Usage in Linux?

To display the Disk Usage in Linux with the help of the following command:

df command – Shows the amount of disk space used and available on Linux file systems.

 du command – Display the amount of disk space used by the specified files and for each subdirectory. 

btrfs fi df /device/ – Show disk space usage information for a btrfs based mount point/file system.


Q12. What is difference between serial and parallel ports?

The difference between serial and parallel ports can be explained as a serial port is able to transmit a single stream of data at a time and data bit by bit after sending a bit at a time. Whereas a parallel port is able to transmit multiple data streams at a time and sends data by sending multiple bits in a parallel fashion.

Q13. Is USB serial or parallel?

USB is basically a serial protocol therefore if the USB device has to handle parallel data, then that data is serialized and transmitted, and de-serialized on the receiving end.

Q14. What are segmentation faults?

Segmentation fault is a specific kind of error caused by accessing memory that does not belong to you. It is a memory error in which a program tries to access a memory address that does not exist or the program does not have the right to access.

Q15. What is the difference between mutex and semaphore?

The difference between mutex and semaphore can be stated as mutex object allows multiple process threads to access a single shared resource but only one at a time whereas the semaphore allows multiple process threads to access the finite instance of the resource until available.

Q16. What is the command you use to sort a file?

The command you can use to sort a file in Linux is the SORT command. It arranges the records in a particular order. By default, the sort command sorts file assuming the contents are ASCII. Using options in the sort command can also be used to sort numerically.

Q17. What is a Linux Loader or LILO?

LILO stands for Linux Loader which is used to load Linux into memory. It is the most popular boot loader among users who employ Linux as their main, or only, operating system.

Q18. What is difference between soft link and hard link?

The difference between a soft link and a hard link can be stated as a soft link acts as a pointer or a reference to the file name and it does not access the data available in the original file. Whereas a hard link acts as a copy of the selected file and accesses the data available in the original file.

Q19. What is an INODE?

INODE is also known as index node is a data structure in a Unix-style file system that describes a file-system object and is used to keep information about a file on your hosting account.

Q20. How to get last line from a file ?

To get the last line from a file you can use the tail command.

Q21. What are daemons?

A daemon is a program that runs continuously and exists for the purpose of handling periodic service requests that a computer system expects to receive and forwards the requests to other programs as appropriate.

Q22. What grep command do?

grep command is basically a command-line utility that is used for searching text from standard input or a file for specific expressions.

Q23. What is the difference between fork and exec in linux?

The difference between fork and exec in Linux can be stated as fork starts a new process which is a copy of the one that calls it whereas exec replaces the current process image with another one.

About Author :

  • Author of Linux Interview Questions

    Sharad Jaiswal

    My name is Sharad Jaiswal, and I am the founder of Conax web Solutions. My tech stacks are PHP, NodeJS, Angular, React. I love to write technical articles and programming blogs.

Leave A Comment :

Valid name is required.

Valid name is required.

Valid email id is required.