Linux MCQs

Linux MCQs

These Linux multiple-choice questions and their answers will help you strengthen your grip on the subject of Linux. You can prepare for an upcoming exam or job interview with these Linux MCQs.
So scroll down and start answering.

1: What is the linux mascot?

A.   Penguin

B.   Gecko

C.   Elephant

D.   Hat

2: What will you get if you try to read from the pseudo-device /dev/null?

A.   Nothing.

B.   An error (/dev/null can only be written to, not read from).

C.   An infinite string of zeroes ('0', ASCII 0x30).

D.   An infinite string of nulls ('\0', ASCII 0x00).

3: What does the following line mean when it is run in a script '#!/bin/bash'?

A.   It checks to see if the bash shell exists on the machine.

B.   It makes sure that the script runs in the bash shell.

C.   all of these

4: By default what file contains encrypted user passwords?

A.   /etc/passwd

B.   /etc/master.passwd

C.   /etc/shadow

D.   /etc/passwdinfo

E.   /etc/password

5: The at command allows you to execute a command at:

A.   a certain machine

B.   a certain date

C.   a certain network

D.   a certain holiday

6: What does GRUB stand for?

A.   Grand Unified Bootloader

B.   Gum Removal Under Boot

C.   Great Ultimate Bootloader

D.   Great Unique Bootloader

E.   Grand Unification Bootloader

7: The jobs command

A.   lists background jobs

B.   provides basic accounting information for all current jobs

C.   halts all foreground jobs

D.   prints a dedication to Steve Jobs

E.   puts all foreground jobs in the background

8: To use chown recursively, instead of using _recursive you can use:

A.   -c

B.   #NAME?

C.   -r

D.   -R

9: Which is an example of a shell comment?

A.   //mkdir text

B.   mkdir text # make a directory

C.   mkdir text //make a directory

10: The run level in a system can be configured in the file _____.

A.   /bin/runlev

B.   /etc/inittab

C.   /bin/rlev

D.   /sys/rinit

E.   /etc/syslev

11: The behavior of the system for each "runlevel" is available in the _____ file.

A.   /etc/rlevel

B.   /etc/hosts

C.   /etc/mtab

D.   /etc/crontab

E.   /etc/inittab

12: To print the first 10 lines of one or more files to the standard output, you use the command:

A.   topf

B.   start

C.   head

D.   ftop

13: uname -a will output...

A.   date where the kernel was built

B.   cpu info

C.   All of the answers are correct.

D.   kernel info

E.   architecture

14: what makes the command cd ../../

A.   nothing

B.   moves the root home directory

C.   moves the current home directory

D.   Traverse two directories up the directory tree.

E.   wil be error

15: With which userspace is Linux typically paired?

A.   Minix

B.   System V

C.   Hurd

D.   GNU

E.   BSD

16: The netstat command give information on:

A.   routing tables

B.   all are correct

C.   active sockets

D.   open sockets

17: To start another shell under the current shell you use the command:

A.   bash

B.   sh

C.   All of these

D.   csh

18: The loaded modules in the kernel are listed in /proc/modules. You can get this list using the command:

A.   modules

B.   lsattr

C.   lsmod

D.   listmodules

19: mknod can create special file (used for sending or receiving data) of type:

A.   all are correct

B.   character file

C.   fifo (pipe) file

D.   block file

20: SSH stands for _____.

A.   Security Shell

B.   Synchronous Shell

C.   Secure Shell

D.   Super Shell

E.   System Shell

21: If you wanted to execute a shell command in the background, which character would you put at the end of the command line?

A.   &

B.   ;

C.   :

22: What is the ssh command?

A.   It is the synchronous shell: all commands are performed in real-time.

B.   It is the secure shell; it is used to connect to remote hosts via an authenticated and encrypted channel.

C.   It is the secure shell; it is used to restrict actions available to users.

D.   It is the standard shell: it has a restricted set of commands, but those are portable across different Linux distributions.

E.   It is the synchronous shell: all commands are performed in a synchrous way.

23: What does the pwd command do?

A.   It asks the password of the current user, and the prompts for a new password.

B.   It launches the power management daemon.

C.   It prints the path of the current working directory

D.   It saves the current working directory, so that you can return there with the popd command.

24: what the command "cd .." do

A.   move to root directory

B.   move to home directory

C.   nothing

D.   one level up from the current directory

25: The Linux Kernel was written by?

