Book: LPI Linux Certification in a Nutshell Section: Chapter 9. Exam 101 Practice Test
20. ### 9.1 Questions What section of the online user's manual and command reference holds administrative (not user) commands? Select one. Section 1 Section 2 Section 8 Section n Section s What two commands will display the status of processes on a Linux system? Select one. ls and df ps and top ps and df df and top du and df What does the device file /dev/hdb6 represent? Select one. An extended partition on a SCSI disk drive A logical partition on a SCSI disk drive An extended partition on an IDE disk drive A primary partition on an IDE disk drive A logical partition on an IDE disk drive Which command will display the last lines of text file file1? Select one. `head -b` file1 `head --bottom` file1 `head -v` file1 `tail` file1 `tail -n 1` file1 In the bash shell, entering the !! command has the same effect as which one of the following? Ctrl-P and Enter Ctrl-N and Enter Ctrl-U and Enter `!-2` `!2` Which of the following commands can be used to check an ext2 filesystem? Select all that apply. `fsck -ext2 /dev/hda5` `fsck /dev/hda5` `e2fsck /dev/hda5` `fsck.ext2 /dev/hda5` `fsck.linux /dev/hda5` Name the command that displays pages from the online user's manual and command reference. In response to the df command, the system reports a `Use%` of `98%` for the filesystem mounted on /home. Which one of the following best describes the significance of this information? Files on /home are consuming 98 percent of the physical disk. File read/write activity on /home are consuming 98 percent of system I/O capacity. Files on /home are consuming 98 percent of the /home filesystem. Inodes on /home are nearly exhausted. Inodes on /home are 98 percent free. Of the following directories, which one is the most important to back up on a routine basis? /var /tmp /usr /root /etc Carolyn has a text file named guest_list containing 12 lines. She executes the following command. What is the result? Select one. `#` `split` `- 4 guest_list gl` The first four columns in the text are written to new files glaa, glab, glac, and glad. The first four columns in the text are written to new files aagl, abgl, acgl, and adgl. The lines of guest_list are evenly divided among new files glaa, glab, glac, and glad. The lines of guest_list are evenly divided among new files glaa, glab, and glac. The lines of guest_list are evenly divided among new files aagl, abgl, and acgl. Which one of the following commands would be best suited to mount a CD-ROM containing a Linux distribution, without depending on any configuration files? `mount /dev/cdrom /dev/hdc` `mount -f linux /dev/hdc /mnt/cdrom` `mount -t iso9660 /dev/cdrom /mnt/cdrom` `mount -t linux /dev/cdrom /mnt/cdrom` `mount -t iso9660 /mnt/cdrom /dev/cdrom` An ext2 filesystem is configured with user quotas enabled. The soft limit is set at 100 MB per user, the hard limit is set at 110 MB per user, and the grace period is seven days. User bsmith already owns 90 MB of the data stored on the filesystem. What happens when bsmith writes a new file of size 30 MB? Select one. The write will fail, but the superuser can recover the entire file within seven days. The write will fail, and the file will be truncated permanently. The write will succeed, but the file will be truncated permanently. The write will succeed, but the file will be available for only seven days. The write will succeed, but the file will be truncated in seven days. User jdoe, a member of the finance group, owns a text file with group owner finance and mode 0077. Which statements are true regarding access to view the contents of the file, assuming the directory that contains it has mode 0777 ? Select all that apply. jdoe can view the file's contents. jdoe can first change the protection mode of the file and then view the file's contents. root cannot view the file's contents. Everyone in the finance group can view the file's contents except jdoe. Everyone in the finance group can view the file's contents including jdoe. Which of the following commands displays the comments from a bash script? Select all that apply. `find "^#" /etc/rc.d/rc.local` `sed '/^#/ !d' /etc/rc.d/init.d/httpd` `grep ^# /etc/rc.d/init.d/httpd` `grep ^# /etc/passwd` `locate "^#" /etc/skel/.bashrc` State the syntax to direct the standard output of cmd1 directly into the standard input of cmd2. Which one of the following answers creates an environment variable `VAR1`, present in the environment of a bash child process? `VAR1="fail" ; export VAR1` `VAR1="fail" \ export VAR1` `VAR1="fail"` `set VAR1="fail" ; enable VAR1` `export VAR1 \ VAR1="fail"` Name the full path and name of the file that holds most of the information on system user groups. Which of the following directories must be part of the root filesystem? Select all that apply. /etc /home /lib /usr /root Name the facility that independently executes commands on a periodic basis for multiple users. Alex is currently working in a directory containing only one file, Afile1. What is displayed after the following commands are entered in bash? Select one.
        # MYVAR=ls
        # echo $MYVAR "$MYVAR" '$MYVAR' `$MYVAR`
