No products in the cart.
CompTIA Linux+ Exam Questions
Page 7 of 25
121.
An administrator wants to bring up the GRUB2 command line during the boot process. How can they get to the command line before the bootloader loads the system?
-
Press the "c" key
-
Press the "e" key
-
Press the up or down arrow
-
Press the "b" key
Correct answer: Press the "c" key
Pressing the "c" key during GRUB's interactive mode will bring up a GRUB shell. You can use the tab button to see available commands.
The "e" key will allow for editing the current line. The up and down arrows move between lines. The "b" key will boot the system.
122.
What is the purpose of running the whoami command?
-
To display the current user's account name
-
To view the current user's ID
-
To delete the current user's processes
-
To list the current user's most recent logins
Correct answer: To display the current user's account name
The whoami command is limited to just displaying the account name of the current user. It is useful for an administrator to run to make sure they are not accidentally logged in as the root user.
The ID can be seen with the id command. Processes can be ended with the kill command. Recent logins can be seen with the last command.
123.
Which directory holds the configuration files for loading and unloading modules?
-
/etc/modprobe.d
-
/usr/lib/modules/[kernelversion]
-
/usr/lib/modules
-
/boot/grub
Correct answer: /etc/modprobe.d
The /etc/modprobe.d directory holds various configuration files for individual modules that have directives for their loading and unloading. In older Linux distros, the file /etc/modprobe.conf contained settings that applied persistently to all modules loaded on the system.
The /usr/lib/modules directory houses subdirectories containing the modules of different kernel versions installed. The directory /usr/lib/modules/[kernelversion] stores the modules used for each installed kernel. The /boot/grub directory stores the menu.lst file with menu commands for GRUB (Legacy).
124.
Which command will let an administrator see user1's default shell?
-
getent passwd user1
-
readlink passwd user1
-
echo passwd user1
-
printenv passwd user1
Correct answer: getent passwd user1
The getent command with the passwd file and username will print the user's information. The shell is the last parameter.
The readlink command prints resolved symbolic links or canonical file names. The echo command prints what is passed to it as an argument. The printenv command will display the specified environment variable or all if given no arguments.
125.
An administrator of a Debian-based system needs to create a RAM disk for booting. They use the mkinitramfs tool to do so. What is the name of the resulting file from this operation?
-
initramfs
-
vmlinuz
-
grub.cfg
-
lilo.conf
Correct answer: initramfs
Using the mkinitramfs command on a Debian-based system will result in a file called initramfs. This contains the root filesystem used for booting. The vmlinuz file is the Linux kernel. The grub.cfg is the file for configuring the GRUB bootloader. The lilo.conf file was used for the original Linux Loader bootloader.
126.
Which principle of security does allowing users to share accounts violate?
-
Non-repudiation
-
Restricting root account
-
Separation of data
-
Restricting applications
Correct answer: Non-repudiaton
Non-repudiation means that every action can be traced back to an individual. If users share accounts, then it cannot be determined who exactly committed an action.
Restricting the root account refers to disabling root from terminals and remote access. Separation of data refers to keeping the system partition and log partitions available. Restricting applications refers to jailing them with commands like chroot.
127.
An administrator has an older storage device that has not been working correctly. They want to know which driver it is currently using. Which command can be used to display the current driver being used?
-
udevadm
-
ls
-
modinfo
-
hdparm
Correct answer: udevadm
The udevadm utility displays and manages information about a device. The info option to the command searches for and displays information about a specified device.
The ls command can be used to see which drivers are located on the system. The modinfo shows information about a Linux kernel module. The hdparm utility sets parameters for a hard drive such as cache, sleep mode, and power management.
128.
When using SELinux, which command is used to change the security context of a file?
-
chcon
-
setenforce
-
setsebool
-
chmod
Correct answer: chcon
The chcon command will change the security context of a file. The -u option specifies the user, the -r option specifies the role, and the -t option specifies the type.
The setenforce command sets the mode for SELinux. The setsebool command changes boolean settings for SELinux. The chmod command changes file permissions.
129.
Which command will take the text from email.txt and convert every character to uppercase before sending to standard output?
-
more email.txt | tr [a-z] [A-Z]
-
more email.txt | cut [a-z] [A-Z]
-
more email.txt | wc [a-z] [A-Z]
-
more email.txt | printf [a-z] [A-Z]
Correct answer: more email.txt | tr [a-z] [A-Z]
The tr command is used to translate characters.
The cut command is used to print fields or columns from a file. The wc command is used to count words in a file. The print command is used to format and print data.
130.
Which of the following commands will start a process with the highest priority?
-
nice -n -1 ./script.sh
-
nice -n 20 ./script.sh
-
nice ./script.sh
-
./script.sh
Correct answer: nice -n -1 ./script.sh
Setting a lower nice value will give a process a higher priority. The nice values can range from -20 to 20. The -n flag is used to set the nice value.
Using the nice command without a value will default to 10. Programs run without nice will have a value of 0.
131.
An administrator wants to quickly add a module to the kernel without checking for dependencies. Which command should they use for this action?
-
insmod
-
lsmod
-
modprobe
-
modinfo
Correct answer: insmod
The insmod command will load a module without regard for dependencies. The command only needs an absolute directory reference to the module file and should be run as the root user.
The lsmod command only gives information about installed modules. The modprobe command will add or remove modules while checking for dependencies. The modinfo command will give information about the module specified in the command line.
132.
Which command will display detailed disk partition information on the volume at /dev/sdb?
-
parted -l /dev/sdb
-
lsblk -l /dev/sdb
-
mdadm -l /dev/sdb
-
du -l /dev/sdb
Correct answer: parted -l /dev/sdb
Both the fdisk command and parted command give information about disk partitions. Just executing the parted command by itself will open its own command prompt.
The lsblk command gives information about block devices. The mdadm command is for configuring RAID levels. The du command gives information about disk usage.
133.
An administrator uses the top command to see view system processes. In the status column, which abbreviation stands for processes that are actively using CPU?
-
R
-
D
-
S
-
T
Correct answer: R
Processes that are actively running use the R abbreviation.
The D abbreviation is for processes in uninterruptible sleep. The S abbreviation is for processes that are sleeping. The T abbreviation is for processes that are stopped.
134.
An administrator is troubleshooting a slow connection to a server. They want to check the latency between the host and each router along the path to the destination. Which tool can measure this?
-
traceroute
-
nc
-
ping
-
iftop
Correct answer: traceroute
The traceroute utility shows the travel times between a host and each router on the way to its destination. It works like ping, except it manipulates the TTL value.
The nc (netcat) command is used to test a network connection between hosts. The ping command only checks the latency to the final destination. The iftop command displays bandwidth usage for an adapter.
135.
What file extension denotes a file that can be used by the Red Hat Package Manager to install and manage software packages?
-
.rpm
-
.deb
-
.tar
-
.gz
Correct answer: .rpm
The .rpm file extension is for Red Hat Package Manager files. The format for these files is <package name>-<version number>-<release number>-<architecture>.rpm.
The .deb extension is for Debian-based software distributions. The .tar file extension is for archiving and distributing files on tape drives or over the internet. The .gz file extension is for a compressed archive.
136.
Which command applies a kernel source code package update to fix bugs or security vulnerabilities?
-
patch
-
ldd
-
curl
-
wget
Correct answer: patch
The patch command can apply updates to the existing kernel source code on a system. The kernel then needs to be recompiled.
The ldd command prints shared libraries needed by a program. The curl program transfers data to or from a server. The wget command downloads files from the web.
137.
Which implementation of cryptography involves encrypting a message digest with a user's private key to provide authentication and data verification?
-
Digital signatures
-
Salting
-
Hashing
-
VPN
Correct answer: Digital signatures
A digital signature is encrypted by a user's private key. It provides both authentication and data verification.
Salting involves adding random values to a hash to make it more secure. Hashing involves running plaintext through an algorithm to produce ciphertext. A VPN is an encrypted tunnel between networks.
138.
An administrator has just set up a system for remote access. They receive a report from the first user trying to log in remotely through SSH that they cannot do so by using their username and password. During troubleshooting, which directive should the administrator confirm is set to "Yes" in the sshd_config file to verify that remote users can log in with their usernames and passwords?
-
PasswordAuthentication
-
ForwardX11
-
AllowUsers
-
PubkeyAuthentication
Correct answer: PasswordAuthentication
The PasswordAuthentication directive is for logging in with a username and password.
The ForwardX11 directive is for using the X11 GUI. The AllowUsers directive only allows users who are matched. The PubkeyAuthentication directive is for authenticating with a public key rather than a username and password.
139.
Which command will change the localization for the current session to en_GB.UTF-8?
-
export LC_ALL=en_GB.UTF-8
-
export LC_IDENTIFICATION=en_GB.UTF-8
-
export LOCALE=en_GB.UTF-8
-
export LOCALECTL=en_GB.UTF-8
Correct answer: export LC_ALL=en_GB.UTF-8
The LC_ALL environment variable can be used to override all local category settings. It also overrides the LANG variable.
LC_IDENTIFICATION is only one environment variable. Locale and localectl are commands, not environment variables.
140.
On a Red Hat Linux system, which file is a symbolic link to grub.cfg?
-
/etc/grub2.cfg
-
/var/grub2.cfg
-
/local/grub2.cfg
-
/dev/grub2.cfg
Correct answer: /etc/grub2.cfg
Red Hat makes a symbolic link to /boot/grub/grub.cfg in the /etc directory to find it easily. Using a different configuration file name makes it easier to have both GRUB and GRUB2 installed on the system.
The other directories do not contain the symbolic link.