linux test 1

Ace your homework & exams now with Quizwiz!

Which of the following is a true statement about files on a default Linux system? (Choose all that apply.) a. Filenames can start with a number. b. Filenames can contain multiple periods. c. Filenames can contain spaces. d. Filenames can contain ampersands. e. Filenames can contain backslashes.

A, B, C, D, E. All of these answers are correct. A filename can contain virtually any character, though in the case of spaces, ampersands, and backslashes, care must be taken to escape the character lest it be interpreted as a command to the shell.

Instead of using the up and down arrows, you can use a. k for up and j for down b. j for up and k for down c. Ctrl+d for down and Ctrl+u for up d. j for up and h for down

A. A is correct because k and j represent up and down motions. B is incorrect because the keys are inverted from their described functions. C is incorrect because Ctrl+d and Ctrl+u move down and up in terms of half pages, not lines like the arrows. D is incorrect because h moves to the left and j moves down.

/dev/sda3 refers to a a. Partition b. Flash drive c. Filesystem d. Disk

A. A is correct because sda3 includes both the device and an offset indicating the partition. B is not correct because a flash drive would not have a number. C is not correct because the filesystem goes on the partition. D is not correct because the disk does not have a number in it.

A hotplug device: a. Doesn't need a driver b. Can be inserted and removed without rebooting the system c. Can't be removed without rebooting the system d. Is another name for a hard drive

B. B is correct because a hotplug device can be inserted or removed at any time. A is incorrect because the device still needs a driver. C is incorrect because the device can be removed without a reboot. D is incorrect because there are more hotplug devices than just hard drives.

A filesystem is applied to a. A hard drive b. A partition c. A physical volume d. A volume group

B. B is correct because a partition contains a filesystem. A is incorrect because you need to partition a hard drive before applying a filesystem. C and D are incorrect because the PV is added to a volume group and then sliced up into logical volumes that contain filesystems.

Which acronym refers to a feature that allows a peripheral to access system memory without needing to use the CPU? a. IRQ b. DMA c. TCP d. MEMCP

B. B is correct because direct memory access lets the peripheral talk directly to memory. A is incorrect because an interrupt request is a signal from the peripheral to the CPU that it needs attention. C is incorrect because the Transmission Control Protocol is a network concern. D is incorrect because it is not a hardware matter.

When laying out hard drive partitions, which of the following is not a primary consideration? a. Performance b. Integration c. Backup d. Security

B. B is correct because integration is not a core consideration—integrity is, however. The others are primary considerations when laying out hard drive partitions.

Which of the following identifies the file produced by the ldconfig program after it is run and has processed all the library files on the machine: a. /etc/ld.so.conf b. /etc/ld.so.cache c. /var/cache/ld.so.cache d. /etc/ld.cache.d

B. B is correct because that is the name of the cache file generated by ldconfig.

libjpg.so.8.0.3 is probably a a. Static library b. Shared library c. Binary d. Shell script

B. B is correct because the .so moniker indicates a shared library (or literally "shared object"). A is not correct because a static library would be bundled with the binary. C and D are not correct because the file is more likely to be a shared library.

Which of the following is a valid cause to receive the error message? (Choose all that apply.) error: cannot get exclusive lock on /var/lib/rpm/Packages? a. Attempting an rpm install command as non-root b. Performing multiple remove commands simultaneously c. Performing multiple verification commands simultaneously d. Performing multiple install commands simultaneously

A, B, D. Answers A, B, and D are correct because they cannot be performed in any way except singly at any given time because the database is locked or because normal users cannot perform the action. Answer C is incorrect because multiple verification commands can be performed simultaneously because the operation is a read, not a read-write.

Which of the following when executed on the command line immediately returns you to your home directory? (Choose all that apply.) a. cd $HOME b. cd ` c. cd ~ d. cd e. cd /home

A, C, D. Answers A, C, and D are correct because they are the recognized ways to be transported back to your home directory.

`You are tasked with running a large set of automated reports that have been scripted to be run as the root user. From experience, you know that these reports often take longer than the 8-hour workday, and you're on salary now so you're uninterested in pulling an all-nighter. Which of the following commands would let you run your script unattended, even after you log out for the evening? (Choose all that apply.) a. nohup b. exec c. screen d. unattend e. control

A, C. The nohup command and the screen command both allow you to execute something and log out. They both essentially detach the process from the controlling terminal and set it free. The other commands don't do what is being asked.

In which of the following locations are you most likely to find the boot loader code on a Linux system? a. Master boot record b. /boot/vmlinuz c. /dev/d0/s0 d. First sector of partition e. /grub/boot.msg

A, D, E. Answers A, D, and E are correct because the numeral 1 puts the system into runlevel 1, a troubleshooting mode. The characters "s" and "S" also are used to put the system into a troubleshooting mode where few modules are loaded and mostly you are presented with a shell prompt. The other answers are incorrect because they don't match the criteria or are nonexistent.

When attempting to boot your Linux system, you see an error message and the system will not complete a normal boot. Which of the following could you type at the GRUB menu to enter a system administrator mode for troubleshooting? Choose all that apply. a. 1 b. 2 c. 5 d. s e. S

A, D, E. Answers A, D, and E are correct because the numeral 1 puts the system into runlevel 1, a troubleshooting mode. The characters "s" and "S" also are used to put the system into a troubleshooting mode where few modules are loaded and mostly you are presented with a shell prompt. The other answers are incorrect because they don't match the criteria or are nonexistent.

You have edited the configuration file of the service named daemon1 and need that service to reread the configuration and continue serving its attached client processes. Which of the following will accomplish this? Choose all that apply. a. kill -s SIGHUP daemon1 b. kill -15 daemon1 c. kill -9 daemon1 d. kill -HUP daemon1 e. kill -1 daemon1

A, D, E. Answers A, D, and E are correct because they are all valid variations of the SIGHUP signal and will "hang up" or restart the service, rereading the configuration file. The other answers are incorrect because they don't match the criteria and will either politely kill the service (9) or abruptly kill the service (15).

