# Chapter 1

**1.** **C** GUI programs create menus with the help of a library that's designed for this purpose; this is not a function of the Linux kernel.
Thus, option C is a non-kernel function, and is correct.
The kernel allocates memory and CPU time, and it also controls access to disk and network hardware, so options A, B, D, and E all describe kernel functions and are incorrect.
**2.** **A** Android is used on cell phones and other small portable devices, and as such it qualifies as an embedded OS, making option A correct.
SUSE, CentOS, Debian, and Fedora are all examples of distributions intended mainly for use on desktop, laptop, and server computers; these do not qualify as embedded OSs, so options B, C, D, and E are all incorrect.
**3.** **B** Linux's GUI is based on the X Window System.
Although OS X provides an X implementation, its primary GUI is Apple's proprietary product.
Thus, option B is correct.
Option A is incorrect because both Linux and OS X can run most GNU programs.
Option C is incorrect because Linux can run on both Apple Macintosh and commodity PC hardware.
Option D is incorrect because OS X includes many BSD utilities in its standard form.
Furthermore, most Linux distributions use GNU utilities rather than their BSD equivalents, although you can use BSD utilities in Linux if you prefer.
Option E is incorrect because both Linux and OS X support text-mode commands, although OS X makes it hard to use these commands in anything but its GUI Terminal application.
**4.** **False** The Linux kernel was intended as a "from-scratch" project to create a new Unix-like kernel.
Although there are influences and similarities, the two kernels are largely independent of each other.
**5.** **False** Programs known as **terminals** enable entry of text-mode commands once you've logged into Linux in GUI mode.
You can also switch between multiple **virtual terminals** by using keystrokes such as Ctrl+Alt+F2.
**6.** **True** CentOS's release cycle is approximately 2 years, which is long by the standards of Linux distributions, some of which have release cycles of just 6 months.
**7.** login:
**8.** viruses
**9.** alpha and beta

# Chapter 2

**1.** **A** Linux's multitasking is preemptive, meaning that the kernel can give CPU time to any process as it sees fit, potentially interrupting (or preempting) other processes.
Thus, option A is correct.
Linux is a multi-user OS, but **multi-user** is not a type of multitasking, so option B is incorrect.
In a co-operative multitasking OS, applications must voluntarily give up CPU time to each other.
Although Linux programs can signal the OS that they don't need CPU time, Linux doesn't rely exclusively on this method, so option C is incorrect.
A single-tasking OS can run just one process at a time, so option D is incorrect.
A single-user OS can support just one user at a time.
Such OSs can be either single-tasking or multitasking, and in the latter case, could use either co-operative or preemptive multitasking.
Thus, option E is incorrect.
**2.** **C** The open source definition includes ten points, one of which is that users may modify the original code and redistribute the altered version.
Thus, option C is correct.
Although as a practical matter all open source software is available at no charge, nothing in the open source definition forbids selling it.
In practice, many organizations and individuals **do** sell open source software, either as a convenience (such as DVD-ROMs with Linux distributions for those with slow Internet connections) or in value-added arrangements (such as Red Hat Enterprise Linux, which bundles open source software with a support contract).
Thus, option A is incorrect.
The open source definition requires distribution of source code, but does not require distribution of binaries.
Thus, option B is incorrect.
Although some open source software, including the Linux kernel, began life in academia, this is not true of all open source software, so option D is incorrect.
The open source definition does not specify that either an interpreted or a compiled language be used, and in fact both have been used to write open source software, so option E is incorrect.
**3.** **D** Evolution is an e-mail reader program.
Such programs are common on desktop computers, so option D is correct.
Apache is a Web server, Postfix is an e-mail server, and the Berkeley Internet Name Domain (BIND) is a Domain Name System (DNS) server.
Such servers are much less likely to be installed on desktop computers than are client programs such as Evolution, so options A, B, and E are all incorrect.
Android is the name of a Linux distribution for cell phones and tablets, so option C is incorrect.

**4.** **False** VMS was an OS for minicomputers and mainframes when Linux was created.
On x86 computers, DOS was the dominant OS in 1991.

**5.** **True** Digital video recorders (DVRs) are specialized computers for recording TV shows.
Some commercial DVRs, such as TiVos, run Linux natively.
DVR software for standard PCs, such as MythTV, which runs under Linux, also exists.
**6.** **True** Most server programs do not require the X Window System (X) GUI, so server computer administrators often disable X or even remove it entirely to save disk space and memory and to minimize the risk of security problems.
**7.** monolithic 
**8.** shareware 
**9.** desktop

