0% found this document useful (0 votes)
13 views13 pages

UNIX Command Mock Test Questions

The document consists of multiple mock tests containing questions related to UNIX commands and shell scripting. Each test includes questions about command syntax, options, and functionalities, such as file manipulation, permissions, and process management. The tests aim to assess knowledge and understanding of UNIX systems and commands.

Uploaded by

Shuvojit Biswas
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
13 views13 pages

UNIX Command Mock Test Questions

The document consists of multiple mock tests containing questions related to UNIX commands and shell scripting. Each test includes questions about command syntax, options, and functionalities, such as file manipulation, permissions, and process management. The tests aim to assess knowledge and understanding of UNIX systems and commands.

Uploaded by

Shuvojit Biswas
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

1st mock test

1. Which of the following characters specify the user and group category?

1. u and g

2. g and o

3. us and gr

4. u and o

2. Which option is used with grep command for ignoring the case in pattern searching?

1. -a

2. -v

3. -i

4. -e

3. Which of the following command will be used for searching director in [Link]?

1. grep director [Link]

2. grep -director [Link]

3. grep -v director [Link]

4. grep director

4. To check if the file exists and is executable we have to use ___ option with test.

1. -e

2. -f

3. -x

4. -w

5. Which command is used to reverse the direction of repeating the search?

1. n

2. N

3. nn

4. NN

6. Which of the following cannot be performed by cat command?

1. appending files

2. deleting files

3. creating files

4. displaying files

7. Which one of the following is the correct syntax for grep command?

1. grep options filename(s)

2. grep options pattern


3. grep pattern filename

4. grep options pattern filename(s)

8. Which command is used for removing/deleting files in UNIX?

1. rmdir

2. rm

3. del

4. mv

9. What happens if the destination file specified in cp command does not exist?

1. file will not be copied

2. an error will be produced

3. destination file will be automatically created

4. none of the mentioned

10. Which of the following flag will be used for interactive substitution?

1. g

2. G

3. gc

4. cg

11. Which command is used for printing a file?

1. lp

2. pr

3. pg

4. more

12. To navigate 20 pages forward, we can use ______ command.

1. 20 ctrl-b

2. 20 ctrl-d

3. 20 ctrl-u

4. 20 ctrl-f

13. echo command is used for _________

1. displaying diagnostic messages

2. displaying date and time

3. displaying errors

4. displaying operating system details


14. _____ option is used with sort command for removing repeated lines.

1. -n

2. -u

3. -t

4. -a

15. Which option is used by the sort command to redirect the output to a specified file?

1. -n

2. -t

3. -o

4. -u

2nd mock test

1. A shell script stopped running when we change its name. Why?

1. location of the file changed

2. we cant change the name of the script

3. $0 was used in the script

4. many possible reasons

Which command is used to know the current line number?

1. ctrl-f

2. ctrl-b

3. ctrl-z

4. ctrl-g

3. Which option is used with ls command for long listing of files with seven attributes?

1. -a

2. -l

3. -x

4. -i

. Which editor is used by the Unix system to edit files?

1. word

2. notepad++

3. vi

4. notepa

5. Which option is used for counting the number of words in a file only?

1. -l

2. -W
3. -c

4. -w

6. What is the default delimiter used by the cut command for cutting fields?

1. space

2. tab

3. double tab

4. underscore

7. The prompt issued by the shell is called ______

1. prompt

2. command translator

3. command prompt

4. command executor

8. Which option is used for counting the number of characters in a file only.

1. -l

2. -W

3. -c

4. -w

9. Which option is used with mv command so that the destination file does not get overwritten?

1. -n

2. -f

3. -b

4. -i

10. Which option is used with grep command for ignoring the case in pattern searching?

1. -a

2. -v

3. -i

4. -e

11. To know the exit status of a command, we can use ____

1. $$

2. $*

3. $?

4. $-

2. Which of the following attribute is not shown by ps command?


1. PID

2. PPID

3. tty

4. size

13. What is the function of cp command in UNIX?

1. list all the available files in the current directory

2. delete a given file

3. cp is a command used for copying files and directories

4. change the directory

14. Which of the following is not a part of all the versions of UNIX?

1. Kernel and Shell

2. Commands and utilities

3. Graphical user interface

4. System Calls

15. Which command is used for acquiring superuser status?

1. sudo

2. pu

3. super

4. admn

3rd mock test

1. A shell script stopped running when we change its name. Why?

1. location of the file changed

2. we cant change the name of the script

3. $0 was used in the script

4. many possible reasons

2. Which command is used for printing a file?

1. lp

2. pr

3. pg

4. more

3. What is the default delimiter used by the cut command for cutting fields?

1. underscore

2. space

3. tab
4. double tab

4. Which of the following is not an internal command for more?

1. q

2. f

3. b

4. z

5. ____ statement is used for shifting arguments left.

1. set

2. shift

3. cut

4. paste

