Linux is an open-source Unix-like operating system that is based on the Linux kernel. The kernel was first released on September 17, 1991, by Linus Torvalds. Linux is typically packaged in a Linux distribution. The Linux operating system comprises several different pieces: Bootloader, Kernel, Init system, Daemons, Graphical server, Desktop environment, Applications, etc.
Linux MCQs: This section contains multiple-choice questions and answers on the Linux operating system. It will help the students to test their skills and prepare well for their exams.
List of Linux MCQs
1. Who founded Linux Kernel?
- Ken Thompson and Dennis Ritchie
- Linus Torvalds
- Linus Torvalds and Ken Thompson
- Richard Stallman
Answer: B) Linus Torvalds
Explanation:
Linus Torvalds founded Linux Kernel.
2. What is the core of the Linux operating system?
- Vi Editor
- Command Line
- Terminal
- Kernel
Answer: D) Kernel
Explanation:
The kernel is the core of the Linux operating system.
3. Which is/are the directories that come under the Binary directory?
- /bin
- /sbin
- /lib
- /opt
- All of the above
Answer: E) All of the above
Explanation:
Binary directory contains following directories:
- /bin
- /sbin
- /lib
- /opt
4. The directory is a type of file?
- Yes
- No
Answer: A) Yes
Explanation:
Yes, the directory is a type of file.
5. Which symbol represents the top-level directory?
- ~
- @
- #
- /
Answer: D) /
Explanation:
The symbol “/” represents the top-level directory.
6. Which symbol represents the user’s home directory?
- ~
- @
- #
- /
Answer: A) ~
Explanation:
The symbol “~” represents the user’s home directory.
7. Which Linux command is used to count the total number of lines, words, and characters contained in a file?
- count
- wcount
- wc
- countw
Answer: C) wc
Explanation:
The “wc” command is used to count the number of lines, words, characters, and bytes of each given file or standard input and print the result.
8. Which Linux command is used to remove files?
- remove
- rm
- delete
- del
Answer: B) rm
Explanation:
The “rm” command is used to remove files in Linux.
9. Which Linux command with vi Editor is used to delete a single character?
- d
- r
- x
- c
Answer: C) x
Explanation:
The command “x” is used to delete a single character in vi Editor.
10. Which Linux command is used to know which directory you are in?
- know
- help
- cwd
- pwd
Answer: D) pwd
Explanation:
To know which directory you are in, the “pwd” command can be used. The “pwd” command stands for “Present Working Directory”. This command gives us the absolute path, which means the path that starts from the root.
11. Which Linux command is used to see all the hidden files?
- ls
- ls -h
- ls -a
- dir -a
Answer: C) ls -a
Explanation:
The “ls” command with argument “-a” can be used to see all the hidden files.
12. Which Linux command is used to give a full listing?
- ls -F
- ls -h
- ls -a
- dir -a
Answer: A) ls -F
Explanation:
The “ls -F” command is used to see a full listing, indicating what type files are by putting a slash after directories and a star after executable files.
13. Which Linux command is used to go back from a folder to the folder before that?
- cd..
- cd
- cd/
- chdir
Answer: A) cd..
Explanation:
To go back from a folder to the folder before that, we can use the Linux command “cd ..” . Here, the two dots (..) represent back.
14. If you want to create a new directory named XYZ, which command will be used for this purpose?
- cd XYZ
- chdir XYZ
- mkdir XYZ
- md XYZ
Answer: C) mkdir XYZ
Explanation:
To create a new directory named XYZ, we can use “mkdir XYZ”. The “mkdir” command is used to make a directory in Linux.
15. Which Linux command is used to create a new file?
- create
- file
- tch
- touch
Answer: D) touch
Explanation:
The “touch” command is used to create a file.
16. Which Linux command is used to copy files through the command line?
- cp
- copy
- fcp
- filecopy
Answer: A) cp
Explanation:
The “cp” command is used to copy files through the command line.
17. Which Linux command is used to move files through the command line?
- move
- mv
- ren
- loc
Answer: B) mv
Explanation:
The “mv” command is used to move files through the command line.
18. Which is the correct command syntax to rename a file “abc.txt” to “pqr.txt”?
- mv abc.txt pqr.txt
- mv pqr.txt abc.txt
- mv -a pqr.txt abc.txt
- mv -all pqr.txt abc.txt
Answer: A) mv abc.txt pqr.txt
Explanation:
The correct command syntax to rename a file “abc.txt” to “pqr.txt” is:
mv abc.txt pqr.txt
19. Just like the Windows Search command, which command is used in Linux?
- search
- find
- findall
- locate
Answer: D) locate
Explanation:
In Linux, the “locate” command is used to locate/search a file, just like the search command in Windows.
20. Which argument with locate command helps us to ignore the case while searching the file in the Linux system?
- -c
- -i
- -a
- -x
Answer: B) -i
Explanation:
To ignore the case while searching the file in the Linux system we can use the argument “-i” with the “locate” command.
21. Which is the correct command syntax to locate a file containing the words “hello” and “this”?
- locate -i *hello*this
- locate -i **hello**this
- locate -i *hello*this*
- locate -i **hello**this**
Answer: A) locate -i *hello*this
Explanation:
The correct command syntax to locate a file containing the words “hello” and “this”:
locate -i *hello*this
22. Which Linux command is used to display the content of a file?
- display
- show
- echo
- cat
Answer: D) cat
Explanation:
The “cat” command is used to display the content of a file in Linux.
23. If you want any command to be done with administrative or root privileges, you can use the ___ command.
- sud
- sudo
- super
- superuser
Answer: B) sudo
Explanation:
If you want any command to be done with administrative or root privileges, you can use the sudo command.
24. The “sudo” command stands for ___.
- su
- superuser does
- superuser do
- super do
Answer: C) superuser do
Explanation:
The “sudo” command stands for “superuser do”.
25. Which Linux command is used to see the available disk space in each of the partitions in your system?
- disk
- diskspace
- available
- df
Answer: D) df
Explanation:
To see the available disk space in each of the partitions in your system, we can use “df” command.
26. Which Linux command is used to check the computer’s hostname?
- hostname
- host
- comph
- hname
Answer: A) hostname
Explanation:
The “hostname” command is used to check a computer’s hostname in Linux.
27. The ___ command gives you your IP address in your network.
- hostname
- hostname -I
- host -I
- hostname -i
Answer: B) hostname -I
Explanation:
The “hostname -I” command gives you your IP address in your network.
28. Which Linux command is used to check your connection to a server?
- connection
- isconnect
- check
- ping
Answer: D) ping
Explanation:
The “ping” command is used to check your connection to a server.
29. Which Linux command is used to clear the terminal if it gets filled up with too many commands?
- clear
- clean
- cls
- clr
Answer: A) clear
Explanation:
The “clear” command is used to clear the terminal if it gets filled up with too many commands.
30. OSS stands for ___.
- Open System Software
- Open Source Software
- Open System Source
- None of the above
Answer: B) Open Source Software
Explanation:
OSS stands for “Open Source Software”.
31. Which Linux command is used to force all buffers to disk?
- sync
- fflush
- flush
- clearx
Answer: A) sync
Explanation:
The “sync” command is used to force all buffers to disk.
32. Compressed files or zipped files can be viewed with the help of ___ command.
- unzip
- catz
- zcat
- All of the above
Answer: C) zcat
Explanation:
Compressed files or zipped files can be viewed with the help of ‘zcat’ command.
33. The command ___ decompresses a file like gunzip command.
- bunzip
- bunzip2
- bunzip3
- bunzip0
Answer: B) bunzip2
Explanation:
The command “bunzip2” decompresses a file like gunzip command.
34. The ___ term stands for the calendar. It displays the current month’s calendar with the current day highlighted.
- calendar
- calc
- cal
- None of the above
Answer: C) cal
Explanation:
The ‘cal’ term stands for the calendar. It displays the current month’s calendar with the current day highlighted.
35. Which Linux command is used to record a user login session in a file?
- script
- style
- log
- record
Answer: A) script
Explanation:
The “script” command is used to record a user login session in a file.
36. Which Linux command is used to display the operating system name?
- os
- osname
- osinfo
- uname
Answer: D) uname
Explanation:
The “uname” command is used to display the operating system name.
37. Which Linux command is used to print a file?
- lp
- pr
- ptr
Answer: A) lp
Explanation:
The “lp” command is used to print a file.
38. Which is the correct syntax to print the file using the default printer in Linux?
- lp [printer_name] [path or filename]
- lp -a [printer_name] [path or filename]
- lp -d [printer_name] [path or filename]
- lp -d [path or filename] [printer_name]
Answer: C) lp -d [printer_name] [path or filename]
Explanation:
The correct syntax to print the file using the default printer in Linux is:
lp -d [Printer_name] [path or filename]
39. Which is the correct syntax to print the file using the default printer with multiple copies in Linux?
- lp -d -n [printer_name] [path or filename]
- lp -d -n 5[printer_name] [path or filename]
- lp -d [printer_name] -n [path or filename]
- lp -d [printer_name] -n 5 [path or filename]
Answer: D) lp -d [printer_name] -n 5 [path or filename]
Explanation:
The correct syntax to print the file using the default printer with multiple copies in Linux is:
lp -d [printer_name] -n 5 [path or filename]
40. Which argument and value with “lp” command specify the page orientation while printing a file?
- -o landscape/portrait
- -o l/p
- -o land/prt
- -or landscape/portrait
Answer: A) -o landscape/portrait
Explanation:
With “ls” command, we can use argument “-0” with value either “landscape” or “portrait” to specify the page orientation. Consider the below command syntax –
lp -d [printer_name] -o landscape/portrait [path or filename]
41. Which Linux command is used to identify file type?
- file
- type
- info
- finfo
Answer: A) file
Explanation:
The “file” command is used to identify the file type.
42. How many types of users are in Linux?
- 2
- 3
- 4
- 5
Answer: B) 3
Explanation:
In Linux, there are three types of users: super users, system users, and regular/normal users.
43. How many types of basic permissions to grant a user?
- 2
- 3
- 4
- 5
Answer: B) 3
Explanation:
There are three basic permissions to grant a user, they are: read, write, and execute.
44. The ___ command in Linux is used to convert the content of input in different formats with the octal format as the default format.
- od
- oct
- o_d
- octal
Answer: A) od
Explanation:
The “od” command in Linux is used to convert the content of input in different formats with the octal format as the default format.
45. The “od” command in Linux is used to convert the content of input in different formats with the octal format as the default format.
- https
- http
- named
- dns
Answer: C) named
Explanation:
The named server is used with the BIND package. In Linux, the named service executes the DNS (Dynamic Name Service) server daemon. It converts hostnames to IP addresses and vice versa.
46. Which Linux command displays “cat” command’s output with syntax highlighting or colorizing?
- xcat
- ccat
- coloredcat
- colored
Answer: B) ccat
Explanation:
The “ccat” command displays “cat” command’s output with syntax highlighting or colorizing?
47. The operator __ is used to redirect the output of a command to the file by erasing all existing data of that file.
- >
- >>
- >>
- <>
Answer: A) >
Explanation:
The operator “>” is used to redirect the output of a command to the file by erasing all existing data of that file.
48. The operator __ is used to redirect the output of a command to the file without erasing all existing data of that file.
- >
- >>
- >>
- <>
Answer: B) >>
Explanation:
The operator “>>” is used to redirect the output of a command to the file without erasing all existing data of that file.
49. The operators “>” and “>>” are known as ___.
- Insertion operators
- Exertion operators
- Redirection operators
- None of the above
Answer: C) Redirection operators
Explanation:
The operators “>” and “>>” are known as Redirection operators.
50. Which keys are used to terminate the command execution in the command prompt?
- CTRL + C
- CTRL + Pause/Break
- Both A and B
- None of the above
Answer: C) Both A and B
Explanation:
Both the combination of the keys CTRL + C and CTRL + Pause/Break can be used to terminate the command execution in the command prompt.