Prepare From Top Linux Interview Questions And Answers
Tejasvee Sharma
Feb 17, 2022
In this post, we will cover a few Linux interview questions and their answers. So, let’s get started. In this article, we’ll answer some common Linux interview questions and provide examples of their answers. To prepare for your Linux interview these are the topics you’ll need to know about. The following are some common Linux interview questions and answers that can help you prepare for a job in this field.
About Linux: Linux is an open-source kernel that was created in 1991. Linus Torvalds, a Finnish computer science student, developed it. Today, Linux is used in a variety of devices and systems including servers, supercomputers, mainframes, mobile phones, tablets, and cars. It can be run on a wide range of hardware from processors built by MIPS and Intel to the SPARC processor used in Sun workstations.
Linux is a Unix-based operating system and is the most popular OS in the world. It was initially developed by Linus Torvalds. One of the key reasons that led to the creation of Linux was the need for a free OS for people who were unable to afford an OS like Windows or iOS, or a UNIX.
2. Differentiate between UNIX and Linux?
In the beginning, UNIX was proprietary software developed by Bell Labs. After several years, it became a market-ready OS which spawned many variations. Linux, by contrast, is free, open-source, and designed for general use by the masses.
3. What does BASH stand for?
BASH is an acronym for Bourne Again SHell, meaning that it was written by Steve Bourne as a replacement to the original Bourne Shell (/bin/sh), which was created by Richard M. Stallman. It contains a large collection of features taken from the original Bourne Shell, with many new features added for greater convenience and ease of use. Linux and its variants have adopted bash as the default shell, which was previously used by Solaris.
4. What do you mean by Linux Kernel?
The Linux kernel is software that controls all of the hardware resources of your computer. It also provides a user-level interface.
5. Explain LILO?
It is a boot loader program for Linux. It’s used primarily to load the Linux operating system into memory for its initial startup phase, allowing it to begin running in less time than conventional “sector style” methods could allow (the sector loading period required no disk access once loaded).
6. Explain swap space?
Swapping space is the amount of memory in RAM that Linux uses to keep track of the program states that are currently running at the same time. When a program can no longer run because there is not enough memory for it to run in, this error occurs.
7. What are the benefits of open source?
It’s easy to distribute your program under open-source licenses. This way developers can edit and test code for bugs that are found later on. They might even take an improved version of this software and freely share it. This is beneficial for everyone in the community.
8. Tell me the basic components of the Linux OS?
Like any other common operating system, Linux has a kernel, shells, and graphical user interfaces (GUIs), various application programs, and system utilities. Another advantage of Linux over other operating systems is that everything comes packaged with it. There is no need to go into the details when installing it.
9. Does having multiple desktop environments installed on your Linux machine help improve things?
Most Linux desktops are fairly capable and offer a standard user interface that works well without issues. It’s up to the user’s preference what desktop user likes best; however, both KDE and GNOME are quite usable. Not all programs run correctly on every platform. As a result, you need to decide whether to use it in one environment or another.
10. Differentiate between BASH and DOS?
The key differences between the BASH and DOS console lie in 3 areas:
DOS commands are not case sensitive while BASH commands are
Under DOS, / represent the command argument delimiter and \ represent the directory separator. Under BASH, / character represents a directory separator and \ represent as an escape character.
DOS uses a standard convention for naming files. A file name will be 8 characters long and contain a dot followed by 3 numbers. BASH follows no such convention.
11. Explain the importance of the GNU project?
Free software is often called Open Source or Open Source Software, and has become very popular due to its non-restrictive licensing. The Open Source philosophy encourages users to share modifications with others, which has made it extremely popular in recent years. Software packages are often upgraded and improved to become better and stronger over time.
12. Describe the root account.
The root account is like a system administrator account that lets you manage everything in the system. With this account, you can create users, configure access permissions, and set up operating modes. Every time you install Linux, it’s the default account.
13. What is CLI?
CLI stands for Command Line Interface. This interface provides a text-based syntax for instructing the computer with commands. The CLI command interface is more flexible, but the typical user (GUI user) doesn’t find flexibility in working it.
14. What is GUI?
A GUI is any kind of user interface that uses graphics. Users interact with computers using visual icons. Since user interaction with systems is aided by the use of graphical elements and their counterparts, it is very likely that modern computers will have additional color and image and icons within them to facilitate this process.
15. How do you open a command prompt when issuing a command?
To access the command prompt, press Ctrl+Alt+F1. It is there where your shell will be waiting for you with its command prompt. Once you’ve used that to launch a command, you can close that window and return to the graphical desktop by pressing Ctrl+Alt+F7.
16. How will you know how much memory Linux is using?
To check memory usage from a shell, use the “concatenate” command cat /proc/meminfo. This command gives you memory usage and a number of processes such as Mem: 64655360 is the amount of total RAM that Linux have to use. You can use the given command
17. What's the normal size of a swap partition in Linux?
The recommended size for a swap partition is 2X of your computer’s available physical memory. If it is not possible, the minimum size should be the same as the amount of memory installed.
18. Explain symbolic links?
The symbolic link is similar to a shortcut in Windows; however, they are different in nature. Symbolic links are a common feature in Linux systems and Unix systems. This also means that you will have access to the file you require without having to first travel through its entire pathname.
19. Does Ctrl+Alt+Del key arrangement work on Linux?
Yes, it does. Like Windows, you can press Ctrl+Alt+Del to restart the computer. However, you won’t get any confirmation message so the reboot is instantaneous.
20. How do you call the parallel port, into which devices like printers have been connected?
Under Windows, you would call the parallel port LPT port. Under Linux, you would call it /dev/lp. Under Linux, /dev/lp0, /dev/lp1, or /dev/lp2 can all refer to LPT1, LPT2 and LPT3 respectively.
21. Can drives such as hard drive and floppy drives be identified by a letter?
No. Linux assigns different names to disks and devices. A floppy disk is known as /dev/fd0, for example. IDE and EIDE drives are often referred to as /dev/hda, /dev/hdb, /dev/hdc, and so on.
22. Tell me the way to modify permissions in Linux?
The chmod command is used to change the access permission of a file or directory. Use + symbol to add permission or - symbol to deny permission and the following characters can be used: u (user), g (group), o (others), a (all), r (read), w (write), and x (execute). By default, if you give a file or directory with rw (for example: chmod go+rw FILE1.TXT) permission, anyone can read from it and write to it.
23. What serial ports names do you have on your Linux installation?
Serial ports have been named from /dev/ttyS0 to /dev/ttyS7. These are the same names used in Windows from COM1 to COM8.
24. How do I access a partition under Linux?
In Linux, the last four letters of the drive letter indicate the partition number. For example, hard drives that are in a system with three IDE-ports, have three primary partitions, all with the same letter assignments that would be named/number, /dev/hda1, /dev/hda2 and /dev/hda3.
25. Explain hard links?
A hard link points directly to the physical file on disk. When you move or rename a file on disk, it’s considered safe to make a hard link. The physical file is what the hard link refers to.
26. What is the maximum filename size in Linux?
The total length of a file name cannot exceed 255 characters in most cases. A filename may be longer than 255 characters if it contains both a path and the file name itself.
27. What are filenames that end with a dot?
Most file systems on the internet support the creation of hidden files, such as those containing configuration information for programs. Setting this file as hidden will make it less likely to be accidentally deleted.
28. Explain Virtual desktop.
You can choose to change all your windows in a similar way, or you can leave each window by itself. When you’re using a single application on your desktop, minimizing or restoring it only to get back to it takes up space. If you’re working with multiple applications simultaneously, creating virtual desktops allows you to avoid unnecessary desktop clearing.
29. How can you share an application between virtual desktops on Linux?
By clicking on the pushpin given at upper left-hand corner, you can bring up another desktop entirely. It pins any applications or windows in place across all virtual desktops at once.
30. What do empty directories represent?
The root directory in a Linux file system is usually called ‘.'. Every folder on the disk is owned by a different user, so each user can have its own directory. All Linux file systems include a hidden. It is a nameless base of the Linux file system that acts as an attachment for various directories, files, drives, and devices.
31. Explain daemon?
Daemons are programs that provide several useful functions that may not be available in the underlying operating system. Its duty is to listen for service requests and fulfill them as fast as possible. After the service is performed, the robot shuts itself off, then waits for additional requests.
32. How does one switch from one desktop environment to another such as switching from KDE to GNOME?
Once you have installed both of the above software, you can log out from the graphical interface. On the login screen, type your username and password. You can select the type of session you want to load. This is your default choice until you change it to something else.
33. What are the different permissions in Linux?
Linux permissions are divided into three different types, or access modes. These permissions are called rwx, -r-x, and -rwx for READ, WRITE, and EXECUTE permissions respectively. Read: users can only read the files or directory- Write: users can write on these files - Execute: users can run the file.
34. How does case sensitivity affect the way you use commands?
Commands are considered exact only each and every character is written as it is, including lowercase and uppercase letters. The difference in spelling between cd, cD, and CD all result in different commands. Commands entered with the wrong case are the cause of this problem.
35. Explain environmental variables?
Environmental variables govern the execution of any given Linux program. Another name for environmental variables is global shell variables.
36. What are the different modes of vi editor?
There are three modes of operation for vi: command mode, edit mode, and ex mode. Command mode lets you issue commands to the editor without entering any text. Edit mode is where you insert, delete, and alter text. Finally, ex mode provides you with a powerful set of commands for editing files.
37. Can shortcuts be used for a long file path?
In many Unix-like operating systems, filename expansion can be done by using a tab key after the file name, and the shell expands the whole string as one word. So, for example, the file /home/iceman/assignments is equivalent to /ho[tab]/ice[tab]/assi[tab]. This is only valid if the trail is distinct from other paths, and your shell can support this feature.
38. Explain redirection?
Data redirection is the transfer of data from one output or data stream to another. In addition, data redirecting can be used to direct an output as an input to another process
39. What does the grep command do
grep is a command-line tool for searching files for specific strings or patterns. To make it work you must specify how to locate the file by a combination of options and parameters when issuing the command.
40. What's the problem when the command that we just typed in, doesn't do what we expected?
If you get different results from the same exact command, you may have case sensitivity issues. Since Linux is case-sensitive, you’ll find yourself using commands that were entered in a different way than the way they’re written in your script. For example, to lists all files in the directory, you need to type ls command, and not LS. The LS command might have a different behavior depending on what program is installed on your computer.