Introduction
Linux is an open-source Unix-like operating system-based family on the Linux kernel, and the OS kernel was first published on 17 September 1991 by Linus Torvalds. Typically, Linux is packaged as the Linux distribution, which contains the supporting libraries and system software and kernel, several of which are offered by the GNU Project. Several Linux distributions use the term “Linux” in the title, but the Free Software Foundation uses the “GNU/Linux” title to focus on the necessity of GNU software, causing a few controversies.
Famous Linux distributions are Ubuntu, Fedora Linux, and Debian, the latter of which is composed of several different modifications and distributions, including Xubuntu and Lubuntu. Commercial distributions are SUSE Linux Enterprise and Red Hat Enterprise Linux. Desktop distributions of Linux are windowing systems like Wayland or X11 and desktop environments like KDE Plasma and GNOME.
Explore fundamental Linux interview questions and expert answers to enhance your understanding of key concepts. Gain insights into command-line operations, file system navigation, user management, and essential troubleshooting. Whether you’re a beginner or seasoned professional, these Linux interview questions cover a spectrum of topics to help you prepare and excel in Linux-related job interviews.
Basic Linux Interview Questions
Linux is an operating system, which is based on Linux Kernel. It is an open-source operating system where it can run on different hardware platforms. It provides a free and low-cost operating system for users. It is a user-friendly environment where they can easily modify and create variations in the source code.
2. Who invented Linux ? Explain the history of Linux ?
Linux Torvalds created Linux. Linus Torvalds was a student at the University of Helsinki, Finland in 1991. He started writing code on his own to get the academic version of Unix for free. Later on, it became popular as Linux Kernel.
3. What is the difference between Linux and Unix ?
Here is the difference between Linux and Unix – mentioned below And some other differences.
Linux | Unix |
Both paid and free distributions are available. | Different paid structures for different levels of Unix. |
Linux primarily uses GUI with an optional command-line interface | Unix uses the command-line interface |
Linux OS is portable and can be executed on different hard drives | Unix OS is not portable. |
Linux is developed by a worldwide Linux community. | Unix is developed by AT&T developers. |
Linux is free. And it is download through the internet under GNU licenses. | Most Unix Like Operating Systems is not free. |
Linux is used at home-based PC’s, phones, etc. | Unix is used in server systems. |
Linux is a Unix clone. But if you consider Portable Operating System Interface (POSIX) standards then Linux can be considered as UNIX.
Linux Is Just Kernal
All Linux distributions include GUI system, GNU utilities, installation & management tools, GNU c/c++ Compilers, Editors (vi), and various applications like OpenOffice, Firefox.
UNIX operating systems are considered a complete OS as everything come from a single vendor.
Security And Firewall
Linux comes with an open-source Netfilter and IPTables-based firewall tool to protect your server and desktop from crackers and hackers. UNIX operating systems come with their own firewall products.
Backup And Recovery
UNIX and Linux come with their own set of tools for backing up data to tape and other backup media. However, both Linux and UNIX share some common tools such as tar, dump/restore, and cpio, etc.
4. What is the core of the Linux operating system ?
The core of the Linux operating system is the Linux kernel. The Linux kernel is the foundational component of the operating system that interacts directly with the hardware of a computer system and provides essential services and functionalities to higher-level software.
The kernel is responsible for managing system resources, such as the CPU (central processing unit), memory, and input/output devices. It provides the necessary abstractions and interfaces for applications and other software components to interact with the hardware effectively.
The Linux kernel is an open-source project that was initially created by Linus Torvalds in 1991. It has since been developed collaboratively by a large community of developers worldwide. The kernel itself is written primarily in the C programming language and is released under the GNU General Public License (GPL), which allows anyone to view, modify, and distribute the source code. This open nature of the Linux kernel has contributed to its widespread adoption and the growth of the Linux ecosystem.
Linux kernel is the heart of the operating system. It acts as a bridge between software and hardware. If Software requests the hardware, then the kernel delivers the data between software and hardware.
For example, if you want to play a song you should launch your default player, it requests the kernel to play a song, now the kernel will contact the hardware to seek the permissions or to seek the hardware components like if you plugged in any headset to the device. Most Android phones use Linux kernels.
Yes, the kernel can edit, because it is released under General Public License.
Bash is a Unix shell and command processor written by Brian Fox for the GNU project. It is free software and acts as a replacement for Bourne Shell. It is an interpreted and not compiled process which can also be run in the terminal window.
This allows users to write commands and cause actions. Bash is capable of reading commands from shell scripts.
LILO means Linux Loader is a boot loader that is used for the Linux operating system. Most of the Linux Operating systems use LILO, to boot the operating system into main memory to start the operations.
CLI means Command language Interpreter. It interacts with the computer program, where the user issues command in the form of text lines. It Interacts with the computer terminals also, the interface accepts the text lines and converts them as a command to the operating system.
9. What is the advantage of Open Source ?
Linux was one of the first open-source technologies, many programmers added software that completely open to the users, which means you can download the file and change the code as you like. It has a wide range of options for users and increased security.
10. What is the disadvantage of Open Source ?
Disadvantages of Open Source Operating System mentioned below
- Difficulty of use
- Compatibility Issues
- Liabilities and warranties
- Hidden costs
Shell is a computer program that acts as an interface between the user and the kernel. Users can communicate with the kernel by writing programs, commands, and scripts on the shell. It accepts human-readable commands and converts them into kernel-understandable language.
12. How many types of Shells are there in Linux ?
They are five Shells in Linux:
- C Shell (csh): It is like C syntax and provides spelling checking and job control.
- Korn Shell (ksh): This is a high-level programming language shell.
- Z Shell (Zsh): It provides some unique nature like it observes login/logout watching, file name generating, startup files, and closing comments.
- Bourne Again Shell (bash): It is the default to Linux distributions.
- Friendly Interactive Shell (Fish): It provides web-based configuration, auto-suggestions, etc.
13. What are the basic components of Linux ?
Basic components of Linux
- Kernel: It is the core component of Linux, it acts as an interface between software and hardware.
- Shell: It acts as an interface between the user and the Kernel.
- GUI: It stands for Graphic User Interface, which is another way for the user to interact with the system. But it is unlike images, buttons, text boxes for interaction.
- System Utilities: These are the software functions that allow users to manage the computer.
- Application Programs: A set of functions designed to perform a set of tasks.
14. How do you open a command prompt when issuing a command ?
Launch your terminal by pressing CTRL+ALT+T or by giving terminal in the menu search bar.
Swap Space is used when the physical Ram memory is running out. It will move the Ram inactive pages to the swap space. It can consider in the form of a dedicated swap partition or swap files.
GUI means Graphical User Interface. It is a human-computer interface that uses windows, images, icons, and menus which can be manipulated by using a mouse. Most of the modern applications in electronic gadgets communicate with the user through GUI. GUI is a combination of graphical and textual interaction that uses buttons, menus, message boxes, etc.
17. Explain File Permissions types in Linux ?
Linux file permissions – Each file or directory has 3 permissions
They are
- Read: It refers to only they can read the file.
- Write: It refers that they can write the file or modify the file of a directory.
- Execute: It affects the user’s capability to execute the file or to view the file of a directory.
18. What are the environmental variables ?
They are dynamic values that affect the process of programs on a computer. They exist in every operating system and their types may vary. They can be created, edited, saved, and deleted and they also give information about the system’s behavior.
19. What are the symbolic links ?
It will be redirected to another file using its path. Target files do not contain any data. Symbolic links redirect to another entry somewhere in the file system. If the target file is deleted, the link to that file is removed, but not the file.
A hard link is another name for an existing file on Linux. We can create so many numbers of hard links, for any file. They can create links for other hard links.
Redirection can be defined as changing the standard input and output devices. To redirect metacharacters are used, you can redirect the file or program.
A Daemons is a background process that accepts requests for service from other computers, most of operating systems use daemons in other forms.
23. Describe the root account ?
The root is the user name, which default has access to all files and commands. The root user can do many things, but an ordinary user cannot do like installing software, changing file permissions, etc.
24. Explain the virtual desktop ?
Virtual Desktop is a user interface when you are facing the problem of how to manage multiple windows on your desktop, virtual desktop serves as an alternative. Virtual desktop stores remote server and allow you to use one or more programs on a clean slate.
25. What are the different modes when using the vi editor ?
There are three kinds of modes in vi editors. They are
- Command Mode/ Regular Mode
- Insertion Mode/Edit Mode.
- Ex Mode/ Replacement Mode.
26. What are inode and process id ?
The inode is a unique name given to each file and the process id is a unique name given to each process.
27. What are the Process states in Linux ?
Five process states in Linux. They are
- New/ Ready: A new process is created and ready to run.
- Running: The process is being executed.
- Blocked/ Wait: The process is waiting for input from the user.
- Terminated/ Completed: The process completed the execution or terminated by the operating system.
- Zombie: The process is deleted, but still the information regarding the process exists in the process table.
28. Explain Process Management System Calls in Linux ?
The process management system calls in Linux:
- fork(): Used to create a new process.
- exec(): Execute new process.
- wait(): wait until process execution.
- exit(): exit from the process.
System calls to get the Process id :
- getpid(): to find the unique process id.
- getppid(): to find the unique parent process id.
29. Explain File Permission groups in Linux ?
There are three user-based permission groups for each file and directory.
They are:
- Owner: Owners only will have to access the file or directory, they will not impact the actions of other users.
- Group: These permissions apply only to the group, that has been assigned to the file or directory. They will not impact the actions of other users.
- All Users: These permissions are applied to all users on the system.
30. What Is a File system in Linux ?
Linux file system stores and handles the data. Without a file system, it cannot know where the file starts from and where the file ends.
31. Explain different file system types in Linux ?
In Linux, there are many file systems:
Ext, Ext2, Ext3, Ext4, JFS, XFS, btrfs, ufs, autofs, devpts, ntfs and swap.
32. What is Kernel ? Explain its functions ?
A kernel is considered the main component of Linux OS. It is simply a resource manager that acts as a bridge between hardware and software. Its main role is to manage hardware resources for users and is generally used to provide an interface for user-level interaction. A kernel is the first program that is loaded whenever a computer system starts. It is also referred to as low-level system software.
Its other main functions include:
- Memory Management
- Process Management
- Device Management
- Storage Management
- Manage access, and use of various peripherals that are connected to the computer.
33. What are two types of Linux User Mode ?
There are two types of Linux user mode as given below:
- Command Line
- GUI
34. What do you mean by Shell Script ?
Shell Script, as name suggests, is a script especially written for shell. Here, script means programming language that is being used to control applications. It simply allows the execution of different commands that are entered in the shell. It generally helps you to create complex programs containing conditional statements, loops, and functions. It is very easy to debug, can simplify everyday automation processes, and is much quicker as compared to writing big programs.