A.   Richard Stallman

B.   Brian Kernighan

C.   Linus Torvalds

D.   Dennis Ritchie

26: What will show you all the subdirectories of the current directory?

A.   rm

B.   cd

C.   cp

D.   ls

27: Which directory contains all the files needed to boot the Linux system?

A.   /boot

B.   /bin

C.   /dev

28: What makes up a Linux kernel?

A.   kernel modules

B.   base kernel

C.   all of these

29: 'mkfs' is used to:

A.   create a named pipe (fifo) on a device

B.   create a filesystem on a device (such as a hard disk partition)

C.   create a fast changing section on a hard disk

D.   format a floppy disk

30: How do you activate the noclobber shell option?

A.   set -o noclobber

B.   noclobber

C.   #NAME?

31: Executing "pwd" in shell will return:

A.   None of these

B.   Your password

C.   There is no such command

D.   Current directory

32: Fedora Linux uses _____ packages.

A.   deb_src

B.   rpm

C.   deb

D.   ebuild

33: Ubuntu is based on...

A.   None of these

B.   Slackware

C.   Gentoo

D.   Debian

E.   Fedora

34: To query DNS (Internet domain name) servers, you use the command:

A.   nslookup

B.   dns

C.   lsrouted

D.   dnsquery

35: _____ is a Linux "desktop environment".

A.   All of these

B.   XFCe

C.   Gnome

D.   KDE

36: What is the right command to save file and exit in Vim?

A.   :q!

B.   :w 'file name'

C.   :q

D.   :a

E.   :wq

37: Which firewall is most commonly used on Linux?

A.   iptables

B.   ipfw

C.   ipchains

D.   pf

38: what the "cd /" command do?

A.   The directory one level up from the current directory

B.   Listing all LISTENING Connections

C.   Change into the root directory

39: What is GNOME ?

A.   A computer software system and network protocol that provides a basis for graphical user interfaces (GUIs) and rich input device capability for networked computers.

B.   A linux distribution

C.   A desktop environment and graphical user interface that runs on top of a computer operating system.

40: What does it means when the ps commands shows a 'Z' in the status column for a process?

A.   The process is running at low priority.

B.   The process is a zombie process.

C.   The process is in sleep mode.

D.   The process is running at top priority.

41: To repeat the last command in the bash shell history, type...

A.   $HISTFILE

B.   !6

C.   !!

42: Which answer assists you in finding help on the whois command?

A.   man whois

B.   none of these

C.   help whois

D.   man help whois

43: What is swap?

A.   Swap is the cache of your Physical Memory (RAM)

B.   Swap is the ability to switch between users in one terminal session

C.   Swap is the cache of your HDD

D.   Swap space is the area on a hard disk which is part of the Virtual Memory of your machine (Swap+RAM)

44: As a privileged user, you may set the hostname with the command:

A.   host

B.   name

C.   hn

D.   hostname

45: LILO...

A.   stands for "Light Loader"

B.   is a type of Linux Distro

C.   is a boot loader that can boot Linux

D.   stands for "Lannister-In-Lannister-Out"

E.   is only used by Slackware

46: How do you view the documentation for the command 'kill' in the Linux terminal?

A.   cat /etc/docs/kill | less

B.   kill --help

C.   man kill

D.   doc kill

E.   kill -help

47: Add this symbol to a command to run it in the background

A.   2

B.   $

C.   *

D.   &

E.   ?

48: On Red Hat Linux and its derivatives, which of the following commands will be appropriate to check whether a particular "package" is installed or not?

A.   ls

B.   sys

C.   pkg

D.   query-pkg

E.   rpm -qa

49: To read one or more files and type them on standard output, you use:

A.   type

B.   cat

C.   biff

D.   ls

50: What command can be used to delete a directory, recursively searching for files and other directories and deleting them?

A.   rm -d

B.   rd

C.   deltree

D.   rmdir

E.   rm -r

51: /etc/resolv.conf is ...

A.   The DNS resolver configuration file

B.   Configuration file with software sources

C.   This file does not exist

D.   Network interfaces configuration file

E.   Configuration file with local user accounts and its identificators

52: To transfer files in an insecure way to and from a remote network site host, you use the command:

A.   ftp

B.   sftp

C.   tcp

D.   ucp

53: The command du -h ~

A.   lists the size of all files within your $HOME with sizes in human readable form

B.   duplicates the current process