24. Afile1 Afile1 Afile1 Afile1 `ls` Afile1 Afile1 Afile1 `ls` `ls` Afile1 Afile1 `ls ls`$MYVAR Afile1 `ls ls ls` $MYVAR What does the & character do when placed at the end of a command? Select one. It allows another command to be entered on the same line. It causes the process to be stopped. It restarts a stopped process. It causes the process to be placed into the foreground. It causes the process to be placed into the background. Which one of the following commands could be used to change all uppercase characters to lowercase in the middle of a pipe? `grep` `egrep` `wc` `tr` `pr` What is the PID of init? Select one. 0 1 2 undefined unknown Which one of the following outcomes results from the following command?
        # chmod g+s /home/software
25. The SUID bit will be set for /home/software. The SGID bit will be set for /home/software, preventing access by those not a member of the software group. The SGID bit will be set for /home/software, in order to keep group membership of the directory consistent for all files created. The sticky bit will be set for /home/software. The sticky bit will be applied to all files in /home/software. Which one of the following commands is equivalent to the following command for user jdoe whose home directory is /home/jdoe ?
        # chmod 754 ~/file1
30. `#` `chmod u=rwx,g=rx,o=r /home/jdoe/file1` `#` `chmod ugo=rwx ~/file1` `#` `chmod u=7,g=5,o=4 ~/file1` `#` `chmod 754 \home\jdoe\file1` `#` `chmod 754 /usr/jdoe/file1` What command and single required option creates a symbolic link in a Linux ext2 filesystem? What command can display the contents of a binary file in a readable hexadecimal form? Select one. `xd` `hd` `od` `Xd` `dump` Which one of the following commands copies files with the .txt extension from /dir1 into /dir2, while preserving file attributes such as dates? `mv --copy /dir1/*.txt /dir2` `mv /dir1/*.txt /dir2` `cp -k /dir1/*.txt /dir2` `cp -p /dir1/*.txt /dir2` `cp -p /dir2 < /dir1/*.txt` Which one of the following file globs matches "Linux" and "linux," but not "linux.com" and not "TurboLinux"? `[L/linux]` `?inux` `\L\linux` `[Ll]inux` `[Ll]inux?` A process with PID 4077 is misbehaving on your system. As superuser, you enter the following command:
        # kill 4077
34. However, nothing changes as a result. What can you do to terminate the process? Select one. # `kill -9 4077` # `kill -1 4077` # `kill +9 4077` # `kill 4078` # `kill --die 4077` Which one of the following key sequences is used to put a noninteractive text-mode program that is attached to the terminal into the background to allow it to continue processing? Ctrl-C Ctrl-B Ctrl-B and then enter the bg command Ctrl-Z Ctrl-Z and then enter the bg command What basic command is used to create hard disk partitions? With a umask of 027, how is the initial mode set for a newly created file? Select one. `0750` `0640` `0027` `1027` `1640` Consider the following script, stored in a file with proper modes for execution:
        #!/bin/bash
        for $v1 in a1 a2
        do
        echo $v1
        done
38. Which one of the following best represents the output produced on a terminal by this script? `in` `a1` `a2` `a1` `a2` `$v1` `$v1` `$v1` No output is produced, but the script executes correctly. No output is produced, because the script has an error. Which one of the following commands verbosely extracts files from a tar archive on a magnetic tape device? `tar cvf /dev/st0` `tar cvf /dev/ttyS0` `tar xvf /dev/st0` `tar xvf /dev/ttyS0` `tar rvf /dev/st0` Alex wants to protect himself from inadvertently overwriting files when copying them, so he wants to alias cp to prevent overwrite. How should he go about this? Select one. Put `alias cp='cp` `-i'` in ~/.bashrc. Put `alias cp='cp` `-i'` in ~/.bash_profile. Put `alias cp='cp` `-p'` in ~/.bashrc. Put `alias cp='cp` `-p'` in ~/.bash_profile. Put `alias cp = `cp` `-I`` in ~/.bashrc. Which one of the following utilities outputs a text file with line numbers along the left margin? `tar` `wc` `tr` `nl` `ln` The following line comes from an /etc/fstab file. Which of the statements is accurate given the contents of this line? Choose all that apply.
        /dev/fd0   /mnt/fd0   vfat   noauto,users  0 0
39. Users are prohibited from mounting and unmounting the filesystem. Users are permitted to mount and unmount the filesystem. The filesystem will be mounted on mount point /dev/fd0. The filesystem is expected to be a Linux native filesystem. The filesystem is on a floppy disk. Which one of the following is an accurate statement regarding this regular expression?
        [^1-8A-Za-z]
40. It matches all letters and numbers. It matches all letters and numbers except 9. It matches all letters and numbers except 9 and 0, but only at the beginning of a line. It matches 9, 0, and other nonletter and nonnumber characters. It matches characters other than letters or numbers. Monica consults the /etc/passwd file expecting to find encrypted passwords for all of the users on her system. She sees the following:
        jdoe:x:500:500::/home/jdoe:/bin/bash
        bsmith:x:501:501::/home/bsmith:/bin/tcsh
