Linux OS Shell Interview Preparation Guide Download PDF
Linux OS Shell frequently Asked Questions by expert members with experience in Linux Shell. These questions and answers will help you strengthen your technical skills, prepare for the new job test and quickly revise the concepts
53 Linux Shell Questions and Answers:
Table of Contents
6 :: What is the output of the following code:
os=Unix
echo 1.$os 2."$os" 3.'$os' 4.$os
a) 1.Unix 2.Unix 3.Unix 4.Unix
b) 1.Unix 2.Unix 3.$os 4.Unix
c) 1.Unix 2.Unix 3.Unix 4.$os
d) 1.Unix 2.$os 3.$os 4.$os
b) 1.Unix 2.Unix 3.$os 4.Unix
7 :: Create a new file "new.txt" that is a concatenation of "file1.txt" and "file2.txt"?
a) cp file.txt file2.txt new.txt
b) cat file1.txt file2.txt > new.txt
c) mv file[12].txt new.txt
d) ls file1.txt file2.txt | new.txt
b) cat file1.txt file2.txt > new.txt
8 :: What will be output of following command:
$ echo "The process id is" $$$$
a) The process id is $$
b) The process id is $<pid>$<pid>
c) The process id is <pid><pid>
d) The process id is $$$$
c) The process id is <pid><pid>
10 :: Which of these is not a valid variable in bash:
a) __ (double underscore)
b) _1var (underscore 1 var )
c) _var_ (underscore var underscore)
d) some-var (some hyphen var)
d) some-var (some hyphen var)
11 :: How do you print the lines between 5 and 10, both inclusive?
a) cat filename | head | tail -6
b) cat filename | head | tail -5
c) cat filename | tail +5 | head
d) cat filename | tail -5 | head -10
a) cat filename | head | tail -6
12 :: What would be the current working directory at the end of the following command sequence?
$ pwd
/home/user1/proj
$ cd src
$ cd generic
$ cd .
$ pwd
a) /home/user1/proj
b) /home/user1/proj/src
c) /home/user1
d) /home/user1/proj/src/generic
d) /home/user1/proj/src/generic
14 :: How to feed standard output of one command to standard input of another in a single shell session?
a) IO redirection can be used
b) Named pipes can be used
c) The pipe operator provided by the shell can be used
d) It can not be done
c) The pipe operator provided by the shell can be used
15 :: The redirection 2> abc implies:
a) Write file 2 to file abc
b) Write standard output to abc
c) Write standard error to abc
d) none of the mentioned
c) Write standard error to abc
16 :: cmd > abc 2>&1 will:
a) Write file2 to file1
b) Write standard output and standard error to abc
c) Write standard error to abc
d) Write standard output to abc & standard error to monitor
b) Write standard output and standard error to abc
17 :: cmd 2>&1 > abc will:
a) Write file2 to file1
b) Write standard output and standard error to abc
c) Write standard error to abc
d) Write standard output to abc & standard error to monitor
d) Write standard output to abc & standard error to monitor
20 :: Which of these is the correct method for appending "foo" in /tmp/bar file?
a) echo foo > /tmp/bar
b) echo foo >> /tmp/bar
c) echo foo | /tmp/var
d) /tmp/bar < echo foo
b) echo foo >> /tmp/bar