You are installing a customized server and need to strip the root filesystem down to the essentials only. According to the FHS 2.3, which of the following are considered optional on the root (/) filesystem? (Choose two.) a. /root b. /usr c. /tmp d. /home

A, D. Answers A and D are correct because the FHS states that the /root and /home partitions are optional. Answers B and C are incorrect because the FHS doesn't list them as optional for the root filesystem.

When executing a command, you want the output, both standard error and standard out to not be displayed on the console. Which of the following accomplishes this? (Choose two.) a. command1 1> /dev/null 2> /dev/null b. command1 1+2> /dev/null c. command1 12>> /dev/null d. command1 stdout> /dev/null +stderr e. command1 > /dev/null 2>&1

A, E. Answers A and E are correct because you can use the specific stdout and stderr number descriptors to redirect output or you can use the 2>&1 option to send the stderr to wherever stdout is directed.

Which of the following is not commonly placed on its own partition? a. /sbin b. /home c. /usr d. /tmp

A. A is correct because /sbin holds binaries necessary to manage the system and boot it. B is not correct because /home is often placed on a separate partition to make it easier to share. C is not correct because /usr can be separated to keep system binaries separate, or to make it easier to grow. D is not correct because /tmp is often put on its own partition so that it can have different mount options, or to prevent temporary files from filling the root partition.

You entered: :set number? Into vim and received nonumber In response. What just happened? a. You asked vim if you were in number mode and it responded no. b. You turned number mode off. c. You turned number mode on. d. You turned number mode on and also made it permanent.

A. A is correct because a set command ending in a question mark queries the setting. The remaining answers are incorrect because the command queries and doesn't set.

Which compression utility offers the highest level of compression? a. bzip2 b. gzip c. compress d. cpio

A. A is correct because bzip2 provides the best compression of them all. gzip generally beats compress, and cpio doesn't offer compression.

You are the sysadmin of a busy server and need to save space on your /home partition. You need to remove all files named core that are older than seven days in the users' home directories, without receiving any prompts. a. find /home -mtime +7 -name core -exec rm -f {} \; b. find ~ -mtime +7 -name core -exec rm -f {} \; c. find /home -mtime -7 -name core -exec rm -f {} \; d. find /home -older 7d -name core -exec rm -f {} \;

A. A is correct because it uses the correct combination of starting directory (/home) search predicates (modify time is greater than 7 days, name is core) and action (execute the rm -f command on the name of the file). B is not correct because the starting directory is the current user's home directory. C is not correct because the mtime search predicate is -7, indicating "less than 7 days old". D is not correct because there is no -older search predicate.

You know that you downloaded a file called backup.tar.gz this morning but can't remember where you put it. Which is the most appropriate command to find the file? a. find / -name backup.tar.gz b. find backup.tar.gz c. locate backup.tar.gz d. whereis backup.tar.gz

A. A is correct because that searches your entire filesystem for a file named backup.tar.gz. B is not correct because the find command needs a search predicate such as -name. C is not correct because locate does not include anything from the current day—the database must be updated on a nightly basis. D is not correct because whereis does not search the filesystem extensively.

To check the signatures on a directory full of RPM files, use a. rpm -K * b. rpm -qk * c. rpm --check-sig * d. rpm-sig *

A. A is correct because the -K option checks signatures. B is not correct because the query option (-k) does not accept a -k parameter. C is not correct because there is no --check-sig option to rpm. D is not correct because there is no rpm-sig command.

Which command deletes from the current cursor position to the end of the line? a. d$ b. DD c. YP d. cW

A. A is correct because the D command deletes and it is applied to the end of the line with the $ . B is incorrect because a single D by itself deletes from the character position to the end of the line, but the second D deletes more characters. YP is incorrect because it duplicates the current line (Yank, Put). D is incorrect because cW changes the current word.

You are the system administrator of two firewalls and want to apply updates from a set of packages in the current directory, but you don't want to install any new packages on the systems. Which command will do this? a. rpm -F *.rpm b. rpm -Uvh *.rpm c. rpm -qp *.rpm d. rpm -Fp *.rpm

A. A is correct because the Freshen command only upgrades packages and won't install new packages. B is incorrect because the upgrade command installs new packages. C is incorrect because that queries a package file and does not install it. D is incorrect because the Freshen command does not use the -p option.

You happen across a file in a directory called foo. What is a good way to find out what the file is or does? a. file foo b. /foo c. cat foo d. which foo

A. A is correct because the file command uses several heuristics to find out what a file is. B is not correct because that executes the file, which may not work in the case of text or data files and could be dangerous if you don't know what it does. C is incorrect because displaying the contents of the file on your screen does not work for binary files and is cumbersome for large text files. D is not correct because which looks for the file in your search path.You happen across a file in a directory called foo. What is a good way to find out what the file is or does?

Your root volume is /dev/sda1. You mount /dev/sda2 on /usr and then /dev/sdb1 on /usr/local/. Files in /usr/bin are then stored on: a. /dev/sda2 b. /dev/sdb1 c. /dev/sda1 d. You can't nest mounts.

A. A is correct because the file would be stored under /usr but not /usr/local.

How would you upgrade the iceweasel package to the latest version? a. apt-get install iceweasel b. apt-get update iceweasel c. apt-get upgrade iceweasel d. dpkg --install --upgrade iceweasel

A. A is correct because the install command both installs and upgrades packages. B is incorrect because update resynchronizes the remote package list. C is incorrect because the upgrade command upgrades all packages on the system. D is incorrect because there is no --upgrade option to dpkg, and that command only operates on local files.

When the kernel is under pressure to give memory to a process, and there is another process that hasn't used its memory in a while, the kernel will a. Swap the old memory to disk b. Give the memory to the new process knowing it's not being used c. Compress the memory pages and give the reclaimed space to the new process d. Refuse to give memory to the new process

A. A is correct because the kernel's virtual memory allows a memory page to be swapped to disk and swapped back later when it's needed. B is incorrect because the memory was promised earlier and can't be discarded. C is incorrect because the VM subsystem doesn't compress memory. D is incorrect because if swap exists, it can be used to make the system appear as if it has more memory than it actually does.

