300+ Top UNIX Multiple Choice Questions and Answers

UNIX Multiple Choice Questions MCQs – Shell

1. Which command is used to display the top of the file?

A. cat
B. head
C. more
D. grep
E. None of the above
Answer: B

2. Which symbol will be used with grep command to match the pattern pat at the beginning of a line?

A. ^pat
B. $pat
C. pat$
D. pat^
E. None of the above
Answer: A

3. Which command is used to sort the lines of data in a file in reverse order

A. sort
B. sh
C. st
D. sort -r
E. None of the above
Answer: D

4. Which command is used to copy all files having the string chap and any two characters after that to the progs directory?

A. cp chap?? progs
B. cp chap* progs
C. cp chap[12] /progs/*.*
D. cp chap?? /progs/*
E. None of the above
Answer: A

5. Which command is used to change protection mode of files starting with the string emp and ending with 1,2, or 3?

A. chmod u+x emp[1-3]
B. chmod 777 emp*
C. chmod u+r ??? emp
D. chmod 222 emp?
E. None of the above
Answer: A

6. Which command is used to remove a directory?

A. rd
B. rmdir
C. dldir
D. rdir
E. None of the above
Answer: B

7. Which of the following keys is used to replace a single character with new text?

A. S
B. s
C. r
D. C
E. None of the above
Answer: B

8. Which command is used to extract specific columns from the file?

A. cat
B. cut
C. grep
D. paste
E. None of the above
Answer: B

9. Which command sends the word count of the file infile to the newfile.

A. wc infile >newfile
B. wc newfile
C. wc infile – newfile
D. wc infile | newfile
E. None of the above
Answer: A

10. Which command is used to remove the read permission of the file ‘note’ from both the group and others?

A. chmod go+r note
B. chmod go+rw note
C. chmod go-x note
D. chmod go-r note
E. None of the above
Answer: D

UNIX Mcqs

11. Which of the following commands is used to display the directory attributes rather than its contents?

A. ls -l -d
B. ls -l
C. ls -x
D. ls -F
E. None of the above
Answer: A

12. Which of the following files will displayed by this command cat *ch*

A. patch
B. catch
C. .ch
D. All of the above
E. None of the above
Answer: D

13. The Octal number to be given alogn with chmod command to make a file readable, writable and executable to the owner, readable and executable to group and others is:

A. 000
B. 755
C. 744
D. 555
E. None of the above
Answer: B

14. If you are to use [Control-c] as the interrupt key instead of [Del], then you will have to use

A. tty ^c
B. stty intr \^c
C. stty echoe
D. stty echo \^a
E. None of the above
Answer: B

15. Which of the following is not a communication command.

A. write
B. mesg
C. mail
D. grep
E. None of the above
Answer: D

16. Which of the following keys is used to move the cursor to the end of the paragraph.

A. }
B. {
C. |
D. $
E. None of the above
Answer: A

17. Which command is used to concatenate all files beginning with the string ’emp’ and followed by a non-numeric characters?

A. cat emp[!0-9]
B. more [emp][!0-9]
C. cat emp[x-z]
D. cat emp[a-z]
E. None of the above
Answer: A

18. The command which transcribes the standard input to the standard output and also makes a copy of the same in a file is

A. tee
B. tr
C. sort
D. grep
E. None of the above
Answer: A

19. Which command is used to remove a file?

A. remove
B. rm
C. mv
D. del
E. None of the above
Answer: B

20. Which symbol is used to separate more than one command in the same command line?

A. $
B. #
C. :
D. ;
E. None of the above
Answer: D

21. The agency that sits between the user and the UNIX system is called the

A. logic
B. profile
C. shell
D. erxc
E. None of the above
Answer: C

22. Which of the following commands is used to update access and modification times of a file?

A. grep
B. wc
C. touch
D. cat
E. None of the above
Answer: C

23. Which command is used to count just the number of characters in a file?

A. wc – 1
B. wc -c
C. wc -w
D. wc -r
E. None of the above
Answer: B

24. Which of the following commands is used to list contents of directories?

A. ls
B. lp
C. dir
D. tar
E. None of the above
Answer: A

25. Which command is used to display a file contents in octal form?

A. cd
B. od
C. of
D. oct
E. None of the above
Answer: B

26. Which command will be used with vi editor to insert text to left of cursor?

A. s
B. S
C. a
D. i
E. None of the above
Answer: D

27. In vi editor, forward search is performed using the command.

A. :pat
B. ?pat
C. /pat
D. All of the above
E. None of the above
Answer: C

28. Which of the following special shell variables is used to process number of the last background job?

A. $!
B. $#
C. $0
D. $*
E. None of the above
Answer: A

29. Which option will be used with ps command to show the entire command line of the process being run?

A. -4
B. -f
C. -1
D. -2
E. None of the above
Answer: B

30. Which of the following command addresses all users who are currently hooked on?

A. write
B. mail
C. wall
D. mesg
E. None of the above
Answer: C

31. Which option is used with rm command to make the command prompt the user with each filename and a ?, before acting on it

A. -r
B. -x
C. -i
D. -1
E. None of the above
Answer: C

32. Which of the following directories contain all the Alias created by a user, including his login directory?

A. /tmp
B. /etc
C. /usr
D. /dev
E. None of the above
Answer: C

33. Which of the following commands is used to obtain a list of all files by modification time?

A. ls -1
B. ls -t
C. ls -i
D. ls -R
E. None of the above
Answer: B

34. The % key allows you

A. to move the cursor to a matching delimiter, when a delimiters a parenthesis, a bracket, or a brace.
B. to move the cursor to the upperleft corner of the screen
C. to move the cursor backward to the beginning of a word
D. to move the cursor to the first column in the current line
E. None of the above
Answer: A

35. Which command is used to display the characteristics of a process?

A. pid
B. du
C. ps
D. au
E. None of the above
Answer: C

36. Which of the following commands is used to identify the type of file by context?

A. ls
B. cat
C. file
D. more
E. None of the above
Answer: C

37. The field separator in cut command is specified with

A. -a option
B. -d option
C. -r option
D. -x option
E. None of the above
Answer: B

38. Which of the following options will be used to display number of blocks used by a file?

A. -c
B. -i
C. -d
D. -s
E. None of the above
Answer: D

39. Which option will be used with touch command to change the access time?

A. -a
B. -b
C. -t
D. -h
E. None of the above
Answer: A

40. Which command is used to make all files and sub-directories in the directory (progs) executable by all users?

A. chmod -R a+x progs
B. chmod -R 222 progs
C. chmod -1 a+x progs
D. chmod -x a+x progs
E. None of the above
Answer: A

41. Which command is used to display and create files?

A. cat
B. vi
C. ed
D. lyrix
E. None of the above
Answer: A

42. The second set of the three permissions (r-) indicates that

A. group has read permission only
B. other has read permission only
C. owner has read permission only
D. group has write permission only
E. None of the above
Answer: A

43. Which column contains all details of the permissions of a file when you issue the ls -l command?

A. second
B. fourth
C. third
D. first
E. None of the above
Answer: D

44. Which of the following commands is used to display your working directory?

A. dir
B. prompt $p$g
C. pwd
D. path
E. None of the above
Answer: C

45. While working with mail command, which command is used to save mail in a separate file?

A. s
B. r
C. w
D. d
E. None of the above
Answer: A

46. The command used to compare the files is known as

A. comp
B. cmp
C. do
D. ccp
E. None of the above
Answer: B

47. Which command is used to terminate a process?

A. shutdown
B. haltsys
C. cancel
D. kill
E. None of the above
Answer: D

48. Which option will be used with sort command to start sorting ofter the nth column of the (m+l)th field?

A. -m.n
B. +m.n
C. + n.m+1
D. +(m+l).n
E. None of the above
Answer: B

49. The cp command uses:

A. standard input file
B. standard output file
C. both input and output file
D. neither standard input nor standard output file
E. None of the above
Answer: D

50. Which command is used with file named ‘note’ to remove the executable permission from the user and assign read permission to the group and others?

A. chmod u-x, go+r note
B. chmod go+r, u+x note
C. chmod g-x, uo+r note
D. chmod go+x, u-x note
E. None of the above
Answer: A

51. Which of the following files contains information related to password aging?

A. Shadow
B. password
C. profile
D. All the three
E. None of the above
Answer: B

52. Which command will be used with vi editor to replace text from cursor to right?

A. r
B. R
C. s
D. S
E. None of the above
Answer: B

53. Which of the following commands is used to rename a file?

A. rename
B. remove
C. mv
D. ren
E. None of the above
Answer: C

54. Which of the following is not a filter?

A. cat
B. grep
C. wc
D. sort
E. None of the above
Answer: E

55. Which of the following commands is used to copy a file wb from the programs directory into a file called wbx in the misc directory?

A. copy programs/wb misc/wbx
B. cp programs/wb misc/wbx
C. tar programs/wb misc/wbx
D. copy a:programs/wb b:misc/wbx
E. None of the above
Answer: B

56. Which command is used to list all the files with extension .lst?

A. ls -l *.lst
B. ls lst*
C. ls *.*
D. ls *[lst]
E. None of the above
Answer: A

57. Which option is used with the chmod command recursively to all files and sub-directories in a directory?

A. -1
B. -i
C. -x
D. -R
E. None of the above
Answer: D

58. Which command is used to change directory to the name beginning with a ‘p’?

A. cd p
B. cd p?
C. cd p*
D. cd [p]
E. None of the above
Answer: C

59. Which of the following is invalid filename?

A. shutry
B. TRY
C. trial
D. my .file
E. None of the above
Answer: E

60. Which commands is used to assign executable permission to all of the files named “letter”?

A. chmod ugo+r letter
B. chmod ugo+rw letter
C. chmod u+x letter
D. chmod ugo+x letter
E. None of the above
Answer: D

61. Which set option is used with vi editor to display line numbers on screen?

A. nm
B. nu
C. ic
D. li
E. None of the above
Answer: B

62. Which command is used to print a file?

A. print
B. prn
C. pg
D. lp
E. None of the above
Answer: D

63. Which command will be used with vi editor to replace single character under cursor with any number of characters?

A. s
B. S
C. a
D. i
E. None of the above
Answer: A

64. Which of the following set options is used with vi editor to ignore case while searching for patterns?

A. ic
B. ai
C. sm
D. ts
E. None of the above
Answer: A

65. Which command is used to list out all the hidden files along with the other files?

A. ls -l
B. ls -x
C. ls -F
D. ls -a
E. None of the above
Answer: D

66. Which of the following commands is used to absolutely assign all permissions to the owner, read and write permissions to the group and only executable permission to the others of the file note?

A. chmod 761 note
B. chmod 671 note
C. chmod 167 note
D. chmod 4=rwx, g=rw note
E. None of the above
Answer: A

67. The chmod ugo+rw note command can be represented in octal notation as

A. chmod 555 note
B. chmod 666 note
C. chmod 444 note
D. chmod 333 note
E. None of the above
Answer: B

68. Which of the following commands is used to display the filenames in multiple columns with indication of directories and executable file?

A. ls -F -x
B. ls -l
C. ls ~ x
D. Ip
E. None of the above
Answer: A

69. Which command is used with vi editor to search a pattern in the forward direction?

A. /
B. ?
C. //
D. ??
E. None of the above
Answer: A

70. Which of the following commands is used to assign executable permission to the owner of the file named “note”?

A. chmod g+x note
B. chmod u+w note
C. chmod u+x note
D. chmod ugo+x note
E. None of the above
Answer: C

71. The command to count the number of files in the current directory by using pipes, is

A. ls | wc
B. ls -l | wc -l
C. ls | wc -w
D. ls | ws -c
E. None of the above
Answer: C

72. Which of the following commands is used to get directory one level up?

A. cd
B. cd ..
C. cd/
D. chdir
E. None of the above
Answer: B

73. Which of the following commands is used to count the total number of lines, words, and characters contained in a file.

A. count p
B. wc
C. wcount
D. countw
E. None of the above
Answer: B

74. Which command is used to delete all files in the current directory as well as all files and sub-directories in its subdirectories?

A. rm *
B. rm -r *
C. rm all
D. rm *.*
E. None of the above
Answer: B

75. Which of the following commands is used to change the working directory?

A. cd
B. changedir
C. chdir
D. cdir
E. None of the above
Answer: A

76. Which of the following commands is used to view your file 24 lines at a time?

A. pg
B. cat
C. lp
D. /p
E. None of the above
Answer: A

77. Which shell’s wild-cards is used to match a single character?

A. *
B. ?
C. [ijk]
D. [!ijk]
E. None of the above
Answer: B

78. In Bourne shell, which file sets the Unix environment for the user when the logs into his HOME directory.

A. .exrc
B. .profile
C. lastlogin
D. .mbox
E. None of the above
Answer: B

79. Which command is used to copy the three files wb, collect and mon into the misc directory, under the same, when you were currently in the programs directory?

A. copy wb ../misc collect ../misc mon ../misc
B. cp wb collect mon ../misc
C. copy wb collect mon /misc
D. tar wb collect mon /misc
E. None of the above
Answer: B

80. The command chmod 761 note is equivalent to

A. chmod 167 note
B. chmod u=rwx, g=rw, o=x note
C. chmo a =761 note
D. chmod 4=7, g=6,0 =1 note
E. None of the above
Answer: B

81. The commonly used UNIX commands like date, ls, cat, etc. are stored in

A. /dev directory
B. /bin and /usr/bin directories
C. /tmp directory
D. /unix directory
E. None of the above
Answer: B

82. Which of the following commands is used to remove files with confirmation prompt from the user file system which have neither been accessed nor modified i the last one year?

A. find -mtime +365 | rm
B. grep (/usr/*) – mtime + 365 | -ok rm
C. find -name – mtime + 365 / – ok rm
D. find /user/* \(-mtime + 365 – a – atime +365 \) – OK rm {} \;
E. None of the above
Answer: D

83. Which of the following commands is used to summarize the disk usage?

A. chkdsk
B. fdisk
C. du
D. disk
E. None of the above
Answer: C

84. Which command is used to sort the lines of data in a file in alphabetical order?

A. sort
B. sh
C. st
D. sort -r
E. None of the above
Answer: A

85. If a file has read and write permissions for the owner, then the octal representation of the permissions will be

A. 1
B. 6
C. 5
D. 3
E. None of the above
Answer: B

86. Which command is used to copy a file wb with the same name from the programs directory to the misc directory?

A. copy programs/wb misc/wb
B. cp programs/wb misc
C. tar programs/wb misc/wb
D. copy a:programs/wb b:misc/wb
E. None of the above
Answer: B

87. Which is the earliest and most widely used shell that came with the UNIX system?

A. C shell
B. Korn shell
C. Bourne shell
D. Smith shell
E. None of the above
Answer: C

88. The seventh field of /etc/password is

A. password
B. login
C. shell
D. home
E. None of the above
Answer: C

89. Which command is used to display the end of the file?

A. head – r
B. tail
C. eof
D. bof
E. None of the above
Answer: B

90. Which command is used to create a directory?

A. crdir
B. md
C. mkdir
D. cr
E. None of the above
Answer: C

91. Which command is used to display the device name of the terminal you are using?

A. who
B. ls
C. tty
D. stty
E. None of the above
Answer: C

92. The ls -l command tells

A. who the owner of the file is
B. the name of the group owner of the file
C. how large the file is and when the file was last modified.
D. All of the above
E. None of the above
Answer: D

93. Which option will be used with disk free command to include the total amount of disk space in the file system?

A. -t
B. -tt
C. -4
D. -i
E. None of the above
Answer: A

94. Which command is used to set the three permissions for all the three categories of users of a file?

A. chgrp
B. chown
C. chmod
D. chusr
E. None of the above
Answer: C

95. Which of the following commands can be used to get information about yourself?

A. who am i
B. i /4
C. pwd
D. which
E. None of the above
Answer: A

96. Which of the following commands can be used to get information about all users who are currently logged into the system?

A. which
B. who
C. who am i
D. 1 /u
E. None of the above
Answer: B

97. Which of the following keys is used to overstrike a whole line?

A. R
B. v
C. C
D. u
E. None of the above
Answer: A

98. Which command is used to locate all the .profile files in the system?

A. ls profile
B. find /-name profile -print
C. cd /.profile
D. l -u .profile
E. None of the above
Answer: B

99. Which of the following commands is used to display the filenames in multiple columns?

A. ls
B. ls -1
C. ls -x
D. lc
E. None of the above
Answer: C

100. Which of are following internal commands is used in mail to forward mail to user in user-list?

A. r user-list
B. m user-list
C. d user-list
D. e user-list
E. None of the above
Answer: B

101. The File that contains a set of instructions which are performed when a user logs in, is

A. .exrc
B. .profile
C. .autoexec
D. autoexec.bat
E. None of the above
Answer: B

102. The octal representation 652 indicates

A. Execute permission for the owner
B. Write permission for others
C. Read and write permission of groups
D. All of the above
E. None of the above
Answer: B

103. Which of the following command is used to count just the number of lines contained in a file?

A. wc -l
B. wc -c
C. wc -w
D. wc -r
E. None of the above
Answer: A

104. Which of the following command is used to go to home directory?

A. cd..
B. cd/
C. cd
D. cd HOME.
E. None of the above
Answer: C

105. Which command is used to move all files to the bin sub-directory of the parent directory?

A. mv *.* /bin/
B. mv * /bin/*
C. mv * ../bin
D. mv * ../bin *.*
E. None of the above
Answer: C

106. Which command is used to save the standard output in a file, as well as display it on the terminal?

A. more
B. cat
C. grep
D. tee
E. None of the above
Answer: D

107. The command that can be used to restrict incoming messages to a user is

A. mesg
B. grep
C. halt
D. sleep
E. None of the above
Answer: A

108. Which of the following commands is used to copy directory structures in and out

A. cp
B. cpio
C. cp – p
D. copy
E. None of the above
Answer: B

109. Which of following commands is used for an automatic reminder service?

A. write
B. mesg
C. calendar
D. mail
E. None of the above
Answer: C

110. Which command allows you to view your file 24 lines at a time?

A. more
B. pg
C. cat
D. lp
E. None of the above
Answer: B

111. Which of the following special shell variables is used to process number of the current shell?

A. $!
B. $$
C. $0
D. $*
E. None of the above
Answer: B

112. Which option is used with cmp command to give a detailed list of the byte number and the differing bytes in octal for each character that differs in both the files?

A. -l
B. -d
C. -r
D. -b
E. None of the above
Answer: A

113. Which command is used with vi editor scroll half page backward?

A. [Control-d]
B. [Control – u]
C. [Control-c]
D. [Control -P]
E. None of the above
Answer: B

114. Which command is used with vi editor to move cursor forward to first occurrence of character ‘ch’ in the current line?

A. tch
B. fch
C. rch
D. ech
E. None of the above
Answer: B

115. Which of the following keys is used to delete the character beneath the cursor?

A. x
B. X
C. dd
D. D
E. None of the above
Answer: A

116. Which command is used to assign only read permission to all three categories of the file ‘note’?

A. chmod go+r note
B. chmod a-rw
C. chmod ugo=r note
D. chmod u+r,g+r,o-x note
E. None of the above
Answer: C

117. Which command will be used with vi editor to append text at end of line?

A. A
B. a
C. i
D. I
E. None of the above
Answer: A

118. The first set of the three permissions (rw) pertains to the owner of the file, indicating that the owner has

A. executable permission only
B. write and executable permissions
C. both read and executable permissions.
D. both read and write permissions
E. None of the above
Answer: D

119. Which of the following commands is used to save the output of the who command in a file named user.lst, as well as display it?

A. who | tee user.lst
B. who > user.lst
C. who >> user.lst
D. who < user.lste
E. None of the above
Answer: A

120. Which of the following shell’s wildcards are used to match any number of characters including none?

A. [ijk]
B. [!ijk]
C. ?
D. *
E. None of the above
Answer: D

121. The command used to remove the directory is;

A. rmdir
B. rd
C. remove
D. rdir
E. None of the above
Answer: A

122. Which symbol will be used with grep command to match the pattern pat at the end of a line?

A. ^pat
B. $pat
C. pat$
D. pat^
E. None of the above
Answer: C

123. Which command is used to display all the lines with the string ‘sales’ from the file empl.lst?

A. cut sales empl.lst
B. /sales > empl.lst
C. grep sales empl.lst
D. cat | /sales > empl.lst
E. None of the above
Answer: C

124. Which of the following commands is not the vi Input mode command?

A. rch
B. R
C. S
D. j
E. None of the above
Answer: D

125. Which of the following commands is used to remove files?

A. erase
B. delete
C. rm
D. dm
E. . None of the above
Answer: C

126. Which command is used with vi editor to save file and remain in the editing mode?

A. :q
B. :w
C. q!
D. : x
E. None of the above
Answer: B

127. You can append to a file instead of overwriting by using the

A. > symbols
B. >> symbols
C. < symbols
D. << symbols
E. None of the above
Answer: B

128. The [line number G] key allows you

A. to move cursor left by one position
B. to move cursor right by one position
C. to move cursor down by one line
D. to move cursor to the beginning of the line specified by the number
E. None of the above
Answer: D

129. Which of the following commands is used to have a two-way communication with any person who is currently logged in?

A. mail
B. mesg
C. write
D. grep
E. None of the above
Answer: C

130. Which command is used with vi editor to move the cursor to the left?

A. i
B. j
C. k
D. h
E. None of the above
Answer: D

131. Which of command is used to copy a file?

A. copy
B. cp
C. cpio
D. tar
E. None of the above
Answer: B

132. The special shell variable $* is used

A. to exit status of ast command executed.
B. to process number of the current shell
C. to list the positional parameters
D. to name the command being executed
E. None of the above
Answer: C

133. The cat command is used to

A. capture a file
B. display a file
C. print a file
D. copy a file
E. None of the above
Answer: B

134. The UNIX file system stores a data in physical blocks of

A. 1024 bytes
B. 2048 bytes
C. 512 bytes
D. 256 bytes
E. None of the above
Answer: C

135. Which command is used to terminate all processes in your own system except the login shell?

A. kill 1
B. kill 0
C. cancel all
D. cancel 1
E. None of the above
Answer: B

136. Which operator will be used with chmod command to assign absolute permission?

A. +
B. –
C. =
D. %
E. None of the above
Answer: C

137. Which command is used to link the files?

A. lk
B. ln
C. cp
D. tar
E. None of the above
Answer: B

138. Which of the following signs is used to back up over typing errors in vi?

A. @
B. #
C. $
D. !
E. None of the above
Answer: B

139. Major expressions used with find command to select file is it has been accessed in more than 375 days, is

A. -atime +365
B. -mtime + 365
C. -atime -365
D. -mtime -365
E. None of the above
Answer: A

UNIX objective questions with answers pdf download online exam test

Leave a Reply

Your email address will not be published. Required fields are marked *