Top 45+ Practice Linux Interview Questions [ANSWERED] in 2020
Linux Interview Questions and Answers

Top 45+ Practice Linux Interview Questions [ANSWERED]

Last updated on 28th May 2020, Blog, Interview Questions

About author

Kannan (Sr Linux Administrator, Mind Tree )

He is Possessing 8+ Years Of Experience in Linux. His Passion lies in Developing Entrepreneurs & Activities. Also, Rendered his intelligence to the Enthusiastic JOB Seekers.

(5.0) | 15876 Ratings 6250

Linux is best-known as a community-developed operating system that is freely distributable and is built around Linux Kernel for computers, servers, mainframes, mobile devices, and embedded devices. It is supported on almost every major computer platform, including x86, ARM, and SPARC, making it one of the most widely supported operating systems.

Here, we have compiled a list of top Linux interview questions that you must know if your potential job opportunity covers Linux in any way.

1. What is Linux?

Ans:

 Linux is an open-source operating system kernel that serves as the foundation for various Linux distributions.

2. What is a distribution?

Ans:

A distribution (distro) is a complete operating system based on the Linux kernel, bundled with software packages, libraries, and utilities.

3. What is meant by shell scripting in Linux?

Ans:

Shell scripting in Linux refers to the practice of creating scripts or programs using shell commands and scripting constructs to automate tasks and perform various operations within the Linux command-line environment. A shell script is a series of commands written in a scripting language supported by the shell (command interpreter), which is executed sequentially when the script is run.

4. Name a few Linux distributions.

Ans:

Ubuntu, CentOS, Debian, Fedora, Red Hat Enterprise Linux (RHEL), openSUSE.

5. Explain the root user.

Ans:

 The root user has superuser privileges, granting unrestricted access to the system. It’s advised to use root only when necessary to avoid accidental damage.

6. Explain the root user.

Ans:

The root user has superuser privileges, granting unrestricted access to the system. It’s advised to use root only when necessary to avoid accidental damage.

7. What is the Linux kernel?

Ans:

The Linux operating system’s foundational element is the Linux kernel. It manages hardware resources, provides essential services to higher-level programs, and bridges software and hardware.

8. What distinguishes Unix and Linux from one another?

Ans:

Unix and Linux are operating systems with similar foundations, but Linux is an open-source reimplementation of Unix. While Unix refers to a family of proprietary OSs, Linux is open and community-driven.

9. Explain the file permissions in Linux

Ans:

The read, write, and execute rights for owner, group, and others make up file permissions in Linux. Access, modification, and execution of a file are all governed by these permissions.

10. What is the /etc/passwd file?

Ans:

The /etc/passwd file stores user account information, including usernames, user IDs, group IDs, home directories, and shell locations. It was historically used to authenticate users but is now usually supplemented with other methods like PAM.

11. What is a shell?

Ans:

A shell is a command-line interface that interprets user commands and interacts with the operating system. It can also refer to a scripting language that automates tasks and interacts with the OS.

12. Differentiate between a process and a thread.

Ans:

A process is an independent execution unit with its own memory space, while a thread is a smaller unit within a process that shares the same memory space. Multiple threads within a process can execute concurrently.

13. What is a daemon?

Ans:

