CS/IT MCQ Collections

Top 20 MCQ Questions on Basic Linux Commands

Pinterest LinkedIn Tumblr

These collections of the top 20 MCQ questions on basic Linux commands include multiple-choice questions on the basic Linux commands for listing the files and directories(ls), making directories(mkdir), pathnames(pwd), and copying and moving the files and directories(cp, mv).

1. -s is a …………. that is used in a Linux shell.
A) Command
B) Parameter
C) Option argument
D) Both B and C

2. …………… is a Linux command that lists the contents in the current directory.
A) li
B) ls
C) lc
D) ld

3. Which of the following is the syntax of the command prompt used in a Linux shell?
A) root@hostname:~#
B) user>
C) Both A and B
D) None of the above

4. The symbol …….. used in a command prompt means that you are in your home directory.
A) #
B) $
C) >
D) ~

5. The symbol …….. used in a command prompt means you have logged in using a normal user account with limited rights.
A) #
B) $
C) >
D) ~

6. The symbol …….. used in a command prompt means you have logged in using a super user account with root user rights.
A) #
B) $
C) >
D) ~

7. ……. is a Linux command that displays the current username.
A) Display
B) Showuser
C) Whoami
D) Currentuser

8. The Linux command ……… is used to print the working directory.
A) print
B) pwd
C) pd
D) prinwd

9. The Linux command ……… is used to change the user password.
A) passwd
B) chpass
C) pwd
D) cpwd

10. ………… is the Linux command used to view the user details.
A) id
B) ud
C) vud
D) iud

11. The Linux command ………… list all files from your home directory including the hidden files.
A) ls -h
B) ls -a
C) li -a
D) li -h

12. ………… command creates the directory with the name “InfoTech”.
A) mkdir InfoTech
B) makedir InfoTech
C) md InfoTech
D) Both A and B

13. The command …………. change the current working directory to “InfoTech”.
A) cdir InfoTech
B) chdir InfoTech
C) cd InfoTech
D) md InfoTech

14. In Linux, which command returns you to your home directory?
A) cd
B) cd.
C) cd~
D) Both A and C

15. Which command is used to copy the contents of file1 to file2?
A) copy file1 file2
B) cp file1 file2
C) copy “file1” “file2”
D) cp “file1” “file2”

16. The ……….. command will copy the contents of directory1 as well as the directory itself to directory2.
A) cp directory1 directory2
B) cp directory2 directory1
C) cp -R directory1 directory2
D) cp -all directory1 directory2

17. What are the uses of the mv command in Linux?
i. It will move a file to a different directory.
ii. It will move multiple files to a different directory.
iii. It will rename a file or a directory.
A) i and ii only
B) i and iii only
C) ii and iii only
D) All i, ii and iii

18. The Linux command mv file1 InfoTech/file2 will ……
i. move the file named “file1” to the directory “InfoTech”.
ii. rename the “file1” to “file2”.
iii. move to file named “file1” to the directory InfoTech/file2
A) i and ii only
B) i and iii only
C) ii and iii only
D) All i, ii and iii

19. The Linux command ………. will delete an empty directory.
A) rm dir1
B) rmdir dir1
C) rmem dir1
D) rm -r dir1

20. The command ………. will recursively delete the files in the “InfoTech” directory.
A) rmr InfoTech
B) rm r InfoTech
C) rm -r InfoTech
D) rm -rf InfoTech

Answers:

  1. D) Both B and C
  2. B) ls
  3. C) Both A and B
  4. D) ~
  5. B) $
  6. A) #
  7. C) Whoami
  8. B) pwd
  9. A) passwd
  10. A) id
  11. B) ls -a
  12. A) mkdir InfoTech
  13. C) cd InfoTech
  14. D) Both A and C
  15. B) cp file1 file2
  16. C) cp -R directory1 directory2
  17. D) All i, ii and iii
  18. A) i and ii only
  19. B) rmdir dir1
  20. C) rm -r InfoTech

Author

Shuseel Baral is a web programmer and the founder of InfoTechSite has over 8 years of experience in software development, internet, SEO, blogging and marketing digital products and services is passionate about exceeding your expectations.

Comments are closed.