Thursday 19 July 2018

Top 35 LINUX Interview Questions and Answers

Best Interview Questions on Linux:
All of us are aware of the fact that, for managing all the hardware resources of your laptop or desktop and for enabling proper communication between software and your computer hardware, there is one word without which software would not function i.e. ‘Operating System’ OS. Just like Windows XP, Windows 7, Windows 8, MAC; LINUX is such operating system.
LINUX is referred to as the most used operating system and is best known for its efficiency and fast performance. LINUX was first introduced by Linux Torvalds and is based on Linux Kernal.
It can run on different hardware platforms manufactured HP, Intel, IBM, etc.
In this article, we will see multiple Linux interview questions and answers which will not only help to prepare for interviews but will also help in learning all about Linux. Questions include Linux admin, Linux commands interview questions etc.

LINUX Interview Question and Answers

LINUX Interview Questions
Que 1) What do you understand by Linux Kernal? Is it legal to edit it?
Ans: ‘Kernal’ basically refers to that core component of the computer operating system that provides basic services for the other parts as well as interacts with user commands. When it comes to ‘Linux Kernal’, it is referred as low-level system software providing an interface for user-level interactions.
Linux Kernal is considered as free and open source software which is capable of managing hardware resources for the users. As it is released under General Public Licence (GPL), it becomes legal for anyone to edit it.
Que 2) Differentiate between LINUX and UNIX?
Ans:  Although there are multiple differences between LINUX and UNIX, enlisted below table covers all the major differences.
LINUXUNIX
LINUX is an open source software development and free operating system used for computer hardware & software, game development, PCs, etc.UNIX is an operating system which is basically used in Intel, HP, internet servers, etc.
LINUX has priced as well as freely distributed and downloaded versions.Different versions/flavours of UNIX have different price structures.
Users of this operating system could be anyone including home users, developers, etc.This operating system was basically developed for mainframes, servers and workstations except for OSX which is designed such that it can be used by anyone.
File support system includes Ext2, Ext3, Ext4, Jfs, Xfs, Btrfs, FAT, etc.File support system includes jfs, gpfs, hfs, etc.
BASH (Bourne Again Shell) is the Linux default shell i.e. text mode interface which supports multiple command interpreters.Bourne shell serves as the text mode interface which is now compatible with many others including BASH.
LINUX provides two GUIs, KDE and Gnome.Common desktop environment was created which serves as a GUI for UNIX.
Examples: Red Hat, Fedora, Ubuntu, Debian, etc.Examples: Solaris, All Linux
It provides higher security and has about 60-100 viruses listed till date.It is also highly secured and has about 85-120 viruses listed till date.
Que 3) Enlist the basic components of LINUX?
Ans: Linux operating system basically consists of 3 components which are enlisted below
  • Kernel: This is considered as the core part and is responsible for all major activities of Linux operating system. Linux Kernel is considered as free and open source software which is capable of managing hardware resources for the users. It consists of various modules and interacts directly with the underlying hardware.
  • System Library: Most of the functionalities of the operating system are implemented by System Libraries. These act as a special function using which application programs accesses Kernel’s features.
  • System Utility: These programs are responsible for performing specialized, individual level tasks.
Que 4) Why we use LINUX?
Ans: LINUX is used widely because it is completely different from other operating systems where every aspect comes with something extra i.e. some additional features. Some of the major reasons to use LINUX are listed below
  • It is an open source operating system where programmers get the advantage of designing their own custom OS
  • Software and the server licensing required to install Linux is completely free and can be installed on many computers as required
  • It has low or minimum but controllable issues with viruses, malware, etc
  • It is highly secured and supports multiple file systems
Que 5) Enlist the features of Linux operating system?
Ans: Following are some important features of LINUX operating system
  • Linux kernel and application programs can be installed on any kind of hardware platform and thus is considered as portable.
  • It serves the purpose of multitasking by serving various functions simultaneously.
  • It provides the security services in three ways namely, Authentication, Authorization, and Encryption.
  • It supports multiple users to access the same system resource but by using different terminals for operation.
  • Linux provides hierarchical file system and its code is freely available to all.
  • It has its own application support (to download and install applications) and customized keyboards.
  • Linux distros provide live CD/USB to their users for installation.