Which of the following situations would prevent you from creating a hard link? a. The link spans filesystems. b. The source of the link is a hidden file. c. The source of the link is a device file. d. The source of the link is a directory. e. The destination contains special characters.

A. A is correct because the link points to the inode of the file, and that wouldn't work if the file were on a filesystem. D is correct because this is a limitation imposed in Linux to avoid cycles in the directory structure that would break the tree model. The rest of the options are incorrect because the name and type of the file do not matter for the hard link.

The dynamic linker is called ______ and is configured in ______. a. ld.so, /etc/ld.so.conf b. so.linux, /etc/ld.so.conf c. ld.so, /etc/so.linux.conf d. so.linux, /etc/so.linux.conf

A. A is correct because the name of the linker is ld.so, sometimes also called ld-linux.so. The configuration file is in /etc/ld.so.conf. The other answers either get the name wrong or the configuration file locations wrong.

While sorting a file that has numbers at the beginning of the lines, you notice that sort seems to oddly order the lines, as follows: 1 11 12 20 What option to the sort command could you use to get a more human-friendly sorting of the file? a. -n b. -k c. -t d. -h

A. The -n option performs a nonmachine or human-friendly sort, effectively padding any numbers such as 1 with a leading 0. If the numbers go to multiple positions, such as 1 to 100, then additional leading 0s are added so that all the numbers are sorted in the human-friendly format. These 0s are not input into the file nor displayed, just used in the sort of the file's data.

You are using a series of command line tools to display output that is useful, but what you would rather see as output is the exact opposite of what is being shown. Which of the following commands with option shows the reverse or inverse of the normal output? a. grep -v b. sort -r c. find -x d. indent -u e. None of the above

A. The grep command is well known for being able to show the exact opposite of the current output by the use of the -v option. All the other commands are functional commands, but either don't have that option or the option is not for reversing output.

Which of the following commands would allow you to make changes to parameters for a configured GRUB menu choice, before booting the system? a. c (change) b. b (boot menu) c. e (edit) d. a (alter)

C. e is the command used by GRUB at the boot menu to edit the parameters for the entry you want to change.

As the sysadmin of a heavily used terminal server, you suddenly notice that the same user is logged on to many different terminals executing similarly named processes and the count of these processes keeps rising rapidly. Which command would allow you to both find all the problem processes and kill them based on the user, controlling the terminal as well as the process name? a. pkill b. pgrep c. pgmnorm d. pkmon e. pkexec

A. The pkill command allows you to specify a concise set of requirements for killing a process or set of processes. The pgrep command can be used to find those processes, but pkill is used to kill them.

The Logical Volume Manager lets you resize disks without rebooting: a. True b. False

A. True. Hot resizing is possible because the makeup of the disk is all logical under LVM.

What is the simplest method of viewing all the variables in your execution environment? a. env b. getent c. for * in $; echo d. show all

A. Typing the env command is the simplest and most complete way to see all variables in your current environment

Which of the following commands are symlinks to the reboot command? (Choose two.) a. shutdown b. halt c. poweroff d. init 6

B, C. If you do a ls -l on the shutdown, halt, poweroff, and init commands, you see that halt and poweroff are symlinks that point to the /sbin/reboot command, while shutdown is its own command and not a symlink. The "init 6" command string will simply cause the system to reboot, but it is NOT a symlink to the reboot command.

During your last system boot, you noticed several error messages that quickly scrolled off the screen and could not be viewed. You are not sure which system initialization scheme is in place. Which of the following commands will likely show you just the messages from the most recent system boot? (Choose three.) a. systemctl --viewboot b. journalctl -b c. syslog --boot d. dmesg e. cat /var/log/boot.msg

B, D, E. Answers B, D, and E are correct because they are all three capable of showing just the system's boot messages from the last boot. The other answers are incorrect because they don't match the criteria or are nonexistent.

As the sysadmin of a system, you notice in the top command output that a particular command is using an inordinate amount of system resources. Which of the following keystrokes or commands would alter the process priority for the unruly command? (Choose two.) a. nice b. renice c. ps -nice d. r e. kill -nice

B, D. Answers B and D are correct.The r keystroke within top allows you to enter a numeric value that changes the priority of the specified process, and the renice command alters the priority of a running process, which the unruly process is, which leaves out the nice command, used for starting processes at an altered priority. The other answers have invalid options.

You want to find the previous instance of the string: ls a* but only if it appears at the beginning of the line. Which command will do this? a. /^ls a\* b. ?^ls a\* c. /$ls a\* d. ?ls a*

B. A is incorrect because the / searches forward, not backward. B is correct because the command searches backward, anchors the search with the ^, and also escapes the splat operator correctly. C is incorrect because it searches forward and doesn't anchor the search to the beginning of the line. D is incorrect because the search isn't anchored nor is the * escaped.

Which command gives an overview of all the hardware and drivers in the system including the ports they use to talk to the CPU? a. lspci b. lsdev c. lsusb d. sysinfo

B. A is not correct because lspci gives an overview of just the PCI hardware. B is correct because lsdev aggregates many different files under /proc to give you a description of all your hardware. C is not correct because lsusb enumerates the USB bus and nothing else. D is not correct because sysinfo is not a valid command.

The configuration file for GRUB2 is a. menu.lst b. grub.cfg c. grub.conf d. bootloader.conf

B. A is not correct because menu.lst is for the Legacy GRUB. B is correct because the new name of the file is grub.cfg. C is not correct because grub.conf is also for the old version of GRUB. D is not correct because that name is not used by any version of GRUB.

You want to add a log entry in a file named output.txt. This entry includes the output of a particular command that includes a timestamp and unique and critical data each time it is run. You don't want to overwrite the current contents of the output.txt file. Which of the following operators causes the proper result to happen? a. !< b. >> c. <> d. > e. <<

B. Answer B is correct because double redirect symbols catenate the output of the command into the described file properly. The > redirect overwrites the file each time, and the other operators are either input redirects or invalid.

