THE FOLLOWING EXAM OBJECTIVES ARE COVERED IN THIS CHAPTER:
Assume that you’re using the Bash shell and want to prevent output redirects from accidentally overwriting existing files. Which command and option can be used to invoke this behavior? What command can be used to view the current settings for your environment when using Bash? Which command is used to access documentation on the Linux computer for a given command? Which of the following commands will print various information about the kernel and architecture, along with other details? When using sed for a substitution operation, which option must be included so that the substitution applies to the entire line rather than just the first instance? Which option for the wc command prints the number of lines given as input? What is the default number of lines printed by the head and tail commands, respectively? You are attempting to use rmdir to remove a directory, but there are still multiple files and other directories contained within it. Assuming that you’re sure you want to remove the directory and all of its contents, what is the command and arguments to remove the directory and all of its contents? Which command will find directories with names beginning with 2014 located beneath the current directory? Which of the following commands will provide the usernames in a sorted list gathered from the /etc/passwd file? Which options to ls will produce output, including hidden (dot) files, in a list that is ordered such that the newest files are at the end of the output? What will be the result if the touch command is executed on a file that already exists? Which option to both mv and cp will cause the command to prompt before overwriting files that already exist? Which of the following commands will send the contents of /etc/passwd to both STDOUT and to a file called passwordfile? The current hierarchy on the server contains a directory called /usr/local. You need to create additional directories below that are called /usr/local/test/october. Which command will accomplish this task? Which option to the cp command will copy directories in a recursive manner? You have received a file that does not have a file extension. Which command can you run to help determine what type of file it might be? Which command will create an image of the /dev/sda1 disk partition and place that image into a file called output.img? What is the default delimiter used by the cut command? Which of the following will unzip and extract the contents of a file that has been tarred and gzipped? What command is used to bring a command to foreground processing after it has been backgrounded with an &? You need to write a script that gathers all of the process IDs for all instances of Apache running on the system. Which of the following commands will accomplish this task? Which of the following command lines would monitor a single process called nagios in a continuous manner? Users are reporting that various programs are crashing on the server. By examining logs, you see that certain processes are reporting out-of-memory conditions. Which command can you use to see the overall memory usage, including available swap space? You are using the Vi editor for changing a file and need to exit. You receive a notice indicating "No write since last change". Assuming you want to save your work, which of the following commands will save your work and exit Vi? What option is used to change the number of lines of output for the head and tail commands? Which command can be used to determine the current load average along with information on the amount of time since the last boot of the system? You need to start a long-running process that requires a terminal and foreground processing. However, you cannot leave your terminal window open due to security restrictions. Which command will enable you to start the process and return at a later time to continue the session? You have attempted to stop a process using its service command and also using the kill command. Which signal can be sent to the process using the kill command in order to force the process to end? When working in the Bash shell, you need to redirect both STDOUT and STDERR. Which of the following commands will redirect both STDOUT and STDERR? Which command can be run to determine the default priority for processes spawned by the current user? Which of the following egrep commands will examine /etc/passwd to find users who are using either /bin/bash or /usr/bin/zsh for their shell environment? Which option to the man command accesses a different level of documentation, for example, system call documentation? When editing with Vi, which command changes to insert mode and opens a new line below the current cursor location? Which kill signal can be sent in order to restart a process? Which of the following commands will display the last 50 lines of your command history when using Bash, including commands from the current session? You have backgrounded several tasks using &. Which command can be used to view the current list of running tasks that have been backgrounded? Which of the following commands searches each user’s .bash_history file to determine whether the user has invoked the sudo command? Which command will watch the Apache log at /var/log/httpd/access.log and continually scroll as new log entries are created? You are debugging a configuration file and the daemon indicates there is a problem on line 932. Which of the following commands will prepend line numbers onto the file? You receive a file with an .lzma extension. Which command can you use to decompress this file? Which find command will locate files within the current directory that have been modified within the last 24 hours? Which command will move all files with a .txt extension to the /tmp directory? Which command prints your current directory? Assume that you have a file called zips.txt that contains several postal ZIP codes and you need to determine how many unique ZIP codes there are in the file. Which of the following commands can be used for that purpose? When using Bash, how would you execute the last command starting with a certain string, even if that command was not the last one that you typed? Which command can be used to kill all processes by using their name? You’re working with a large file in Vi and need to search for instances of a string earlier in the file. Which key will search backward in the file? You need to declare a local environment variable that will then be available to child processes. Which of the following commands accomplishes this task? You are creating a Bash shell script and need to output the current script name to the current terminal. Which of the following commands accomplishes this task? You have downloaded a file with a .gz extension. What is the most likely command that you will use to decompress this file? You need to remove a single file from a directory if it exists but would like to be prompted for confirmation before doing so. Which option to the rm command causes the command to prompt for confirmation? You need to determine files that are sized above 1GB. Which of the following commands accomplishes this task? Which option to cpio lists the files as it is operating on them? Which command is used to send contents of a bzip2 archive to STDOUT? You are attempting to find more information about the jobs command; however, an Internet search was not particularly helpful because there are so many Linux-related jobs available. Additionally, you attempted to view the man page for the jobs command but it was not available. Which man page should you use to view more information on jobs? You need to start a process that cannot be sent or will not accept a SIGHUP signal. Which command should be used to start the process? You need to run a command periodically and examine its output in real time. Which of the following commands enables this scenario? You would like to tail a log file to watch entries as they are being added to the log file. In addition, you would also like to work within the same terminal window or SSH (Secure Shell) session to add entries to another file at the same time. Which command can be used to create two sessions within the same terminal window? You need to kill several processes at once. Rather than writing a complex ps-based command to do so, you can use which other command? You are using pgrep to find the process IDs for a given command. However, several other commands seem to also appear. Which option to pgrep enables matching against the full path of the process? You need to determine the exact command that will be run based on your current environment settings. Which command is used for this purpose? An environment variable has been set on login, but you need to remove that variable temporarily for the current session. Which shell built-in command can be used for this purpose? You cannot find the man page of a command but you know the command exists. For example, the alias command exists but there is no man page for it. Which of the following commands could you execute to determine what type of command alias is? Which type of quotes are used so that variables are interpolated within a Bash shell script? Which of the following pagers includes the ability to search backward and forward as well as move backward and forward, line-by-line, and page-by-page? You have a specialized need for outputting a file in octal format. Which command or series of commands can be used for this purpose? Which option to sha256sum causes the file to be read in binary mode? When operating in command mode, which keys enable you to move the cursor in the Vi editor? Which options to xz are functionally equivalent to the xzcat program? Which environment variable is used to control the default text editor used on a Linux system? You need to examine the seventh section of the manual page for regular expressions, or regex, on a Linux system. Which command displays the seventh section of the manual? Which of the following commands reprioritizes an already running process? The fgrep command is equivalent to running the grep command with which option? Which of the following regular expressions would find the pattern Steve or steve in a file when used with grep? Which of the following commands shows the currently running processes and their resource usage in real time, updated every few seconds? You have been asked to create a compressed file that will be readable by those with other operating systems. Which tool can you use for this purpose? You need to match files that begin with 201, as in 2017, 2018, 2019. Which of the following wildcard specifications can be used? You need to break a large file into smaller pieces. Which command can be used for this purpose? When examining the output from top, you see that a process has a value in the PR column of 20. To what does the PR column refer? You need to cut or remove eight lines from a file while editing with Vi. Which combination should be used for this purpose? Which command is used in order to decompress a file that has been compressed with xz? Which of the following commands uses 128-bit message digests? You have several files that need to be combined, with a line from each file being appended onto a single line. Which command can be used for this purpose? You need to run a command that is not inside your current path. Which of the following represents the typical method for doing so? Which signal is used by default by the pkill command? You are working with the jobs built-in command to display jobs. You would like to see only running jobs. Which option to the jobs built-in command will display only running jobs? Which option to the bunzip2 command sends output to STDOUT, much like the bzcat command?