0% found this document useful (0 votes)
80 views

A. B. C. D. E.: Answer: Explanation

This document contains 20 multiple choice questions about Unix commands. It tests knowledge of commands like grep, sort, head, tail, cp, rm, chmod, ls and more. For each question, the question text and 5 possible answers are provided, along with the correct answer and sometimes a brief explanation. The questions cover topics like pattern matching, sorting, viewing parts of files, copying and removing files, changing file permissions and more.

Uploaded by

attique
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
80 views

A. B. C. D. E.: Answer: Explanation

This document contains 20 multiple choice questions about Unix commands. It tests knowledge of commands like grep, sort, head, tail, cp, rm, chmod, ls and more. For each question, the question text and 5 possible answers are provided, along with the correct answer and sometimes a brief explanation. The questions cover topics like pattern matching, sorting, viewing parts of files, copying and removing files, changing file permissions and more.

Uploaded by

attique
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 26

Unix

1. 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: Option A
Explanation:
No answer description available for this question. Let us discuss.
View Answer Discuss in Forum Workspace Report

2. 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: Option D
Explanation:
No answer description available for this question. Let us discuss.
View Answer Discuss in Forum Workspace Report

3. 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: Option B
Explanation:
The head command displays the first few lines at the top of a file. It can be useful when you want
a quick peek at a large file, as an alternative to opening the file.
View Answer Discuss in Forum Workspace Report
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: Option A
Explanation:
No answer description available for this question. Let us discuss.
View Answer Discuss in Forum Workspace Report

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: Option A

6. Which command is used to remove a directory?


A. rd

B. rmdir

C. dldir

D. rdir

E. None of the above


Answer: Option B
Explanation:
No answer description available for this question. Let us discuss.
View Answer Discuss in Forum Workspace Report

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: Option B
Explanation:
No answer description available for this question. Let us discuss.
View Answer Discuss in Forum Workspace Report

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: Option B
Explanation:
No answer description available for this question. Let us discuss.
View Answer Discuss in Forum Workspace Report

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

B. wc <infile >newfile

C. wc infile - newfile

D. wc infile | newfile

E. None of the above


Answer: Option A
Explanation:
No answer description available for this question. Let us discuss.
View Answer Discuss in Forum Workspace Report

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: Option D

1. 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: Option A
Explanation:
No answer description available for this question. Let us discuss.
View Answer Discuss in Forum Workspace Report

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: Option D
Explanation:
No answer description available for this question. Let us discuss.
View Answer Discuss in Forum Workspace Report

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: Option B
Explanation:
No answer description available for this question. Let us discuss.
View Answer Discuss in Forum Workspace Report

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: Option B
Explanation:
No answer description available for this question. Let us discuss.
View Answer Discuss in Forum Workspace Report

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


A. write

B. mesg

C. mail

D. grep

E. None of the above


Answer: Option 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: Option A
Explanation:
No answer description available for this question. Let us discuss.
View Answer Discuss in Forum Workspace Report

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: Option A
Explanation:
No answer description available for this question. Let us discuss.
View Answer Discuss in Forum Workspace Report

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: Option A
Explanation:
The tee command reads standard input, then writes its content to standard output and
simultaneously copies it into the specified file(s) or variables.
View Answer Discuss in Forum Workspace Report

19. Which command is used to remove a file?


A. remove

B. rm

C. mv

D. del

E. None of the above


Answer: Option B
Explanation:
No answer description available for this question. Let us discuss.
View Answer Discuss in Forum Workspace Report

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: Option 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: Option C
Explanation:
No answer description available for this question. Let us discuss.
View Answer Discuss in Forum Workspace Report

1. 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: Option B
Explanation:
No answer description available for this question. Let us discuss.
View Answer Discuss in Forum Workspace Report

2. 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: Option B
Explanation:
No answer description available for this question. Let us discuss.
View Answer Discuss in Forum Workspace Report

3. 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: Option C
Explanation:
No answer description available for this question. Let us discuss.
View Answer Discuss in Forum Workspace Report

4. Which of the following is not a filter?


A. cat

B. grep

C. wc

D. sort

E. None of the above


Answer: Option E
Explanation:
No answer description available for this question. Let us discuss.
View Answer Discuss in Forum Workspace Report

5. 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: Option B
6. 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: Option A
Explanation:
No answer description available for this question. Let us discuss.
View Answer Discuss in Forum Workspace Report

7. 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: Option D
Explanation:
No answer description available for this question. Let us discuss.
View Answer Discuss in Forum Workspace Report

8. 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: Option C
Explanation:
No answer description available for this question. Let us discuss.
View Answer Discuss in Forum Workspace Report

9. Which of the following is invalid filename?


A. shutry

B. TRY

C. trial

D. my .file

E. None of the above


Answer: Option E
Explanation:
No answer description available for this question. Let us discuss.
View Answer Discuss in Forum Workspace Report

10. 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: Option D
11. 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: Option B
Explanation:
No answer description available for this question. Let us discuss.
View Answer Discuss in Forum Workspace Report

12. Which command is used to print a file?


A. print
B. prn

C. pg

D. lp

E. None of the above


Answer: Option D
Explanation:
No answer description available for this question. Let us discuss.
View Answer Discuss in Forum Workspace Report

13. 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: Option A
Explanation:
No answer description available for this question. Let us discuss.
View Answer Discuss in Forum Workspace Report

14. 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: Option A
Explanation:
No answer description available for this question. Let us discuss.
View Answer Discuss in Forum Workspace Report

15. 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: Option D

