Linux Interview Questions and Answers

Linux Interview Questions and Answers

Last updated on 23rd Sep 2020, Blog, Interview Question

About author

Kannan ( (Sr Project Manager ) )

He is Possessing 8+ Years Of Experience in Linux. His Passion lies in Developing Entrepreneurs & Activities. Also, Rendered his intelligence to the Enthusiastic JOB Seekers.

(5.0) | 16547 Ratings 1065

Just like Windows, iOS, and Mac OS, Linux is an operating system. In fact, one of the most popular platforms on the planet, Android, is powered by the Linux operating system. An operating system is software that manages all of the hardware resources associated with your desktop or laptop. To put it simply, the operating system manages the communication between your software and your hardware. Without the operating system (OS), the software wouldn?t function.

Below we have listed the top 100 Linux interview questions & answers for fresher and  experienced candidates to clear the job interview. 

1.What do you understand by Linux Kernel? Is it legal to edit it?

Ans:

‘Kernel’ 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 Kernel’, it is referred to as low-level system software providing an interface for user-level interactions.

Linux Kernel 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.

2.Enlist the basic components of LINUX?

Ans:

Linux operating system basically consists of 3 components. They are:

  • Kernel: This is considered as the core part and is responsible for all major activities of the Linux operating system. Linux Kernel is considered as free and open-source software that 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.

3.Why do 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

4.Enlist the features of the Linux operating system?

Ans:

Following are some important features of the LINUX operating system:

  • Linux Kernel and application programs can be installed on any kind of hardware platform and thus are considered portable.
  • It serves the purpose of multitasking by serving various functions simultaneously.
  • It provides 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 a 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.

5.Explain LILO?

Ans:

LILO (Linux Loader) is the boot loader for the 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 boot 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.

6.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.

7.What do you understand by the Root account?

Ans:

As the name suggests, it is like a system administrator account which gives you the ability to fully control the system. The root account serves as the default account whenever Linux is installed.

Below mentioned functions can be performed by the Root account:

  • Create user accounts
  • Maintain user accounts
  • Assign different permissions to each account created and so on.

8.Explain the 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:

  • 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.
  • Fewer compatibility issues.

9.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:

  • It allows users to navigate and operate the software with the help of visual elements.
  • The more intuitive and rich interface is possible to be created.
  • Fewer 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 a mouse and keyboard for navigation and controlling the 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.

10.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 the 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
  • It does not use much CPU processing time.

Disadvantages of CLI

  • Learning and remembering type commands is hard.
  • Have to be typed precisely.
  • It can be very confusing.
  • Surfing web, graphics, etc are a few tasks that are hard or impossible to do on the command line.
Subscribe For Free Demo

Error: Contact form not found.

11.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. Some of the important ones are:

  • 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 a MAC operating system.
  • Linux Mint: It uses cinnamon and mates 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 a GNOME3 desktop environment by default.
  • Red Hat Enterprise: It is to be used commercially and to be well tested before release. It usually provides a stable platform for a long time.
  • Arch Linux: Every package is to be installed by you and is not suitable for beginners.

12.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 adequately. There are roughly 5 methods that determine the total memory used by Linux.

This is explained as below:

  • Free command: This is the most simple 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 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 memory usage along with other details.

13.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’. The three kinds of permissions defined for all the three owners are:

  • 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: Users can access and run the file in the directory. You cannot run a file unless the execute permission is set.

14.What is the maximum length for any file name under LINUX?

Ans:

The maximum length for any file name under Linux is 255 characters.

15.How are permissions 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

16.Permissions also include a single letter which denotes

Ans:

u : user; g: group; o: other; a: all; r: read; w: write; x: execute.

17.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

18.Explain the Linux Directory commands along with the description?

Ans:

The Linux Directory commands along with descriptions are as follows:

  • 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.

19.Explain the work of Ctrl+Alt+Del key combination on the Linux operating system?

Ans:

The work of Ctrl+Alt+Del key combination on the Linux operating system is the 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.

20.What is the role of case sensitivity in affecting the way commands are used?

Ans:

Linux is considered a case sensitive. Case sensitivity can sometimes serve as the reason for displaying different answers for the same command as you might enter the different formats of commands each time. In terms of case sensitivity, the command is the same but the only difference occurs with regard to uppercase and lowercase letters.

