Thursday 2 May 2024

100 Important Linux Interview Questions with Answers

 

  1. What’s Linux?
    Linux is a free operating system quite similar to UNIX.
  2. Name the inventor of Linux.
    Linux was developed by Finnish-American software engineer Linus Torvalds in 1991.
  3. What’s an open-source OS?
    An open-source operating system means users can modify the source code and create their own versions of the software.
  4. Name some hardware platforms where Linux can be run.
    Linux can be run on various hardware platforms, including laptops, desktop computers, smartphones, tablets, raspberry pi, and so on.
  5. What does manage hardware resources?
    Linux kernel manages hardware resources for Linux users.
  6. What’s Linux Kernel?
    Linux Kernel is the core part of the Linux operating system. Kernel offers basic services to other components of the OS. Also, it interacts with user commands. Linux kernel is a free, modular, monolithic, multitasking, open-source, Unix-like OS kernel. It was created by Finnish-American software engineer Linus Torvalds in 1991. C and assembly language were used to write its code. Kernel 5.16.3 is its latest version.
  7. Is it legal if you use the Linux Kernel?

    Linux Kernel is free and open-source software. It comes under General Public License, shortened to GPL. Hence, it’s legal for anyone to edit the kernel.

  8. Explain one task performed by the kernel.
    Linux kernel manages your computer resources. Kernel enables a smooth run of various computer programs. Also, it allows the programs to use computer resources, such as CPU, memory, and i/o devices.
  9. How is the kernel useful in process management?
    The kernel takes care of process management. The kernel allows more than one process to run simultaneously.
  10. How do the processes access the devices attached to the computer?
    Processes access the devices attached with the help of the Linux kernel.
  11. Can you perform multiple tasks on Linux?
    Yes, Linux users can perform multiple tasks at once.
  12. What’s the role of the Linux kernel in managing memory?
    Linux kernel can access the system’s memory. So, it allows running processes to access the memory whenever needed.
  13. What’s the role of the Linux kernel in managing system calls?
    When the processes want to access the services, system calls are required. The kernel avails system calls for that purpose.
  14. What do you mean by a Command Line Interface?
    Command Line Interface, often shortened to CLI, is an interface that allows users to write declarative commands for instructing the computer to perform tasks.
  15. What are the characteristics of Command Line Interface?
    Below are the characteristics of CLI.

    • CLI is highly flexible.
    • OSes implement CLI in a program known as a Shell. It gives interactive access to the operating system’s services and functions.
  16. Does Ctrl+Alt+Del key combination work on Linux?
    Yes, Ctrl+Alt+Del key combination works on Linux. Just like Windows, this provides a system restart. The only difference is, on Linux, you won’t get any confirmation note, resulting in an immediate reboot of the system.
  17. How would you copy files to a Floppy Disk?
    For copying files to a Floppy Disk without any problem, we should follow the steps given below.

    • Mount the floppy disk
    • Copy the files to the disk
    • Unmount the floppy disk safely
  18. How many process states are there in Linux?
    There are five process states in Linux: new or ready, running, blocked or wait, zombie, and terminated.
  19. What does happen in the New process state?
    In the New or Ready process state, a brand new process gets created and becomes ready to run.
  20. What do you mean by the Running process state?
    The process being executed defines the Running process state.
  21. What do you mean by Blocked process state?
    In the Blocked or Wait process state, a process waits for input from the user.
  22. Define the Terminated process state.
    When a process has finished the execution or is terminated by the OS, it’s called a Terminated or Completed state.

  23. What’s the Zombie process state?
    In the Zombie process state, the process is deleted, but the information related to the process still remains in the process table.
  24. What are the system calls used for process management in Linux?
    System calls used for process management in Linux are fork(), exit(), wait(), exec(), nice(), getpid(), getppid().
  25. What’s the functionality of fork()?
    Fork() is used for creating new processes.
  26. What’s the functionality of exit()?
    Exit() is used to exit from the processes.
  27. What’s the functionality of wait()?
    The wait() is used for waiting until the process completes its execution.
  28. What’s the functionality of exec()?
    The exec() executes a new program.
  29. What’s the function of nice()?
    The nice() is used to bias the property of a process.
  30. What’s the role of getppid()?
    The getppid() gets the unique id of the parent process.
  31. What’s the role of getpid()?
    The getpid() gets the unique id of the process.
  32. What are Inode and Process Id?
    The inode or index node is the unique name given to each file. Process Id is the unique name given to each of the processes.
  33. What is Swap Space?
    Swap space is a part of a hard disk’s space that can be a substitute for physical memory.
  34. How does swap space work?
    Swap space works as virtual memory. It contains process memory images. During the memory shortage, your computer uses virtual memory. Swap space fulfils the RAM requirement of the operating system.
  35. What’s swapping?
    This information exchange between real memory and virtual memory is called swapping.
  36. Mention one advantage of using swap space.
    If your system has enough swap files, it keeps some amount of physical memory free.
  37. Why should we keep some physical memory free?
    The free physical memory can be used for different vital operations.
  38. Where are the unused applications kept?
    Unused or less used applications are usually kept in a swap file.
  39. How can swap space be used in reading or writing files?
    Swap space can be used as a single memory to reduce I/O operations during reading or writing files.
  40. Name two important features of the Linux operating system.
    Two important features of the Linux OS are:

    • Linux distributions come with live USB or CD required for installation purposes.
    • Linux has customized keyboards and outstanding application support.
  41. Which are the high-security services offered by Linux?
    Linux provides high-security services, such as Authentication, Encryption, and Authorization.
  42. How’s the file system offered by Linux?
    Linux offers a hierarchical file system, and its source code is free for everyone.
  43. Can you run Linux application programs on any hardware?
    Yes, the Linux kernel and the application programs are compatible with any hardware platform.
  44. What are daemons?
    Daemons are services that offer different functions that are not necessarily available under the base OS. Daemons receive service requests and respond as per the requests. Once the service is completed, it’s disconnected and then waits for the next requests.
  45. Name some daemons used in Linux.
    Daemons used in Linux are httpd, ftpd, amd, sshd, mysql, etc.
  46. Mention one speciality of Daemons used in Linux.
    Daemons mostly have ‘d’ at the end of their process names.
  47. What’s the full form of HTTPD?
    HTTPD stands for Hypertext Transfer Protocol Daemon.
  48. What’s the purpose of HTTPD?
    HTTPD runs in the background and works as a server.
  49. What’s the other name of the HTTP server?
    The HTTP server is better known as the Web Server.
  50. What’s the full form of FTPD?
    FTPD stands for File Transfer Protocol Daemon.
  51. What’s the full form of TCP?
    TCP stands for Transmission Control Protocol.
  52. What’s the full form of AMD?
    AMD stands for AutoMount Daemon.
  53. What’s the purpose of AMD?
    AMD takes care of mounted file systems’ cache.
  54. What’s the full form of NFSD?
    NFSD stands for Network File Sharing Daemon.
  55. What’s the purpose of NFSD?
    NFSD runs on a server. It manages client requests coming for file system operations.
  56. What’s AFS?
    AFS or Andrew File System is a distributed NFS used for facilitating stored server file access among AFS client computers placed in different areas.
  57. Who developed AFS?
    AFS was developed by Carnegie Mellon University. Later it was further developed by Transarc Corporation and IBM.
  58. Mention one difference between AFS and NFS.
    AFS has stateful servers.NFS has stateless servers.
  59. Explain the PWD command.
    When you open the Linux terminal, you land up to the user’s home directory. Using the PWD command lets you easily understand which directory it is. It provides the absolute path. The path starts from the root. The root is the Linux file system’s base. It’s denoted by the “/” (forward slash) sign. The user directory looks like “/home/username”.
  60. What’s the full form of SSHD?
    SSHD stands for Secure Shell Server Daemon
  61. What’s the purpose of SSHD?
    SSHD provides secured and encrypted communications between untrusted hosts across an insecure network.
  62. What do you mean by a computer file system?
    In short, filesystem or FS, a computer file system is a data structure and method used by an OS for controlling data storage and retrieval.
  63. What’s a Linux shell?
    The shell is the command-line interpreter of Linux. Linux shell acts as an interface between the kernel and the user. It’s used to execute programs called commands in Linux operating system. For instance, if you’ll enter LS, the shell will execute the LS command. Also, the Linux shell is able to execute many other programs, such as scripts, applications, and user programs. The shell is written in C or shell programming language.
  64. Which are the shells used in Linux?
    Some commonly used shells of Linux are BASH, CSH, KSH, and FISH.
  65. What’s BASH?
    BASH stands for Bourne Again Shell. BASH is the default shell found in most of the Linux distros.
  66. What’s CSH?
    CSH stands for C Shell. CSH is based on C-like syntax. And it offers job control and spelling correction.
  67. How to clear the cache in linux?
    echo 1 > /proc/sys/vm/drop_caches
  68. How to get the stack trace of a process on Linux
    Run pstack or run gdb and attach to process and use backtrace command
  69. What do you mean by a Virtual Desktop?
    A virtual desktop is a preconfigured image of an operating system and applications where the desktop environment is kept separated from the real physical device. That physical device is used for accessing it.
  70. How do the users access a virtual desktop?
    Users access virtual desktops remotely via a network. An endpoint device, like a smartphone, laptop, or tablet, is used for accessing a virtual desktop.
  71. How do a virtual desktop work?
    The virtual desktop works like a physical workstation. The VD service provider installs client software over the endpoint device. And the user interacts with the software on the device.
  72. What are the approaches to desktop virtualization?
    There are mainly 5 approaches to desktop virtualization. These are,

    • Remote Desktop Service or RDS
    • Operating system provisioning
    • Client hypervisors
    • Application virtualization
    • Client-side hosted virtual desktops
  73. What’s a hypervisor?
    A hypervisor is a software, hardware, or firmware that creates and runs VMs (virtual machines).
  74. What are client hypervisors?
    Client hypervisors are hypervisors designed for the purpose of using in client’s computers, such as workstations, desktops, or laptops, rather than using on a server.
  75. What’s a server?
    A server is computer software or hardware which offers functionality to other devices or programs, known as clients.
  76. What’s the other name used for the remote desktop services?
    Remote desktop services or RDS is also known as Terminal Services.
  77. What’s the full form of RDP?
    The full form of RDP is Remote Desktop Protocol.
  78. What do you mean by operating system provisioning?
    Operating system provisioning means installing an operating system over a number of host computers.
  79. What’s application virtualization?
    Application virtualization is a technology that lets users use any application from a different computer than the one machine where the application has been installed.
  80. What’s the right size for a swap partition?
    The ideal size for swap partition should be 2X of the RAM space installed in the computer. So for a 64 KB RAM, the swap space should be 128 KB.
  81. What are virtual desktops?
    Virtual desktops are operating systems and applications’ preconfigured images. Here desktop environment and the physical device used for accessing it are different.
  82. What’s the root account in Linux?
    The Root is the superuser account in Linux.
  83. What are the basic components of Linux?
    Linux OS has three basic components: kernel, system library, and system utility.
  84. How many permissions are there in Linux?
    There are mainly three types of file permissions in Linux: read, write, and execute.
  85. What’s the Linux kernel?
    Linux kernel is Linux’s core part. All major activities of the OS are performed by the Linux kernel. The kernel has various modules. It interacts with the underlying hardware. Linux kernel offers the required abstraction for hiding low hardware details.
  86. What do you mean by the Write file permission?
    With the Write permission, you have the authority to modify or change file contents. You can simply add, rename, and remove files that are stored in the directory. In any case, if you have the Write permission on the file but don’t have it on the directory, you can modify file contents. However, you can’t rename, remove, or move the file from the directory.
  87. What’s the Execute file permission?
    In Linux, you must set the Execute permission for running a program. If this isn’t set, you might be able to modify and see the program code, but you can’t run the program.
  88. How many Linux file ownerships are there?
    There are three types of Linux file ownerships such as User, Group, and Other.
  89. What do you mean by system libraries in Linux?
    In Linux, the system libraries are programs or special functions. Access Kernel features using these programs, system utilities, or application programs. System libraries implement operating system’s functionalities. They don’t require code access rights of Linux kernel modules.
  90. What do you understand by system utility in Linux?
    Linux uses applications called utilities that help users manage the computer. There are different utility programs. These vary across OSes. System utility is often accessed via the control panel or a special menu in the operating system.
  91. What’s the role of the Read file permission?
    With the Read file permission, you have the authority to read a file. You can list the content of a directory if you have the Read permission on the same. Also, you can open a file with the Read file permission.
  92. What are the differences between BASH and DOS?
    The major differences between BASH and DOS consoles are as given below.

    1. BASH commands are generally case-sensitive. DOS commands aren’t case-sensitive.
    2. In BASH, \ is an escape character and / acts as a directory separator. In DOS, \ acts as the directory separator and / is a command argument delimiter.
    3. DOS follows a particular convention in naming files. This is 8 character file name, a dot, and 3 characters for the extension. BASH doesn’t follow any such convention.
  93. What’s TCP?
    TCP stands for Transmission Control Protocol. It’s a transport protocol used to ensure packets’ reliable transmission. TCP provides mechanisms for solving problems caused by packet-based messaging, such as out-of-order packets, corrupted packets, duplicate packets, and lost packets.
  94. What does the CTRL+Q shortcut do in Linux?
    In Linux, the CTRL+Q shortcut quits the application in focus.
  95. What does the CTRL+ALT+F7 shortcut do in Linux?
    In Linux, the CTRL+ALT+F7 switches to the first graphics terminal.
  96. Briefly explain the history of Linux.
    Linux began its journey in 1991 as a hobby project by Linus Torvalds. Linus was a Finnish student who aimed to create a free OS kernel. Today’s Linux kernel results from constant efforts put throughout the past years. The source code was first released in 1991. Initially, Linux was a collection of a small number of files written in the C programming language. At that time, it was released under a license that prohibited commercial distribution. In mid-December of 1992, the kernel was released under the GNU GPL license. Around 2000, kernel started using the GPLv2 license. And in 2007, the GPLv3 license was released.

    Linus wanted to call this newly created OS Linux but dismissed the idea of being egotistical. So, he named the project Freax. Freax was a combination of “free”, “freak”, “x” from Unix. However, the team chose the name Linux as more appropriate later on.

  97. What does the CTRL+S shortcut do in Linux?
    In Linux, the CTRL+S saves the presently opened file.
  98. What’s Run level 0?
    The run level 0 denotes system halt. It means the system can be powered off without any activity.
  99. What do you mean by a run level?
    In Unix-based OSes, a Run level signifies the state of the computer after boot. Runlevel is previously set on various Linux distributions. There are seven Run levels, starting from zero to six. Run levels determine the programs to be executed after the operating system boots up. System admins assign a default run level as per their requirements. You can find out your computer’s current run level using the /sbin/runlevel command.
  100. What does the CAL command do? Give its syntax.
    In Linux, CAL is a calendar command. If you want to see a year’s calendar or a specific month, you need to use CAL. 

No comments:

Post a Comment