17 October, 2020
Categories of Linux Interview Questions
Ans. Linux is an Open-Source Operating System first introduced by Linus Torvalds. It is based on UNIX and it is available freely. It can be executed on different hardware platforms such as Intel, HP, MIPS, Motorola, SPARC, IBM, etc.
Ans. Major components in the Linux operating system are:
Ans. Using the command ‘cat /proc/net/bonding/bond0,’ we can check what mode is enabled and what LAN cards are used in this bond. In this example, we have one bond interface. However, we can have multiple bond interfaces like bond1, bond2, and so on.
Ans. Kernal essentially refers to that core component of the PC working framework that gives fundamental administrations to alternate parts and in addition connects with client summons. With regards to 'Linux Kernal, it is referred to as low-level system software providing an interface for user-level interactions.
Linux Kernal is considered as free and open-source programming which is fit for managing hardware resources for the clients. As it is released under General Public License (GPL), it winds up legal for anybody to alter it.
Ans. LINUX is used widely because it is completely different from other operating systems with something extra i.e. some additional features
Ans. GUI stands for the Graphical user interface. GUI is considered as the most attractive and user-friendly because it consists of the usage of images and icons.
Ans. CLI stands for Command Line Interface. It is a way for humans to interact with computers and is also known as a Command-line user interface.
Inclined to build a profession as Linux Developer? Then here is the blog post on, explore Linux Training
Ans. The maximum length for any filename under Linux is 255 characters.
Ans. Add following entry in /etc/fstab LABEL=/home /home ext3 acl 1 2 Now remount /home partition with acl option. mount -t ext3 -o acl /dev/sda3 /home
Ans. # mke2fs -t ext4 /dev/DEV
Ans. By default, the main system log is ‘/var/log/messages’. This file contains all the messages and the script written by the user. By default, all scripts are saved in this file. This is the standard system log file, which contains messages from all system software, non-kernel boot issues, and messages that go to ‘dmesg’. dmesg is a system file that is written upon system boot.
Ans. When you select only a portion of your file hierarchy or a single partition to back up, it is called partial backup.
Ans.
LINUX | UNIX |
LINUX is an open-source free operating system used in the functioning of computer hardware & software, system application, game development etc. | UNIX is also an operating system mostly used in internet servers, HP, intel etc. |
LINUX is available in both the versions- freely downloaded and distributed as well as priced minimally. | UNIX comes in different versions with different price structures. |
Linux can be easily used by anyone such as web developers, software engineers, home users, etc. | UNIX is developed to be generally used for servers, mainframes, and workstations. |
The file support system in LINUX comprises Ext2 to Ext4, Xfs, Jfs, FAT, Btrfs, etc. | The file support system in UNIX consists of gpfs, jfs hfs, etc. |
In LINUX, BASH (Bourne Again Shell) serves as the Linux default shell i.e. text-mode interface that can be executed on multiple command-line interpreters. | Bourne shell acts as the text mode interface that is compatible with multiple other interfaces including BASH. |
LINUX comprises two GUIs, Gnome and KDE. | In UNIX, the Common desktop environment serves as a GUI. |
Examples: Fedora, Red Hat, Debian, Ubuntu, etc. | Examples: Linux, Solaris |
Ans. In Linux, commands are case-sensitive, and more often than not they are entirely in lowercase. Items that are surrounded by brackets ([]) are optional. You will more than likely use at least some of these commands every time you log into a Linux system. Become familiar with these commands because they can get you pretty far in a short amount of time.
Ans. Automatic or batch processes are not connected to a terminal. Rather, these are tasks that can be queued into a spooler area, where they wait to be executed on a FIFO (first-in, first-out) basis. Such tasks can be executed using one of two criteria:
Ans. The low-level system software is referred to as the Linux kernel. It is mainly used to allocate resources and to provide a medium for the user interface.
Yes, it is possible as well as legal to edit Linux Kernel. Since Linux comes under the General Public License (General Public License), it can be edited and modified by the end-users.
Ans. BASH refers to Bourne Again SHell. It is a replacement of the initial Bourne shell represented by/bin/sh. And it is created by Steve Bourne. It is the better version of the previous and original bourne shell as it contains unique additional features that are easy to use. Later it got adopted as a default shell script for most of the systems operating Linux.
Ans. LILO is a term given to Linux LOader. It loads the Linux Operating System into the system’s main memory for execution. Mostly all the computers come with inbuilt boot loaders in some of the versions of Mac OS or windows. For using Linux OS, a special boot loader needs to be installed in the system and one such boot loader is LILO. One of the major advantages of using this boot loader is that it can boot Linux OS really fast.
Ans. Some of the common Shells that are used in Linux are
Ans. It is a space that temporarily stores concurrent executing programs in Linux. When RAM has a shortage of enough space to store the programs that are executing in a system, then swap space comes into action.
Ans. There are many reasons why LINUX is preferred over other operating systems. Some of them are listed below.
Ans. It is the primary account similar to a system administrator that controls all the functioning in the system. It is a default account that gets loaded whenever the Linux is set up. Some of the functions performed by the root account are:
Ans. In open-source, software including the source code is distributed without any cost to the end-users. People can customize the source code to customize and add features of their choice. They can even debug the source code if any error creeps in. The whole community can be benefited with enhanced features as the people can again distribute it freely after customizing it.
Ans.
Sl. no. | BASH | BASH |
1. | Commands used for different functions are case-sensitive. | Commands used for different functions are not case-sensitive. |
2. | (‘/’ forward slash) in BASH is used to separate directories. (” backslash) is used as an escape character. | (‘/’ forward slash) in DOS is used as a command argument delimiter. (” backslash) is used as a directory separator. |
3. | A naming convention is followed in which 8 characters are fixed for file name postfixed with 3 characters for the extension. | A naming convention is not followed |
Ans. GNU being a free software movement provides several advantages as it gives the flexibility to modify the programs according to their use and convenience. It is also allowed to redistribute the modified copies of the software for free and release it for the public to use it.
Ans. The command prompt is found in the default shell and to open it Ctrl-Alt-F1 is pressed. This will start the command-line interface (CLI) from which commands can be entered and executed.
Ans. Generally, the size of the swap partition is twice the size of the physical memory present in the system. If it is not possible to have this size, then the minimum required size for a swap partition is the amount of memory present in the system
Ans. This is a special feature which is very useful for the users who enhance the physical boundaries of a screen to a larger extent. With a virtual desktop, a virtual screen is created that can expand the normal screen of the system. A virtual desktop can be implemented by using 2 ways
Switching Desktops
With switching desktops, distinct virtual desktops can be created to run programs. Each virtual desktop acts as a separate desktop and programs executing on these desktops can only be accessed by the users who are using that particular virtual desktop
Oversized Desktops
It does not provide distant desktops but lets the user scroll over a desktop that is expanded and is larger in size than the desktop having a normal physical screen.
Ans. Symbolic links are the same as shortcuts in Windows and they point to files or directories and programs. It provides instant access to the desired directories or files without going to the full pathname.
Ans. Daemons are those computer programs that run as a background process to execute those functions that are not there in the base Operating System. They are used to run the services in the background so that they can not be directly controlled by the end-users. They are also used to handle periodic requests so that these requests can be sent to the appropriate programs for implementation.
Ans. Only system administrators or file owners can grant or change the access permissions in Linux. Permissions are granted using the chmod command. + symbol is used to add permission and – symbol is used to deny permission, followed by any of these letters: u (user), o (others), g (group), an (all), r (read), w (write) and x (execute). For instance, the command chmod u+rw FILE23.TXT is used to grant read and write access to the file FILE23.TXT, which is assigned to users.
Ans. The process states in Linux are:
Ans. In Linux, numbers are assigned as a suffix to the drive identifier. For instance, the first IDE hard drive had three primary partitions, will be written as name/number just like /dev/hda1, /dev/hda2, and /dev/hda3.
Ans. Grep is the term used for Global Regular Expression Print. It is used to search for a text expression in a file by matching the patterns based on a regular expression.
It follows the following syntax
Syntax: grep [text options] pattern [filename]
For Example:
$ grep -c "shell script" inlinux.txt
This command will print the count of the word “shell script” in the “inlinux.txt” file.
Ans. Hard links are the links that point directly to the file and not to the pathname. It means even if the file is renamed or moved from one location to the other, the link will remain the same as the link is for the file and not for the path where the file is located.
Ans. Process management system calls are:
Ans. The ls command lists down all the files in a particular directory. The syntax for using this command is:
$ ls
For instance: The command to list all the files in the tutorial directory will be as follows:
$ ls tutorial/
Different options can be used with the ls command to provide extra information about the file/folder from where information needs to be fetched. The options are:
Ans. Generally, all the hidden files are preceded by a dot. These files hold important or setup info as they can be configuration files. Keeping these files as hidden makes them secure from being accidentally deleted.
Ans. The redirection operator is used when there is a need to use the output of one command as an input to the other command or file. It is generally used in 2 ways
‘>’ – this operator overwrites the existing data in the file or makes a new file.
‘>>’ appends the new data at the end of the file or makes a new file.
So in simple words, in this ‘>’ redirection operator, the data in the file is overwritten and in this ‘>>’ redirection operator, the data is appended.
Ans. Yes, it is possible to execute several commands from a single command line entry by separating them using a semicolon symbol. For instance: Consider the example below in which a series of commands are issued from a single entry.
ls –l cd .. ls –an EXAMPLE of having 3 commands from the single line: ls -l cd.. ls -an EXAMPLE
Ans. An archived file can be created or extracted by using the tar command in Linux. For instance: to extract all the files from the archive ‘example.tar.gz’, the following command will be used:
$ tar -xvzf example.tar.gz
To create an archive of all the file stored in /home/linux/, the following command can be used:
$ tar -xvzf filename.tar.gz
where c refers to create an archive, x refers to extract, v refers to verbose and f refers to file
Ans. For sharing the programs across different virtual desktops, press the button in the upper left-hand corner of a window which appears to be a pushpin. It will "pin" that application thus making it visible at the same position on the physical screen in all virtual desktops.
Ans. A Latch is a binary storage device that stores the file temporarily and is controlled by a timing signal with the value being either 0 or 1. It has two stable states. The high output state denotes 1 and a low output state denotes 0. If the power is on, it can store 1 bit of data.
Ans. In Linux, an empty directory acts as the nameless base of the file system. It serves as an attachment for all other files, directories, devices, and drives.
Ans. It is a single-chip device that is used to execute commands. It fetches, decodes, and then decodes the instructions from the memory. The basic functions carried out by microprocessor are:
basic mathematical operations such as add, subtract, multiply, and divide
moving data from one place to another
decision making based on the conditions and then moving on to new instructions based on those decisions.
Ans. The pwd command refers to the print working directory. It displays the pathname of the directory which is currently in use.
For instance: If we will write the below command
Pwd
The following output will be generated:
/home/ajay12/myDir
Ans. Regular Expressions in Linux are used to search for options with specified patterns. Some commands used with regular expressions are sed, tr,vi and grep.
Some symbols used with Regular Expressions are:
. | To match any character |
$ | To match the end of the String |
^ | To match the beginning of the String |
It is used to depict special characters | |
* | To match zero or more than one characters |
? | It is used to match exactly one character |
Ans. Considering that these two desktop environments are already installed, just log out from the current session through the user interface. Then again login from the login screen by entering the ID and password and choose the session type you wish to continue with. This will remain the default desktop environment until you change it to some other environment.
Ans. Linux being a case sensitive language, it can alter the output if every character is not encoded as it is including the uppercase and lowercase letters. For instance- CD, cd, and Cd will produce different outputs as these are three different commands. If a command is written in lowercase where it should be in uppercase, it will generate different results.
Ans. Minimum 2 partitions are required to install Linux. In one partition, all the local files are stored including configuration files of the OS, application files and services along with user files. The second partition is used as Swap Space which is an extended memory for RAM in Linux.
Ans. Environmental variables are also known as global shell variables. They are global settings responsible for controlling the shell’s function along with other Linux programs.
Ans. Shortcuts can be created by using a feature called filename expansion in which the TAB key is used for this purpose. The condition is that the pathname should be unique and the shell which is in use should support this feature. For instance, pathname /home/shell/example directory, will be written as follows: /ho[tab]/she[tab]/exa[tab].
Ans. Vi editor uses 3 modes for its functioning
Ans. It works similarly as in windows to restart a system. The only difference is that the reboot starts immediately in Linux after striking this key combination without giving any notification or confirmation message.
Ans. This directory holds locally installed files and is mainly used in the environments where files are generally stored in a network. They are used for those software packages that are installed from the source or software that are not official to use. Local files normally go to /usr/local/bin, /usr/local/lib etc. kinds of directories in Linux.
Ans. Linux distributors are often called Distros. Different parts of LINUX such as the kernel, graphical programs, system environment etc. are developed and distributed by different organizations. Distros assemble these parts and compile them in an operating system that is ready to be installed in a system for use. There are more than six hundred Linux distributors in the market but some of the well-known distributors are
Ans. Comments are always followed by a # symbol in Linux. From this symbol, shell understands that this is a comment and not a command. Shell completely ignores the content which is followed by # symbol. For instance "# Comment is followed by this symbol and not the command."
Ans. It is important to determine the total memory used by different programs in Linux in order to analyze whether the resources and the server is being used adequately by the users or not. Below are some of the methods to find out the memory in use.
Free command: Memory usage can be checked by this simple command. For instance, ‘$ free –m’, in this command’ displays all the data in MBs.
Vmstat: With this command, the memory usage statistics can be known. For instance, ‘$ vmstat –s’
/proc/meminfo: Memory in use can also be known by reading the file /proc/meminfo file. For instance, ‘$ cat /proc/meminfo’
Top command: Total memory which is in use along with the RAM usage can be determined by using this command.
Htop: Memory usage along with other useful details can be displayed by using this command.
Ans. Every process has a unique id known as pid in Linux. Kill command followed by pid is used to terminate a process. To terminate all the processes in one go, kill 0 is followed by pid.
Ans. Parentheses can be used to group commands in Linux. For instance, To send the recent date and time along with a file named EXAMPLE to a second file named GROUPING, command grouping can be applied by using this command (date cat EXAMPLE) >GROUPING
TekSlate
TekSlate is the best online training provider in delivering world-class IT skills to individuals and corporates from all parts of the globe. We are proven experts in accumulating every need of an IT skills upgrade aspirant and have delivered excellent services. We aim to bring you all the essentials to learn and master new technologies in the market with our articles, blogs, and videos. Build your career success with us, enhancing most in-demand skills .