Linux Admin
Linux Admin
Linux Admin
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
Answer: D
2. 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
Answer: A
5. What is the return value ($?) of this code:os = Unix[$osName = UnixName] && exit
2[$osName = UnixName] && exit 3
A. 0
B. 1
C. 2
D. 3
Answer: D
13. Shell is ?
A. Command Interpreter
B. Interface between Kernel and Hardware
C. Interface between user and applications
D. Command Compiler
Answer: A
14. If a file with execute permissions set, but with unknown file format is
executed
A. The file is passed to /bin/sh
B. The system returns an error
C. The current shell will try to execute it
D. None of the mentioned
Answer: C
19. The user bhojas logged in and performed the following sequence of command. What
will be the output of the last command?$ cd project/module1$ pwd
A. /home/bhojas/project/module1
B. /home/project/module1
C. /usr/bhojas/project/module1
D. project/module1
Answer: A
24. 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
Answer: B
26. The following commands gives the output like this#cat file1 file2#cat: file1:
No such file or directoryhelloIf we execute the command “cat file1 file2 1>2 2>&1”
the output would be
A. cat: file1: No such file or directory hello
B. No output is displayed
C. Cat: 1>2: No such file or directory
D. hello
Answer: B
29. From where would the read statement read if the following statements were
executed?exec < file1exec < file2exec < file3read line
A. It would read all the files
B. It would not read any files
C. It would read all the files in reverse order
D. It would read only file3
Answer: B
31. Which variable is used to display number of arguments specified in command line
A. $0
B. $#
C. $*
D. $?
Answer: B
34. What command would send the output of cmd1 to the input of cmd2?
A. cmd1 | cmd2
B. cmd1 || cmd2
C. cmd1 && cmd2
D. cmd1 ; cmd2
Answer: A
35. What is the output of the following command for bash shell:echo linux $0
A. linux echo
B. linux linux
C. linux bash
D. linux
Answer: C
36. Which variable will display the list of the positional parameters?
A. $#
B. $*
C. $?
D. $$
Answer: B
37. 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 cannot be done
Answer: C
38. Which of the following commands allows definition and assignment of environment
variables under bash
A. env
B. export
C. environ
D. setenviron
Answer: A
45. The user bhojas logged in and performed the following sequence of command. What
will be the output of the last command?$ cd project/module1$ pwd
A. /home/bhojas/project/module1
B. /home/project/module1
C. /usr/bhojas/project/module1
D. project/module1
Answer: A
47. Which of the following files will not be displayed by the command cat re* ?
A. reminder
B. receipt
C. Receipt
D. recipe-cake
Answer: C
49. 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
Answer: B
51. The following commands gives the output like this#cat file1 file2#cat: file1:
No such file or directoryhelloIf we execute the command “cat file1 file2 1>2 2>&1”
the output would be
A. cat: file1: No such file or directory hello
B. No output is displayed
C. Cat: 1>2: No such file or directory
D. hello
Answer: B
54. From where would the read statement read if the following statements were
executed?exec < file1exec < file2exec < file3read line
A. It would read all the files
B. It would not read any files
C. It would read all the files in reverse order
D. It would read only file3
Answer: B
57. Which of the following file set in the current directory are identified by the
regular expression a?b*
A. afcc, aabb
B. aabb, axbc
C. abbb, abxy
D. abcd, axbb
Answer: B
58. What command would send the output of cmd1 to the input of cmd2?
A. cmd1 | cmd2
B. cmd1 || cmd2
C. cmd1 && cmd2
D. cmd1 ; cmd2
Answer: A
59. What is the output of the following command for bash shell:echo linux $0
A. linux echo
B. linux linux
C. linux bash
D. linux
Answer: C
62. Assuming the files fileA, fileB, fileAB, fileBC and fileABC, exist in a
directory, which files match with the pattern file[ABC]?
A. fileA, fileB and fileABC
B. fileABC
C. fileA and fileB
D. fileAB, fileBC and fileABC
Answer: C
63. What will be printed for the command below?$ grep –c “^echo” abc
A. The count of lines that do not contain the pattern echo in file abc
B. The count of lines which begin with the pattern echo in file abc
C. The count of lines that ends with the pattern echo in file abc
D. None of the above
Answer: B
64. Which one is used to select only one copy of the repeated lines?
A. uniq -u
B. uniq -d
C. uniq -c
D. uniq –I
Answer: A
65. Indicate the right option to search for BOB, Bob, BOb or BoB?
A. grep –i Bob files
B. grep ‘B[oO][bB]’ files
C. grep ‘[BOB]’ files
D. grep -v ‘Bob’ files
Answer: B
66. Indicate the right option to search for anything not a letter or number
A. grep ‘^[a-zA-Z0-9]’
B. grep ‘[^a-zA-Z0-9]’
C. grep ‘[a-zA-Z0-9]’
D. None of the above
Answer: B
67. How do you remove duplicate lines from the file foo using uniq?
A. sort foo | uniq –u
B. sort -u foo | uniq -d
C. sort foo | uniq –c
D. sort foo | uniq –I
Answer: A
69. who | cut –d ” ” -f1what is the ouput if the who command displays like
thisuser1 tty 0 1234
A. user1
B. user1 tty 0 1234
C. tty
D. tty 0 1234
Answer: A
70. What is the command that can print lines of first file matching with second
file?
A. printline
B. cmp
C. com
D. comm
Answer: D
71. When the return value of any function is not specified within the function,
what function returns?
A. nothing
B. exit status of the last command executed
C. 0
D. none of the mentioned
Answer: B
73. Which of the following command provides the list of the functions defined in
the login session?
A. declare -f
B. declare -F
C. both (a) and (b)
D. none of the mentioned
Answer: C
76. Which command reads user input from the terminal and assign this value to a
variable name?
A. read
B. get
C. declare
D. set
Answer: A
77. Which one of the following statement is true about variables in shell?
A. variables do not require declaration before assigning value to them
B. variables are case sensitive
C. to extract the contents of a variable, we have to provide the variable a
preceding $
D. all of the mentioned
Answer: D
79. To redefine a variable, it can be removed from the list of variables by using
the command
A. unset
B. delete
C. remove
D. clear
Answer: A
82. Which one of the following is not correct about job control in bash shell?
A. it is the ability to stop and resume any process running in shell at a later
point
B. user employs this facility via an interactive interface supplied by the kernel’s
terminal driver and bash
C. it is the ability to create any process
D. none of the mentioned
Answer: C
83. Which command allows to view the current jobs being handled by the shell?
A. jobs
B. view
C. show
D. none of the mentioned
Answer: A
93. Which statement resumes the next iteration of a for, while, select, or untill
loop?
A. continue
B. break
C. complete
D. command
Answer: A
98. Which command concatenate the specified argument into a single command, then
execute the command?
A. fc
B. eval
C. exec
D. getopts
Answer: B
103. Which option of the kill command sends the given signal name to the specified
process?
A. -l
B. -n
C. -s
D. -a
Answer: C
108. Which command wait for the specified process to complete and return the exit
status?
A. sleep
B. wait
C. delay
D. stop
Answer: B
109. Which command prints the accumulated user and system times for processes run
from the shell?
A. time
B. times
C. both (a) and (b)
D. none of the mentioned
Answer: B
110. Which command runs the shell built-in command ‘command’ with the given
argument?
A. builtin
B. caller
C. there is no command present for this purpose
D. none of the mentioned
Answer: A
111. Which option of the command ‘cd’ use the actual filesystem path for cd.. and
the value of pwd?
A. -l
B. -L
C. -p
D. -P
Answer: D
112. Which command generates possible completions for string according to the and
write it to standard output?
A. compgen
B. complete
C. continue
D. none of the mentioned
Answer: A
113. Which command executes ‘command’ in place of the current process instead of
creating a new process?
A. exec
B. command
C. trap
D. none of the mentioned
Answer: A
116. Which vi editor command copies the current line of the file?
A. yy
B. yw
C. yc
D. none of the mentioned
Answer: A
117. Which command is used to delete the character before the cursor location in vi
editor?
A. X
B. x
C. D
D. d
Answer: A
124. If any sed command does not specify any address then the command is applied to
A. each input line
B. none of the input line
C. last input line
D. none of the mentioned
Answer: A
127. Which command is used to replace word ‘cat’ (already present in the file) with
‘mouse’ at all places in a file ‘old.txt’ and save the result in a new file
‘new.txt’?
A. sed ‘s/cat/mouce/g’ old.txt > new.txt
B. sed ‘s/cat/mouse’ old.txt new.txt
C. sed ‘/s/cat/mouse/g’ old.txt new.txt
D. sed ‘/s/cat/mouse’ old.txt > new.txt
Answer: A
128. Which command will delete all the blank lines in file old.txt?
A. sed ‘/d’ old.txt
B. sed ‘/^/d’ old.txt
C. sed ‘/^$/d’ old.txt
D. sed ‘/^*/d’ old.txt
Answer: C
130. Which option is used by sed to specify that the following string is an
instruction or set of instructions?
A. -n
B. -e
C. -f
D. -i
Answer: A
136. The print and printf statements can be told to send their output to other
place except standard output, is called
A. redirection
B. redistribution
C. reinsertion
D. none of the mentioned
Answer: A
138. What is the output of the command awk ‘BEGIN printf “%c”,65’
A. A
B. 65
C. syntax error
D. none of the mentioned
Answer: A
139. Which one of the following statement is not true about the format-control
letters for printf statement in awk program?
A. “c” prints a number as an ASCII character
B. “d” prints a decimal integer
C. “h” prints an unsigned hexadecimal integer
D. “o” prints an unsigned octal integer
Answer: C
145. Which statement skips over the rest of the loop body, causing the next cycle
around the loop to begin immediately?
A. continue
B. break
C. next
D. none of the mentioned
Answer: A
146. Which statement instructs gawk to stop processing the current data file?
A. next
B. nextfile
C. exit
D. exitfile
Answer: B
147. The command “awk ‘if (“9?>”10”) print “sanfoundry” else print “linux”'”
A. will print “sanfoundry”
B. will print “linux”
C. will generate syntax error
D. none of the mentioned
Answer: C
151. Which one of the following is used by awk to control the conversion of numbers
to string?
A. RS
B. OFMT
C. SUBSEP
D. RSTART
Answer: B
152. In awk program, the name of the array cannot be same with the
A. name of variable
B. value of the array element
C. both (a) and (b)
D. none of the mentioned
Answer: A
155. Which one of the following is used by awk to control the conversion of numbers
to string?
A. RS
B. OFMT
C. SUBSEP
D. RSTART
Answer: B
156. In awk program, the name of the array can not be same with the
A. name of variable
B. value of the array element
C. both (a) and (b)
D. none of the mentioned
Answer: A
158. Which one of the following is a mount point for a temporarily mounted
filesystem?
A. /mnt directory
B. /media directory
C. /dev directory
D. none of the mentioned
Answer: A
171. Which one of the directory does not contain binary files?
A. /bin
B. /sbin
C. /etc
D. none of the mentioned
Answer: C
175. Any file or directory present in the ______ directory may not be reserved
between the invocation of the program.
A. /var
B. /tmp
C. /etc
D. all of the mentioned
Answer: B
176. Which one of the following is not true about proc filesystem?
A. proc filesystem is a pseudo-filesystem
B. proc filesystem is used as an interface to kernel data structures
C. some files in proc filesystem allow kernel variables to be changed
D. none of the mentioned
Answer: D
180. The file /proc/[PID]/cmdline holds the complete command line for the process,
unless the process is a
A. child process
B. zombie process
C. orphan process
D. none of the mentioned
Answer: B
182. Which one of the following file contains the environment for the process?
A. /proc/[PID]/environ
B. /proc/[PID]/env
C. /proc/[PID]/path
D. none of the mentioned
Answer: A
183. The entry for each file opened by the process is present in
A. /proc/[PID]/fd
B. /proc/[PID]/file
C. /proc/[PID]/maps
D. none of the mentioned
Answer: A
184. The file /proc/[PID]/limits displays the ______ for each of the process’s
resource limits.
A. hard limit
B. soft limit
C. units of measurement
D. all of the mentioned
Answer: D
193. Which file of the proc filesystem can be used instead of “syslog” system call
to read kernel messages?
A. /proc/kmsg
B. /proc/moudle/kmsg
C. /proc/module/msg
D. /proc/msg
Answer: A
195. Which one of the following operating system does not supports proc filesystem?
A. IBM AIX
B. QNX
C. Solaries
D. none of the mentioned
Answer: D
197. Which one of the following contains various bits of information about the
state of power management?
A. /proc/acpi
B. /proc/apm
C. both (a) and (b)
D. none of the mentioned
Answer: C
198. Which file contains the boot options passed to the kernel?
A. /proc/cmdline
B. /proc/root
C. /proc/boot
D. none of the mentioned
Answer: C
199. Which one of the following is a symlink to the root path as seen by the
process?
A. /proc/[PID]/root
B. /proc/[PID]/path
C. both (a) and (b)
D. none of the mentioned
Answer: A
206. Which one of the following command will print the environement of process 1?
A. cat /proc/1/environ
B. cat /proc/bin/1/env
C. cat /proc/1/var/env
D. none of the mentioned
Answer: A
207. Most files and directories within /proc are 0 bytes in size because
A. proc filesystem exists only as a reflection of the in-memory kernel data
structure
B. these files contains very only one or two instructions
C. both(a) and (b)
D. none of the mentioned
Answer: A
208. Accessing the file /proc/meminfo gives the different result each time because
A. memory usages is always fluctuating
B. a new process id is assigned
C. logical address is different from the physical address
D. none of the mentioned
Answer: A
212. Which file is used primarily for diagnosing memory fragmentation issues ?
A. /proc/buddyinfo
B. /proc/meminfo
C. /proc/apm
D. none of the mentioned
Answer: A
213. Which file shows the parameter passed to kernel at the time of starting?
A. /proc/apm
B. /proc/cmdline
C. both (a) and (b)
D. none of the mentioned
Answer: B
216. The file /proc/locks displays the file currently locked by the
A. kernel
B. user
C. superuser
D. none of the mentioned
Answer: A
217. The file /proc version shows the version of ______ used in the system.
A. kernel
B. gcc
C. both (a) and (b)
D. none of the mentioned
Answer: C
223. If we want to get the exit status that specified targets are up to date or
not, we have to execute the make command with option
A. -q
B. -r
C. -s
D. -t
Answer: A
224. Which make command option ignores all errors in commands executed to remark
files?
A. -i
B. -j
C. -k
D. -l
Answer: A
225. If we want to execute the makefile by just giving the “make” command, makefile
should be named as
A. Makefile
B. makefile
C. MAKEFILE
D. none of the mentioned
Answer: A
226. Which one of the following command can be used to provide executable
permissions for a file?
A. chmod +x
B. chmod 777
C. both (a) and (b)
D. none of the mentioned
Answer: C
227. The lines in our code that begin with the “#” character are
A. preprocessor directives
B. macros
C. header files
D. none of the mentioned
Answer: A
228. The result of an expression can be assigned to an environement variable with
the command
A. assign
B. set
C. env
D. none of the mentioned
Answer: B