Que 6) Explain LILO?
Ans: LILO (Linux Loader) is the boot loader for Linux operating system to load it into the main memory so that it can begin its operations. Bootloader here is a small program that manages a dual boot. LILO resides in MBR (Master Boot Record).
Its major advantage is that it allows the fast bootup of Linux when installing in the MBR.
Its limitation lies in the fact that it is not possible for all computers to tolerate modification of MBR.
Que 7) What is Swap space?
Ans: Swap space is the amount of physical memory that is allocated for use by Linux to hold some concurrent running programs temporarily. This condition usually occurs when Ram does not have enough memory to support all concurrent running programs. This memory management involves the swapping of memory to and from physical storage.
There are different commands and tools available to manage the Swap space usage.
Que 8) What do you understand by Root account?
Ans: As the name suggests, it is like a system administrator account which gives you the ability to fully control the system. Root account serves as the default account whenever Linux is installed.Below mentioned functions can be performed by Root account
Below mentioned functions can be performed by Root account
  • Create user accounts
  • Maintain user accounts
  • Assign different permissions to each account created and so on..
Que 9) Explain virtual desktop?
Ans: When there are multiple windows available on the current desktop and there appears the problem of minimizing and maximizing windows or restoring all the current programs, there ‘Virtual Desktop’ serves as an alternative. It allows you to open one or more programs on a clean slate. Virtual desktops are basically stored on a remote server and serve the following benefits:
Virtual desktops are basically stored on a remote server and serve the following benefits
  • Cost savings as the resources can be shared and allocated as and when required.
  • Resources and energy are more efficiently used.
  • Data integrity is improved.
  • Centralized administration
  • Less compatibility issues.
Que 10) Differentiate between BASH and DOS?
Ans: The basic differences between BASH and DOS can be understood from the below table
Que 11) Explain the term GUI?
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. These images and icons are clicked and being manipulated by the users for the purpose of communication with the system.
Advantages of GUI:
  • Allows users to navigate and operate the software with the help of visual elements.
  • More intuitive and rich interface is possible to be created.
  • Less chances of occurrence of errors as complex, multi-step, dependent tasks are easily grouped together.
  • Productivity is enhanced with the means of multitasking as with a simple click of the mouse, the user is able to maintain multiple open applications and transitions between them.
Disadvantages of GUI:
  • End-users have less control over the operating system and file systems.
  • Although it is easier to use mouse and keyboard for navigation and controlling operating system, the whole process is a bit slow.
  • It requires more resources because of the elements that need to be loaded such as icons, fonts, etc.
Que 12) Explain the term CLI?
Ans: CLI stands for Command Line Interface. It is a way for humans to interact with computers and is also known as Command line user interface. It relies on textual request and response transaction process where user types declarative commands to instruct the computer to perform operations.
Advantages of CLI
  • Very flexible
  • Can easily access commands
  • Much faster and easier to use by expert
  • Does not use much CPU processing time.
Disadvantages of CLI
  • Learning and remembering type commands is hard.
  • Have to be typed precisely.
  • Can be very confusing.
  • Surfing web, graphics, etc are few tasks which are hard or impossible to do on the command line.
Que 13) Enlist some Linux distributors (Distros) along with its usage?
Ans: Different parts of LINUX say kernel, system environment, graphical programs, etc are developed by different organizations. LINUX Distributions (Distros) assemble all these different parts of Linux and give us a compiled operating system to be installed and used.
There are around six hundred Linux distributors. Let us see some of the important ones
  • UBuntu: It is a well known Linux Distribution with a lot of pre-installed apps and easy to use repositories libraries. It is very easy to use and works like MAC operating system.
  • Linux Mint: It uses cinnamon and mate desktop. It works on windows and should be used by newcomers.
  • Debian: It is the most stable, quicker and user-friendly Linux Distributors.
  • Fedora: It is less stable but provides the latest version of the software. It has GNOME3 desktop environment by default.
  • Red Hat Enterprise: It is to be used commercially and to be well tested before release. It usually provides the stable platform for a long time.
  • Arch Linux: Every package is to be installed by you and is not suitable for the beginners.