# Chapter 3

**1.** **C** The open source definition specifies that users be able to distribute changes, but it doesn't require that the license require distribution under the terms of the same license.
Thus, option C does not describe an open source requirement, and so is the correct answer.
Options A, B, D, and E all paraphrase actual open source license term requirements.
**2.** **B** Some distributions (particularly "Enterprise" versions that
are sold for money) include software that is neither open source nor even freely redistributable, so option B is correct.
Distributions as a whole use many licenses, not just one, so option A is incorrect.
The MIT license is one of several open source licenses; such software is not an impediment to copying a distribution, so option C is incorrect.
Although some distributions, such as Debian, aim to make their main systems fully open source compliant, not all do this, so option D is incorrect.
Likewise, not all distributions are composed completely of free software as the FSF uses the term.
**3.** **E** Option E paraphrases one of the four key points in the FSF's philosophy, and so is correct.
Contrary to option A, the FSF's philosophy does not mandate use of the GPL, much less its most recent version, although the GPL is the FSF's preferred license.
Option B is contrary to the FSF's position, which is that free software should remain free; however, this option is compatible with the OSI's philosophy.
Although the FSF advocates free software and free OSs, option C is not an explicit part of their philosophy and so is incorrect.
Although the FSF wants to see a world dominated by free software, they do **not** advocate software piracy, so option D is incorrect.
**4.** **True** Courts and laws explicitly recognize computer software as being creative works that are governed by copyright law.
In some countries, patent laws also apply to software, although this is not globally true.
**5.** **True** This principle is at the heart of both the free software and the open source software definitions.
 **6.** **False** Hardware vendors often do release open source drivers for their products.
One caveat is that the release of open source drivers necessarily renders some programming interfaces for the hardware open, which some hardware vendors are reluctant to do.
**7.** LGPL (or Lesser GPL, or Lesser General Public License)
**8.** Creative Commons
**9.** copyleft

# Chapter 4

**1.** **B, C, E** GNOME, KDE, and Xfce are all Linux desktop environments, so options B, C, and E are all correct.
(Others include LXDE and Unity.) The GIMP Tool Kit (GTK+) is a GUI programming library.
Although GNOME and Xfce are both built atop GTK+, it's not a desktop environment, so option A is incorrect.
Evolution is a Linux e-mail client, not a desktop environment, so option D is incorrect.
**2.** **B** The Network File System (NFS) was designed for exactly the task described in the question (although for Unix generally, not just Linux), so option B is correct.
The Simple Mail Transfer Protocol (SMTP) is a protocol that enables one computer to send e-mail messages to another computer, so it's a poor choice for achieving the stated goal, and option A is incorrect.
The PHP: Hypertext Processor (PHP) language is used to generate dynamic content for Web pages, so option C is incorrect.
The Domain Name System (DNS) is a protocol for delivering the mappings between hostnames and IP addresses to computers, so it won't easily achieve the stated goals, making option D incorrect.
The Dynamic Host Configuration Protocol (DHCP) enables one computer to provide network configuration information to another one over a network link, so option E is incorrect.
**3.** **C** The main language for the Linux kernel is C, so option C is correct.
Although Bash shell scripts control much of the Linux startup process, these scripts are not part of the kernel, so option A is incorrect.
Java is a popular language for Web-based applications, but it's not used in the Linux kernel, so option B is incorrect.
C++ is a derivative of C that adds object-oriented features to the language, but the Linux kernel uses regular C, not C++, so option D is incorrect.
Perl is a popular interpreted language, particularly for tasks that involve processing text, but it's not the language of the Linux kernel, so option E is incorrect.
**4.** **True** LibreOffice forked from OpenOffice.org in 2011.
Although there are some small differences, the two are still nearly identical, and will likely remain quite similar for years.
**5.** **True** A denial-of-service (DoS) attack can disrupt a server's operation by directing an overwhelming quantity of bogus data at the server program, or even just the computer on which it runs.
This is true even if the server is impeccably managed.
**6.** **True** Python, like Perl, PHP, and shell languages, is interpreted.
This contrasts with C and C++, which are two common compiled languages, and with Java, which is somewhere in-between.
**7.** e-mail client
**8.** Samba
**9.** compiled

# Chapter 5