For Example,

cd, CD, Cd are different commands with different outputs.

21.Explain Linux Shell?

Ans:

For executing any commands the user uses a program known as the shell. Linux shell is basically a user interface used for executing the commands and communicating with the 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.

22.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, the Shell script is easy to debug and can also simplify everyday automation processes.

23.Explain the features of a 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:

  • Stores prototype of every machine
  • Store snapshots
  • Store home directories
  • Uses LDAP which determines the snapshot of state to be run on which system.

24.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

[table “” not found /]

25.Enlist some Linux to 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 the 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.

26.Explain Redirection?

Ans:

It is well known that every command takes input and displays output. Keyboard serves as the standard input device and the 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 input data for another process.

There are basically three streams available in which input and output of the 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).

27.Why is Linux considered more secure 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 also it is considered 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 that includes detailed logs.
  • Enhanced features of IPtables are used in order to implement a greater level of security for the Linux machine.
  • Linux has tougher program permissions before installing anything on your machine.
Course Curriculum

Get Linux Administration Training for Beginners from Industry Experts

  • Instructor-led Sessions
  • Real-life Case Studies
  • Assignments
Explore Curriculum

28.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. Example, (list)
  • When the commands are placed within the parenthesis, then they are executed by a subshell. Example, {list;}

29.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 24×7.Anacron does not expect the system to be running 24×7.

30. 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 below purposes:

  • To find the full path of the current directory
  • Store the full path
  • Verify the absolute and physical path

31.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 the 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

32.What is known 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 an HTML file named “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.

33.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:

The commands are:

  • 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.

34.Enlist some Linux networking and troubleshooting commands?

Ans:

Every computer is connected to the 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.

A network administrator maintains a system network that 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 a network troubleshooting utility that is used to find the number of hops required for a particular packet to reach the destination.
  • Tracepath: It is the 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 the DNS lookup.
  • nslookup: To find DNS related query.
  • Route: It shows the details of the route table and manipulates the 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.

35.What is LD_LIBRARY_PATH?

Ans:

LD_LIBRARY_PATH is an environment variable used for debugging a new library or a non-standard library. It is also used to identify the directories that need to be searched for; in order to do this, the path to search for the directories needs to be specified.

The variable can be set using the following:

setenv—LD_LIBRARY_PATH–$PATH

It is used to search for the shared objects/dynamic libraries by the operating system for extendable functionality at the runtime.

36.Name a service that you should disable (which acts both as web and FTP servers) on a Linux server.

Ans:

The finger service should be disabled on a Linux server because a remote user can get important information about the system by using this command.

37.What does sar provide? Where are the sar logs stored?

Ans:

In Linux, the sar command collects, reports, or saves system activity information, and it serves to log and evaluate a variety of information regarding system activity. With performance problems, sar also permits retroactive analysis of the load values for various sub-systems (CPUs, memory, disks, interrupts, network interfaces, and so on). If CPU utilization is near to 100 percent, the sampled workload is considered to be CPU-bound.

By default, the log files of the sar command are located at the /var/log/sa/sadd file, where the dd parameter indicates the current day.

38.How to check memory stats and CPU stats as a Linux Admin?

Ans:

Using the free and vmstat commands, we can display the physical and virtual memory statistics, respectively. With the help of the sar command, we can see the CPU utilization and other stats.

CPU-utilization

39.How to reduce or shrink the size of the LVM partition?

Ans:

Below are the logical steps to reduce the size of the LVM partition:

  • Unmount the file system using the unmount command
  • Use the resize2fs command as follows:
  • resize2fs /dev/mapper/myvg-mylv 10G

Then, use the lvreduce command as follows:

  • lvreduce -L 10G /dev/mapper/myvg-mylv

This way, we can reduce the size of the LVM partition and fix the size of the file system to 10 GB.

40.What are the different modes of Network Bonding in Linux?

Ans:

Below is the list of various modes used in Network Bonding:

  • balance-rr or 0: The round-robin mode for fault tolerance and load balancing
  • active-backup or 1: Sets the active-backup mode for fault tolerance
  • balance-xor or 2: Sets an XOR (exclusive-or) mode for fault tolerance and load balancing
  • broadcast or 3: Sets a broadcast mode for fault tolerance. All transmissions are sent on all the slave interfaces
  • 802.3ad or 4: Sets an IEEE 802.3ad dynamic link aggregation mode and creates aggregation groups that share the same speed and duplex settings
  • balance-tlb or 5: Sets a transmit load balancing (TLB) mode for fault tolerance and load balancing
  • balance-alb or 6: Sets an active load balancing (ALB) mode for fault tolerance and load balancing

41.What is BASH?

Ans:

BASH is short for Bourne Again SHell. Written by Steve Bourne, it acts as the default shell for most Linux systems since it has been adapted.

42.What is the difference between BASH and DOS?

Ans:

There are three key differences between BASH and DOS:

  • BASH commands are case sensitive while DOS commands are not
  • BASH follows no convention in naming files, while DOS follows a convention
  • Under BASH, / character serves as a directory separator while in DOS \ serves as the directory separator

43.What is the minimum number of partitions that you need to install Linux?

Ans:

Minimum 2 partitions are needed for installing Linux

44.Which command would you use to create a file system on a new hard drive?

Ans:

The mkfs command

45.Which command is used to review boot messages?

Ans:

The dmesg command

46.Which file is used to automatically mount file systems?

Ans:

Fstab file

47.What is the difference between internal and external commands?

Ans:

Internal commands are those which are already loaded in the system. External commands are those which can be executed any time and are independent.

48.What is the difference between home directory and working directory?

Ans:

Home directory is the default working directory when a user logs in.

Working directory is the user’s current directory

49.Explain how to uninstall the libraries in Linux?

Ans:

By using the command

  • sudo apt – get remove library_name

50.Which command is used to delete a group?

Ans:

The groupdel command

Course Curriculum

Get Advanced Practical Oriented Linux Certification Course

Weekday / Weekend BatchesSee Batch Details

51.How do you terminate an ongoing process?

Ans:

Use the kill command followed by the pid in order to terminate that process. To terminate all processes at once, use kill 0.

52.Can a Linux computer be made a router so that several machines may share a single Internet connection? How?

Ans:

Yes, by IP masquerading

53.What daemon is used for scheduling of the commands?

Ans:

The crontab command

54.If you have saved a file in Linux. Later you wish to rename that file, what command is designed for it?

Ans:

The ‘mv’ command is used to rename a file.

55.Write about an internal command.

Ans:

The commands which are built in the shells are called the internal commands.

56.Define inode.

Ans:

Each file is given a unique name by the operating system which is called as the inode.

57.If the programmer wishes to execute an instruction at the specified time. Which command is used?

Ans:

The ‘at’ command is used for the same.

58.Explain process id.

Ans:

The operating system uniquely identifies each process by a unique id called as the process id.

59.Name some Linux variants.

Ans:

Some of the Linux commands are:

  • CentOS
  • Ubuntu
  • Redhat
  • Debian
  • Fedora

60.Which popular office suite is available free for both Microsoft and Linux?

Ans:

Open Office Suite is available free for both Microsoft and Linux. You can install it on both of them.

61.Suppose your company has recently switched from Microsoft to Linux and you have some MS Word document to save and work in Linux, what will you do?

Ans:

Install Open Office Suite on Linux. It facilitates you to work with Microsoft documents.

62.What is SMTP?

Ans:

SMTP stands for Simple Mail Transfer Protocol. It is an internet standard for mail transmission.

63.What is Samba? Why is it used?

Ans:

Samba service is used to connect Linux machines to Microsoft network resources by providing Microsoft SMB support.

64.What are the basic commands for user management?

Ans:

  • last,
  • chage,
  • chsh,
  • lsof,
  • chown,
  • chmod,
  • useradd,
  • userdel,
  • newusers etc.

65.What is the maximum length for a filename in Linux?

Ans:

255 characters.

66.Is the Linux Operating system virus free?

Ans:

No, There is no operating system till date that is virus free, but Linux is known to have less number of viruses.

67.Which partition stores the system configuration files in the Linux system?

Ans:

/stc partition.

68.Which command is used to uncompress gzip files?

Ans:

gunzip command is used to uncompress gzip files.

69.Why do developers use MD5 options on passwords?

Ans:

MD5 is an encryption method, so it is used to encrypt the passwords before saving.