Que 14) How can you determine the total memory used by LINUX?
Ans: It is always required to keep a check on the memory usage in order to find out whether the user is able to access the server or the resources are adequate. There are roughly 5 methods that determine the total memory used by the Linux.
This is explained as below
  • Free command: This is the most simple and easy to use the command to check memory usage. For example: ‘$ free –m’, the option ‘m’ displays all the data in MBs.
  • /proc/meminfo: The next way to determine the memory usage is to read /proc/meminfo file. For example: ‘$ cat /proc/meminfo’
  • Vmstat: This command basically lays out the memory usage statistics. For example: ‘$ vmstat –s’
  • Top command: This command determines the total memory usage as well as also monitors the RAM usage.
  • Htop: This command also displays the memory usage along with other details.
Que 15) Explain the 3 kinds of file permissions under LINUX?
Ans: Every file and directory in Linux are assigned three types of owners namely ‘User’, ‘Group’, and ‘Others’. Find the three kinds of permissions defined for all the three owners
  • Read: This permission allows you to open and read the file as well as list the contents of the directory.
  • Write: This permission allows you to modify the contents of the file as well as allows adding, removing and renaming files stored in the directories.
  • Execute: User can access and run the file in the directory. You cannot run a file unless the execute permission is set.
Que 16) What is the maximum length for any file name under LINUX?
Ans: The maximum length for any filename under Linux is 255 characters.
Que 17) How permissions are granted under LINUX?
Ans: A system administrator or the owner of the file can grant permissions using the ‘chmod’ command. Following symbols are used while writing permissions

  • ‘+’ for adding permission
  • ‘-‘ for denying permission
Permissions also includes single letter which denotes
u : user; g: group; o: other; a: all; r: read; w: write; x: execute.
Que 18) What are the different modes when using the vi editor?
Ans: The 3 different kinds of modes in vi editor are enlisted below
  • Command Mode/ Regular Mode
  • Insertion Mode/ Edit Mode
  • Ex Mode/ Replacement Mode
Que 19) Explain the Linux Directory commands along with the description?
Ans: Enlisted below are the directory commands along with descriptions
  • pwd: It is a built-in command which stands for ‘print working directory’. It displays the current working location, working path starting with / and directory of the user. Basically, it displays the full path to the directory you are currently in.
  • Is: This command list out all the files in the directed folder.
  • cd: This stands for ‘change directory’. This command is used to change to the directory you want to work from the present directory. We just need to type cd followed by the directory name to access that particular directory.
  • mkdir: This command is used to create an entirely new directory.
  • rmdir: This command is used to remove a directory from the system.
Que 20) Differentiate between Cron and Anacron?
Ans: Difference between Cron and Anacron can be understood from the below table
CronAnacron
Cron allows the user to schedule tasks to be executed every minute.Anacron allows the user to schedule tasks to be run either on a specific date or the first available cycle after the date.
Tasks can be scheduled by any normal user and are basically used when tasks have to be completed/executed at a particular hour or minute.Anacron can be used only by super users and is used when a task has to be executed irrespective of hour or minute.
It is ideal for serversIt is ideal for desktops and laptops
Cron expects the system to be running 24x7.Anacron does not expects the system to be running 24x7.
Que 21) Explain the work of Ctrl+Alt+Del key combination on Linux operating system?
Ans: The work of Ctrl+Alt+Del key combination on Linux operating system is same as is for Windows i.e. to restart the system. The only difference is that there is no confirmation message displayed and a system is rebooted directly.
Que 22) What is the role of case sensitivity in affecting the way commands are used?
Ans: Linux is considered as cases sensitive. Case sensitivity can sometimes serve as the reason for displaying different answers for the same command as you might enter different format of commands each time. In terms of case sensitivity, the command is same but the only difference occurs with regard to uppercase and lowercase letters.
For example cd, CD, Cd are different commands with different outputs.
Que 23) Explain Linux Shell?
Ans: For executing any commands user uses a program known as the shell. Linux shell is basically a user interface used for executing the commands and communicating with Linux operating system. Shell does not use the kernel to execute certain programs, create files, etc. There are several shells available with Linux which includes the following
  • BASH (Bourne Again SHell)
  • CSH ( C Shell)
  • KSH ( Korn Shell)
  • TCSH