C.   deletes your account and home directory

D.   dumps your home directory to /tmp

E.   searches you home directory for duplicate filenames

A.   fastfind

B.   locate

C.   search

55: The command "free" reports on:

A.   cpu

B.   disk space

C.   memory

56: LVM is...

A.   Logical Volume Manager

B.   Linux Volume Manager

C.   Light Video Manager

D.   Linux Video Manager

57: Consider using the command "cd /a/b/c", then executing "cd ..". What does this last command do?

A.   displays the default directory path

B.   changes to /a/b directory

C.   changes to the / directory

D.   prompts you for the next directory choice

E.   changes to your home directory

58: To access the value of an environment variable, we _____.

A.   type the variable's name (in lower case only)

B.   add the dollar ($) symbol after the variable name

C.   add the hash (#) symbol after the variable name

D.   add the underscore (_) symbol before the variable name

E.   add the dollar ($) symbol before the variable name

59: What is a zombie process?

A.   A zombie process is a process whose status had been saved on the disk, and which is now waiting to be restored.

B.   A zombie process is a process which has terminated, but whose parent had not yet read its exit status.

C.   A zombie process is a process created by a worm to remain active even after it is killed.

60: What does the Linux "no" command do?

A.   Nothing; it doesn't exist.

B.   It's the opposite of the "yes" command; it outputs an infinite series of 'n's (or a word of your choice).

C.   It returns a non-zero exit code to indicate failure (it's a synonym to the "false" command).

61: LILO is _____.

A.   used for LIsting the boot LOaders

B.   a type of Linux

C.   lists all the devices

D.   lists all the lower memory areas

E.   a boot loader

62: the '-r' switch to the mount command will:

A.   mount a filesystem as read-only

B.   mount filesystem only after a read-write check is performed

C.   mount removable (e.g., CD-ROM) filesystem

D.   mount remote (network) filesystems

63: How would you create an alias for the cat command?

A.   ren bkw=cat

B.   You cannot do that.

C.   alias bkw=cat

64: Which of the following is not an editor?

A.   vi

B.   emacs

C.   expr

D.   ex

65: How to reveal detailed information about CPU?

A.   cpusage

B.   dmesg

C.   sysinfo --cpu

D.   cat /proc/cpuinfo

66: Which return value from an ioctl request indicates success?

A.   ENOTTY

B.   EFAULTF

C.   EINVAL

D.   EBADF

E.   0

67: mount -a' will load all filesystems listed in:

A.   /etc/mtab

B.   /etc/fstab

C.   /etc/filesystems

D.   /etc/fs.conf

68: What does "chmod 755 file" accomplish?

A.   Makes the file read by the owner, execute by group and other.

B.   Makes the file execute by the owner, execute/read by group and other.

C.   Makes the file read/write/execute by the owner, read/execute by group and other.

D.   Makes the file write/read by the owner, execute by group and other.

E.   Makes the file write/execute by the owner, execute by group and other.

69: If you use the rm command to accidentally delete a file, how can you get the file back?

A.   You cannot get the file back.

B.   Go to the trash bin and remove it.

C.   Type the rm -u command.

70: Which of the following accurately describes a "ping?"

A.   sends ICMP packets to target device/server to verify if it's online.

B.   makes an audiable ping each time a disk drive start spinning

C.   verifies that the routing tables comply to the current network state

D.   sends TCP packets to target device/server to verify if it's online.

71: What is the maximum length of a file name on Linux?

A.   255 bytes.

B.   It depends on the file system.

C.   256 bytes.

D.   1024 bytes.

E.   1023 bytes.

72: printenv will:

A.   type values of environment variables

B.   print a text file to the default printer

C.   print a text file to the printer specified in $PRINTER

D.   print a text file to the printer specified in /etc/env

73: If a host is called HHH, 'rstat HHH' will:

A.   show HHH uptime

B.   show HHH load averages

C.   all are correct

D.   show HHH current time

74: In a date +format, you add the hour in 24 hours format using:

A.   %h

B.   %f

C.   %H

D.   %F

75: _____ command starts the default desktop environment.

A.   startx

B.   xterm

C.   gdm-start

D.   gdm

E.   gnome-terminal

76: True or false: The Linux OS is not affected by malware.

A.   False

B.   True

77: When does /tmp normally get cleaned out?

A.   Never; it has to be manually cleaned.

B.   Every week (run by /etc/cron.weekly).

C.   Every month (run by /etc/cron.monthly).

D.   Every time the system is booted.

78: lsof command means:

A.   List Open Files

B.   Local Service of Files

C.   Lag Spike of Death

D.   Local System Officer

E.   Large Scale Optimization File

79: If DDD is a non empty directory, and you execute 'rmdir DDD', it will:

A.   move the contents of DDD to /tmp, and delete the DDD directory

B.   delete both the contents of and the DDD directory

C.   produce an error

D.   delete only the contents of the DDD directory

80: You want to load the main kernel module for USB support. Which command would help you achieve this task?

A.   modprobe uhci-hcd

B.   modprobe ehci-ocd

C.   modprobe usbcore

81: What flag makes "ls -l" print file sizes in human readable format (e.g. 1K, 231M, 2G, etc)?

A.   -H

B.   -h

C.   -f

D.   -r

82: Why hasn't ZFS been added to the Linux kernel?

A.   It's too hard to port filesystems to Linux

B.   Sun's implementation uses a license incompatible with the GPL

C.   Oracle is suing the Linux Foundation

D.   There is a user space port using FUSE

83: Is it possible to increase SWAP space without rebooting?

A.   No, you have to reboot for the new swap to be activated properly

B.   Yes if you create a swap file

C.   No, you have to boot with a Live CD to do that

D.   No, you have to re-install your system to do that

84: To report the amount of free disk space available on all mounted file systems you use the command:

A.   fs

B.   free

C.   du

D.   df

85: command1 | command2 will?

A.   Output command2 wil be input of command1

B.   Command2 run after Command1

C.   Command1 and Command2 run together

D.   Output command1 wil be input of command2

86: what makes the command "netstat -s"

A.   Only list of the listening ports

B.   Showing statistics of only TCP protocol

C.   Displays statistics by protocol. By default, statistics are shown for the TCP, UDP, ICMP, and IP protocols.

D.   List of processes that use the connection at the moment

87: What does the "uname" command do?

A.   print system information

B.   nothing

C.   show the user name

D.   change user name

88: What does the $ represent within the context of a shell command?

A.   The string after the $ is replaced by a directory name.

B.   The string after the $ will take on the value of the environment variable with the same name.

C.   all of these

89: modprobe...

A.   attempts to load a kernel module along with all its depended modules

B.   searches all filesystems for the specified module

C.   types the header section of the specified module

D.   searches memory to see if the specified module is loaded to memory

90: How do you redirect stderr to stdout?

A.   Using 2>&1

B.   Using >/dev/error

C.   Using >>stderr

91: To display contents of files on standard output, you could use the command:

A.   All of these

B.   less

C.   more

D.   cat

92: How do you show all processes being run by a particular user?

A.   top --USERNAME

B.   cat /etc/activeprocess | grep USERNAME

C.   top -U [USERNAME]

D.   cat /home/USERNAME/open.process

E.   netstat -u USERNAME

93: 'mv -f' will:

A.   will move the file in a fast mode, namely will not make any checks (like if there's enough space for the file)

B.   will move the file or directory to a FIFO device

C.   even if the target file exists, the operation will be carried out (and no warning messages on restricted access modes will be printed)

D.   move the file to the filesystem indicated after the '-f' switch

94: To see the kernel routing tables, you do:

A.   route -w

B.   cat /etc/routetab

C.   route or netstat -r

D.   routing

95: GRUB stands for _____.

A.   GNU Released Unix Booter

B.   Great Unix Boot Loader

C.   Gentoo's Regular Booter

D.   Grand Unified Boot Loader

96: In a ps command output, the PPID displays the:

A.   Process's scheduling priority

B.   Number of memory pages (swap) of the process

C.   Process ID

D.   Parent process ID

97: modinfo [options] ofile' will:

A.   create a help file for kernel module ofile

B.   set information about kernel module ofile

C.   print information about kernel module ofile

D.   set default handling options for kernel module ofile

98: Which Run Level provides "Full multiuser mode with network and X display manager"?

A.   Run Level 3

B.   Run Level 1

C.   Run Level 5

D.   Run Level 4

E.   Run Level 2

99: To create one or more directories with the mkdir command, which permissions in the directory's parent directory do you need?

A.   write

B.   create

C.   execute

D.   read

100: _____ is not a 'Terminal Emulator'.

A.   gnome-terminal

B.   konsole

C.   gdm

D.   xterm