Unix/Linux Interview Questions and Answers

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.

Post comment
Cancel
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 (Global Regular Expression Print) is a pattern search command. It searches for the pattern, specified in the command line with appropriate option, in a given file(s).
Syntax : grep [options] pattern [files]
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.

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

What is inode?

An inode is a unique entry which by default gets created on a disk section for a file system. It contains the following information:

Location on the disk
User of the file
Size of the file
Group of the file
Device ID
File size
Date of creation
Permission
Owner of the file

Latest Updates

Percentage

20% of a quantity is Rs 400, the quantity equals?

Time and Work

A certain piece of work can be completed by 12 men in 9 days. After they have worked for six days, six more men joined them. How many days will it take to complete the remaining work?

Ratio and Proportion

A certain sum was divided among A, B and C in the ratio 5 : 7 : 6. If B received Rs 4500 more than C, find C's share?

Problems on Ages

A is two years older than B who is twice as old as C. If the total of the ages of A, B and C be 27, the how old is A?

Time and Work

A and B can together finish a work in 30 days. They worked at it for 20 days and then B left. The remaining work was done by A alone in 20 more days. B alone can do the entire work in?

Discount

A retailer buys a washing machine marked at Rs 4800 and gets two successive discounts of 15% and 5%. If he spends Rs 124 on transportation and sells the washing machine at a gain of 13%, then find the selling price of the machine.

Boats and Streams

Speed of a boat in still water is 10 kmph, and speed of the stream is 5 Kmph. In how many minutes would the boat cover a distance of 5 km downstream?

Problems on Ages

The age of two persons differ by 2 years. If the sum of their ages is equal to the square root of 144 then find the age of the elder among the two person?

The age of A is six times the age of his son. A's father is 40 years older than him. Together, they are 118 years old. What is the age of A?

Average

The average mark of 50 students is 75. If the marks obtained by one of the student had been written as 36 instead of 86, then the corrected average of marks is:

Unix/Linux

What is inode?

Problems on Ages

A group of 15 people has average age of 45 years. Two persons are excluded and the average of the remaining is increased by 5 years. What is the average age of the two persons who have been excluded?

Average

In the world cup, Yuvraj has a batting average of 65 in 7 matches till semi-final. How much should Yuvraj score in the 8th match ie the final match to get a batting average of 85?

Problems on Trains

A train takes 8 sec to cross a 75 metre long platform at a speed of 90 km/h. What is the length of the train?

Alligation or Mixture

In what ratio must Rs 50 per kg salt be mixed with Rs 80 per kg salt to obtain a mixture worth of Rs 60 per kg?

Numbers

Find the sum of the given series: 3 + 9 + 27 + 81 + 243 + 729 + 2187 + 6561

Average

Find the average. 62, 54, 44, 36, 28 & 22

Percentage

In an examination, 36% of the students failed in English and 40% failed in Hindi. If 20% of the students failed in both subjects, then the pass percentage is?

Latest Job Notifications

Jobs in Madhya Pradesh

राष्ट्रीय स्वास्थ्य मिशन मध्य प्रदेश National Health Mission MP(NRHM) - 5215 पद - 22/06/2021 अंतिम तिथि

Jobs in Punjab

पंजाब स्टेट पावर कॉर्पोरेशन लिमिटेड Punjab State Power Corporation Limited (PSPCL) - 2632 पद - 20/06/2021 अंतिम तिथि

Jobs in Chhattisgarh

स्वास्थ्य सेवा निदेशालय, छत्तीसगढ़ Department of Health & Family Welfare, Chhattisgarh - 267 पद - 26/06/2021 अंतिम तिथि

Government Jobs

दिल्ली सबऑर्डिनेट सर्विस सिलेक्शन बोर्ड Delhi Subordinate Services Selection Board(DSSSB) - 5807 पद - 03/07/2021 अंतिम तिथि

Jobs in Madhya Pradesh

राष्ट्रीय स्वास्थ्य मिशन मध्य प्रदेश National Health Mission MP(NRHM) - 2850 पद - 31/05/2021 अंतिम तिथि

Government Jobs

इंडियन पोस्ट सर्विस Indian Post Service - 4368 पद - 29/05/2021 अंतिम तिथि

दिल्ली सबऑर्डिनेट सर्विस सिलेक्शन बोर्ड Delhi Subordinate Services Selection Board(DSSSB) - 7236 पद - 24/06/2021 अंतिम तिथि

Banking Jobs

Reserve Bank of India (RBI) - 841 Posts - 15/03/2021 Last date

Institute of Banking Personnel Selection (IBPS) - CRP SPL-IX - 1163 Posts - 26/11/2019 Last date

Government Jobs

Reserve Bank of India (RBI) - 199 Posts - 11/10/2019 Last date