A daemon is a background process that functions without human input and frequently offers services like network administration, printing, or scheduling.

    Subscribe For Free Demo

    [custom_views_post_title]

    14. Explain the purpose of the /etc/fstab file.

    Ans:

    The /etc/fstab file contains information about storage devices and filesystems that need to be mounted during system startup. It defines the rules for automounting filesystems.

    15. What is the Linux filesystem hierarchy?

    Ans:

    The Linux filesystem hierarchy defines the structure of directories in the system. Important directories include /bin (essential binaries), /etc (configuration files), /home (user home directories), and others.

    16. How do you change user and group ownership of a file in Linux?

    Ans:

    Use the chown command, followed by the chosen user and group, the file name, and the desired ownership change.

    17. What is a symbolic link?

    Ans:

    A symbolic link, or symlink, is a reference to another file or directory. It acts like a shortcut, allowing you to access files or directories from different locations.

    18. Describe the purpose of the crontab file.

    Ans:

    The crontab file is used to schedule and automate recurring tasks in Linux. It contains time and command specifications for tasks to run at specific intervals.

    19. What is the purpose of the PATH environment variable?

    Ans:

    The PATH variable lists directories where the shell looks for executable files. It allows you to run commands without specifying their full path.

    20. Explain the concept of runlevels.

    Ans:

    Runlevels are different operating modes of a Linux system. They determine which services and daemons are active, making it useful for tasks like booting or shutting down.

    21. What is SSH? How does it work?

    Ans:

    SSH (Secure Shell) is a cryptographic network protocol used for secure remote access and data communication. It provides encrypted sessions and secure authentication mechanisms.

    22. What is the purpose of the grep command?

    Ans:

    The grep command is used to search for specific text patterns within files. It scans the content of files and displays lines that match the provided pattern.

    23. What is a package manager in Linux?

    Ans:

    The process of installing, updating, and managing software packages on a Linux system is automated by a tool called a package manager. Examples include apt (based on Debian), yum (based on Red Hat), and pacman (based on Arch Linux).

    24. Explain the difference between a distribution and a desktop environment

    Ans:

    A full operating system based on the Linux kernel is known as a Linux distribution (distro). A desktop environment is a graphical user interface including elements like menus, windows, and icons that offer a consistent user experience.

    25. What is the purpose of the cron daemon?

    The cron daemon is in charge of carrying out predetermined intervals of scheduled tasks. The daemon guarantees that users’ tasks are completed once they schedule them using the cron syntax.

    26. What is the significance of the /var/log directory?

    Ans:

    The /var/log directory stores system and application logs, helping administrators diagnose issues and monitor system activities.

    27. What is the Linux swap space, and why is it used?

    Ans:

    Swap space is a reserved area on disk used as an extension of physical memory (RAM). It allows the system to move less-used data to disk when RAM is full, preventing memory exhaustion.

    28. What is an inode in Linux filesystems?

    Ans:

    An inode is a data structure that stores metadata about a file, including permissions, ownership, timestamps, and pointers to the file’s data blocks.

    Course Curriculum

    Get Advanced Practical Oriented Linux Certification Course

    Weekday / Weekend BatchesSee Batch Details

    29. How do you find information about a command using the man command?

    Ans:

    The man command displays manual pages that provide detailed information about Linux commands, including their usage, options, and examples.

    30. Explain the purpose of the sudo command.

    Ans:

    The sudo command allows authorized users to execute commands with superuser privileges. It helps maintain security by limiting administrative access to authorized users.

    31. What is the purpose of the chroot command?

    Ans:

    The chroot command changes the root directory for a process, creating an isolated environment. This is often used for testing, recovery, or security purposes.

    32. What is the purpose of the umask command?

    Ans:

    The umask command sets default permissions for new files and directories. It subtracts the mask value from the maximum permissions to determine the default.

    33. What is the /proc filesystem?

    Ans:

    The /proc filesystem provides information about running processes and system status. It presents process-related data as a hierarchical file-like structure.

    34. Explain the concept of pipes in Linux.

    Ans:

    Using pipes, you may chain commands together to process data in a sequential manner by connecting the result of one operation to its input.

    35. What is RAID and Explain RAID levels 0, 1, and 5?

    Ans:

    Data storage technology called RAID (Redundant Array of Independent Discs) combines numerous physical discs for increased performance, redundancy, or a combination of the two. Data is striped in RAID 0 for performance, replicated in RAID 1 for redundancy, and striped in RAID 5 with parity for a mix of redundancy and performance.

    36. What is the purpose of the df command?

    Ans:

    The df command displays information about disk space usage, including the amount of space used, available, and utilized by different filesystems.

    37. What is the purpose of the tar command?

    The tar command is used to create, view, or extract compressed archive files. It bundles multiple files and directories into a single archive, often used for backups or distribution.

    38. Explain the difference between hard links and symbolic links.

    Ans:

    Hard links point directly to the same data blocks as the original file, sharing the same inode. Symbolic links (symlinks) are separate files that point to the target file’s path. Changes in the original file affect symlinks but not hard links

    39. What is the purpose of the iptables command?

    Ans:

    The firewall rules of the Linux kernel are configured using the iptables command. By setting up rules for filtering, NAT (Network Address Translation), and other things, you can regulate network traffic.

    40. Define the concept of a shell script.

    Ans:

    A text file called a shell script is a collection of commands that a shell interpreter can run.Users can automate procedures and execute several commands simultaneously.

    41. Explain the role of the init process in Linux.

    Ans:

    The init process is the first process started by the kernel during system initialization. It acts as the parent of all other processes and manages the system’s runlevels.

    42. What is SELinux, and what is its purpose?

    Ans:

    Mandatory access controls are implemented via the security framework for Linux known as SELinux (Security-Enhanced Linux). By setting policies and regulations, it gives users fine-grained control over system access while boosting security.

    43. What is the purpose of the mount command?

    Ans:

    The mount command is used to attach filesystems to directories in the Linux directory hierarchy. It enables access to storage devices and network shares.

    44. Explain the purpose of the /etc/hosts file.

    Ans:

    The /etc/hosts file is used to map IP addresses to hostnames locally. It provides a simple way to resolve hostnames without relying on DNS.

    Course Curriculum

    Get Linux Administration Training for Beginners from Industry Experts

    • Instructor-led Sessions
    • Real-life Case Studies
    • Assignments
    Explore Curriculum

    45. What is the difference between kill and killall commands?

    Ans:

    With the kill command, you can manage how a process reacts by sending a particular signal to a certain process ID (PID). The killall command kills specific processes.

    46. Explain the purpose of the at and cron commands.

    Ans:

    The at command schedules one-time tasks to run at a specified time, while the cron command schedules recurring tasks at specified intervals.

    47. What is the purpose of the uptime command?

    Ans:

    The uptime command displays system load averages and how long the system has been running. It provides information about system performance and utilization.

    48. What is the purpose of the lsof command?

    Ans:

    The lsof command lists open files and processes on a Linux system. It helps identify which processes have files open, which is useful for troubleshooting.

    49. Explain the concept of fork() and exec() system calls.

    Ans:

    The fork() system call creates a new process by duplicating the existing process. The exec() system call replaces the current process with a new program, allowing a process to run another program.

    50. What is the purpose of the chown command?

    Ans:

    The chown command is used to change the ownership of files and directories, assigning them to a specific user or group.

    51. What is a shell variable?

    Ans:

    A shell variable is a named value used by the shell and its child processes. It can store data for use in scripts, commands, or the shell itself.

    52. What is a runlevel in Linux, and how is it used?

    Ans:

    A runlevel is a mode that the Linux system operates in, defining which services are active. Runlevels determine the behavior during booting, shutdown, and system operation.

    53. What is the purpose of the nice command?

    Ans:

    The nice command is used to launch processes with a specific priority level. It affects the scheduling priority of a process, allowing users to influence resource allocation.

    54. What is the purpose of the ulimit command?

    Ans:

    The ulimit command is used to control user process resource limits, such as the maximum number of open files, the maximum memory usage, and other resource restrictions.

    55. Explain the purpose of the rsync command.

    Ans:

    The rsync command is used for efficient file synchronization and data transfer between local and remote systems. It can copy or update files while preserving permissions and timestamps.

    56. What is the purpose of the /etc/resolv.conf file?

    Ans:

    The /etc/resolv.conf file contains configuration information for the system’s DNS resolver. It specifies the DNS servers used to resolve domain names to IP addresses.

    57. What is the purpose of the strace command?

    Ans:

    The strace command is used for debugging and troubleshooting by tracing system calls and signals made by a process. It provides insight into how a program interacts with the kernel.

    58. What is a runlevel in Linux, and how is it used?

    Ans:

    A runlevel is a mode that the Linux system operates in, defining which services are active. Runlevels determine the behavior during booting, shutdown, and system operation.

    59. Explain the difference between a process and a daemon.

    Ans:

    A process is a running program instance, while a daemon is a background process that runs independently of user interaction, often providing services or performing tasks.

    60. What is the purpose of the ulimit command?

    Ans:

    The ulimit command is used to control user process resource limits, such as the maximum number of open files, the maximum memory usage, and other resource restrictions.

    61. Explain the purpose of the rsync command.

    Ans:

    The rsync command is used for efficient file synchronization and data transfer between local and remote systems. It can copy or update files while preserving permissions and timestamps.

    62. What is the purpose of the /etc/resolv.conf file?

    Ans:

    The /etc/resolv.conf file contains configuration information for the system’s DNS resolver. It specifies the DNS servers used to resolve domain names to IP addresses.

    62. What is the purpose of the strace command?

    Ans:

    The strace command is used for debugging and troubleshooting by tracing system calls and signals made by a process. It provides insight into how a program interacts with the kernel.

    64. What is the purpose of the /dev/null device file?

    Ans:

    The /dev/null device file discards any data written to it and provides no output when read from. It’s commonly used to discard unwanted output or to send a command’s output into oblivion.

    65. Explain the purpose of the free command.

    Ans:

    The free command is used to display information about the system’s memory usage, including total, used, and free memory, as well as swap space.

    66. What is the purpose of the top command?

    Ans:

    The top command provides a real-time view of system processes, including information about CPU usage, memory usage, and running processes. It’s a dynamic monitoring tool.

    Explore Linux Sample Resumes! Download & Edit, Get Noticed by Top Employers! Download

    Are you looking training with Right Jobs?

    Contact Us
    Get Training Quote for Free