Unix/Linux Interview Questions and Answers

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 *
t 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.

Latest Updates

Height and Distance

An aeroplane flying at a height of 300 m above the ground passes vertically above another plane at an instant when the angles of elevation of the two planes from the same point on the ground are 60º and 45º respectively. What is the height of the lower plane from the ground?

From the top of a building 90 m high, the angles of depression of the top and the bottom of a tree are 30º and 45º respectively. What is the height of the tree?

Trigonometry

What is the value of sinx √( 1 /1+cosx + 1 /1-cosx ) ?

What is cos4 A - sin4 A / cos2 A - sin2 A equal to?

If 7sin2 x +3cos2 x = 4, 0 < x < 90º ,then what is the value of tan x?

If x = a cosθ + b sinθ and y = a sinθ - b cosθ then what is x2 + y2 equal to?

Average

The mean of 5 numbers is 15. If one more number is included, the mean of the 6 numbers becomes 17. What is the included number?

The mean marks obtained by 300 students in a subject are 60. The mean of top 100 students was found to be 80 and the mean of last 100 students was found to be 50. The mean marks of the remaining 100 students are?

In an asymmetrical distribution, of the mean and median of the distribution are 270 and 220 respectively, then the mode of the data is?

Let a, b, c, d, e, f, g be consecutive even numbers and j, k, l, m, n be consecutive odd numbers. What is the average of all the numbers?

Alligation or Mixture

25 kg of alloy X is mixed with 125 kg of alloy Y. If the amount of lead and tin in the alloy X is the ratio 1 : 2 and the amount of lead and tin in the alloy Y is in the ratio 2 : 3, then what is the ratio of lead to tin in the mixture?

Simplification

The ratio of two numbers is 1 : 5 and their product is 320. What is the difference between the square of these two numbers?

Trigonometry

What is the value of cot 4π/3 ?

Indian Politics

Article-24 of the Indian Constitution ‘Prohibition of employment of children in factories, etc’ deals with?

Article-134A of the Indian Constitution ‘Certificate for appeal to the Supreme Court’ deals with?

Chemistry

Who invented Aspirin?

Physics

A larger force on a rotating body results in larger?

What is the unit of the physical quantity, magnetic flux density?