**1.** **D** The `lspci` command displays information on PCI devices.
Since many motherboard features appear to Linux as PCI devices, option D provides a great deal of information on your motherboard, and so is correct.
Option A's `lscpu` command provides information on the CPU, which means that it provides little direct information on the motherboard, so option A is incorrect.
The `Xorg` program is the Linux X server, and option B creates a new X configuration file.
This file might provide hints about video hardware on the motherboard, but option D provides better and more information, so option B is incorrect.
The `fdisk` utility can partition a disk, and the command in option C displays information on how `/dev/sda` is partitioned.
This information has nothing to do with the motherboard's features, though, so option C is incorrect.
You can enter `http://localhost:631` in a Web browser to configure your printer, but even if you do this, you'll gain no information about your motherboard's features, so option E is incorrect.
**2.** **A, D** Disk partitioning enables you to separate data of different types into different parts of a disk.
Examples of reasons to do this include installing multiple OSs and separating filesystem data from swap space.
Thus, options A and D are both correct.
Filesystem choice (ext4fs vs.
ReiserFS) has nothing to do with partitioning, unless you want to use one filesystem for one partition and the other on another partition, so option B is incorrect.
The Parallel Advanced Technology Attachment (PATA) and Serial ATA (SATA) interfaces are hardware standards; you can't turn a PATA disk into an SATA disk by partitioning the disk, so option C is incorrect.
Hard disks have caches to improve performance, but partitioning the disk does not separate the disk's cache from the bulk of the disk's data, so option E is incorrect.
**3.** **A** Video monitors normally attach to the video circuitry built into a computer's motherboard or to a separate video card, so option A is correct.
Keyboards, external hard disks, printers, and scanners all commonly connect to a computer via USB, although alternative interfaces exist for all of these devices.
**4.** **True** Most CPU families have multiple names.
*EM64T* is one name that Intel has used for its implementation of the x86-64 architecture, and AMD64 is one of AMD's names for the same architecture.
Thus, the two names identify the same architecture, and an AMD64 Linux distribution will run on an EM64T CPU.
**5.** **False** The Universal Disk Format (UDF) is a filesystem that's used primarily on optical discs, not on hard disks.
Using it for a Linux installation on a hard disk would be awkward or impossible.
Linux-specific filesystems (ext2fs, ext3fs, ext4fs, ReiserFS, JFS, XFS, and Btrfs) are the only practical choices for Linux installations on a hard disk.
**6.** **True** In Linux, most drivers, including those specified, are provided as part of the kernel.
Some other drivers, such as those for video cards under X, printers, and scanners, exist outside the kernel, although these may also rely on kernel drivers to do their work.
**7.** 32
**8.** direct current
**9.** Digital Visual Interface (DVI)

# Chapter 6