There are basically two types of Shell commands
  • Built-in shell commands: These commands are called from the shell and executed directly within the shell. Examples: ‘pwd’, ’help’, ’type’, ’set’, etc.
  • External/ Linux commands: These commands are totally shell independent, have their own binary and are located in the file system.
Que 24) What is a Shell script?
Ans: As the name suggests, the shell script is the script written for the shell. This is a program file or says a flat text file where certain Linux commands are executed one after another. Although the execution speed is slow, Shell script is easy to debug and can also simplify everyday automation processes.
Que 25) Explain the features of Stateless Linux server?
Ans: The word stateless itself means ‘no state’. When on a single workstation, no state exists for the centralized server, and then the stateless Linux server comes into the picture. Under such conditions, scenarios like keeping all the systems on the same particular state can occur.
Some of the features of Stateless Linux server are explained below
  • Stores prototype of every machine
  • Store snapshots
  • Store home directories
  • Uses LDAP which determines the snapshot of state to be run on which system.
Que 26) What are system calls used for process management in Linux?
Ans: Process management in Linux uses certain system calls. These are mentioned in below table with a brief explanation
System callsExplanation
Fork()To create a new process
Exec()For execution of a new program
Wait()To make the process to wait
Exit()Exit/terminate the process
Getpid()To find the unique process id
Getppid()To find the parent process id
Nice()To bias the currently running process property
Que 27) Enlist some Linux file content commands?
Ans: There are many commands present in Linux which are used to look at the contents of the file.
Some of them are enlisted below
  • head: Displays the beginning of the file
  • tail: Displays the last part of the file
  • cat: Concatenate files and print on the standard output.
  • more: Displays the content in pager form and is used to view text in the terminal window one page or screen at a time.
  • less: Displays the content in pager form and allows backward and single line movement.
Que 28) Explain Redirection?
Ans: It is well known that every command takes an input and displays an output. Keyboard serves as the standard input device and screen serves as the standard output device. Redirection is defined as the process of directing data from one output to another or even cases exist where output serves as an input data for another process.
There are basically three streams available in which input and output of Linux environment are distributed.
These are explained as below
  • Input Redirection: ‘<’ symbol is used for input redirection and is numbered as (0). Thus it is denoted as STDIN(0).
  • Output Redirection: ‘>’ symbol is used for output redirection and is numbered as (1). Thus it is denoted as STDOUT(1).
  • Error Redirection: It is denoted as STDERR(2).
Que 29) Why is Linux considered as more secured than other operating systems?
Ans: Linux is an open source operating system and nowadays it is growing rapidly in the tech world/market. Although the entire code written in Linux can be read by anyone, then to it is considered as more secure because of the following reasons
  • Linux provides its user with limited default privileges which are basically restricted to the lower levels .i.e. in the case of any virus attack, it will reach only local files and folders where the system-wide damage is saved.
  • It has a powerful auditing system which includes detailed logs.
  • Enhanced features of IPtables are used in order to implement a greater level of security for Linux machine.
  • Linux has tougher program permissions before installing anything on your machine.
