Unix/Linux Interview Questions and Answers

How do display the 10th, 11th and 12th line of a file in Unix?

Combining the two commands head and tail can give you the result -

$ head -12 <filename> | tail -3
Ex -

$ head -12 test.txt | tail -3
Post comment
Thanks for your comment.!
Write a comment(Click here) ...
What is relative path and absolute path?
Absolute path : Exact path from root directory. Relative path : Relative to the current path.
How to count number char, line in a file?
by using wc-stands for word count. wc -c for counting number of characters in a file. wc -l for counting lines in a file.
What is du command do?

With the help of this command you can find the disk capacity and free space of the disk.

What is the use of the command 'ls -x chapter[1-5]'?
ls stands for list; so it displays the list of the files that starts with 'chapter' with suffix '1' to '5', chapter1, chapter2, and so on.

What will the following command do?
$echo *

It is similar to 'ls' command and displays all the files in the current directory.

Which command is used to delete all files in the current directory and all its sub-directories?
rm -r *

What is the use of "grep" command?
"grep" is a pattern search command. It searches for the pattern, specified in the command line with appropriate option, in a file(s). Example : grep 99mx mcafile
What is a pipe and give an example?
Unix commands alone are powerful, but when you combine them together, you can accomplish complex tasks with ease. The way you combine Unix commands is through using pipes and filters. The symbol | is the Unix pipe symbol that is used on the command line. What it means is that the standard output of the command to the left of the pipe gets sent as standard input of the command to the right of the pipe. However, the pipe is different because it is used to pass the output of a command to another command- example: $ cat apple.txt | wc
What is the difference between cat and more command?
"Cat" displays file contents. If the file is large the contents scroll off the screen before we view it. So command "more" is like a pager which displays the contents page by page.

What is nohup command in unix?

Nohup stands for no hang up. It is a Unix command that is used to run another command. It tells Unix not to stop passed command once it has started, that will keep running until done.
When you execute a Unix job in the background( &, bg command), and logout from the session, then that process will get killed. It can avoid this by executing the job with nohup.
Nohup prevents the command from being aborted automatically when you log out or exit the shell.

# nohup sample.sh &

By default, standard output will be redirected to nohup.out file in the current directory. You can also redirect the output to an other file using the normal shell redirection.

# nohup sh sample.sh > sample-out.log &

Once a job is started or executed using the nohup command, stdin will not be available to the user.

Latest Updates


By what number should we multiply -1/5 so that the product may be 9/25?

Profit and Loss

A person sells an article for Rs 550, gaining 1/10 of its cost price. Its gain percentage is.


If 3x + 2y = 12 and xy = 6, then 9x2 + 4y2 = ______.

Volume and Surface Area

In a temple there are 25 cylindrical pillars. The radius of each pillar is 28cm and height 4m. The total cost of painting the curved surface area of pillars at the rate of Rs. 8 per m2 is:

Problems on Ages

After 12 years, I shall be 3 times as old as I was 4 years ago. My present age is:

Square and Cube Root

The smallest number by which 1100 must be multiplied so that the product becomes a perfect square is____.


What is the probability that a number selected from the numbers 1, 2, 3,…….,25 is a prime number, when each of the given numbers is equally likely to be selected?

Square and Cube Root

What is the smallest number by which 3087 must be divided so that the quotient is a perfect cube?


The most comfortable distance at which one can read with a normal eye is:


Cholera is caused by:

Write the name of reptile with four chambered heart?

Compound Interest

Raj borrowed Rs. 5000 at 10% per annum on simple interest and lent the same amount at 15% per annum on compound interest. At the end of 2 years, he would ?


If the area of a square is 16 cm2, then the area of the square joining the mid-points of the sides is?

General Knowledge of MP

Vidisha is situated on the banks of river?

General Knowledge of World

When is the Human Rights Day celebrated?

Profit and Loss

By selling coconuts at the rate of Rs. 6/- each, a trader gained 20%. Find the cost of 100 coconuts?

General Knowledge of India

How many coastal state are in India?


A person is to count 4500 currency notes. Let an denote the number of notes he counts in the nth minute. If a1 = a2 = .... = a10 = 150 and a10 , a11 ,... are in an AP with common difference – 2, then the time taken by him to count all notes is ?