CompTIA Linux+ (XKO-004) Post-Assessment Quiz
When writing a shell script, you have a command that you do not want to execute unless a prior command executed successfully. Which of the following could you use between the two commands to set up this logic?
&&
Which of the following is the correct list of numbers that are output from the command seq 1 10 2?
1
Which of the following commands would set the BIOS time to match the current Linux time?
hwclock --systohc
Which of the following is not a system initialization and service management technology?
kickstart
Which of the following commands, when run, shows a continuous update of running process information?
top
Caleb's workstation boots up into GNOME every time he turns it on. However, he prefers to work in the text based shell and only launch GNOME when he needs a graphical interface. Which of the following files can he modify to change this?
/etc/inittab
A user on a Fedora Linux system with the username hsimpson has created several scheduled jobs using the crontab -e command. Which of the following is the file where those jobs' information is saved?
/var/spool/cron/hsimpson
What date does Linux calculate its epoch time from?
January 1, 1970
John sees that job number 7 has been paused and wants to restart it. However, he has other tasks that he needs to perform on the system, so he doesn't want the output displaying on his terminal. What command can he use to restart the job without it taking over his screen?
bg 7
Which of the following is a complete set of directories that you would find on a normal Linux filesystem, bundled into a single cpio archive, and compressed with one of the several compression algorithms that gets loaded into memory at boot time?
initramfs
Rather than configuring the logging daemons, Gene wants to configure a utility Linux server to take the log files for the web server and back them up each day while creating a blank log file for the current day. He wants to automatically delete any files that are more than 30 days old. Which of the following utilities could Gene use to accomplish these goals?
logrotate
What command could a system administrator use to display the logical volumes that have been created on a Linux server?
lvdisplay
Kay can't remember the exact options that she needs to use with a command. Which of the following utilities could she use to find which options are available for a command?
man
Sam wants to create a new subdirectory named recipes within his directory. Which of the following will accomplish this task?
mkdir ~/recipes
Which of the following commands will display information about a kernel module whether it is loaded and running or not?
modinfo
Bryant just copied some files from another workstation onto a USB drive. He now needs to be able to view the contents of the USB drive on his workstation. Which of the following commands will be use?
mount
Which of the following commands converts an RPM package to a cpio archive so that files can be viewed or extracted without installing the package on the system?
rpm2cpio
Which of the following accessibility options would audibly assist a user that is visually impaired?
screen reader
Which of the following commands will replace all of the instances of france with the properly capitalized France in a file named geography and writes the result to a file named newgeography?
sed s/france/France/ geography < newgeography
Aaron wants to temporarily deactivate the virtual memory partition while he performs some routine maintenance. Which of the following commands might Aaron run?
swapoff
Which of the following commands would allow a user to ensure that the time and time zone information are obtained from a server on the Internet?
timedatectl set-ntp true
Which of the following configuration settings is set in the GRUB2 configuration file to allow the menu to display for X number of seconds before booting the default operating system?
timeout
Which of the following commands will create a new empty file named frogtown.txt?
touch frogtown.txt
Theo needs to publish a text document to the intranet website. However, when the author wrote the document, they used two spaces after the period and Theo wants to change the text so that there is only one space after the period, as well as replacing any other instances of multiple spaces with just one space. Which of the following commands could perform this action for Theo?
tr -s ' ' < document.txt > newdocument.txt
If you're not sure about which time zone file you should use with the TZ variable, which of the following commands will prompt you to answer a series of questions to determine the name of the correct time zone file?
tzselect
Which command can you use on Ubuntu to update the /etc/rc[runlevel].d directories?
update-rc.d
Frank needs to schedule a process to run every 60 seconds. Which of the following commands could Frank use to schedule this?
watch
Which of the following commands can be used to check and repair an XFS filesystem?
xfs_repair
You have developed a script that you want to run each time you log out to perform a variety of cleanup tasks. Which file should you modify in order to run this script upon logout?
~/.bash_logout
Which of the following commands will show the last 50 lines of the /var/log/messages log file?
tail -50 /var/log/messages
Which of the following commands can be used to limit the number of processes that users can start in a shell?
ulimit
Jerome previously set an environment variable named BUSINESSUNIT. He now wants to remove that variable from shell memory. What command can he use to do this?
unset BUSINESSUNIT
Which of the following commands will allow the root user to edit the list of users who are allowed to use the sudo command?
visudo
Which of the following firewall-cmd options will disallow a specified port within the current network zone at boot time?
--remove-port
Moe knows that every computer on the network needs to have a unique name. He wants to configure the name on his new workstation. Which of the following files should he edit?
/etc/hostname
Which of the following files would allow connections from only the computers listed in the file?
/etc/hosts.allow
Sierra has been monitoring incoming network connections on one of her servers and has noticed what appears to be attempted malicious connections coming from a few IP addresses that appear to be from overseas. Which of the following files can she add those IP addresses to in order to ensure that they are unable to connect to her server?
/etc/hosts.deny
Which of the following files will allow only the root user to log in if the file exists?
/etc/nologin
Ty wants to configure his workstation to use a certain set of DNS servers. In which file would he configure the IP addresses of the DNS servers that he wants to use?
/etc/resolv.conf
Which of the following locations are used to configure the repositories to be used by yum? (Choose two)
/etc/yum.repos.d/* /etc/yum.conf
Which of the following files needs to be modified so that the contents of the file are simply the number 1 in order to enable a Linux system to operate as a router for IPv4 packets?
/proc/sys/net/ipv4/ip_forward
What is the default nice value of new processes
0
Which of the following is the runlevel for graphical mode?
5
Tom wants to copy 5 lines and paste them somewhere else in the file. He positions the cursor at the beginning of the lines that he wants to copy. Which keystroke combination will copy those 5 lines into memory?
5yy
Which of the following characters will read from an input source until an end of input delimiter is reached?
<<
Where does GNU Privacy Guard store the public/private key pair generated by the gpg --gen-key command for the user?
~/.gnupg/
What would you type into the command line to create an alias named ll that will run the ls-al command?
alias ll="ls -al"
Which of the following commands would remove at job number 7? (Choose two)
at -r 7 atrm 7
Which of the following commands lists the user's pending jobs? (Unless the user is a superuser in which case everybody's jobs are listed.)
atq
Hannah downloaded a Linux ISO from the Internet last week, but can't seem to remember where she saved it. Which of the following commands might help determine where the ISO was saved? (Choose two.)
find locate
Which of the following commands will show the current list of print jobs waiting to be printed? (Choose two)
lpq lpstat
Which of the following facilities used by the system log daemon specifies messages related to the printing system?
lpr
Which of the following commands can be used to display the current routing table? (Choose two)
netstat -r route
John is the mail administrator for his organization. The HR manager has asked you if a new e-mail address could be created for resumes to be e-mailed into the company without having to advertise the e-mail address with their name on it. John adds the alias to /etc/aliases. What is the next task that John needs to perform?
newaliases
Which of the following tools can you use to find which services are responding and on which ports?
nmap
Which of the following is a command that can be used with Network Manager to view or modify network connection information?
nmcli
George needs to run a program that will take a number of hours to run. At the end of the workday, he logs out of his workstation, but the program keeps running. What command could George have used before the name of the program to ensure that the program continued to run even after logging out?
nohup
Marge wants to ping the IPv6 loop address on her system. Which of the following commands will accomplish this task?
ping6 ::1
Which of the following commands can be used to display entries from the Name Service Switch libraries?
getent
Which of the following commands can be used to verify the digital signature of a file that was digitally signed and encrypted with GPG?
gpg
Which of the following commands can be used to generate a public/private key pair to be used with GNU Privacy Guard?
gpg --gen-key
Check My Work To prevent having to enter your GPG passphrase each time you digitally sign or decrypt a file, which of the following daemons could you start?
gpg-agent
Which of the following commands can be used to determine which network services are listening on different ports on a Linux system?
netstat
Molly wants to change her password. What command can she use to do that?
passwd
Which of the following commands will allow a user that is a member of the wheel group to edit text files, such as configuration files, as the root user?
sudoedit
Grace is trying to pinpoint the source of connectivity issues between her workstation and a server in a remote office. Which of the following commands could help her pinpoint where the issue might be in the network?
traceroute
Larry has just gotten another IP address from his company's ISP to assign to the new web server he has just installed. Which of the following might be an IP address that could have been assigned by the ISP?
192.1.168.155
Where does Linux store the user's encrypted password?
/etc/shadow
When a new user account is created, a home directory is also created for that user and populated with a set of files. What directory does Linux use as the template to copy these files from for the user's new directory?
/etc/skel
Which of the following directories would an administrator look in to review log files?
/var
Xavier has just made a bunch of changes to a configuration file using the vi editor. However, he realizes that he doesn't want to save those changes and needs to be able to exit without saving. Which of the following keystroke combinations could he use to do that?
:q!
The most common desktop environments are KDE and GNOME. If a system administrator needs to install an alternative lightweight desktop environment that uses minimal resources, which of the following might they install?
XFCE
Which of the following regular expressions would match the names George, Georgia, and Geoff, but not Georgio?
^Geo[aefgir]*
Which of the following settings tells a Linux system to ignore fast duplicate key presses?
bounce keys
Which of the following commands can be used to change group ownership of a file or directory? (Choose two.)
chown chgrp
Which of the following commands allows a user to configure their own cron jobs?
crontab -e
John tries to print a spreadsheet that he has been working on but receives an error message that the print queue is not currently able to allow new print jobs. Which of the following does he need to do to allow print jobs to queue again?
cupsaccept
What bash command could be used to display the path to the executable of the shell you are currently using?
echo $SHELL
When writing a shell script, many times a logical test is used by means of an if statement to test whether certain criteria are met. What is the proper method of closing an if statement in the BASH shell?
fi
Gregory has a 1 TB hard drive that has MBR partitions on it, but wants to convert them to GPT. He has already backed up all of the data since he knows the conversion will wipe out the existing partitions. Which of the following tools can he not use to perform this task?
gptdisk
Bart has just changed ethernet interface eth0 to use dhcp instead of a static IP address. He needs to reload the configuration by shutting down the interface and then bringing it back up. Which of the following commands would Bart need to use to accomplish this task?
ifdown eth0 ifup eth0
Alex has created a shortcut/reference to a file in a directory that resides on another hard disk. Which of the following types of shortcuts did he create?
soft link
Katie is logged into a Linux workstation and issues the cd command and presses enter. She then issues the pwd command and presses enter. What output does Katie most likely see?
/home/katie
Phillip needs to access some data on a DVD-ROM. He has started typing the mount command. Which of the following is a valid filesystem type for optical media?
ISO9660
Ian issues the command below. What does this command do? ls -al 1>&2 2>results.txt
Standard output and standard error are both written to results.txt
Lisa knows that she can modify the /etc/hostname configuration file to set the host name on her workstation so that it boots up with that host name every time. Alternatively, she knows that she can use a command to perform this function as well. Which command should Lisa use?
hostnamectl set-hostname workstation5
Which of the following commands could be used to format a partition as XFS? (Choose all that apply)
mkfs.xfs -f /dev/sdc1 mkfs -f -t xfs /dev/sdc1
Caleb has decided to use /dev/sdb2 as his swap partition. Which of the following commands does he need to run to prepare the swap partition before he can activate it?
mkswap /dev/sdb2
Kendra is planning to create a separate subnet for a group of servers in the data center. In total, she needs 16 IP addresses for the new subnet. Which of the following subnets would provide the minimum number of IP addresses necessary while having the fewest number of unused addresses?
10.2.3.128/27
Frodo wants to set a special permission on a binary file so that when the binary is executed, the person who executed the binary temporarily becomes the owner of the binary file while it is executing. Which of the following does Frodo need to set?
SUID
Which of the following commands will display the output of the Apache2 configuration file with line numbers displayed? (Choose all that apply)
cat -n /etc/apache2/httpd.conf nl /etc/apache2/httpd.conf
Andy has a software package on a Debian Linux workstation that he initially configured during the installation process. He needs to modify some of the configuration options. Which command can he use to make those configuration modifications?
dkpg-reconfigure
Curly is modifying a .htaccess file on the web server to automatically redirect traffic coming in on an unsecure port to the secure port. Which source port is he redirecting, and to which destination port is he sending the traffic to?
port 80 to port 443
You are writing a shell script and need to collect input from the user and store it in a variable named CITY. Which of the following statements could you use to perform this function?
read CITY
Process id 2019 has a default nice value. What command could be used to change the nice value from the default to 15?
renice +15 2019
Which of the following directories contains a number of individual files for each of the various timezones that can be configured on the system.
/usr/share/zoneinfo/
Trey has noticed some unusual activity on a Linux server and needs to investigate what has been occurring. Which of the following directories would provide a good place for Trey to start his investigation?
/var/log
Which of the following commands will display the contents of /etc/passwd to standard output as well as make a copy to a file named passwdcopy.txt?
cat /etc/passwd | tee passwdcopy.txt
Which of the following commands can be used to change the number of days before a user's password expires that they will start to receive warning messages?
chage
What command will set the following permissions on the file hobbit.pdf: (choose all that apply) User: Read, Write, Execute Group: Read, Execute Other: Read
chmod 764 hobbit.pdf
Emmett wants to see how much free disk space is left on his workstation. He knows that some of the utilities can show the information in number of blocks, but he wants to see it in the number of KB or GB still free. Which of the following commands would give Emmett the information he is looking for?
df -h
Jason has written a shell script containing a while loop. What is the last line that he needs to include to complete the while loop portion of the code?
done
Which command can be used to show the number of free inodes? (Choose all that apply)
dumpe2fs df -i
Katherine has just run the command: COSTCENTER="3016". How would she be able to view the value of this variable at the command line?
echo $COSTCENTER
SUSE and openSUSE use an alternative to yum that provides the same functionality. What is the name of the command used on these platforms?
zypper
Which of the following is the built-in hypervisor functionality built into Linux?
KVM
Jay has just installed a 1U server that has 2 hard drives. He wants to ensure that he implements redundancy so that he doesn't lose any data. Which of the following might Jay configure?
RAID 1
Which of the following character sets allows software to use one to four 8-bit bytes to represent the characters defined by Unicode?
UTF-8
Geoff wants to examine the /etc/passwd file to see which shell is currently set as the default for a user. Since there are quite a few users on the Linux server, he does not want to scroll through many lines looking for the right account. Which of the following commands could Geoff use to narrow down the search results?
grep
What are the two most common logging daemons that you will find in a Linux operating system? (Choose two)
journald rsyslogd
Carissa wants to see which shared libraries are used by the /bin/bash command. Which of the following could she use to get this information?
ldd /bin/bash
Which two commands can add custom log file entries to the journald database?
logger systemd-cat
Which of the following commands will display an at symbol in addition to the symbolic link?
ls -F
Which of the following files contains the list of operating systems to be displayed on the GRUB legacy bootloader menu?
menu.lst
Aria has just backed up an old project directory named projectx to a network file server and now wants to delete the directory and all of its files and subdirectories from her workstation. Which of the following should Aria run to accomplish this task?
rm -rf projectx