Olete.in
Articles
Mock Tests
🧪 Unix/Lunux MCQ Quiz Hub
Unix MCQS Set 1
Choose a topic to test your knowledge and improve your Unix/Lunux skills
1. Which symbol will be used with grep command to match the pattern pat at the beginning of a line?
^pat
$pat
pat$
pat^
2. Which command is used to sort the
sort
sh
st
sort -r
3. Which command is used to display the top of the file?
cat
head
more
grep
4. Which command is used to copy all files having the string chap and any two characters after that to the progs directory?
cp chap?? progs
cp chap* progs
cp chap[12] /progs/*.*
cp chap?? /progs/*
5. Which command is used to change protection mode of files starting with the string emp and ending with 1,2, or 3?
chmod u+x emp[1-3]
chmod 777 emp*
chmod u+r ??? emp
chmod 222 emp?
6. Which command is used to remove a directory?
rd
rmdir
dldir
rdir
7. Which of the following keys is used to replace a single character with new text?
sort
s
r
C
8. Which command is used to extract specific columns from the file?
cat
cut
grep
paste
9. Which command sends the word count of the file infile to the newfile.
wc infile >newfile
wc <infile >newfile
wc infile - newfile
wc infile | newfile
10. Which command is used to remove the read permission of the file 'note' from both the group and others?
chmod go+r note
chmod go+rw note
chmod go-x note
chmod go-r note
11. Which of the following commands is used to display the directory attributes rather than its contents?
ls -l -d
ls -l
ls -x
ls -F
12. Which of the following files will displayed by this command cat *ch*
patch
catch
.ch
All of the above
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:
0
755
744
555
14. If you are to use [Control-c] as the interrupt key instead of [Del], then you will have to use
tty ^c
stty intr ^c
stty echoe
stty echo ^a
15. Which of the following is not a communication command.
write
mesg
mail
grep
16. Which of the following keys is used to move the cursor to the end of the paragraph.
}
{
|
$
17. Which command is used to concatenate all files beginning with the string 'emp' and followed by a non-numeric characters?
cat emp[!0-9]
more [emp][!0-9]
cat emp[x-z]
cat emp[a-z]
18. The command which transcribes the standard input to the standard output and also makes a copy of the same in a file is
tee
tr
sort
grep
19. Which command is used to remove a file?
remove
rm
mv
del
20. Which symbol is used to separate more than one command in the same command line?
$
#
:
;
21. The agency that sits between the user and the UNIX system is called the
logic
profile
shell
erxc
22. Which of the following commands is used to update access and modification times of a file?
grep
wc
touch
cat
23. Which command is used to count just the number of characters in a file?
wc - 1
wc -c
wc -w
wc -r
24. Which of the following commands is used to list contents of directories?
ls
lp
dir
tar
25. Which command is used to display a file contents in octal form?
cd
od
of
oct
26. Which command will be used with vi editor to insert text to left of cursor?
s
S
a
i
27. In vi editor, forward search is performed using the command.
:pat
?pat
/pat
All of the above
28. Which of the following special shell variables is used to process number of the last background job?
$!
$#
$0
$*
29. The second set of the three permissions (r-) indicates that
group has read permission only
other has read permission only
owner has read permission only
group has write permission only
30. Which of the following command addresses all users who are currently hooked on?
write
mail
wall
mesg
31. Which column contains all details of the permissions of a file when you issue the ls -l command?
second
fourth
third
first
32. Which of the following directories contain all the Alias created by a user, including his login
/tmp
/etc
/usr
/dev
33. Which of the following commands is used to obtain a list of all files by modification time?
ls -1
ls -t
ls -i
ls -R
34. The % key allows you
to move the cursor to a matching delimiter, when a delimiters a parenthesis, a bracket, or a brace.
to move the cursor to the upperleft corner of the screen
to move the cursor backward to the beginning of a word
to move the cursor to the first column in the current line
35. Which command is used to display the characteristics of a process?
pid
du
ps
au
36. Which of the following commands is used to identify the type of file by context?
Is
cat
file
more
37. TWhich of the following commands is used to display your working directory?
dir
prompt $p$g
pwd
path
38. Which command is used to display and create files?
cat
vi
ed
lyrix
39. Which option will be used with touch command to change the access time?
a
b
t
h
40. Which command is used to make all files and sub-directories in the directory (progs) executable by all users?
chmod -R a+x progs
chmod -R 222 progs
chmod -1 a+x progs
chmod -x a+x progs
41. While working with mail command, which command is used to save mail in a separate file?
s
r
w
d
42. The command used to compare the files is known as
comp
cmp
do
ccp
43. Which command is used to terminate a process?
shutdown
haltsys
cancel
kill
44. The cp command uses:
standard input file
standard output file
both input and output file
neither standard input nor standard output file
Submit