. Which system call is used to run a new program?

1. fork

2. wait

3. exec

4. exit

7. What is the function of cp command in UNIX?

1. list all the available files in the current directory

2. delete a given file

3. cp is a command used for copying files and directories

4. change the directory

8. To run the script, we should make it executable first by using _____

1. chmod +x

2. chmod +r

3. chmod +w

4. chmod +rwx

9. A higher nice value implies a lower priority. nice reduces the priority of any process.

1. -a

2. -n

3. -o

4. -q

10. What is the default symbol for command prompt in Bourne shell?

1. $

2. %
3. #

4. @

11. Which command is used for making the scripts interactive?

1. ip

2. input

3. read

4. write

12. Which of the following command will be used to write the 4th line to file named file002?

1. : 1,40w file002

2. : 1,$w file002

3. : 4w file002

4. : 1,4w file002

13. What if the destination file specified in mv command already exists?

1. it will be deleted

2. it will not be affected

3. it will be overwritten

4. an error will be produced

14. Which command is used for premature termination of a process?

1. signal

2. nice

3. kill

4. nohup

15. Which process is immediately set up by the kernel when we log on to a Unix system?

1. System

2. bash

3. shell

4. parent

4th mock test

1. Which option is used for the recursive functioning of chmod command?

1. -R

2. -r

3. -l

4. -i
2. To check if the file exists and is executable we have to use ___ option with test.

1. -e

2. -f

3. -x

4. -w

3. To run the script, we should make it executable first by using _____

1. chmod +w

2. chmod +rwx

3. chmod +x

4. chmod +r

4. Which option is used with cmp command to limit the number of bytes to be compared?

1. -n

2. -l

3. -f

4. -b

5. Which of the following command is used to create a child shell?

1. sh

2. env

3. wait

4. fork

6. Which of the following commands will be used to delete 6 lines from the current cursor location?

1. 6d

2. 6X

3. 6dd

4. 6x

7. What is a superuser?

1. system manager

2. normal user

3. administrator

4. a user with special rights

8. Which command will be used to join 4 lines with the current line?

1. 5J

2. 4J

3. 6J
4. 4j

9. What will the output of the following command?

$ ps -t dev/console

1. processes running on terminal named console

2. undefined output

3. erroneous

4. processes running on the current terminal

10. Which command is used for removing/deleting files in Unix?

1. rm

2. mv

3. rmdir

4. del

11. Using b command we can _____________

1. move back to the beginning of the word

2. move forward to the end of the word

3. move forward to the beginning of the word

4. move back to the end of the word

12. Which of the following operator is used as a shorthand for test?

1. % %

2. [ ]

3. & &

4. ( )

13. Which of the following control keys will be used for scrolling one page forward?

1. ctrl-f

2. ctrl-b

3. ctrl-z

4. ctrl-v

14. Which symbol is used to change permissions for hidden files?

1. .

2. &

3. $

4. *

15. Which option is used by the sort command to redirect the output to a specified file?

1. -n
2. -t

3. -o

4. -u

5th mock test

1. Which of the following is not a special parameter used by the shell?

1. $$

2. $*

3. $?

4. $-

2. What is the function of cp command in Unix?

1. delete a given file

2. change the directory

3. list all the available files in the current directory

4. cp is a command used for copying files and directories

3. Which command is used to change the permissions of a file?

1. chmod

2. ch

3. chown

4. chgrp

4. Which option is used with cmp command to limit the number of bytes to be compared?

1. -n

2. -l

3. -f

4. -b

5. In ex-mode, last line is represented by ___

1. :

2. $

3. >

4. .

6. Using b command we can _____________

1. move back to the beginning of the word

2. move forward to the end of the word

3. move forward to the beginning of the word


4. move back to the end of the word

7. Which option is used with lp command if there are more than one printers in the system?

1. -t

2. -d

3. -i

4. -p

8. To remove write permission from group and others, which one of the following commands will be used?

1. chmod go+w file01

2. chmod go-w file01

3. chmod ug-w file01

4. chmod a-w file01

9. Which command is used for changing filename extensions?

1. chown

2. rename

3. basename

4. rm

10. Which of the following flag will be used for interactive substitution?

1. g

2. G

3. gc

4. cg

11. Which option is used with ls to display attributes of the directory ?

1. -a

2. -ld

3. -d

4. -o

12. What will be the command if we want to suppress column 1 and column 2 in the output of comm Command?

1. comm -12

2. comm -1-2

3. comm -3

4. comm -1,-2

13. Which command is used by the user to change their login password in Unix?

1. cp

2. man
3. reset

4. passwd

14. Which command is used for joining lines?

1. J

2. j

3. yy

4. jn

15. Which one of the following commands will be used to delete all the instances of string manager in file003?

1. 1,$s/manager/ /g

2. %s/manager/director/g

3. 1,$s/professor/director

4. %s/manager/ /

You might also like