57. Which of the following is true? Select one. Accounts jdoe and bsmith have no passwords. Accounts jdoe and bsmith are disabled. The passwords are in /etc/passwd- The passwords are in /etc/shadow The passwords are in /etc/shadow- Name the briefest form of the command to initiate a change to runlevel 5. Where does The Linux System Administrators' Guide originate? Select one. Red Hat Software, Inc. O'Reilly and Associates, Inc. The Free Software Foundation. The Linux Documentation Project. Usenet newsgroup comp.os.linux. What does the "sticky bit" do? Select one. It prevents files from being deleted by anyone. It marks files for deletion. It prevents files from being deleted by nonowners except root. It prevents files from being deleted by nonowners including root. It marks files for archive. What variable holds the list of directories searched by the shell to find executable programs? Which one of the following commands displays the full path and name of the executable program myprog that the shell would execute if myprog were entered as a command? `#` `which myprog` `#` `find -name myprog` `#` `find myprog` `#` `locate myprog` `#` `apropos myprog` Alex executes the runlevel command and gets `3 5` as the response. What does this tell Alex? Select one. The system is in runlevel `3` and the default is `5`. The system is in runlevel `3` and will next go to runlevel `5`. The system was in runlevel `3` and is now in runlevel `5`. The system does not have a default runlevel. The system default runlevel is improperly configured. Which one of these files determines how messages are stored using syslogd? /etc/sysconfig/logger.conf /etc/syslog.conf /etc/syslogd.conf /etc/conf.syslog /etc/conf.syslogd What does the pr command do? Select one. It prints files to the default printer. It displays a list of active processes. It modifies the execution priority of a process. It paginates text files. It modifies the command-line prompt. Dave has a Linux system with an interrupt conflict caused by his 3C509 network card. Dave's kernel is fully modular. How could Dave instruct the system to use interrupt 11 for his network adapter? Select one. Enter `linux eth0=irq11` at the LILO boot loader prompt. Enter `linux 3c509=irq11` at the LILO boot loader prompt. Add `options 3c509 irq=11` to /etc/conf.modules. Add `options irq=11 3c509` to /etc/conf.modules. Add `ifup` `-irq 11 eth0` to /etc/rc.d/rc.sysinit. What is contained in directory /sbin? Select the single best answer. Commands needed in the event of a system emergency of interest to all system users. Commands of interest to all system users. Commands needed in the event of a system emergency of interest mainly to the administrator. Commands of interest mainly to the administrator. Libraries needed in the event of an emergency. What ext2 filesystem attribute allows a process to take on the ownership of the executable file's owner? What is appended to the beginning of a command line in order to modify the execution priority of the resulting process? How are the cat and tac commands related? Select one. cat displays files and tac does the same but in reverse order. cat concatenates files while tac splits a file into pieces. cat creates file catalogs while tac displays the catalogs. The two commands are links to the same executable. There is no relation or similarity between cat and tac. With regard to the use of regular expressions to match text in a file, describe a metacharacter. Select one. They are standard text characters used in the regular expression. They are special control characters used in the regular expression. They are used to display results after using a regular expression. They are used by the shell to display graphics. Metacharacters aren't used in regular expressions. How many IDE devices can be installed and simultaneously used in a typical Intel-based system? Select one. 1 2 3 4 5 Which one of the following would be a consequence of a filesystem running out of inodes? More inodes would be automatically created in the filesystem. Quotas would become disabled on the filesystem. The filesystem would be corrupted. The filesystem would be marked read-only. No writes would be possible on the filesystem until existing files were deleted. Consider the following line of console output, excerpted from among other lines of output. Which one of the commands produced it?
        /dev/hda8      1.9G  559M  1.2G  30% /home
`du -s` `du -k` `df -h` `df -k` `df -m` How can you configure your system at shutdown time to suppress fsck upon the next boot? Select one. `init 6` `init --suppress 6` `shutdown -h` `shutdown -f` `shutdown -F` Which one of the following is true about the LILO boot loader? It can start the Windows NT Loader. It is started using the lilo command. It is the only boot loader available for Linux. It can start multiple Linux kernels, but no foreign operating systems. It resides entirely in the boot sector. Which one of the following statements correctly describes the `>` and `>>` symbols in the context of the bash shell? `>` appends standard output to an existing file, and `>>` writes standard output to a new file. `>` writes standard output to a new file, and `>>` appends standard output to an existing file. `>` writes standard error to a new file, and `>>` appends standard error to an existing file. `>` pipes standard output to a new file, and `>>` pipes standard output to an existing file. `>` pipes standard output to an existing file and `>>` pipes standard error to a new file.