Linux Commands Multiple Choice

Approved & Edited by ProProfs Editorial Team
The editorial team at ProProfs Quizzes consists of a select group of subject experts, trivia writers, and quiz masters who have authored over 10,000 quizzes taken by more than 100 million users. This team includes our in-house seasoned quiz moderators and subject matter experts. Our editorial experts, spread across the world, are rigorously trained using our comprehensive guidelines to ensure that you receive the highest quality quizzes.
Learn about Our Editorial Process
| By Mariiikar
M
Mariiikar
Community Contributor
Quizzes Created: 2 | Total Attempts: 6,977
Questions: 40 | Attempts: 6,533

SettingsSettingsSettings
Linux Commands Multiple Choice - Quiz

Hey, check out this incredible 'Linux commands multiple-choice quiz' that consists of well-researched questions and answers. This quiz is perfect for anyone who is in college studying Linux, systems administration, or other computer courses and want to test themselves on multiple-choice questions for exams. So, are you ready to take this test? Do you think you can pass it? Let's start the quiz and see how well you score. Good luck!


Questions and Answers
  • 1. 

    During the linux boot process, what happens immediately after the phase called "load kernel"?

    • A.

      Load initial ramdisk

    • B.

      Run init

    • C.

      Mount root filesystem

    • D.

      Load modules

    Correct Answer
    A. Load initial ramdisk
    Explanation
    After the phase called "load kernel" during the Linux boot process, the next step is to load the initial ramdisk. The initial ramdisk, also known as initrd or initramfs, is a temporary file system that contains essential files and drivers needed to boot the system. It is loaded into memory and used as a temporary root file system until the actual root file system can be mounted. The initial ramdisk provides necessary modules and scripts for the system to initialize and prepare for the next phase of the boot process.

    Rate this question:

  • 2. 

    How do you copy an entire directory structure? E.g. from Project to Project.backup

    • A.

      Cp -r Project Project.backup

    • B.

      Cp -e Project Project.backup

    • C.

      Cp -d Project Project.backup

    • D.

      Cp -s Project Project.backup

    Correct Answer
    A. Cp -r Project Project.backup
    Explanation
    The correct answer is "cp -r Project Project.backup". The "-r" option in the "cp" command stands for "recursive" which allows the entire directory structure to be copied. By specifying the source directory "Project" and the destination directory "Project.backup", the command will recursively copy all the files and subdirectories from "Project" to "Project.backup".

    Rate this question:

  • 3. 

    How do you create a crontab entry?

    • A.

      Crontab -c

    • B.

      Crontab -e

    • C.

      Crontab -make

    • D.

      Crontab --create

    Correct Answer
    B. Crontab -e
    Explanation
    To create a crontab entry, the correct command is "crontab -e". This command allows the user to edit the crontab file, which contains the schedule of cron jobs to be executed. By using this command, the user can add, modify, or remove cron jobs according to their requirements.

    Rate this question:

  • 4. 

    How do you delete your crontab entry?

    • A.

      Crontab -d

    • B.

      Crontab -e

    • C.

      Crontab -r

    • D.

      Del -crontab

    Correct Answer
    C. Crontab -r
    Explanation
    To delete a crontab entry, you can use the command "crontab -r". This command removes all the cron jobs associated with the user's crontab file. It effectively deletes the entire crontab entry for the user, removing any scheduled tasks or commands that were previously set up.

    Rate this question:

  • 5. 

    How do you direct the shell to execute a command in the background?

    • A.

      Put an & symbol at the end of the command line.

    • B.

      Key in fg followed by the command name.

    • C.

      Press Ctrl+c after you have keyed in the command.

    • D.

      Press Ctrl+d after you have keyed in the command.

    Correct Answer
    A. Put an & symbol at the end of the command line.
    Explanation
    To direct the shell to execute a command in the background, you need to put an & symbol at the end of the command line. This allows the command to run in the background while you can continue using the shell for other tasks.

    Rate this question:

  • 6. 

    How do you display the kernel release?

    • A.

      Kernel -r

    • B.

      Uname -r

    • C.

      Cat /proc/etc/kernel/release

    • D.

      Cat /etc/config/kernel/release

    Correct Answer
    B. Uname -r
    Explanation
    The correct answer is "uname -r". The "uname" command is used to display various system information, and the "-r" option specifically displays the kernel release information. This command is commonly used in Linux systems to quickly check the kernel version running on the system.

    Rate this question:

  • 7. 

    How do you display your current crontab entry?

    • A.

      Crontab -display

    • B.

      Crontab -d

    • C.

      List --crontab

    • D.

      Crontab -l

    Correct Answer
    D. Crontab -l
    Explanation
    The correct answer is "crontab -l". This command is used to display the current crontab entry. It lists all the scheduled tasks and their respective timings.

    Rate this question:

  • 8. 

    How do you find out information about your identity, including the names of the groups you are in?

    • A.

      Echo $UID

    • B.

      Id

    • C.

      Cat /etc/passwd

    • D.

      Cat /etc/groups

    Correct Answer
    B. Id
    Explanation
    The given answer "id" is correct because the "id" command is used to display the user identity and group information. It provides information such as the user ID (UID), group ID (GID), and the groups the user belongs to. Therefore, running the "id" command would give you the required information about your identity, including the names of the groups you are in.

    Rate this question:

  • 9. 

    How do you run a job that will continue running even if you are logged out?

    • A.

      Hup.out command

    • B.

      Hup command

    • C.

      Jobc command

    • D.

      Nohup command

    Correct Answer
    D. Nohup command
    Explanation
    The correct answer is "nohup command". The "nohup" command is used to run a job in the background that will continue running even if the user logs out. It stands for "no hangup" and is typically used to prevent a process from being terminated when the user's terminal session ends. By using the "nohup" command, the job is detached from the current session and can run independently.

    Rate this question:

  • 10. 

    How do you see if two files are hard linked to each other?

    • A.

      Hl -l

    • B.

      Ln -s

    • C.

      Ls -i

    • D.

      Link -s

    Correct Answer
    C. Ls -i
    Explanation
    To see if two files are hard linked to each other, the "ls -i" command can be used. The "-i" option displays the inode number of each file in the directory listing. If two files have the same inode number, it means they are hard linked to each other.

    Rate this question:

  • 11. 

    How do you create a crontab entry?

    • A.

      Crontab --create

    • B.

      Crontab -make

    • C.

      Crontab -e

    • D.

      Crontab -c

    Correct Answer
    C. Crontab -e
    Explanation
    To create a crontab entry, you would use the command "crontab -e". This command allows you to edit the crontab file, where you can specify the schedule and command for the desired task. The "-e" flag stands for "edit" and opens the crontab file in a text editor, allowing you to make changes to the existing entries or add new ones. This is the correct way to create a crontab entry in most Unix-like operating systems.

    Rate this question:

  • 12. 

    How would you avoid accidentally removing files?

    • A.

      Rm -i

    • B.

      Rm -chk

    • C.

      Rm -a

    • D.

      Rm -r

    Correct Answer
    A. Rm -i
    Explanation
    The correct answer is "rm -i". This command prompts the user for confirmation before deleting each file, ensuring that files are not accidentally removed without explicit permission.

    Rate this question:

  • 13. 

    How would you continuously display memory usage every 5 seconds?

    • A.

      Free -s 5

    • B.

      Top -m 5

    • C.

      Du -m 5

    • D.

      Mem -c 5

    Correct Answer
    A. Free -s 5
    Explanation
    The correct answer is "free -s 5". This command is used to display the memory usage on a system. The "-s 5" option specifies that the memory usage should be displayed every 5 seconds, providing a continuous update on the memory usage.

    Rate this question:

  • 14. 

    How would you display running httpd processes?

    • A.

      Ps -C httpd

    • B.

      Ps -d httpd

    • C.

      Ps -r httpd

    • D.

      Ps -D httpd

    Correct Answer
    A. Ps -C httpd
    Explanation
    The correct answer is "ps -C httpd". This command is used to display the running processes with the name "httpd". The "-C" option is used to specify the process name, in this case, "httpd". This command will provide a list of all the running httpd processes.

    Rate this question:

  • 15. 

    How would you find out what your current login shell is?

    • A.

      Cat /etc/shell

    • B.

      Cat /etc/current/shell

    • C.

      Ps | grep sshd

    • D.

      Echo $$SHELL

    Correct Answer
    D. Echo $$SHELL
    Explanation
    To find out the current login shell, the correct command is "echo $$SHELL". The command "echo" is used to display the value of a shell variable, and "$$" is a special variable that represents the current process ID. By appending "SHELL" to "$$", the command will display the value of the "SHELL" variable, which represents the current login shell.

    Rate this question:

  • 16. 

    How would you list oldest files first and newest ones last?

    • A.

      Ls /o-d

    • B.

      Ls -od

    • C.

      Ls -rt

    • D.

      Ls -dt

    Correct Answer
    C. Ls -rt
    Explanation
    The command "ls -rt" is the correct answer because it uses the "-r" flag to reverse the order of the listing and the "-t" flag to sort the files by modification time, with the oldest files appearing first and the newest ones appearing last. This command will list the files in the desired order.

    Rate this question:

  • 17. 

    How would you lock the user account named csm099?

    • A.

      Usermod -l csm099

    • B.

      Usermod -L csm099

    • C.

      Usermod --l csm099

    • D.

      Usermod -lock csm099

    Correct Answer
    B. Usermod -L csm099
    Explanation
    The correct answer is usermod -L csm099. The "-L" option in the usermod command is used to lock a user account. By using this option followed by the username "csm099", the user account named csm099 will be locked.

    Rate this question:

  • 18. 

    How would you remove a directory that is not empty?

    • A.

      Rm -r

    • B.

      Rm -f

    • C.

      Rmdir -f

    • D.

      Rmdir -le

    Correct Answer
    A. Rm -r
    Explanation
    To remove a directory that is not empty, you would use the command "rm -r". The "-r" flag stands for "recursive", which means that it will remove not only the specified directory but also all its contents, including subdirectories and files. This command is necessary because the "rmdir" command only works for empty directories, and the "-f" flag with "rm" is used to forcefully remove files or directories without prompting for confirmation. Therefore, "rm -r" is the appropriate command to remove a non-empty directory.

    Rate this question:

  • 19. 

    How would you show process hierarchy in forest format?

    • A.

      Ps -ef -tree

    • B.

      Ps -ef --f

    • C.

      Ps -ef --forest

    • D.

      Ps -ef -t

    Correct Answer
    C. Ps -ef --forest
    Explanation
    The correct answer is "ps -ef --forest" because the "--forest" option is used to display the process hierarchy in a tree-like format. This command will show all the processes in a hierarchical structure, making it easier to understand the relationship between different processes. The "ps -ef" part of the command is used to display all the processes in a detailed format, including the process ID, parent process ID, CPU usage, and more.

    Rate this question:

  • 20. 

    How would you sort a file called shopping on column 3?

    • A.

      Sort -n 3 shopping

    • B.

      Sort -k 3 shopping

    • C.

      Sort -c 3 shopping

    • D.

      Sort -c3 shopping

    Correct Answer
    B. Sort -k 3 shopping
    Explanation
    The correct answer is "sort -k 3 shopping".

    The "-k" option in the sort command is used to specify the key or column number to sort the file on. In this case, we want to sort the file "shopping" based on column 3. Therefore, the correct command would be "sort -k 3 shopping".

    Rate this question:

  • 21. 

    How would you switch to virtual terminal 1?

    • A.

      Ctrl+Alt+F1

    • B.

      Alt+F1

    • C.

      Ctrl+F1

    • D.

      Shift+Ctrl+F1

    Correct Answer
    A. Ctrl+Alt+F1
    Explanation
    To switch to virtual terminal 1, you would use the key combination Ctrl+Alt+F1. This combination allows you to access a separate terminal session, which can be useful for troubleshooting or running commands without interfering with the graphical user interface. The Ctrl+Alt+F1 combination is a common shortcut in Linux-based operating systems for switching to the first virtual terminal.

    Rate this question:

  • 22. 

    How would you turn on the sticky bit on the directory /tmp?

    • A.

      Chmod u+s /tmp

    • B.

      Chmod +st /tmp

    • C.

      Chmod a+s /tmp

    • D.

      Chmod o+t /temp

    Correct Answer
    D. Chmod o+t /temp
    Explanation
    The correct answer is "chmod o+t /temp". The sticky bit is a permission that can be set on a directory to allow only the owner of a file within that directory to delete or rename the file. In this case, the command "chmod o+t /temp" is used to turn on the sticky bit on the directory /temp, allowing only the owner of a file to modify it.

    Rate this question:

  • 23. 

    In which directory are the crontab files for users stored on suse linux?

    • A.

      /var/spool/cron/tabs

    • B.

      /usr/lib/cron

    • C.

      /usr/bin/cron/crontabs

    • D.

      /var/spool/cron/users/tabs

    Correct Answer
    A. /var/spool/cron/tabs
    Explanation
    The correct answer is /var/spool/cron/tabs. This directory is where the crontab files for users are stored on SUSE Linux. The crontab files contain the schedules and commands for the cron daemon to execute at specified times. Storing them in this directory allows the cron daemon to easily access and manage the crontab files for each user.

    Rate this question:

  • 24. 

    Some commands, including cat, interpret a minus sign (-) as a shortcut for...

    • A.

      /dev/stdin

    • B.

      /dev/stdout

    • C.

      /dev/stderr

    • D.

      /dev/hdal

    Correct Answer
    A. /dev/stdin
    Explanation
    The correct answer is /dev/stdin. In Unix-like operating systems, /dev/stdin is a special file that represents the standard input. When the cat command is used with a minus sign as an argument, it reads data from the standard input, which can be redirected from a file or entered directly from the keyboard.

    Rate this question:

  • 25. 

    Suppose you are in your home directory, /home/raf as in diagram above. What is the relative path for the file called "save" in the Email subdirectory?

    • A.

      Raf/email/save

    • B.

      /email/save

    • C.

      /home/raf/email/save

    • D.

      Email/save

    Correct Answer
    D. Email/save
    Explanation
    The relative path for the file called "save" in the Email subdirectory is "email/save". This is because the current directory is already "/home/raf", so we don't need to include it in the relative path. We simply need to navigate to the "Email" subdirectory and then access the "save" file within it.

    Rate this question:

  • 26. 

    Which of this option can be used to set the immutable attribute on a file?

    • A.

      Chattr +i

    • B.

      Attrib +i

    • C.

      Imod +a

    • D.

      Chmod +i

    Correct Answer
    A. Chattr +i
    Explanation
    The correct answer is "chattr +i". The chattr command in Linux is used to change file attributes. The +i option is used to set the immutable attribute on a file, which means the file cannot be modified, deleted, or renamed. This attribute provides an extra layer of protection for important files.

    Rate this question:

  • 27. 

    What does the permission string nvxr-xr-- correspond with in octal?

    • A.

      754

    • B.

      724

    • C.

      624

    • D.

      742

    Correct Answer
    A. 754
    Explanation
    The permission string "nvxr-xr--" corresponds with the octal value 754. In octal representation, each digit represents the permissions for different user groups. The first digit (7) represents the permissions for the owner, the second digit (5) represents the permissions for the group, and the third digit (4) represents the permissions for others. In this case, the owner has read, write, and execute permissions (7), the group has read and execute permissions (5), and others have only read permissions (4).

    Rate this question:

  • 28. 

    What is the following syntax used forcommand 2> /dev/null

    • A.

      Send the output of command to a file called /dev/null

    • B.

      Discard standard error entirely.

    • C.

      Append the output of command to a file called /dev/null

    • D.

      Send error messages from command to a file called /dev/null

    Correct Answer
    D. Send error messages from command to a file called /dev/null
    Explanation
    The syntax "2> /dev/null" is used to send error messages from a command to a file called /dev/null. The "2" represents the standard error stream, and the "> /dev/null" redirects that stream to the file /dev/null, which is a special file that discards any data written to it. By using this syntax, any error messages generated by the command will be sent to /dev/null and effectively discarded.

    Rate this question:

  • 29. 

    What symbol is used to show that ACLs have been set on a file?

    • A.

    • B.

      +

    • C.

      ~

    • D.

      >

    Correct Answer
    B. +
    Explanation
    The symbol "+" is used to show that ACLs (Access Control Lists) have been set on a file. ACLs are used to define permissions and access rights for different users or groups on a file or directory. The "+" symbol indicates that additional permissions beyond the traditional owner, group, and other permissions have been assigned to the file.

    Rate this question:

  • 30. 

    Which command can be used to edit and then run command no. 40?

    • A.

      Fc 40

    • B.

      Hs 40

    • C.

      Rc 40

    • D.

      Er 40

    Correct Answer
    A. Fc 40
    Explanation
    The command "fc 40" can be used to edit and then run command number 40.

    Rate this question:

  • 31. 

    Which command displays the settings for all services at all runlevels?

    • A.

      Runlevel --settings

    • B.

      Status --l

    • C.

      Services --runlevels

    • D.

      Chkconfig --list

    Correct Answer
    D. Chkconfig --list
    Explanation
    The command "chkconfig --list" displays the settings for all services at all runlevels. This command is commonly used in Linux systems to view the status and configuration of services. It provides a comprehensive list of services along with their current runlevel settings, allowing users to easily manage and troubleshoot services on their system.

    Rate this question:

  • 32. 

    The command is used to unmount a filesystem is __________. 

    • A.

      Dmount

    • B.

      Dismount

    • C.

      Unmount

    • D.

      Umount

    Correct Answer
    D. Umount
    Explanation
    The correct command used to unmount a filesystem is "umount". This command is used to detach a mounted filesystem from its mount point, allowing the device or partition to be accessed by other processes or to be safely removed.

    Rate this question:

  • 33. 

    Which file determines what will run at each run level?

    • A.

      /etc/init/runlevels

    • B.

      /etc/levels/fstab

    • C.

      /etc/fstab

    • D.

      /etc/inittab

    Correct Answer
    D. /etc/inittab
    Explanation
    The correct answer is /etc/inittab. This file is responsible for determining what processes or services will run at each run level in a Unix or Linux system. It contains the configuration settings for the init process, which is the first process that is started during the boot process and is responsible for starting and managing other processes. The /etc/inittab file specifies which programs should be run at each run level, allowing the system administrator to define different sets of processes to be started depending on the desired run level.

    Rate this question:

  • 34. 

    Which command can be used to set the immutable attribute on a file?

    • A.

      Chmod +i

    • B.

      Immut +a

    • C.

      Attrib +i

    • D.

      Chattr +i

    Correct Answer
    D. Chattr +i
    Explanation
    The command "chattr +i" can be used to set the immutable attribute on a file. This command is used in Linux systems to change the attributes of a file or directory. The "+i" option specifically sets the immutable attribute, which prevents the file from being modified or deleted even by the root user. This attribute provides an extra layer of security and ensures that critical files remain unchanged.

    Rate this question:

  • 35. 

    Which of the following cannot be used as a mount option in /etc/fstab?

    • A.

      Rw

    • B.

      Noexec

    • C.

      Ndev

    • D.

      Defaults

    Correct Answer
    C. Ndev
    Explanation
    The option "ndev" cannot be used as a mount option in /etc/fstab. This is because "ndev" is not a valid mount option. The correct options that can be used in /etc/fstab are "rw" (read-write), "noexec" (do not allow execution of binaries), and "defaults" (use default mount options). However, "ndev" is not a recognized mount option and therefore cannot be used in /etc/fstab.

    Rate this question:

  • 36. 

    Which of the following could you use to check if the cron daemon is running?

    • A.

      Service --status-all

    • B.

      Ps -list --daemons

    • C.

      Daemons --list --all

    • D.

      Cron --status

    Correct Answer
    A. Service --status-all
    Explanation
    You can use the command "service --status-all" to check if the cron daemon is running. This command displays the status of all services, including the cron daemon.

    Rate this question:

  • 37. 

    Which runlevel allows full multiuser mode but with no graphical login manager?

    • A.

      Runlevel 2

    • B.

      Runlevel 3

    • C.

      Runlevel 0

    • D.

      Runlevel 1

    Correct Answer
    B. Runlevel 3
    Explanation
    Runlevel 3 allows full multiuser mode but with no graphical login manager. In this runlevel, the system boots into a text-based console and allows multiple users to log in and use the system simultaneously. However, there is no graphical interface or login manager present, which means users have to use command-line interfaces for all interactions with the system. This runlevel is often used in server environments where a graphical interface is not required or desired.

    Rate this question:

  • 38. 

    Which runlevel allows full multiuser mode but with no graphical login manager?

    • A.

      Runlevel 1

    • B.

      Runlevel 2

    • C.

      Runlevel 3

    • D.

      Runlevel 0

    Correct Answer
    C. Runlevel 3
    Explanation
    Runlevel 3 allows full multiuser mode but with no graphical login manager. In this runlevel, the system boots into a multiuser mode with a command line interface, allowing multiple users to log in and use the system simultaneously. However, there is no graphical login manager present in this runlevel, so users cannot log in through a graphical user interface.

    Rate this question:

  • 39. 

    Which signal number corresponds with the SIGSTOP signal?

    • A.

      1

    • B.

      19

    • C.

      9

    • D.

      18

    Correct Answer
    B. 19
    Explanation
    The signal number that corresponds with the SIGSTOP signal is 19.

    Rate this question:

  • 40. 

    You want to display a message when you open a new terminal window. Which file do you edit?

    • A.

      .bashtr

    • B.

      .linux_term

    • C.

      .term_win

    • D.

      .bashrc

    Correct Answer
    D. .bashrc
    Explanation
    The correct answer is .bashrc. This file is a script that is executed every time a new terminal window is opened. By editing this file, you can add commands or messages that you want to display when a new terminal window is opened.

    Rate this question:

Quiz Review Timeline +

Our quizzes are rigorously reviewed, monitored and continuously updated by our expert board to maintain accuracy, relevance, and timeliness.

  • Current Version
  • May 01, 2023
    Quiz Edited by
    ProProfs Editorial Team
  • Aug 17, 2010
    Quiz Created by
    Mariiikar
Back to Top Back to top
Advertisement
×

Wait!
Here's an interesting quiz for you.

We have other quizzes matching your interest.