18. 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: Option A
Explanation:
No answer description available for this question. Let us discuss.
View Answer Discuss in Forum Workspace Report

19. 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: Option A
Explanation:
No answer description available for this question. Let us discuss.
View Answer Discuss in Forum Workspace Report

20. 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: Option C
21. 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: Option C
Explanation:
No answer description available for this question. Let us discuss.
View Answer Discuss in Forum Workspace Report

22. 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: Option B
Explanation:
No answer description available for this question. Let us discuss.
View Answer Discuss in Forum Workspace Report

23. 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: Option B
Explanation:
No answer description available for this question. Let us discuss.
View Answer Discuss in Forum Workspace Report
24. 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: Option B
Explanation:
No answer description available for this question. Let us discuss.
View Answer Discuss in Forum Workspace Report

25. 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: Option A
27. Which shell's wild-cards is used to match a single character?
A. *

B. ?

C. [ijk]

D. [!ijk]

E. None of the above


Answer: Option B
Explanation:
No answer description available for this question. Let us discuss.
View Answer Discuss in Forum Workspace Report

28. 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: Option B
33. 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: Option C
Explanation:
No answer description available for this question. Let us discuss.
View Answer Discuss in Forum Workspace Report

34. 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: Option A
Explanation:
No answer description available for this question. Let us discuss.
View Answer Discuss in Forum Workspace Report

35. 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: Option B
37. 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: Option C
Explanation:
No answer description available for this question. Let us discuss.
View Answer Discuss in Forum Workspace Report

38. The seventh field of /etc/password is


A. password

B. login

C. shell

D. home

E. None of the above


Answer: Option C
Explanation:
No answer description available for this question. Let us discuss.
View Answer Discuss in Forum Workspace Report

39. 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: Option B
Explanation:
No answer description available for this question. Let us discuss.
View Answer Discuss in Forum Workspace Report

40. Which command is used to create a directory?


A. crdir
B. md

C. mkdir

D. cr

E. None of the above


Answer: Option 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: Option C
Explanation:
No answer description available for this question. Let us discuss.
View Answer Discuss in Forum Workspace Report

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: Option B
Explanation:
No answer description available for this question. Let us discuss.
View Answer Discuss in Forum Workspace Report

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: Option A
Explanation:
No answer description available for this question. Let us discuss.
View Answer Discuss in Forum Workspace Report

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: Option 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: Option D
Explanation:
No answer description available for this question. Let us discuss.
View Answer Discuss in Forum Workspace Report

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: Option C
Explanation:
No answer description available for this question. Let us discuss.
View Answer Discuss in Forum Workspace Report
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: Option A
Explanation:
No answer description available for this question. Let us discuss.
View Answer Discuss in Forum Workspace Report

29. Which option will be used with ps command to slow the entire command line of the process
being run?
A. -4

B. -f

C. -1

D. -2

E. None of the above


Answer: Option B
Explanation:
No answer description available for this question. Let us discuss.
View Answer Discuss in Forum Workspace Report

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: Option 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: Option C
Explanation:
No answer description available for this question. Let us discuss.
View Answer Discuss in Forum Workspace Report

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: Option C
Explanation:
No answer description available for this question. Let us discuss.
View Answer Discuss in Forum Workspace Report

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: Option B

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: Option C
Explanation:
No answer description available for this question. Let us discuss.
View Answer Discuss in Forum Workspace Report

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: Option B
Explanation:
No answer description available for this question. Let us discuss.
View Answer Discuss in Forum Workspace Report

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: Option D
Explanation:
No answer description available for this question. Let us discuss.
View Answer Discuss in Forum Workspace Report

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: Option A
Explanation:
No answer description available for this question. Let us discuss.
View Answer Discuss in Forum Workspace Report

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: Option 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: Option A
Explanation:
No answer description available for this question. Let us discuss.
View Answer Discuss in Forum Workspace Report

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: Option A
Explanation:
No answer description available for this question. Let us discuss.
View Answer Discuss in Forum Workspace Report

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: Option D
Explanation:
root@server [~]# ls -l
....
-rw------- 1 root root 37 Dec 31 2009 .my.cnf
-rw------- 1 root root 737 Aug 18 21:20 .mysql_history
-rw-r--r-- 1 root root 264 Aug 18 16:51 .pearrc
....
View Answer Discuss in Forum Workspace Report

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: Option C
Explanation:
No answer description available for this question. Let us discuss.
View Answer Discuss in Forum Workspace Report

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: Option A

41. 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: Option C
Explanation:
No answer description available for this question. Let us discuss.
View Answer Discuss in Forum Workspace Report

42. 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: Option D
Explanation:
No answer description available for this question. Let us discuss.
View Answer Discuss in Forum Workspace Report

43. 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: Option A
Explanation:
No answer description available for this question. Let us discuss.
View Answer Discuss in Forum Workspace Report
44. 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: Option C
Explanation:
No answer description available for this question. Let us discuss.
View Answer Discuss in Forum Workspace Report

45. 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: Option 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: Option B
Explanation:
No answer description available for this question. Let us discuss.
View Answer Discuss in Forum Workspace Report

47. Which command is used to terminate a process?


A. shutdown

B. haltsys
C. cancel

D. kill

E. None of the above


Answer: Option D
Explanation:
No answer description available for this question. Let us discuss.
View Answer Discuss in Forum Workspace Report

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: Option B
Explanation:
No answer description available for this question. Let us discuss.
View Answer Discuss in Forum Workspace Report

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: Option D

You might also like