Linux Commands Multiple Choice

Reviewed by Editorial Team
The ProProfs editorial team is comprised of experienced subject matter experts. They've collectively created over 10,000 quizzes and lessons, serving over 100 million users. Our team includes in-house content moderators and subject matter experts, as well as a global network of rigorously trained contributors. All adhere to our comprehensive editorial guidelines, ensuring the delivery of high-quality content.
Learn about Our Editorial Process
| By Mariiikar
M
Mariiikar
Community Contributor
Quizzes Created: 2 | Total Attempts: 7,288
| Attempts: 6,785 | Questions: 40
Please wait...
Question 1 / 40
0 %
0/100
Score 0/100
1. How do you create a crontab entry?

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.

Submit
Please wait...
About This Quiz
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,... see moresystems 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!
see less

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

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.

Submit
3. How do you copy an entire directory structure? E.g. from Project to 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".

Submit
4. How do you create a crontab entry?

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.

Submit
5. The command is used to unmount a filesystem is __________. 

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.

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

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.

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

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.

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

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).

Submit
9. How do you display your current crontab entry?

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.

Submit
10. How would you switch to virtual terminal 1?

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.

Submit
11. How do you display the kernel release?

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.

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

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.

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

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.

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

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.

Submit
15. How would you remove a directory that is not empty?

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.

Submit
16. How would you lock the user account named 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.

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

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.

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

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.

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

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.

Submit
20. How would you avoid accidentally removing files?

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.

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

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.

Submit
22. How would you continuously display memory usage every 5 seconds?

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.

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

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.

Submit
24. What is the following syntax used forcommand 2> /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.

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

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.

Submit
26. How do you delete your crontab entry?

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.

Submit
27. Which file determines what will run at each run level?

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.

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

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.

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

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.

Submit
30. How would you show process hierarchy in forest format?

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.

Submit
31. Which signal number corresponds with the SIGSTOP signal?

Explanation

The signal number that corresponds with the SIGSTOP signal is 19.

Submit
32. Which command displays the settings for all services at all runlevels?

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.

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

Explanation

The command "fc 40" can be used to edit and then run command number 40.

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

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.

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

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".

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

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.

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

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.

Submit
38. 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?

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.

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

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.

Submit
40. How would you display running httpd processes?

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.

Submit
View My Results

Quiz Review Timeline (Updated): Sep 16, 2024 +

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

  • Current Version
  • Sep 16, 2024
    Quiz Edited by
    ProProfs Editorial Team
  • Aug 17, 2010
    Quiz Created by
    Mariiikar
Cancel
  • All
    All (40)
  • Unanswered
    Unanswered ()
  • Answered
    Answered ()
How do you create a crontab entry?
Which runlevel allows full multiuser mode but with no graphical login...
How do you copy an entire directory structure? E.g. from Project to...
How do you create a crontab entry?
The command is used to unmount a filesystem is __________. 
Which runlevel allows full multiuser mode but with no graphical login...
How do you direct the shell to execute a command in the background?
What does the permission string nvxr-xr-- correspond with in octal?
How do you display your current crontab entry?
How would you switch to virtual terminal 1?
How do you display the kernel release?
You want to display a message when you open a new terminal window....
How would you find out what your current login shell is?
Which of this option can be used to set the immutable attribute on a...
How would you remove a directory that is not empty?
How would you lock the user account named csm099?
How do you run a job that will continue running even if you are logged...
What symbol is used to show that ACLs have been set on a file?
Which command can be used to set the immutable attribute on a file?
How would you avoid accidentally removing files?
How do you see if two files are hard linked to each other?
How would you continuously display memory usage every 5 seconds?
How would you list oldest files first and newest ones last?
What is the following syntax used forcommand 2> /dev/null
Some commands, including cat, interpret a minus sign (-) as a shortcut...
How do you delete your crontab entry?
Which file determines what will run at each run level?
How do you find out information about your identity, including the...
Which of the following cannot be used as a mount option in /etc/fstab?
How would you show process hierarchy in forest format?
Which signal number corresponds with the SIGSTOP signal?
Which command displays the settings for all services at all runlevels?
Which command can be used to edit and then run command no. 40?
During the linux boot process, what happens immediately after the...
How would you sort a file called shopping on column 3?
How would you turn on the sticky bit on the directory /tmp?
In which directory are the crontab files for users stored on suse...
Suppose you are in your home directory, /home/raf as in diagram above....
Which of the following could you use to check if the cron daemon is...
How would you display running httpd processes?
Alert!

Advertisement