Basic Unix Commands Quiz

Test your knowledge of fundamental Unix command-line operations including file management, text processing, and permissions.

10 Questions Published

Questions

Question 1 Multiple Choice (Single Answer)

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

  1. ^pat
  2. $pat
  3. pat$
  4. pat^
Question 2 Multiple Choice (Single Answer)

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

  1. sort
  2. sh
  3. st
  4. sort -r
Question 3 Multiple Choice (Single Answer)

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

  1. cat
  2. head
  3. more
  4. grep
Question 4 Multiple Choice (Single Answer)

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

  1. cp chap?? progs
  2. cp chap* progs
  3. cp chap[12] /progs/.
  4. cp chap?? /progs/*
Question 5 Multiple Choice (Single Answer)

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

  1. chmod u x emp[l-3]
  2. chmod 777 emp*
  3. chmod u r ??? emp
  4. chmod 222 emp?
Question 6 Multiple Choice (Single Answer)

Which command is used to remove a directory?

  1. rd
  2. rmdir
  3. dldir
  4. rdir
Question 7 Multiple Choice (Single Answer)

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

  1. S
  2. s
  3. r
  4. C
Question 8 Multiple Choice (Single Answer)

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

  1. cat
  2. cut
  3. grep
  4. paste
Question 9 Multiple Choice (Single Answer)

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

  1. wc infile >newfile
  2. wc <infile >newfile
  3. wc infile - newfile
  4. wc infile | newfile
Question 10 Multiple Choice (Single Answer)

Which command is used to remove the read permission of the file 'note' from both the group and others?

  1. chmod go r note
  2. chmod go rw note
  3. chmod go-x note
  4. chmod go-r, 4-x note