After executing a command, you don't see an error message, but the behavior of the command and its output are different. What could you type on the command line immediately afterward to see whether there was an error? a. echo $# b. echo $? c. echo $ d. echo $|

B. Answer B is correct because echoing $? displays the exit code for the previously executed program.

Which feature listed below helps in the orderly removal of processes and groups of processes when the system is using the systemd initialization process? a. /etc/group b. group tag c. groupmod d. gkill

B. Answer B is correct because group tags are used by systemd to refer to and allow the loading and removal of groups of processes. The other answers are incorrect because they don't match the criteria or are nonexistent.

You have just executed the screen command and are at a bash prompt. After creating three new window sessions, you want to see a list of the available screen sessions. Which keystroke set would you use to show the list? a. Ctrl+a show all b. Ctrl+a " c. Ctrl+a ls d. Ctrl+a c e. Ctrl+c r

B. Answer B is correct because it's the only possible answer that causes the screen command to show you a listing of the available sessions. All the others are variations on the Ctrl-a theme, but either are false or don't work as described.

Which of the follow commands simulate a shutdown event on the system, but do not actually take the system down? a. shutdown -h b. shutdown -k c. shutdown -r d. shutdown -c

B. Answer B is correct because the -k option to shutdown is for simulating a system shutdown event, as well as sending a message to the attached users. The other answers are incorrect because -h halts the system, -r reboots the system, and -c cancels a shutdown that has already been issued, if there is sufficient time.

One of your programmers has produced an order entry system that will be shared among your users from a central file server. What is the appropriate directory to place this program and its associated files in? a. /usr/local/bin b. /usr/local c. /usr/share d. /opt

B. Answer B is correct because the FHS states that sharable programs should be in /usr/local/appname. Answer A is incorrect because the /usr/local/bin directory is for single binaries and is often just a link to some application in /usr/local/appname/bin. Answer C is incorrect because the /usr/share directory contains files for multiple architectures and the question does not state that multiple architectures are involved. Answer D is incorrect because the /opt directory is for locally installed programs only and is not to be shared out for multiple system usage.

Which command can be used to show only the last 10 lines of your History file? a. tail -f /var/log/history b. history | tail c. cat +10 $HISTFILE d. lasthist

B. Answer B is correct because the history command when piped through the tail command shows only the last 10 lines of your command history.

