No products in the cart.
CompTIA Linux+ Exam Questions
Page 4 of 25
61.
An administrator wants to be sure that users who have not been active and have not changed their password after it expired are deactivated. Which option for the passwd command will let them set the number of days after a password has expired and not been changed until the account is deactivated?
-
-i
-
-l
-
-x
-
-d
Correct answer: -i
The -i option will allow an administrator to set a number of days after which the password has expired and not been changed until it is deactivated.
The -l option will lock out a user. The -x option will set the maximum number of days needed before a password must be changed. The -d command will remove a user's password but still allow them to log in.
62.
Which directory contains system statistics about partitions used by the kernel?
-
/proc/partitions
-
/etc/mtab
-
/etc/fstab
-
/sys/block
Correct answer: /proc/partitions
The /proc folder is a filesystem that the kernel uses to record system statistics. The /proc/partions folder is for information on partitions.
The /etc/mtab file is for listing currently mounted filesystems. The /etc/fstab file is for automatically mounting drives. The /sys/block directory has symbolic links for each block device discovered by the system.
63.
Which command forces the kernel to read a new partition table into memory?
-
partprobe
-
parted
-
fsck
-
fdisk
Correct answer: partprobe
The partprobe utility lets the operating system kernel know that it should re-read the partition table after changes have been made.
The parted utility is used to manage disk partitions. The fsck utility is used to check for errors in a filesystem. The fdisk utility is used to change hard disk partitions.
64.
Which application shows the information about installed hardware devices, including device name, DMS, IRQ, and I/O ports?
-
lsdev
-
lsblk
-
dmesg
-
lspci
Correct answer: lsdev
The lsdev gives all the important information about devices running on the system. It is part of the procinfo package, which may need to be installed separately.
The lsblk command shows information about block devices. The dmesg command records kernel-level events. The lspci command views installed PCI and PCIe cards.
65.
Which option to the cp command does a recursive copy and keeps the original files' attributes?
-
-a
-
-f
-
-v
-
-n
Correct answer: -a
The -a option performs a recursive copy and keeps attributes like permissions, ownership, and timestamps.
The -f option forces an overwrite in the target destination. The -v option provides detailed command action information as the command executes. The -n option will not overwrite files with the same name at the target destination.
66.
An administrator is troubleshooting an issue that they believe is related to a name resolution failure. Which command can they use to test name resolution?
-
dig
-
traceroute
-
nmcli
-
ifconfig
Correct answer: dig
The dig command is a tool that can be used for gathering information and testing name resolution.
The traceroute command reports the path between source and destination hosts. The nmcli command is used to view and manage network settings. The ifconfig command will display the current IP address information for each network interface card.
67.
Which variable contains the directories that will be searched when a command is entered in a shell?
-
PATH
-
SHELL
-
TERM
-
HOME
Correct answer: PATH
The PATH variable has directories that are searched after aliases, functions, and built-in commands are checked.
The SHELL variable is the name of the current shell. The TERM variable is the terminal type. The HOME variable is the user's home directory.
68.
An administrator wants to do secure remote backups using the scp command. They do not want to have to enter their password since it will be automated through a cron job. To which file should they add their public key to on the SSH server where they will put the backups?
-
~/.ssh/authorized_keys
-
~/.ssh/id_rsa
-
~/.ssh/id_rsa.pub
-
~/.ssh/known_hosts
Correct answer: ~/.ssh/authorized_keys
A user's public key should be appended to the ~/.ssh/authorized_keys in the user's account on the remote server. It can be appended to the file after copying it and using the cat command.
The ~/.ssh/id_rsa file is for storing your private key after generating your key pair. The ~/.ssh/id_rsa.pub file is for storing the public key after generating the key pair. The ~/.ssh/known_hosts file has public keys of remote hosts to which they have been connected.
69.
An administrator needs to install virtual machines on their server. Which library will give them the tools they need to install and manage the virtual machine managers?
-
libvirt
-
libk5crypto
-
glibc
-
libcurl
Correct answer: libvirt
The libvirt library can manage a variety of hypervisors. It includes APIs, a daemon, and command-line utilities.
The libk5crypto library has encryption tools. The glibc library is for programming in C. The libcurl library is for file transfer tools.
70.
Which command shows the security context assigned to a process?
-
ps -Z
-
ls -Z
-
id -Z
-
chcon -Z
Correct answer: ps -Z
SELinux labels each object on a system with a security context. To view the security context for objects, add the -Z option to common Linux commands like id, ls, and ps. The ps command with the -Z option will show the context of processes.
The ls -Z command will show the context for files. The id -Z command will show a user's context. The chcon -Z command is for changing contexts.
71.
An administrator is using the UEFI startup method. Where will their partition for this be mounted?
-
/boot/efi
-
/etc/default/grub
-
/boot/grub
-
/etc/efi
Correct answer: /boot/efi
UEFI uses a special disk partition to store bootloader programs. This is usually located at /boot/efi.
Global variables are kept in /etc/default/grub. Bootloader configuration files for GRUB are stored in /boot/grub. The /etc directory is for storing configuration files and does not typically have a subfolder called /efi.
72.
Which of the following commands would redirect the error for a missing file or directory to the file error.txt rather than to the terminal?
-
ls /missing 2> error.txt
-
ls /missing > error.txt
-
ls /missing >> error.txt
-
ls /missing <> error.txt
Correct answer: ls /missing 2> error.txt
The 2> operator will redirect standard error to a specified file. It will overwrite the file unless it uses the 2>> operator.
The other answer choices will show an error in the terminal window.
73.
The git checkout command can be used to do what?
-
Switch to a specific branch to work with
-
Display the status of the repository
-
Create a working copy of an existing repository
-
Create a git repository or reinitialize an existing one
Correct answer: Switch to a specific branch to work with
The git checkout command is used to switch to a specific branch to work with.
The git status command is used to display the status of the repository. The git clone command is used to create a working copy of an existing repository. The git init command is used to create a git repository or reinitialize an existing one.
74.
What is the syntax of a file in /etc/pam.d?
-
TYPE CONTROL-FLAG PAM-MODULE [MODULE-OPTIONS]
-
ACCOUNT AUTH PASSWORD SESSION
-
LOGIN FAILURES LATEST-FAILUE FROM
-
WHEN TYPE SOURCE VALID
Correct answer: TYPE CONTROL-FLAG PAM-MODULE [MODULE-OPTIONS]
A configuration file in /etc/pam.d has a stack of modules that a user must go through to gain access to the system. These modules have a type, control-flag, and module-name that are considered for granting access.
The account/auth/password/session option refers to the various TYPE options in an /etc/pam.d file. The login/failures/latest-failure/from syntax refers to the output of pam_tally2. The when/type/source/valid syntax refers to the output of the faillock command.
75.
Which authentication service is an open-source Active Directory service that uses a centralized authorization database and has a hierarchical tree structure?
-
LDAP
-
Kerberos
-
RADIUS
-
TACACS+
Correct answer: LDAP
LDAP can work well in Linux, Windows, or Mac environments. Its database can be distributed amongst many servers, which can speed up response times.
Kerberos is known for its strong authentication system that has a key distribution center and a ticket-granting service. RADIUS is for authenticating local and remote users connecting via a modem. TACACS+ implements authentication, authorization, and accounting as well as encrypting all transactions.
76.
An administrator has numerous log files in a directory that start with the letter "a" that they want to delete. Which command will delete the files while asking for permission first?
-
ls a* | xargs -p /bin/rm
-
ls a* | xargs /bin/rm
-
ls a* > /bin/rm
-
ls a* | /bin/rm
Correct answer: ls a* | xargs -p /bin/rm
The ls a* | xargs -p /bin/rm command will use the xargs utility to delete files. The -p option makes it ask for permission.
The other operators will not result in the files being deleted.
77.
Which term in DevOps defines the process of easily deploying, configuring, or rolling back app containers?
-
Infrastructure automation
-
Agent-based monitoring
-
Git
-
Agentless orchestration
Correct answer: Infrastructure automation
Infrastructure automation means using orchestration tools that can automatically do chores that would ordinarily be tedious, such as building or spinning up hundreds of containers.
Agent-based monitoring refers to having monitoring tools within an app container. Git is a tool for using version control. Agentless orchestration refers to monitoring app containers externally rather than from within the container.
78.
An administrator is troubleshooting an issue in which keyboard presses do not match what appears on the screen. The issue is occurring on a Red Hat-based system. Which command can they use to see the current key map settings?
-
localectl
-
dpkg-reconfigure keyboard-configuration
-
lshw
-
systemctl
Correct answer: localectl
The localectl command is used to view and change keyboard maps on a Red Hat-based system. The locale can be changed to US by using the command localectl set-keymap us.
The dpkg-reconfigure command is used with Debian-based systems. The lshw command is for hardware configurations such as for the CPU, cache, and bus. The systemctl command is to manage systemd and services.
79.
On a Red Hat-based system, an administrator wants to check which runlevels have ntpd enabled. Which command will accomplish this?
-
chkconfig --list ntpd
-
update-rc.d --list ntpd
-
init --list ntpd
-
readlink --list ntpd
Correct answer: chkconfig --list ntpd
The chkconfig command is used to display or change the runlevels at which a service starts. These commands can also be found in a service's /etc/init.d script.
The update-rc.d command is used with Debian-based systems. The init command is used to change runlevels. The readlink command is used to view resolved symbolic links.
80.
Which filesystem type is used to provide shared access to files, printers, and serial ports?
-
SMB
-
EXT3
-
NFS
-
VFAT
Correct answer: SMB
Server Message Block (SMB) was developed by Microsoft to let users interact with network devices like printers. It allows Linux and Windows clients and servers to work together.
The Third Extended Filesystem (EXT3) is specifically for Linux. The Network File System (NFS) is for using network storage devices. The Virtual File Allocation Table (VFAT) filesystem is used on devices like USB sticks.