Linux Interview Questions

Best Technical Answers for Linux Interview Questions by Linux Developers, Advanced Technical questions for freshers and experience Persons. Get Free Practical Tests

1. What Is Linux Shell?

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 users shell. Shell categories in Linux are:

Bourne shell compatible, C shell compatible, nontraditional, and historical.

2. What Is Shell Script?

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.

Linux Certification Training

  • Master Your Craft
  • Lifetime LMS & Faculty Access
  • 24/7 online expert support
  • Real-world & Project Based Learning


3. What Is Kernel? Explain The Task It Performs.

Kernel is used in UNIX like systems and is considered to be the heart of the operating system. It is responsible for communication between hardware and software components. It is primarily used for managing the systems resources as well.

Kernel Activities:

The Kernel task manager allows tasks to run concurrently.

Managing the computer resources: Kernel allows the other programs to run and use the resources.

Resources include i/o devices, CPU, memory.

Kernel is responsible for Process management. It allows multiple processes to run simultaneously allowing user to multitask.

Kernel has an access to the systems memory and allows the processes to access the memory when required.

Processes may also need to access the devices attached to the system. Kernel assists the processes in doing so.

For the processes to access and make use of these services, system calls are used.

Subscribe to our youtube channel to get new updates..!


4. What Are Pipes?

A pipe is a chain of processes so that output of one process (stdout) is fed an input (stdin) to another. UNIX shell has a special syntax for creation of pipelines. The commands are written in sequence separated by |. Different filters are used for Pipes like AWK, GREP.

E.g. sort file | lpr ( sort the file and send it to printer)

Linux Certification Training

Weekday / Weekend Batches


5. Explain Trap Command; Shift Command, Getopts Command Of Linux

Trap command: controls the action to be taken by the shell when a signal is received.

Trap [OPTIONS] [ [arg] signspec..]

Arg is the action to be taken or executed on receiving a signal specified in signspec.

e.g. trap “rm $FILE; exit” // exit (signal) and remove file (action).

Shift Command: Using shift command, command line arguments can be accessed. The command causes the positional parameters shift to the left. Shift [n] where n defaults to 1. It is useful when several parameters need to be tested.

Getopts command: this command is used to parse arguments passed. It examines the next command line argument and determines whether it is a valid option.

Getopts {optstring} {variable1}. Here, optsring contains letters to be recognized if a letter is followed by a colon, an argument should be specified. E.g (whether the argument begins with a minus sign and is followed by any single letter contained inside options) If not, diagnostic messages are shown. It is usually executed inside a loop.

6. What Stateless Linux Server? What Feature It Offers?

A stateless Linux server is a centralized server in which no state exists on the single workstations. There may be scenarios when a state of a particular system is meaningful (A snap shot is taken then) and the user wants all the other machines to be in that state. This is where the stateless Linux server comes into picture.


It stores the prototypes of every machine.

It stores snapshots taken for those systems.

It stores home directories for that system.

Uses LDAP containing information of all systems to assist in finding out which snapshot (of state) should be running on which system.

7. What Does Nslookup Do? Explain Its Two Modes.

Nslookup is used to find details related to a Domain name server. Details like IP addresses of a machine, MX records, servers etc. It sends a domain name query packet to the corresponding DNS.

Nslookup has two modes. Interactive and non-interactive. Interactive mode allows the user to interact by querying information about different hosts and domains.

Non interactive mode is used to fetch information about the specified host or domain.

Interactive mode:

Nslookup [options] [server]

8. What Is Bash Shell?

Bash is a free shell for UNIX. It is the default shell for most UNIX systems. It has a combination of the C and Korn shell features. Bash shell is not portable. any Bash-specific feature will not function on a system using the Bourne shell or one of its replacements, unless bash is installed as a secondary shell and the script begins with #!/bin/bash. It supports regular and expressions. When bash script starts, it executes commands of different scripts.

9. What Are The Process States In Linux?

Process states in Linux:

Running: Process is either running or ready to run.

Interruptible: a Blocked state of a process and waiting for an event or signal from another process.

Uninterruptible:- a blocked state. Process waits for a hardware condition and cannot handle any signal.

Stopped: Process is stopped or halted and can be restarted by some other process.

Zombie: process terminated, but information is still there in the process table

10. What Is A Zombie?

Zombie is a process state when the child dies before the parent process. In this case the structural information of the process is still in the process table. Since this process is not alive, it cannot react to signals. Zombie state can finish when the parent dies. All resources of the zombie state process are cleared by the kernel.

11. Explain Each System Calls Used For Process Management In Linux.

System calls used for Process management:

Fork () :- Used to create a new process

Exec() :- Execute a new program

Wait():- wait until the process finishes execution

Exit():- Exit from the process

Getpid():- get the unique process id of the process

Getppid():- get the parent process unique id

Nice():- to bias the existing property of process

12. How Do You List Files In A Directory?

ls - list directory contents

ls -l (-l use a long listing format)

13. How Do You List All Files In A Directory, Including The Hidden Files?

ls -a (-a, do not hide entries starting with .)

14. How Do You Find Out All Processes That Are Currently Running?

ps -f (-f does full-format listing.)

15. How Do You Find Out The Processes That Are Currently Running Or A Particular User?

ps -au Myname (-u by effective user ID (supports names)) (a - all users)

16. How Do You Kill A Process?

kill -9 8 (process_id 8) or kill -9 %7 (job number 7)

kill -9 -1 (Kill all processes you can kill.)

killall - kill processes by name most (useful - killall java)

17. What Would You Use To Edit Contents Of The File?

vi screen editor or jedit, nedit or ex line editor

18. What Would You Use To View Contents Of A Large Error Log File?

tail -10 file_name ( last 10 rows)

19. How Do You Log In To A Remote Unix Box?

Using telnet server_name or ssh -l ( ssh - OpenSSH SSH client (remote login program))

20. How Do You Get Help On A UNIX Terminal?

Man command name

info command name (more information)

21. How Do You List Contents Of A Directory Including All Of Its Subdirectories, Providing Full Details And Sorted By Modification Time?

ls -lac

-a all entries

-c by time

21. What Is A Filesystem?

Sum of all directories called file system.

A file system is the primary means of file storage in UNIX. File systems are made of inodes and superblocks.

22. How Do You Get Its Usage (a Filesystem)?

By storing and manipulate files.

23. How Do You Check for Processes Started by User 'pat'?

ps -fu pat (-f -full_format u -user_name )

24. How Do You Start A Job On Background?

bg %4 (job 4)

25. What Utility Would You Use To Replace A String '2001' For '2002' In A Text File?

Grep, Kde( works on Linux and Unix)

26. What Utility Would You Use To Cut Off The First Column In A Text File?

awk, kde

27. How to Copy File Into Directory

cp /tmp/file_name . (dot mean in the current directory)

28. How To Remove Directory With Files?

rm -rf directory_name

29. What Is The Difference Between Internal And External Commands?

Internal commands are stored in the; same level as the operating system while external commands are stored on the hard disk among the other utility programs.

30. List The Three Main Parts Of An Operating System Command:

The three main parts are the command, options and arguments.

Submit an interview question


Request for more information


Python tutorial for beginners

5th April | 08:00 AM

150 Registered

servicenow developer
Praneetha is a Post Graduate in Computer Science from Andhra University .She is currently working as an IT developer at hkr And she has great experience includes both IT development and operational roles. Connect with her also on LinkedIn and Twitter. Thank you

To Top