You have a directory named /dir1 that contains subdirectories and regular files. You want to replicate this directory structure exactly into an existing directory named /dir2. Which of the following commands accomplish this? (Choose all that apply.) a. cp --contents dir1/ /dir2 b. cp -r /dir1/* /dir2 c. xcopy /dir1 /dir2 d. cp -r /dir1 /dir2

B. Answer B is correct because, to copy the contents of a directory, the source must end with a /*; otherwise, the directory itself is copied as a subdirectory of the target. Answer A is incorrect because there isn't a --contents option to the cp command. Answer C is incorrect because the xcopy command is offered only on DOS and Windows machines. Answer D is incorrect because the source directory doesn't include a /* suffix and therefore copies the source into the target as a subdirectory.

A pseudo-filesystem containing information about the system is a. /dev b. /proc c. /usr d. /sbin

B. B is correct because /proc exposes files containing information about the system. A is incorrect because /dev contains device files used to talk to devices. C and D are incorrect because they are file storage locations.

Which of the following commands shows the revision history for a software application from the package file on disk? a. rpm --revision tree-1.2-7.i386.rpm b. rpm -qp tree-1.2-7.i386.rpm --changelog c. rpm -qc tree-1.2-7.i386.rpm d. rpm -qlp tree-1.2-7.i386.rpm --showrev

B. B is correct because the combination of the -qp and --changelog options shows the changelog or revision history for a package that's on disk. Answer A is incorrect because there is no such thing as a --revision option for the rpm command. Answer C is incorrect because there isn't a -p option to query the package on disk, nor does -qc show the required information. Answer D is incorrect because the -qlp option shows the files in the package, not the revision history, and there isn't a --showrev option to the rpm command.

If you want to install a local Debian package and ignore any dependency errors, what do you need to do? a. Nothing, this is the default. b. Add --force-depends (dpkg -i pkg.deb --force-depends) c. Add --force-conflicts (dpkg -i pkg.deb --force-conflicts) d. Add --force-reinstreq (dpkg -i pkg.deb --force-reinstreq)

B. B is correct because the option tells dpkg to install dependency errors. A is incorrect because the default is to stop processing when a dependency error has been found. C is not correct because that overrides an error indicating a package is conflicting, rather than missing a dependency. D is incorrect because that overrides packages that need to be reinstalled.

Your shell is in /usr/local. You type cd ../bin. Which directory is shown when you type pwd? a. /bin b. /usr/bin c. /usr/local/bin d. Nothing, this command returns an error.

B. B is correct because the path given first descends one directory to /usr, then moves into bin. A is incorrect because the shell would have to descend two levels, not one. C is incorrect because /usr/local/bin is a subdirectory of the current working directory. D is incorrect because the command is valid

To view the list of required capabilities that a package needs to function properly, which command and options display this for an installed package? a. rpm -qi b. rpm -qR c. rpm --whatrequires d. rpm -qa

B. B is correct because the query and requires options together produce a list of what the package needs. A is incorrect because that queries the basic information about the package. C is incorrect because the --whatrequires option gives a list of which packages depend on the given package or capability, not the other way around. D is incorrect because it gives a list of all installed packages.

While monitoring your backup success and failure, you notice that at times your sole backup scheme is failing. As it's a simple command typed at the command line, what character(s) could you use to separate the main command from an alternate command to ensure that if the first command fails, the secondary or alternative command will run, but only then? a. ** b. || c. && d. !=

B. B is correct because when you place double pipe characters between two commands, the shell monitors the exit status for the first command, and if it exits with an error, only then is the second command executed. Double asterisks (a) means any character or none followed by any character or none, the double ampersands (c) means to execute the subsequent command if the first is successful and the not equal (!=) means that the two items on either side of it are not equal to each other.

When using the GRUB boot loader, which of the answers describes the first logical partition on the first hard disk in a GRUB configuration? a. /dev/sda5 b. (hd0,4) c. c:8000:6 d. /dev/dsk/c0d0s3

B. In a GRUB configuration file, the disks are referred to by (hd#,#). The first disk is referred to by (hd0) and the fifth partition, the first logical, is referred to by (hd0,4) as GRUB starts counting from 0.

Which of the following words best describes what the Bash shell does with what we type into it? a. Extrapolates b. Interprets c. Expresses d. Translates

B. The bash shell takes the words/commands we type into it and interprets those to make the system take certain actions. The other phrases are not indicative of what is happening in the Bash shell.

Which of the following commands shows messages read from the kernel ring buffer to standard output? a. cat /var/log/messages/kernel b. dmesg c. kernring d. lastlog

B. The dmesg command is designed to show to standard output the kernel ring messages generated by the Linux Kernel.

Which of the following is the file descriptor that matches stdout? a. /proc/self/fd/0 b. /proc/self/fd/1 c. /proc/self/fd/2 d. /proc/self/fd/3

B. The file descriptors are 0 = stdin, 1 = stdout, 2 = stderr, and 3 is not an existing file descriptor.

Which of the following sets of keystrokes pause or stop a program's execution and allow you to run job control on it? a. Ctrl-c b. Ctrl-z c. Ctrl-p d. Ctrl-q e. Ctrl-f

B. The keystrokes Ctrl-z send a SIGTSTP or 20 signal to the process, pausing or freezing its execution. The logical next step is to use the bg command and put that process back to executing in the background. The other Ctrl-? combinations all send signals, but don't perform the function specified.

You are trying to display a formatted text file in a uniform manner as output on the console, but some of the columns don't line up properly. What command could you use to filter this file so that any tabs are replaced with spaces when it's output to the console? a. convert b. expand c. detab d. spacer

B. The tabs in files combined with the length of the data in each column often display oddly when the file is output to the console. The proper command to temporarily remove tabs and replace them with the appropriate number of spaces is the expand command. The other commands are either not correct or don't exist.

Which of the following commands can show you a treelike hierarchy of processes and information about them? (Choose all that apply.) a. procheir b. lsproc c. ps d. pstree e. gvfs-tree

C, D. C and D both have the capability of listing out the running processes on a system in a hierarchical or treelike format. A is a nonsense command to distract you, B, lsproc shows you a listing of the /proc directory, while E, gvfs-tree is for listing files in a directory structure.

You want to remove an option in the Bash Shell, which of the following would accomplish that? (Choose two.) a. shoptout b. undel c. set +o d. optdel e. unset

C, E. When setting options, you use the set -o option command; when unsetting the option, you either use unset option or set +o option.

Which of the following are a part of the systemd utilities or commands? (Choose all that apply.) a. servicectl b. haltd c. journald d. shutdownd e. systemctl

C, E. journald is one of the daemons that is a part of the systemd suite, and systemctl is a configuration utility that is also part of the systemd suite. The others are incorrect.

In your vim editor you entered 10J What did you just do? a. Moved 10 characters down b. Moved 10 words to the right c. Joined the next 10 lines together d. Jumped down 10 screens

C. A and b are incorrect because the j command joins lines rather than moving the cursor. C is correct because you are running the join command 10 times. D is incorrect because that would involve the Ctrl+F command.

From vim's Command mode you type the letter "i". What does this do? a. Begins editing the text at the end of the line b. Begins editing the text at the beginning of the line c. Begins editing the text at the current cursor position d. Inverts the case of the character at the current cursor position

C. A is incorrect because you edit the text at the end of the line with A . B is incorrect because that would be I as opposed to i . C is correct because the i command begins editing at the current place. D is incorrect because the ~ command inverts the case of the character.

You are using vi or another text editor to write a technical article for your organization's website, and the instructions from the site's editor are to keep the word count to 500 and the character count to less than 2,000. Which utility would you typically use to see these statistics for a given text file? a. count b. num c. wc d. pr e. ed

C. Answer C is correct because it is the only answer whose command shows a count of lines, words, and characters for a given file.

You execute a command that is supposed to end the execution of a process, and it is not successful. Which signal should you use with the kill command to guarantee the termination of the process? a. 15 b. 23 c. 9 d. 18 e. 27

C. Answer C is correct because the original signal must have been 15, and the signal guaranteed to terminate the process is the 9 signal.

You find a string in a shell script that contains the following command: cp /data/*.doc ~tarfoo What is the meaning of the characters ~tarfoo? a. A special function named tarfoo b. A directory named tarfoo in your home directory c. The tarfoo user's home directory d. The /data/tarfoo directory

C. Answer C is correct because the use of a ~ character in front of a string parses the /etc/passwd file for a username of that string. So in this case /home/tarfoo. Answer A is incorrect because functions begin with a left parentheses mark and contain commands. Answer B is incorrect because, for that string to denote a directory named tarfoo in your home directory, it would need to be ~/tarfoo. Answer D is incorrect because the /data directory is not mentioned in the command, nor is it implied by the ~ character.

You are currently in the /bbb directory and want to move the contents from the /ccc directory to this one. What is the shortest command that will accomplish this? a. mv /ccc/*.* . b. mv ../ccc/*.* . c. mv /ccc/* . d. mv /ccc/ /bbb

C. Answer C is correct because this command moves the contents from the source to the target and is the shortest command. Answer A is incorrect because this command doesn't work for copying the contents—*.* is incorrect syntax for the command. Answer B is incorrect because the same condition exists—the string *.* doesn't match all files or directories. Answer D is incorrect because it moves the /ccc directory to be a subdirectory of the /bbb subdirectory.

While attempting to execute a command utility with a long name, you cannot remember the last several characters. After typing what you are sure of, what character or characters can you typically type next to find out the rest of the command? a. ESC b. Ctrl-Enter c. Tab Tab d. \~

C. Answer C is correct because you are using Tab completion to complete the missing characters of the command. The rest are simple characters that do their appropriate actions, but not the one asked for.

As the sysadmin of a financial organization, you receive a real-time feed of information that your web team uses to display financial data to customers. You must keep a log of the data you receive as well as send that data on for further processing. Which of the following commands would you use to accomplish this? a. tac b. split c. tee d. branch e. culvert

C. Answer C is correct, as the tee command allows you to simultaneously log a stream of output to a file and send the identical stream on to be further processed. The other commands do not accomplish the described task.

You want to package up Fred's home directory on a USB stick to send with him as he's leaving your company. Which command is the best? Hurry, because there's cake! a. find /home/fred | tar -czf > /media/removable/fred.tar.gz b. tar -czf /home/fred > /media/removable/fred.tar.gz c. cd /home/; tar -cjf /media/removable/fred.tar.bz2 fred d. cd /home/fred tar -cjf /media/removable/fred.tar.bz2 *

C. C is correct because it creates a bzip2 compressed archive in the correct location, using files from /home/fred. A is not correct because tar does not accept a list of files as input, and with the -f parameter, it expects a filename. B is not correct because tar does not write to standard out if a filename is present, and the /home/fred passed will be interpreted as the output filename, not the files to archive. D is not correct because the command is run out of Fred's home directory and will result in all the files being part of the root when extracted. This is less optimal than the previous option.

You are trying to create a new series of nested directories: /a/b/c/d/. What is the fastest way to create this nested directory set? a. mkdir /a; mkdir /a/b; mkdir /a/b/c; mkdir /a/b/c/d b. mkdir /a/b/c/d c. mkdir -p /a/b/c/d d. md /a/b/c/d

C. C is correct because the -p option is needed to create the nested structure; otherwise, you get an error because the parent directories don't exist. A is not correct because it takes far more typing than doing it with the correct option. B is incorrect because the command will not create the parent directories. D is not correct because md is not a Unix command for making directories.

What does the command tar -tf archive.tar etc/pine.conf do? a. Makes a new archive called archive.tar containing /etc/pine.conf b. Adds etc/pine.conf to archive.tar c. Checks to see whether etc/pine.conf is inside the archive d. Extracts etc/pine.conf from archive.tar

C. C is correct because the -t option lists what's in the archive, and passing a filename only returns matches. A is not correct because the -c option creates an archive. B is not correct because -r adds to an archive. D is not correct because extraction is done with -x

How does a peripheral notify the CPU that there is an event that needs its attention? a. Contacts the CPU over an IO port b. Initiates a direct memory access channel c. Issues an interrupt request d. Modifies the program counter of the CPU to execute code on the device

C. C is correct because the IRQ is a signal to the processor. A is incorrect because IO ports are used by the CPU to talk to the device. B is not correct because pushing to memory does not involve the CPU. D is incorrect because devices don't execute code out of main memory.

The first block on the disk is called (the): a. GRUB b. Bootloader c. Master boot record d. Index

C. C is correct because the MBR is the first block on the disk where the first stage of the bootloader and the partition tables are located. A and B are incorrect because GRUB is a bootloader that uses the MBR. D is incorrect because the index is a component of the filesystem and is not stored on the MBR.

How would you install a package called foo-1.2.3.deb? a. yum install foo-1.2.3.deb b. rpm -i foo-1.2.3.deb c. dpkg --install foo-1.2.3.deb d. apt-get install foo-1.2.3.deb

C. C is correct because the dpkg tool is used to install local Debian packages. A and B are not correct because yum and rpm are for RPM-based systems. D is not correct because apt-get is for retrieving packages from remote repositories.

What is the purpose of running the ldd program? a. Rebuilding links to library files b. Creating a link to a library file c. Displaying a program's required libraries d. Reading a program's library capabilities

C. C is correct because the ldd program, when used with a program name as the argument, shows the necessary libraries for the program's functionality. Answer A is incorrect because ldconfig is used to rebuild links to library files, not ldd. Answer B is incorrect because creating a link to a library file is done by the ldconfig or ln command, not ldd. Answer D is incorrect because the ldd command does not read a program's library capabilities; instead it reads its dependencies.

Which of the following are not mass storage devices? a. Network attached drive b. Flash drive c. RAM d. CD-ROM

C. C is correct because the memory of the system is not persistent. All the others are persistent block devices.

How would you check for the presence of an installed package called foobar? a. rpm -qV foobar b. rpm -qVp foobar c. rpm -q foobar d. rpm -qp foobar

C. C is correct because the query (-q) checks the installed RPMs. A and B are not correct because there is no -V option to rpm query. D is not correct because the -p makes the operation work on a local file, not the rpm database.

How would you back up Rebecca's home directory using the best compression available? a. cd /home; tar -czf rebecca.tgz rebecca b. find ~rebecca | tar -cjf - > rebecca.tar.bz2 c. tar -cjf rebecca.tar.bz2 ~rebecca d. tar -xjf rebecca.tar.bz2 ~rebecca

C. C is correct because the tar command uses the create option with bzip2 compression, and the correct ordering of output filename and files to archive. A is incorrect because it uses gzip compression, which creates larger archives than does bzip2. B is incorrect because it uses a cpio style of archiving—tar does not accept the list of files over stdin. D is incorrect because it uses the extract option instead of the create option

You want to navigate from wherever you currently are on the system to the directory named .h, which is a subdirectory of the test directory in the currently logged-on user's home directory. Which of the following will do this? a. cd /home/{user}/test/.h b. cd ../home/$USER/test/.h c. cd ~/test/.h d. None of the above

C. C is the correct answer because it properly uses the ~ character, which represents the path of the currently logged-in user, followed by the /test and /.h directories. The others are incorrect syntax or distractors.

While creating a script to perform backups from one server to another, you want to ensure that if the first command isn't successful a second command will run. Which of the following when inserted between the two commands accomplishes this? a. & b. >> c. || d. ; e. @

C. The characters chosen are based on the exit code for the first command. Only the double ||'s will cause the second command to run based on the failure of the first command.

What is the result of the following command? $ find / -iname "*.txt" | file > sort a. A file named "file" in the current directory b. An error message that the files could not be found c. A file named "sort" in the current directory d. An endless loop on the system e. None of the above

C. The output of the find command is sent to the file command, which sends its output to be redirected into a file named "sort" in the current directory

. If you wanted to start a new line above the current cursor position, from Command mode, you would type: a. I (capital i) b. i (lowercase i) c. A (capital a) d. O (capital o)

D. A and B are incorrect because the i and I commands insert on the current line. Similarly, the A command appends on the current line, so C is incorrect. D is correct: The O command opens a new line before the current cursor position.

Which one of the following is not used for peripherals to communicate with the CPU and other peripherals? a. IO ports b. Direct memory access channels c. Interrupt requests d. TCP/IP ports

D. A is incorrect because IO ports are used to transfer data between the CPU and devices. B is incorrect because DMA allows a device to access memory directly. C is incorrect because IRQs are used by a device to ask for the CPU's attention. D is correct because TCP/IP ports are used to talk to other hosts, not peripherals

You are editing a shell script and want to look at a configuration file at the same time. Which vim command opens up /etc/group in a window to the right of your currently open script? a. :rsplit /etc/group b. You have to quit vim to do this. c. : split /etc/group d. : vsplit /etc/group

D. A is incorrect because rsplit is not a vim command. B is incorrect because you can do this within vim. C is incorrect because :split opens a window above, not to the right. Only D, the :vsplit , works here.

You want to copy 10 lines of text into a named buffer for later use. How do you do this? a. "A10yy b. 10Y'a c. 10Y"a d. a10yy

D. A is incorrect because the capital A appends the yanked text into the named buffer rather than replacing it. B and C are incorrect because they do the same operation 10 times on the same buffer rather than bringing 10 lines into the buffer. D is correct because it first indicates the operation is on a named buffer and then yanks 10 lines.

How would you query your Debian system to see whether the bulldozer package was installed? a. dpkg --info bulldozer b. apt-cache search bulldozer c. rpm -q bulldozer d. dpkg --list bulldozer

D. A is not correct because the --info option is used to examine a local Debian package. B is not correct because apt-cache is used to update the cache of remote packages. C is not correct because rpm is a tool for RPM-based systems. D is correct because the --list option searches the list of locally installed packages.

The first stage of the boot manager is typically stored in a. The BIOS b. /boot c. The partition table d. The master boot record

D. A is not correct because the BIOS is used to load the first stage of the boot manager. B is not correct because /boot contains the kernel and later stages. C is not correct because the partition table is just a table pointing at the locations of the various partitions. D is correct because the MBR is the first place the BIOS looks for a bootable block.

Which LVM component would be formatted with a filesystem and mounted? a. Physical volume b. Volume group c. Physical extent d. Logical volume

D. A is not correct because the PV is the disk itself. B is not correct because the VG pools all the PVs but still does not allocate disks to be used. C is not correct because PEs are just a unit of allocation. D is correct because the LV is comprised of multiple PEs allocated from the VG.

Which option to the mkdir and rmdir commands allows you to create a nested subdirectory tree? Example: /dir1/dir2/dir3/dir4 a. -c b. -n c. -d d. -p

D. Answer D is correct because the -p option allows mkdir and rmdir to create and remove parent directories. Answers A, B, and C are incorrect: These options are not available to the mkdir and rmdir commands.

Which of the following shell does not support inline editing of the command line? a. Bash b. Ash c. pdKsh d. csh

D. Answer D is correct because the C shell is the only one listed that doesn't offer inline command line editing.

You are currently in the directory /home1/user1/subdir1 and need to navigate to the directory /home12/user3. Which of the following commands will accomplish this? a. cd home12/user3 b. cd ~/user3 c. cd ../../home12/user3 d. cd ../../../home12/user3

D. Answer D is correct because the series of .. and forward slashes that precede the /home12/user3 string correctly navigate to that directory. Answer A is incorrect because the path is not absolute; it's relative and would work only from the root of the system. Answer B is incorrect because the ~/user3 string denotes a subdirectory of the current user's home directory named user3 and would have to be changed to ~user3 to work. Answer C is incorrect because the string does not go back to the root of the system; it only goes back up to the /home1 directory.

/dev/sda2 is a. A hard drive b. A logical volume c. A network adapter d. A partition on a hard drive

D. D is correct because /dev/sda2 refers to the second partition on the first hard drive. A is incorrect because sda would be the name of the hard drive. B is incorrect because sda refers to a physical disk, not a logical volume. C is not correct because network adapters are named differently.

GRUB2's configuration file is called: a. /etc/grub2/menu.lst b. /etc/grub2/grub.conf c. /etc/grub2/grub2.conf d. /etc/grub2/grub.cfg

D. D is correct because grub.cfg is the new name of the configuration file. A and B are incorrect because they are the name of the configuration for GRUB Legacy. C is incorrect because that file is not use

Which of the following directories should be on the same partition as the root? a. /boot b. /usr c. /home d. /sbin

D. D is correct because items in /sbin are needed to boot the system, and therefore must be on the root partition. All the remaining options can be on their own filesystem because they are not essential to booting

What does the lsdev command do? a. Shows PCI devices b. Shows IO ports c. Shows DMA channels d. All of the above

D. D is correct because lsdev shows information about system resources including devices, IO ports, and DMA channels.

Files that change often should go under: a. /usr b. /proc c. /root d. /var

D. D is correct because the /var directory is reserved for data that changes. A is not correct because /usr is for sharable, read-only, data. B is not correct because /proc exposes kernel variables and status through the procfs pseudofilesystem. C is not correct because /root is for the root user's home directory.

After updating your list of remote Debian repository files you should run: a. dpkg update b. apt-cache fetch c. apt-cache update d. apt-get update

D. D is correct because the apt-get update command is used to update the list of remote repositories and their contents. A is not correct because dpkg does not deal with repositories. B and C are not correct because apt-cache is only used for searching the cache.

An RPM package's long name does not contain: a. Name of the package b. Version c. Distribution version d. Architecture

D. D is correct because the architecture, such as x86_64, is not part of the package name. The long name contains the name of the package, version, and the distribution version. For example, kernel-3.17.7-300.fc21 is a long name.

You need to remove all instances of the package woohoo, regardless of the version, with a single command. Which of the following accomplishes this task? (Choose all that apply.) a. rpm -e woohoo* b. rpm -ea woohoo c. rpm -a woohoo --remove d. rpm -e woohoo --allmatches

D. D is correct because the command is the only one that removes all instances of the package woohoo with a single command. Answer A is incorrect because asterisks do not invoke multiple removals and can be used only in installation situations for multiple packages on disk. Answer B is incorrect because the -ea option does not allow for multiple removals and works only in queries. Answer C is incorrect because there is no --remove option for the rpm command.

How would you see whether you have installed the iceweasel package? a. apt-cache search iceweasel b. apt-get --list iceweasel c. dpkg --info iceweasel d. dpkg --list iceweasel

D. D is correct because the dpkg --list command lists installed packages. A is incorrect because that command searches remote repositories for the packages. B is incorrect because apt-get does not search local packages. C is not correct because the --info command reads a local package and gives information about it.

Which environment variable is used to provide additional library support and is also considered to be a security risk? a. LIBC_EXTRA b. LD_SO_ETC c. LD_LIBRARY d. LD_LIBRARY_PATH

D. D is correct because the dynamic linker will use the LD_LIBRARY_PATH environment variable to load extra libraries if the variable is present. None of the other options refers to a variable that's in use.

In the Logical Volume Manager, the hard drive partitions themselves are a. Logical volumes b. Volume groups c. Physical extents d. Physical volumes

D. D is correct because the hard drives are added as PVs. A is incorrect because the LV is the target of a filesystem and is mounted. B is incorrect because the volume groups are a collection of physical volumes. C is incorrect because the PVs are carved up into PEs.

What command would be used to update the date on a file? a. tar b. file c. date d. touch

D. D is correct because the touch command updates dates on files. A is not correct because tar is for archiving files. B is not correct because file is for determining what a file is. C is not correct because that queries and sets the system date.

What subsystem manages entries under /dev? a. systemd b. init c. procfs d. udev

D. D is correct because the udev subsystem monitors for device changes and makes the appropriate changes in /dev. A is incorrect because systemd is used for managing processes, though udevd can be a component of systemd. B is incorrect because init is used for managing processes. C is incorrect because procfs is used for exposing system information to the user.

You know that you have multiple copies of the doit command on your system. How do you find which one you will run if you type doit at the command line? a. whereis doit b. locate doit c. find doit d. which doit

D. D is correct because which looks at your shell aliases and search path to find which command will be run when you type a particular command. A is not correct because whereis returns multiple matches and doesn't tell you which of multiple options will be run. B is not correct because it finds anything with doit in the name. C is not correct because find searches for any file and the command is not a correct use of find.

If you wanted to remove all running instances of the foobar application, which of the following commands would accomplish this? a. pskill foobar b. halt foobar c. kill foobar* d. killall foobar e. pstree foobar

D. Killing more than one process by name is done via the killall command. halt is a command used to bring the system to a halted state, pskill doesn't exist, kill just kills a single instance of foobar, likely the first one found in the process table, and pstree shows the treelike hierarchy of processes and alone does not kill a process.

Which of the following files are executed upon a user's terminal login? a. /etc/profile b. ~/.profile c. ~/.bashrc d. None of the above

D. None of the files listed are "executed" during the user's login. They are instead "sourced," which loads their settings and variables into the current version of the shell. The files are relatively meaningless to the question, as it is the method of executing versus sourcing that is being tested.

When you run the jobs command, you see the following output: linux-8z04:~ # jobs [1]- Stopped top [2]+ Stopped vim [3] Running strace top & If you were to run the fg command at this time, what would happen? a. The top command would be brought to the foreground. b. The strace command would be brought to the foreground. c. Nothing. d. The vim command would be brought to the foreground.

D. The fg command acts on the last used or last suspended, notated by the + sign after the [2]. The other jobs must be interacted with by their job #.

You want to replace the words "Linux Tarballs" with "Linus Torvalds" in a given text file. Which of the following commands would you most likely use to execute a search and replace on these words? a. ex b. ed c. edlin d. tr e. sed

E. All the answers are functional commands, but most are simple editors or—in edlin's case a DOS command—and don't work on Linux. The tr command could possibly be used to replace the words specified, but it would take a great deal of work to use it, as tr replaces single characters with other characters. Only the sed command is designed to easily replace whole words as words.

Read the following phrase: _________ is the process of reading the contents of a configuration script and loading the results of the commands in the current shell environment. Which of the following words correctly completes the above statement? a. Substituting b. Transliterating c. Loading d. Parsing e. Sourcing

E. Answer E is correct because none of the others correctly completes the statement. Sourcing is where instead of instantiating a new lower-level shell, the commands and variables in the script are loaded into the current shell's environment.

1. Which command shows you a frequently updated screen display of the running processes on your system? a. threads b. procinfo c. mem d. free e. top

E. Answer E is correct because top is the only command listed that does what is being asked about.

The jobs command can only be used on systems that run in text mode or via the ssh command. It cannot be used in graphical terminal sessions such as gnome-terminal or xterm. True or False? a. True b. False

False. The jobs command can run and work properly inside any bash shell instance.

Write on the following line the exact text to specify at the GRUB prompt to cause a default install of a Linux distribution to boot directly to runlevel 2 after system initialization:

The correct answer is 2. Entering the character 2 at the boot prompt causes the majority of distributions to then subsequently enter Runlevel 2. The same would be true for the various other configured numerals and their corresponding runlevels.


Related study sets

TTC NUR205 MedSurgII: Chapter 25 PrepU (Hepatic & Biliary Disorders)

View Set

General Insurance Practice Questions

View Set

Midterm Environmental Sampling and Analysis

View Set

Mastering Assignment 7 - Exercise 8

View Set