70.What is a virtual desktop?

Ans:

The virtual desktop is used as an alternative to minimizing and maximizing different windows on the current desktop. Virtual desktop facilitates you to open one or more programs on a clean slate rather than minimizing or restoring all the needed programs.

Linux Sample Resumes! Download & Edit, Get Noticed by Top Employers! Download

71.What is the difference between soft and hard mounting points?

Ans:

In the soft mount, if the client fails to connect the server, it gives an error report and closes the connection whereas in the hard mount, if the client fails to access the server, the connection hangs; and once the system is up, it again accesses the server.

72.Does the Alt+Ctrl+Del key combination work in Linux?

Ans:

Yes, it works like windows.

73.What are the file permissions in Linux?

Ans:

There are 3 types of permissions in Linux OS that are given below:

  • Read: User can read the file and list the directory.
  • Write: Users can write new files in the directory .
  • Execute: User can access and run the file in a directory.

74.What are the modes used in VI editor?

Ans:

There are 3 types of modes in vi Editor:

  • Regular mode or command mode
  • Insertion mode or edit mode
  • Replacement mode or Ex-mode

75.How to exit from vi editors?

Ans:

The following commands are used to exit from vi editors.

    1. 1.:wq saves the current work and exits the VI.
    2. 2.:q! exits the VI without saving current work.

76.How to delete information from a file in vi?

Ans:

The following commands are used to delete information from vi editors.

    1. 1.x deletes a current character.
    2. 2.dd deletes the current line.

77.How to create a new file or modify an existing file in vi?

Ans:

vi filename  

78.What Is Linux Shell?

Ans:

Linux shell is a user interface used for executing the commands. Shell is a program the user uses for executing the commands. In UNIX, any program can be the user’s shell. Shell categories in Linux are:
Bourne shell compatible, C shell compatible, nontraditional, and historical.

79.What Is Shell Script?

Ans:

A shell script, as the name suggests, is a script written for the shell. Script here means a programming language used to control the application. The shell script allows different commands entered in the shell to be executed. Shell script is easy to debug, quicker as compared to writing big programs. However the execution speed is slow because it launches a new process for every shell command executed. Examples of commands are cp, cn, cd.

80.Which alphabet keys can move the cursor equivalent to arrow keys?

Ans:

k, j, h and l

81.What is yanking with reference to vi editor?

Ans:

Yanking is the process of holding the cut or copied text into the buffer which can be pasted.

82.How can you display line numbers in vi editor?

Ans:

set nu

83.What is a shebang line?

Ans:

A first line in the shell script which tells which shell needs to be used to execute the following commands in the shell script.

84.Which command can be used to alter the file access permissions?

Ans:

chmod

85.How can we retrieve the value of the shell variable?

Ans:

By prefixing the dollar ($) symbol for the shell variable.

86.Which command can be used to delete a shell variable?

Ans:

unset.

87.Which shell variable holds the shell script file name?

Ans:

$0

88.What is the value returned by a command after its successful execution?

Ans:

0

89.How can we get the execution status of the last executed command?

Ans:

$?

90.Which command can be used to perform arithmetical computations?

Ans:

expr

91.Which switch can be used in test expression to determine a file as a regular file?

Ans:

−f

92.How can we capture commands displayable output in a shell variable?

Ans:

Enclose the command in back quotes and assign it to a variable.

93.What is a here document?

Ans:

A here document is used to redirect input into an interactive shell script or program.

94.Which command can be used to throw/return a value from the function?

Ans:

return

95.Is it compulsory to have the extension ‘sh’ for a shell script?

Ans:

No, it is a convention.

96.How can we execute a shell script if the execution bit is off for a shell script?

Ans:

sh <file>

97.What is the full form of grep?

Ans:

Globally search for regular expressions.

98.Which filter can be used to extract a/specific/range of character from the lines of text?

Ans:

cut

99.Command ‘cat’ basically does ___

Ans:

Concatenation of files text.

These are some of the popular questions that are asked in Linux interviews. Always be prepared to answer all types of questions — technical skills, interpersonal, leadership or methodology. If you are someone who has recently started your career in this field, you can always get certified to understand the industry-related terminology, skills and methodologies.

Are you looking training with Right Jobs?

Contact Us

Popular Courses