**1.** **A** The Ctrl+A keystroke moves the cursor to the start of the line when editing a command in Bash, so option A is correct.
The left arrow key moves a single character to the left, Ctrl+T transposes two characters, the up arrow moves up one item in the history, and Ctrl+E moves to the end of the line.
**2.** **C, D** Options C and D both describe ways to run a program in the background from a shell, so options C and D are both correct.
Neither `start` nor `bg` is a command that launches a program in the background.
The `fg` command returns a program to the foreground, meaning that the shell will go back to sleep, which isn't what the question specified.
**3.** **E** Because the `cd` command changes the current directory and a tilde (`~`) refers to your home directory, option E does as the question specifies, and so is correct.
Neither `home` nor `homedir` is a standard Linux or Bash command, so options A and D are both incorrect.
Option B sets the current directory to `/home`, which is a directory that probably holds your home directory, but it is not your home directory itself, so option B is incorrect.
Option C sets the current directory to the `homedir` subdirectory of the current directory, if it exists.
Since this is almost certainly not your home directory, this option is incorrect.
**4.** **False** When in X, Ctrl must be added to the VT-switching keystroke, so the correct keystroke should be Ctrl+Alt+F2 (or other function keys, through F6).
**5.** **False** In Linux, a slash (`/`), not a backslash (`\`), is the directory separator; a backslash "quotes" the following character, so `..\upone.txt` refers to the file `..upone.txt` in the current directory.
Specifying `../upone.txt` (with a slash rather than a backslash) refers to `upone.txt` in the parent directory.
**6.** **False** You can obtain a recursive directory listing from `ls` by using either `--recursive` or `-R`, but a lowercase `-r` does not have this effect.
**7.** `pwd`
**8.** `-a`
**9.** `cat`

# Chapter 7

**1.** **A** The `mv` command moves or renames a file, so option A is correct.
The `cp` command copies a file, so option B is incorrect.
The `ln` command creates a link between two files, so option C is incorrect.
Option D's `rn` command is fictitious, so this option is incorrect.
The `touch` command creates a new file or adjusts the time stamps on an existing file, so option E is incorrect.
**2.** **C** Because two files (`outline.pdf` and `Outline.PDF`) have names that differ only in case, and because FAT is a case-insensitive filesystem, one of those files will be missing on the copy.
(Both files will be copied, but the second one copied will overwrite the first.) Thus, option C is correct.
The specified `cp` command does not create links, so option A is incorrect.
Because the specified `cp` command included the `-a` option, which performs a recursive copy, all of the files in `MyFiles` will be copied, along with the directory itself, so option B is incorrect.
In order to copy all of the files, you will have to manually change one file's name; however, `cp` won't do this automatically, so option D is incorrect.
Because option C is correct, option E is not correct.
**3.** **A, B** If you try to create a directory inside a directory that doesn't exist, `mkdir` responds with a `No such file or directory` error.
The `--parents` parameter tells `mkdir` to automatically create all necessary parent directories in such situations, so option A is correct.
You can also manually do this by creating each necessary directory separately, so option B is also correct.
(It's possible that `mkdir one` wouldn't be necessary in this example if the directory `one` already existed.
No harm will come from trying to create a directory that already exists, although `mkdir` will return a `File exists` error.) Option C will have no useful effect; at most, it will change the time stamps on the `mkdir` program file, but if you type it as a normal user, it probably won't even do that.
Options D and E are both based on the premise that you must remove directories that already exist with the names that you want to use, but this isn't true, so these options are both incorrect.
**4.** **True** Symbolic links work by storing the name of the linked-to file in the symbolic link file.
Linux reads this filename and transparently substitutes the linked-to file.
This process works both on a single filesystem and across filesystems, so the statement is true.
Hard links, by contrast, work by providing multiple directory entries that point to a single file.
This method of creating a link does *not* work across low-level filesystems.
**5.** **False** Linux's security features prevent accidental damage when you work as an ordinary user.
You must be more careful when you acquire `root` privileges to perform system maintenance, though.
**6.** **True** The `touch` command updates a file's time stamps, and for this purpose, a directory counts as a file, so this statement is true.
**7.** `-u` or `--update`
**8.** `rm -R junk`, `rm -r junk`, or `rm --recursive junk`
**9.** `?`

# Chapter 8

**1.** **D** The `less` program, like `more`, displays a text file a page at a time.
The `less` utility also includes the ability to page backward in the text file, search its contents, and do other things that `more` can't do.
Thus, option D is correct.
The `grep` command searches a file for a specified string, so it doesn't do a task that's similar to `more`, and option A is incorrect.
The Hypertext Markup Language (HTML) is a file format, often indicated with the filename extension `.html`, that's commonly used on the Web.
As such, it's not a better version of `more`, so option B is incorrect.
The `cat` command can concatenate two or more files, or display a single file on the screen.
In the former capacity, `cat` doesn't do the task of `more`, and in the latter capacity, `cat` is less capable than `more`.
Thus, option C is incorrect.
The `man` command displays Linux manual pages.
Although `man` uses `less` by default, `man` is not itself an improved version of more, so option E is incorrect.
**2.** **D** `man` pages are intended to give you quick information on commands, configuration files, or the like.
HOWTOs are intended as introductions to packages or broad topics.
Thus, option D is correct.
Both `man` pages and HOWTOs are available on the Internet, and both can be installed on your computer, so option A is incorrect.
Both `man` pages and HOWTOs are available electronically, and it's easy to print either type of document, so option B is incorrect.
Some `man` pages are intended for ordinary users and others are intended for programmers.
The same is true of HOWTOs, so option C is incorrect.
`man` pages are "flat" (non-hyperlinked) documents, whereas many HOWTOs are hyperlinked, so option E is incorrect.
**3.** **C** The `whatis` command searches a database that contains `man` page Name sections for matches on the specified keyword and returns the names of the commands whose `man` pages include that keyword.
Thus, option C is correct.
Options A, D, and E are essentially fictitious descriptions.
Option B describes the output of the `which` command.
**4.** **True** When you want to override `man`'s search order, you specify the desired manual section between `man` and the command name, filename, or other name on which you're searching.
**5.** **False** Although `info` pages, like Web pages, use hyperlinks to tie related documents together, the two systems use different formats and protocols.
`info` pages also reside on the computer's hard disk; they require no Internet access to read.
For these reasons, `info` pages are *not* Web-based.
**6.** **False** Individual program authors decide on documentation file format based on their own idiosyncratic needs and preferences.
Although some documents are in OpenDocument Text format, many documents are not.
**7.** 5
**8.** node
**9.** `locate`

# Chapter 9

**1.** **E** The `apt-get` utility is a network-enabled tool that can resolve dependencies and retrieve all the required packages to install a package that you specify.
Debian and its derivatives all use it, so option E is correct.
The `yum` and `zypper` programs are conceptually similar to `apt-get`, but they work on Red Hat (and its derivatives) and SUSE distributions, respectively, so options A and B are both incorrect.
The `dmesg` program displays the kernel ring buffer; it has nothing to do with package management, so option C is incorrect.
The `rpm` program is a non-network-enabled program for managing packages on an RPM-based system, not on a Debian system, so option D is incorrect.
**2.** **A** Typically, Linux starts `init` as the first process, so option A is correct.
`bash` is a Linux text-mode shell program.
Although it's important for user interaction, it's far from the first process Linux starts.
The `cron` daemon manages timed execution of programs to handle routine maintenance tasks.
It's started automatically in the boot process, but it's not the first process the kernel starts, so option C is incorrect.
Although the `login` process is critical to logging in users in text mode, it's started by `init` or by another process, so option D is incorrect.
The GRand Unified Bootloader (GRUB) boots the computer, so parts of GRUB run **before** the kernel.
Several Linux programs help manage a GRUB installation, but the kernel doesn't start any of them automatically.
Thus, option E is incorrect.
**3.** **A** Option A,`/var/log`, is the standard home for log files in Linux.
Options B through E all present fictitious locations and so are all incorrect.
**4.** **True** Network-enabled package managers, such as APT, `yum`, `zypper`, and `urpmi`, can automatically download and install packages on which a package you want to install depends.
**5.** **True** The `top` program sorts a process list by CPU use, so the topmost item in the list is currently consuming the most CPU time.
You can change the sort order in various ways, though.
**6.** **True** Like on-disk log files, the kernel ring buffer (which `dmesg` displays) changes as the computer runs.
Thus, its contents immediately after booting are not likely to be the same as its contents after the computer has been running for weeks.
**7.** package database
**8.** child
**9.** `syslog`

# Chapter 10

**1.** **A** The `grep` utility finds matching text within a file and prints those lines.
It accepts regular expressions, which means you can place in brackets the two characters that differ in the words for which you're looking.
Option A shows the correct syntax for doing this.
The `tar` utility creates or manipulates archive files, and option B's syntax is incorrect for any use of `tar`, so that option is incorrect.
The `find` utility locates files based on filenames, file sizes, and other surface features.
Furthermore, options C and E both present incorrect syntax for `find`, and so are incorrect.
Option D's `cat` utility displays or concatenates files, so it won't have the desired effect and this option is wrong.
**2.** **E** The `>>` operator appends standard output to a file, so option E is correct.
The vertical bar (`|`) is the pipe character; it ties one program's standard output to another's standard input, so option A is incorrect.
The `2>` operator redirects standard error, not standard output, and it overwrites the target file.
Thus, option B is incorrect.
The `&>` operator redirects both standard output **and** standard error, and it overwrites the target file, so option C is incorrect.
The `>` operator redirects standard output, but it overwrites the target file, so option D is incorrect.
**3.** **D** With the `tar` utility, the `--list` command is used to read the archive and display its contents.
The `--verbose` (`v`) option creates a verbose file listing, and `--file` specifies the filename---`data79.tar` in this case.
Option D uses all of these features, and therefore does as the question specifies.
Options A, B, C, and E all substitute other commands for `--list`, which is required by the question, so all of these options are incorrect.
**4.** **True** The special characters `[^x]` match any single character **except** `x`, and `.\*` matches any sequence of any characters.
The string `Linus Torvalds` is just one of many strings to match the specified regular expression.
**5.** **True** You can use the `-size` option to `find` to locate files based on their sizes.
**6.** **False** The `zip` utility creates or manipulates zip archive files.
This file type supports compression directly, as does the `zip` program.
Thus, there's no need to involve another compression program to compress files archived with `zip`.
**7.** `^`
**8.** `&>`
**9.** lossless

# Chapter 11

**1.** **D** LibreOffice, like most word processors, uses a binary format that can't be properly parsed using an ASCII or Unicode text editor.
Thus, `nano` won't be useful in examining such a document, making option D correct.
The other document types described in options A, B, C, and E are all likely or certain to be stored in ASCII or Unicode format, which `nano` can handle, making them all incorrect choices.
**2.** **B, E** The F6 and Ctrl+W keystrokes both invoke the search function, so options B and E are correct.
The F3 key writes the current buffer to disk, so option A is incorrect.
The Esc-S keystroke is an obscure one; it enables or disables smooth scrolling, so option C is incorrect.
Ctrl+F moves forward one character, so option D is incorrect.
**3.** **A** In Vi, `dd` is the command-mode command that deletes lines.
Preceding this command by a number deletes that number of lines.
Thus, option A is correct.
Although `yy` works similarly, it copies (yanks) text rather than deleting it, so option B is incorrect.
Option C works in many more modern text editors, but not in Vi.
Option D works in `emacs` and similar text editors (including `pico` and `nano`), but not in Vi.
Option E, or something similar, works in many GUI text editors, but not in Vi.
**4.** **False** Unicode provides support for most alphabets, including the huge logographic systems used in common East Asian languages.
**5.** **False** Support for underlining, italics, multiple fonts, and similar advanced formatting features is present in word processors, not plain text editors---even GUI text editors lack such support.
**6.** **True** The convention of using a hash mark to identify comments is common, but not universal, in configuration files.
**7.** 128
**8.** Ctrl+\\ and Esc-R
**9.** `u`

# Chapter 12

**1.** **A** Scripts, like binary programs, normally have at least one executable bit set, although they can be run in certain ways without this feature, so option A is correct.
There is no standard `/usr/bin/scripts` directory, and scripts can reside in any directory, so option B is incorrect.
Scripts are interpreted programs, which means they don't need to be compiled.
Typing `bash scriptname` will run the script; option C is incorrect.
Viruses are extremely rare in Linux, and because you just created the script, the only ways it could possibly contain a virus would be if your system was already infected or if you wrote it as a virus.
Thus, option D is incorrect.
Most spell-checkers are intended for English or other human languages, so they lack valid Bash commands such as `esac`.
Furthermore, even if every keyword is spelled correctly, the script could contain bugs.
Thus, option E is incorrect.
**2.** **C** The `cp` command is the only one called in the script, and that command copies files.
Because the script passes the arguments (`$1` and `$2`) to `cp` in reverse order, their effect is reversed---where `cp` copies its first argument to the second name, the `cp1` script copies the second argument to the first name.
Option C correctly describes this effect.
Option A ignores the reversed order of the arguments, so this option is incorrect.
The `cp` command has nothing to do with compiling C or C++ programs, so neither does the script, making option B incorrect.
Since `cp` is a simple file-copying command, it can't convert a C program into a C++ program, making option D incorrect.
The script's first line is a valid shebang line, contrary to option E, so that option is incorrect.
**3.** **C** Conditional expressions return a true or false response, enabling the script to execute one set of instructions or another or to terminate or continue a loop.
Option C is another way of saying this, and so is correct.
Conditional expressions need have nothing to do with license conditions (option A), displaying information on the environment (option B), Pavlovian conditioning (option D), or executing the script at certain times of day (option E).
That said, conditional expressions *could* be used in service of any of these goals, but that's not their purpose.
**4.** **False** The `\$0` variable holds the name of the script---`myscript` in this example.
To access the first parameter passed to the script (`laser.txt`), the script must use the `$1` variable.
**5.** **True** You can use `for` to execute a loop a fixed number of times, whereas `while` and `until` execute until a test condition is no longer met or is met, respectively.
**6.** **False** The effect of the specified script is to launch three instances of `terminal` *sequentially*; the second launches only after the first terminates, and the third launches only after the second terminates.
To do as the question specifies, you should include a trailing ampersand (`&`) in at least the first two calls to `terminal` (as in `terminal &`); this causes them to run in the background, so that the script can continue to execute to launch the remaining instances of `terminal`.
**7.** `#!/bin/sh`
**8.** `echo`
**9.** `case`

# Chapter 13

**1.** **A** UID 0 is reserved for the system administrator's account, also known as `root`, so option A is correct.
The first ordinary user account is not a system account, and its UID is normally 500 or 1000, depending on the distribution, so option B is incorrect.
Because A is correct, C cannot be correct.
The association of UID 0 for administrative tasks is very basic in Linux, so you won't find variation on this score, making option D incorrect.
Option E describes the `nobody` account, which does not have a UID of 0.
**2.** **A, C, E** The `/etc/passwd` file's fields specify the username, an encrypted password (or `x` to denote use of shadow passwords, which is more common), a UID number (option A), a *single *default GID number, a comment field that normally holds the user's full name, the path to the account's home directory (option C), and the path to the account's default text-mode shell (option E).
Option B is incorrect because, although `/etc/passwd` includes the user's *default* group, the user *may* belong to additional groups that are defined elsewhere.
Option D is incorrect because the user's default desktop environment is defined in the user's home directory, not in `/etc/password`.
**3.** **A** The `sudo` command is the usual way to execute a single command as `root`, and option A gives the correct syntax to use it as the question specifies.
There is no standard `root` command, so option B is incorrect.
The `passwd` command changes passwords, so option C is incorrect.
Although you can use `su` to execute a single command as `root`, you must use it with the `-c` option to do this, as in `su -c "iptables -L`, so option D is incorrect.
Option E's `admin` is a fictitious command, so this option is incorrect.
**4.** **False** The `whoami` command displays your username only.
The `id` command displays your username, your UID number, your primary group name, your primary GID number, and the group names and GID numbers of all your groups.
**5.** **False** The name for the group data file in Linux is `/etc/group`, not `/etc/groups`.
**6.** **True** It's possible to do more damage to a computer as root than as an ordinary user.
Thus, you should be extra cautious when using `root`---run only trusted programs, double-check your commands for errors, and so on.
**7.** `/etc/passwd`
**8.** `w`
**9.** system

# Chapter 14

**1.** **C** The `userdel` command deletes an account, and the `-r` option to `userdel` causes it to delete the user's home directory and mail spool, thus satisfying the terms of the question.
Option A deletes the account but leaves the user's home directory intact.
Option B does the same; the `-f` option forces account deletion and file removal under some circumstances, but it's only meaningful when `-r` is also used.
Option D's command will probably have no effect, since `rm` works on directories only in conjunction with `-r`, and `/home/nemo` is probably the user's home directory.
Option E's `rm` command deletes the user's home directory (assuming it's located in the conventional place, given the username) but doesn't delete the user's account.
**2.** **B** The password in option B uses a combination of upper- and lowercase letters, numbers, and symbols, and it doesn't contain any obvious word.
Furthermore, it's a long password.
All of these characteristics make it unlikely to appear in an intruder's password dictionary and make it hard to guess.
Thus, option B represents a good password, and the best of those shown.
Option A is the name of a well-known celebrity (at least in the Linux world!); such a name is likely to appear in password-cracking dictionaries, and so makes a poor password choice.
Option C is an extremely common password, which makes it a bad choice.
Furthermore, it's short and it consists of just one symbol type (digits).
Option D is another popular (and therefore very poor) password.
It's a single common word in all-lowercase and it contains no numbers or other non-alphabetic symbols.
Although option E is fairly long, it consists entirely of lowercase letters, and it's three related words, making it a poor password.
**3.** **A** The `groupadd` command creates a new group, as described in option A, so that option is correct.
To add a user to a group, as suggested by option B, you would use the `usermod` utility.
No standard command imports group information from a file, as option C suggests, so this option is incorrect.
(Some network user management tools do provide such functionality, though.) To change a user's default group or list of supplemental groups, you would use `usermod`, so options D and E are both incorrect.
**4.** **True** System accounts have UID values between 0 and some number (normally 499 or 999), whereas user accounts have UID values above that number (starting at 500 or 1,000, typically).
**5.** **False** The usual command-line command for changing passwords is `passwd`.
**6.** **True** Although the `userdel` command's `-r` option deletes the user's home directory and mail files, this command doesn't track down the user's files stored in more exotic locations.
You can use `find` to locate such files if you want to delete them or transfer ownership to another user.
**7.** `-u 1926`
**8.** `usermod -l emilyn e1211`
**9.** `-r` or `--system`

# Chapter 15

**1.** **D** Option D is the correct command.
Typing `chown ralph:tony somefile.txt`, as in option A, sets the owner of the file to `ralph` and the group to `tony`.
The `chmod` command used in options B and E is used to change file permissions, not ownership.
Option C reverses the order of the filename and the owner.
**2.** **C, D** The `d` character that leads the mode indicates that the file is actually a directory, while the `r` symbol in the `r-x` triplet at the end of the symbolic mode indicates that all users of the system have read access to the directory, so options C and D are both correct.
Symbolic links are denoted by leading `l` characters, which this mode lacks, so option A is incorrect.
Although the `x` symbols usually denote executable program files, as specified in option B, in the case of directories this permission bit indicates that the directory's contents may be searched; executing a directory is meaningless.
The only permission field set for write access is in the first triplet, which refers to the file's owner, so only that user, and not other members of the file's group, may write to the file, contrary to option E.
**3.** **E** Although the `chgrp` command is the usual one for changing a file's group, you can also use `chown` to do the job, so option E is correct.
Option A's `groupadd` command adds a new group to the system, so this option is incorrect.
The `groupmod` command can modify details of a group definition, but it doesn't change the group associated with a file, so option B is incorrect.
The `chmod` command changes a file's mode (that is, its permissions), but not its group association, so option C is incorrect.
You can use `ls` to learn a file's current group (among other things), but not to change it, so option D is incorrect.
**4.** **True** The octal permission of 755 corresponds to a symbolic representation of`-rwxr-xr-x`, which includes world read permissions (in the final three bits of `r-x`).
Thus, anybody can read the file.
**5.** **False** Any user may use `chmod`; however, only a file's owner or `root` may change the permissions on a file.
**6.** **True** Although an ordinary user can use `chown` to change a file's group, ordinary users cannot change a file's ownership.
**7.** `-R` or `--recursive`
**8.** `r-x`
**9.** `a+x`

# Chapter 16

**1.** **D** The `/usr/lib` directory holds library files, as stated in option D.
These files contain code that can be used by multiple programs.
Using libraries reduces the sizes of the other programs and can simplify upgrades and bug fixes.
Options A, B, C, and E are all fictitious file types.
**2.** **A** The `-l` parameter produces a long listing, including file sizes.
The `-a` parameter produces a listing of all files in a directory, including the dot files.
Combining the two produces the desired information (along with information about other files), so option A is correct.
The `-p`, `-R`, and `-d` options don't have the specified effects, so options B, C, D, and E are all incorrect.
**3.** **C** The set user ID (SUID) bit enables programs to run as the program's owner rather than as the user who ran them.
This makes SUID `root` programs risky, so setting the SUID bit on `root`-owned programs should be done only when it's required for the program's normal functioning, as stated in option C.
This should certainly *not* be done for all programs because the SUID bit is *not* required of all executable programs as option A asserts.
Although the SUID `root` configuration does enable programs to access device files, the device files' permissions can be modified to give programs access to those files, if this is required, so option B is incorrect.
Despite the similarity in acronyms, the SUID bit has nothing to do with accessing user ID (UID) data for accounts, so option D is incorrect.
Although SUID `root` programs are a security risk, as stated in option E, they're a necessary risk for a few programs, so option E goes too far.
**4.** **True** The `/var` directory holds variable data files, which are quite diverse in their purpose.
One of the many types of files that resides in `/var` is print spool files, as noted in the question.
**5.** **False** Normally, the sticky bit is set on `/tmp`, which prevents anybody but the directory's owner (normally `root`) or the file's owner from deleting files within it, even though the directory's world write permission bit is set.
**6.** **True** Dot files are created by placing a dot (`.`) as the first character in a filename.
As such, converting an existing file into a dot file means that its filename has changed, and any existing references to the file must change if they're to continue working.
**7.** `/media`
**8.** `/var/tmp`
**9.** `a+t`

# Chapter 17

**1.** **C** The gateway computer is a router that transfers data between two or more network segments.
As such, if a computer isn't configured to use a gateway, it won't be able to communicate beyond its local network segment, as option C suggests.
(If your DNS server is on a different network segment, name resolution via DNS won't work, although other types of name resolution, such as `/etc/hosts` file entries, will still work.) Lack of a gateway address will not cause the symptoms described by options A, B, D, or E.
**2.** **B, C** When used to display information on an interface, `ifconfig` shows the hardware (option C) and IP (option B) addresses of the interface, the protocols (such as TCP/IP) bound to the interface, and statistics on transmitted and received packets.
This command does *not* return information about programs using the interface (option A), the hostname associated with the interface (option D), or the gateway with which it communicates (option E).
**3.** **A, E** DNS problems can manifest as an ability to connect to computers using IP addresses but not using hostnames.
Thus, options A and E (and various other DNS-related problems) could create the symptoms described.
If the target system were configured to ignore `ping` packets, as described in option B, it wouldn't respond when you identified it by IP address.
The target system's DNS configuration (option C) doesn't enter into the equation, because it responds to the `ping` request via IP address alone.
Your computer's local hostname configuration won't affect its ability to send or receive packets, even by hostname, so option D is incorrect.
**4.** **True** IPv4 addresses are four bytes long, and are typically expressed as four decimal numbers separated by dots, as in 192.168.0.1.
**5.** **False** The `/etc/resolv.conf` file holds DNS server information---the IP addresses of up to three DNS servers and domain names that should be searched when the user omits them.
**6.** **True** When used without any other options, the `route` command displays the current routing table.
**7.** `netstat`
**8.** `eth0`
**9.** firewall