Que 30) Explain command grouping in Linux?
Ans: Command grouping is basically done by the use of braces ‘()’ and parenthesis ‘{}’. Redirection is applied to the entire group when the command is grouped.
  • When commands are placed within the braces, then they are executed by the current shell. Eg: (list)
  • When the commands are placed within the parenthesis, then they are executed by a subshell. Eg: {list;}
Que 31) What is Linux pwd (print working directory) command?
Ans: Linux pwd command displays the whole path of the current location you are working in starting from the root ‘/’. For example, to print the current working directory enter “$ pwd”.
It can be used for the bellow purposes
  • To find the full path of the current directory
  • Store the full path
  • Verify the absolute and physical path
Que 32) Explain the Linux ‘cd’ command options along with the description?
Ans: ‘cd’ stands for change directory and is used to change the current directory on which user is working.
cd syntax : $ cd {directory}
Following purposes can be served with ‘cd’ commands
  • Change from current to a new directory
  • Change directory using the absolute path
  • Change directory using the relative path
Few of the ‘cd’ options are enlisted below
  • cd~: Brings you to the home directory
  • cd-: Brings you to the previous directory
  • . : Bring you to the parent directory
  • cd/: Takes you to the entire system’s root directory
Que 33) What is know about grep commands?
Ans: Grep stands for ‘global regular expression print’. This command is used for matching a regular expression against text in a file. This command performs pattern-based searching and only the matching lines are displayed as output. It makes use of options and parameters that are specified along with the command line.
For example: Suppose we need to locate the phrase “our orders” in HTML file named as “order-listing.html”. Then the command will be as follows:
$ grep “our orders” order-listing.html
The grep command outputs the entire matching line to the terminal.
Que 34) How to create a new file and modify an existing file in vi editor? Also, enlist the commands used to delete information from vi editor.?
Ans: Find below the commands with the description
  • vi filename: This is the command used to create a new file as well as modify an existing file.
  • View filename: This command opens an existing file in read-only mode.
  • X: This command deletes the character which is under the cursor or before the cursor location.
  • dd: This command is used to delete the current line.
Que 35) Enlist some Linux networking and troubleshooting commands?
Ans: Every computer is connected to network internally or externally for the purpose of exchanging information. Network troubleshooting and configuration are essential parts of and network administration. The networking commands enable you to quickly troubleshoot connection issues with another system, check the response of another host, etc.
Network administrator maintains system network which includes network configuration and troubleshooting. Mentioned below are few commands along with their description:
Mentioned below are few commands along with their description
  • Hostname: To view the hostname (domain and IP address) of the machine and to set the hostname.
  • Ping: To check if the remote server is reachable or not.
  • ifconfig: To display and manipulate route and network interfaces. It displays network configuration. ‘ip’ is the replacement of ifconfig command.
  • netstat: It displays network connections, routing tables, interface statistics. ‘ss’ is the replacement of netstat command which is used to get more information.
  • Traceroute: It is network troubleshooting utility which is used to find the number of hops required for a particular packet to reach the destination.
  • Tracepath: It is same as traceroute with a difference that it does not require root privileges.
  • Dig: This command is used to query the DNS name servers for any task related to DNS lookup.
  • nslookup: To find DNS related query.
  • Route: It shows the details of the route table and manipulates IP routing table.
  • mtr: This command combines ping and track path into a single command.
  • Ifplugstatus: This command tells us whether the network cable is plugged in or not.

Conclusion:

Thus concluding this article with the learning fact that Linux is a complete operating system having different versions that suit any type of users (new/experienced). Linux is considered as a lot more user-friendly, stable, secure and reliable which can run non-stop for years without a single reboot.

1 comment:

  1. Las Vegas - Casino, Hotel & Travel Maps - Mapyro
    Get directions, reviews and 경산 출장샵 information 익산 출장안마 for Las Vegas in Las 평택 출장안마 Vegas, NV. Find the best hotels in Las Vegas. Best 안양 출장샵 of 광주광역 출장마사지 all: Hotel, Casino, Hotel & Travel Map.

    ReplyDelete