50 Best Linux Interview Questions And Answers
The following Linux interview questions and answers list is intended to provide a comprehensive overview of Linux interview questions for freshers as well as Linux interview questions for experienced candidates.
More than 90% of the world's fastest computers run Linux-based operating systems. The reason is simple! Linux is fast, powerful, and favored by techies. Here you will learn what you need to know to prepare for the interview for Linux Administrator. This article will cover some of the most commonly asked and most important Linux Interview Questions and answers.
This Linux interview questions list contains 50 essential interview questions for freshers and Linux interview questions and answers for experienced candidates to help prepare for the interview. Learn how to crack the Linux job interview with this detailed guide to Linux interview questions.
You can learn Linux to develop your website at low costs from the best Linux tutorials, as it can run almost any of the major languages.
Linux Interview Questions And Answers For Experienced and Freshers
1. What is Linux?
Answer: Linux is a Unix-based open-source operating system created by Linus Torvalds. Linux was developed to provide users with a free and low-cost alternative to expensive operating systems such as Windows, iOS, and Unix.
2. What features does Linux have?
Answer: Linux OS includes the following features:
- Portable: Applications and the Linux kernel can be installed on all kinds of hardware platforms.
- Free and Open Source: Anyone can use it for free.
- GUI (Graphical User Interface): It provides interfaces for users to interact with the system, and it enables users to run GUI-based applications, like VLC and Firefox.
- Robust and Adaptable: Linux can operate for long periods without crashing, and it is considered very secure.
- Application Support: It has its software repository i.e., a place from which software can be retrieved by users so that they can install and download applications.
- More secure: The system uses authentication methods such as password authentication, security auditing, and file system access control to provide security.
- Supports customized keywords: Because languages vary throughout the world, Linux supports the installation of multiple language keyboards.
- Multiprogramming: The ability to run multiple applications at the same time.
3. What is the difference between Linux and UNIX?
|Linux is used for computer hardware & software, game development, and more.
|Several server hardware manufacturers, such as Intel, HP, and others, use Unix as an operating system.
|Both free and paid versions are available.
|There are different cost structures for different versions of UNIX.
|Anyone can use it, including home users, developers, etc.
|Most mainframes, internet servers, and workstations use it.
|FAT, NTFS, Ext2, Ext3, Ext4, JFS, ReiserFS, XFS, BTRFS, and ReiserFS are some of the file systems supported.
|Among the file support systems are JFS, GPFS, HFS, UFS, and VXFS.
|Gnome and KDE are the two GUIs available.
|Common desktop environments are used as GUIs.
|Ensures a higher level of security. Currently, it lists between 60 and 100 viruses.
|It is also highly secure and has approximately 85-120 viruses listed.
|Red Hat, Fedora, Kali Linux, Debian, Android, Ubuntu are examples.
|Solaris, OS X, and all Linux are examples.
4. What is BASH?
Answer: BASH stands for Bourne Again SHell. It is a replacement for Steve Bourne's original Bourne Shell (represented by /bin/sh). Despite the fact it does the same thing as Bourne Shell's original version, it has been enhanced to be easier and more convenient to use. Since then, it has become the default shell for most Linux systems.
5. What is LILO?
Answer: LILO or Linux Loader is a Linux Boot Loader that loads the Linux Operating System into main memory to begin execution. In most cases, computers come with boot loaders for Windows or Mac OS. To use Linux OS, you must install a special boot loader. LILO is one of these boot loaders.
BIOS performs some initial tests and transfers control to the Master Boot Record when the computer is started. LILO loads and starts the Linux OS from here. The advantage of LILO is that it allows fast booting of Linux OS.
6. What are the basic components of Linux?
Answer: Linux consists of the following components:
- Kernel: An Operating System's core component that manages hardware and operations.
- Shell: Shell is a Linux interpreter used to run commands.
- Application Programs: Programs or functions designed to accomplish a particular task.
- GUI: A GUI is a graphical user interface used to interact with a computer system. However, unlike CLI, GUI consists of Images, Buttons, and TextBoxes for interaction.
- System Utilities: These are the software tools that help you manage your computer.
7. What is Swap Space?
Answer: When RAM has insufficient space to hold multiple programs running simultaneously, Linux uses swap space to store them temporarily. Whenever you run a program, its data resides in RAM so that the processor can obtain it quickly. If you are running more programs than the RAM can hold, then the running programs are stored in Swap Space. The processor will now search the RAM and swap space for data.
Linux uses Swap Space as an extension of RAM.
8. Is it legal to edit the Linux kernel?
Answer: There is no legal restriction on editing the Linux kernel. Linux is released under the GPL (General Public License). GPL-licensed projects can be modified and edited by end-users.
9. Which are the Shells used in Linux?
Answer: Linux uses several Shells, including
- bash: Bash is the default shell for a majority of Linux distributions.
- ksh: KornSHell is a high-level programming language shell that executes commands read from a terminal or a file.
- csh: C Shell uses C-like syntax and provides job control and spelling correction.
- zsh: Z Shell provides some special features like filename generation, startup files, login/logout monitoring, closing comments, etc.
- fish: Friendly Interactive Shell offers special features like web-based configuration, auto-suggestions, fully scriptable with clean scripts.
10. Explain file permission in Linux.
Answer: In Linux, there are three types of file permissions:
- Read: Enables a user to open and read the file.
- Write: Allows a user to open and edit the file.
- Execute: Enables a user to run the file.
11. What are two types of Linux User Mode?
Answer: There are two types of Linux user mode as follows:
- Command Line
12. What is Kernel? Explain its functions.
Answer: A kernel is considered to be the heart of Linux OS. It is a simple resource manager that acts as a conduit between hardware and software. Its main purpose is to manage hardware resources for users and to act as an interface for the user. When a computer system starts, a kernel is the first program to run. It is also known as low-level system software.
13. Describe the root account.
Answer: A root account is like a system administrator account and allows you full control over the system. Here you can create and manage user accounts, giving each account a different set of permissions. When you install Linux, this account is created by default.
14. What is the importance of the GNU project?
Answer: This so-called Free software movement offers several advantages, such as the ability to run programs for any purpose and the opportunity to study and modify programs to fit your needs. Additionally, you can redistribute copies of the software to others, as well as improve the software and have it released for public use.
15. Name the different types of modes used in the VI editor.
Answer: In Linux, the VI editor (Visual Editor) is the default text editor. There are three types of modes in VI editor:
- Command Mode/Regular Mode: It is the default mode for the vi editors. Generally, it is used to type commands that perform particular vi functions. Press [ESC] to enter this mode from another mode (Insert mode). Simply put, it lets you view the content.
- Insertion Mode/Edit Mode: This mode allows you to edit text, or type text into a file. Press [ESC] to enter this mode from another mode (command mode). Simply put, it allows you to delete or add text or content.
- Ex Mode/Replacement Mode: This mode is commonly used to save files and execute commands. There are different parameters it uses when executing files. Press [:] to enter this mode. Simply put, you can overwrite content and text.
16. Name the Linux that is specially designed by the Sun micro-system.
Answer: Solaris is a version of Linux designed specifically by Sun Microsystems.
17. What is the maximum length for a filename under Linux?
Answer: Under Linux, the maximum filename length is 255 characters. In this case, the pathname is not included in the character limit, so the entire pathname and filename could well exceed 255 characters.
18. What is LVM and why is it required?
Answer: For the Linux kernel, LVM (Logical Volume Management) provides logical volume management. The goal is simply to make it easier to manage physical storage devices. Furthermore, it involves allocating disk space, striping, mirroring, and resizing logical volumes. Abstractions, flexibility, and control are its main advantages. You can flexibly manage disk space with it.
In particular, it is necessary to resize the file system online. The size of an LVM partition can be increased using the "lvextend" command and reduced using the "lvreduce" command, respectively, in Linux.
19. What do you mean by the Daemons?
Answer: Daemons also referred to as background processes, are Linux programs that run in the background. They operate in the background since they are not controlled by their terminal. Typically, these processes start when the system boots up and end only when the system is shut down. It simply extends the functionality of the base OS. Many functions that aren't available in OS are provided and offered by it. This program's primary function is to process periodic requests and forward them to the appropriate programs for processing.
20. What is a Zombie Process?
Answer: Zombie processes, also known as defunct or dead processes in Linux, terminate after finishing their execution, but their entries remain in the process table. This usually happens when there is no correspondence between the parent and child processes. For the child process, this process occurs because the parent process needs to read the status of the child process. The process is removed from the process table once it has been completed using the wait system call.
21. What are hard links?
Answer: The hard link points directly to the physical file on the disk, not the pathname. Renaming or moving the original file will not break the link since the link refers to the file itself, not the path where the file is located.
22. How do you access partitions under Linux?
Answer: Linux assigns numbers to the end of the drive identifier. As an example, if the first IDE hard drives contained three primary partitions, they would be named or numbered as follows: /dev/hda1, /dev/hda2, and /dev/hda3.
23. What are filenames that are preceded by a dot?
Answer: Filenames that begin with a dot are usually hidden. These files may contain configuration information or hold important data. By hiding these files, they are less likely to be accidentally deleted.
24. How do you share a program across different virtual desktops under Linux?
Answer: To share a program across multiple virtual desktops, look for an icon that looks like a pushpin in the upper left-hand corner of the program window. When this button is pressed, the application will be "pinned" in place for all virtual desktops, so it appears in a consistent location.
25. What does a nameless (empty) directory represent?
Answer: The Linux file system is based on this nameless directory. This attachment links to all other directories, files, disks, drives, and devices.
26. What are Environmental variables?
Answer: In Linux, environmental variables affect the behavior of both the shell and other programs. Environmental variables are also called global shell variables.
27. What is Redirection?
Answer: Using redirection, data is directed from one output to another. Another use is to direct output to another process as an input.
28. How do you switch from one desktop environment to another, such as switching from KDE to Gnome?
Answer: Just log out of the graphical user interface if you have these two environments installed. Enter your login ID and password at the login screen, and then select the session type you wish to load. Until you change it, this choice will remain your default.
29. Is it possible to use shortcuts for a long pathname?
Answer: You're right, there is. The TAB key can be used to expand filenames using a feature called filename expansion. Specifically, if you have a path named /home/iceman/assignments, you would type as follows: /ho[tab]/ice[tab]/assi[tab] . This approach, however, is predicated on the path being unique and your shell supporting this function.
30. What is the grep command?
Answer: The Grep command is a pattern-based search command. As part of the command line, it uses options and parameters to determine how to search the required file output.
31. What are the contents of /usr/local?
Answer: Locally installed files are contained in it. In environments where files are stored on the network, this directory is crucial. Locally-installed files are found at /usr/local/bin, /usr/local/lib, etc.). Secondly, this directory is used to store software packages that are installed from the source or that are not included with the distribution.
32. How do you insert comments in the command line prompt?
Answer: # is typed before the comment text to create a comment. This tells the shell to ignore everything that follows. As an example, "# This is just a comment which will be ignored by the shell."
33. What could be the problem when a command that was issued gave a different result from the last time it was used?
Answer: Getting different results from what seems to be the same command can be caused by case sensitivity issues. Due to the case sensitivity of Linux, a command previously entered might have been entered differently from the present one. For instance, it is more accurate to type ls instead of LS to list all files in the directory. In either case, typing LS will result in a message indicating no program by that name exists, or you will receive a different result if a program of that name performs another function.
34. How do you terminate an ongoing process?
Answer: It is possible to identify each process in the system by its unique process id. To terminate a process, use the kill command followed by the pid. Use kill 0 to terminate all processes at once.
35. What is command grouping and how does it work?
Answer: Parentheses can be used to group commands. In this example, if you want to send the current date and time along with the contents of a file named OUTPUT to a second file called MYDATES, you can use the command grouping: (date cat OUTPUT) > MYDATES.
36. How do you execute more than one command or program from a single command line entry?
Answer: If you want to combine several commands or programs, separate them with semicolons. Such a series of commands can be entered in a single entry, for example:
ls –l cd .. ls –a MYWORK which is equivalent to 3 commands: ls -l cd.. ls -a MYWORK
Note: These will be executed sequentially, according to the order specified.
37. Does the Alt+Ctrl+Del key combination work in Linux?
Answer: Yes. It works the same way as Windows.
38. Why do developers use MD5 options on passwords?
Answer: Since MD5 is an encryption method, it is used to encrypt passwords before they are saved.
39. How to delete information from a file in vi?
Answer: You can delete information from vi editors using the following commands.
- x deletes the current character.
- The dd command deletes the current line.
40. How to exit from vi editors?
Answer: To exit the vi editors, use the following commands.
- :wq terminates the VI by saving the current work.
- :q! terminates the VI without saving the current work.
41. What are the modes used in VI editor?
Answer: Vi Editor has three types of modes:
- Regular mode or command mode
- Insertion mode or edit mode
- Replacement mode or Ex-mode
42. How to create a new file or modify an existing file in vi?
Answer: To create a new file or modify an existing file in vi, you can use the
vi filename command.
43. What is Samba? Why is it used?
Answer: Samba is an open-source software suite. It runs several different Operating systems such as OpenVMS, IBM, etc. By providing Microsoft SMB support, Samba connects Linux machines to Microsoft network resources.
44. What is the difference between soft and hard mounting points?
Answer: With soft-mount, when the client cannot connect to the server, it gives an error report and closes the connection, whereas in the hard mount, if the client cannot access the server, the connection hangs; and once the system is up, it tries again.
45. What are the advantages of using NIC teaming?
Answer: NIC (Network Interface Card) teaming offers the following advantages:
- Increases uptime
- Load Balancing
46. Why /etc/resolv.conf and /etc/hosts files are used?
/etc/resolv.conf: This is used to configure DNS name servers since it contains the details of your DNS server, i.e., your nameserver. The DNS server then resolves the hostname of the IP address.
/etc/hosts: Any hostname or domain name can be mapped to its relevant IP address using this command.
47. Name default ports used for DNS, SMTP, FTP, SSH, DHCP, and squid.
|20 (Data transfer), 21 (Connection established)
|67/UDP (dhcp server), 68/UDP (dhcp client)
48. Name three standard streams in Linux.
Answer: In Linux, standard streams are essentially I/O (Input/Output) communication channels between a program and its environment. The Linux environment uses three standard streams for input and output. Linux has three standard streams:
- Standard Input (stdin)
- Standard Output (stdout)
- Standard Error (stderr)
49. What is SSH? How can we connect to a remote server via SSH?
Answer: SSH (Secure Shell) is a protocol that is used to connect to remote servers and systems, enabling two systems to communicate securely. Linux servers are typically accessed using this method. Since it transmits data over encrypted channels, security is considered to be high. SSH requires a domain name and an IP address to connect to a remote server.
50. What is the difference between BASH and DOS?
BASH (Bourne Again Shell): Based on the Bourne shell found on UNIX systems, it's a powerful command shell and scripting language. Multi-OS compatibility and regular updates assure that the software remains relevant. Shell scripts allow it to read and execute commands from files.
DOS (Disk Operating System): This is an operating system that runs from a hard drive. It was the first operating system for IBM-compatible computers. Using the command line, users can provide instructions in the form of commands.
If you have made it this far, then certainly you are willing to learn more about Linux. Here are some more resources related to Linux that we think will be useful to you.