Mastering Linux Textbook Site

Mastering Linux

Update Bulletin

Information updates related to the textbook will be posted here.

Textbook Errata/Revisions

Hopefully there won't be many bugs or misprints. But, the ones that are found will be listed here.

If you find something wrong or have a suggestion, either for the text or the website, please let us know. Your input will be deeply appreciated.

  • Page 96, 3rd bullet item

    Add footnote to LibreOffice is a new version of the code base maintained by the nonprofit Document Foundation.

  • Page 171, at the end of section 6.3—Insert the following

    Modern Linux distributions often include SELinux to improve system security. SELinux security policies use security contexts on users, roles, and types to allow/deny operations on files and processes, giving administrators great flexibility in securing different parts of a Linux system. Files with security context restrictions have a character such as . or + at the end of their ls -l access control display. To view security context information for such files and folders, give the -Z option to ls. To change security context settings, use the chcon command. Other security context related commands exist. See the SELinux link on the Resources page for more information.

  • Page 184, just before subsection "Packing Files with shar"—Insert the following paragraph

    More secure alternatives to md5sum use the US National Security Agency published SHA-2 algorithms. On Linux, these include the commands sha224sum, sha256sum, sha384sum, and sha512sum that produce finger prints of different lengths.

  • Page 241, 2 lines before section 8.16—Insert the following

    Then, test the server from another host on the same LAN, with


    where host is the domain name of your server. Make sure the firewall on the server allows both HTTP and HTTPS access. Otherwise, the Apache Web server won't be accessible from other hosts. On CentOS/Fedora firewall configuration is an option on the system->admin menu. For Ubuntu the gufw tool is handy for the same purpose.

  • Page 268, section 8.24

    Add footnote: In some new Linux distributions, such as Fedora 22, YUM has been replaced by a much improved DNF (Dandified Yum). Among other features, DNF supports automated system upgrade to a new Linux distribution.

  • Note: Great thanks to Marcin Dulak who read the book cover to cover and provided some 90 corrections and suggestions. The resulting revisions are listed below.

  • Page 39 section 1.7 line 4

    only text files --> only supported files

  • Page 29, line -2

    The plan field these two files to supply additional information about themselves --> The plan field displays the user's .plan file. These two files supply additional information about a user

  • Page 33 Section 1.10 line 2

    in a general programming --> in a general-purpose programming language such as C

  • Page 38 Section 1.12 line 1

    hundreds of --> many available

  • Page 40, line -6

    destroyed --> removed

  • Page 51 line 4 before Table 2.1 and last entry of Table 2.1

    &| --> |&

    3rd entry of Table 2.1

    cmd &>[|] file    Combines stdout and stderr to overwrite file
    cmd &> file       Sends stdout and stderr to file

    entry 6 in Table 2.1

    cmd 2>&1 Joins stderr to redirected stdout
    cmd 2>&1 > file  Joins stderr to redirected stdout
  • Page 53, line 6

    For example, %vim, %vi, or %v all refer to job 2. --> For example, %nano, %na, or %n all refer to job 2.

  • Page 54 first 3 paragraphs modified as follows

    to terminate the job. The optional argument -9 instructs kill to send a specific signal to the process, which forces it to terminate. Signals are described further in Chapter 10, Section 10.16.

    In addition to jobids, kill can also take process numbers. The command

    jobs -l
    gives the process numbers for all jobs.

    The kill command discussed here is built into Bash. There is also a regular command, /bin/kill, that can be used. Among other differences, /bin/kill works only on process numbers.

  • Page 61, line before "Command expansion" section

    declare -f (displays all functions)

  • Page 74 add to end of 2nd paragraph

    ... semicolon. (Add) --> Some whitespace between the { and command 1 is necessary.

  • Page 74, line -6

    are there --> are given

  • page 75: 8 lines before section 2.16 Add footnote to word "recursively" at the end of paragraph

    If your BASH Shell comes with an alias for which, unalias it so you can reach the function.

  • Page 76 line 10 of Summary

    an alias or a function defined in the Shell. --> a Shell alias or function if one exists.

  • Page 85 Desktop Appearance section end of 1st paragraph, add footnote:

    The start menu on Linux systems can be organized differently.

  • Page 85, line -3

    in ways you see fit. desktop --> . Desktop

  • Page 99, line -12

    Edit->Copy --> Edit->Paste

  • Page 103 line 2, add footnote to "700 different commands"

    See Directory of Linux Commands on the Web.

  • Page 105, line -10

    tr TAB % --> tr 'TAB' %

  • Page 106, line -3 in section Tab Expansion

    expand 6 < file --> expand -t 6 < file

  • Page 106 line -6

    -c n --> -w n

  • Page 115, line 9

    applies two string replacement actions, sequentially,

  • Page 115, line -3

    The output will be the same as file, but with ..." --> The output will be file with all empty lines deleted.

  • Page 116 line 1, add sentence after "respectively."

    Remember to escape the TAB with CTRL+V or you can use \t instead.

  • Page 117 line -6, correct example:

    history | tail -8 | sed 's/ *[0-9]* *// '> file
    and remove "( ... is a TAB)".

  • Page 120 line 13 before section awk Patterns

    While it is impossible --> While it is hard

  • Page 123, line 15

    "separated by the ." --> "separated by the :."

  • Page 123, line just before the table

    "secnd" --> "second"

  • Page 129, add sentences to the end of last paragraph

    If you include . on PATH, make sure it is at the very end. Otherwise, you may execute unexpected, or even malicious, code in the current folder.

  • Page 139 section 5.11 first sentence

    Because Shell variables are string-valued, we need to use the arithmetic expansion notation

  • Page 155 line -6, should read:

    The special files . and .. are excluded (line c).

  • Page 156, line 13

    "pupd" --> "popd"

  • Page 157, line 11

    "here document]" --> "here document"

  • Page 157 line 5 fix command

    resize '75%' trip *.jpg

  • Page 162, second bullet in summary

    "esca" --> "esac"

  • Page 171, add sentence at page top:

    As discussed in Section 2.12, you can set/display the default file permissions with the Shell command umask.

  • Page 171-172

    Delete entire subsection "Default File Protection Settings: umask"

  • Page 174 from "Set-userid Mode" section to line -4, replace by

    Setuid and Setgid Modes

    If the setuid (setgid) bit is turned on for an executable file, then when it runs under the userid (groupid) of the executable file rather than that of the invoking user.

    The setuid and setgid bits are often used to grant temporarily elevated privileges for certain tasks involving access to files/programs normally unaccessible to regular users.

    Consider changing password for example. The command passwd has its setuid bit turned on

    -rwsr-xr-x. 1 root root 35480 Jul 16  2010 /usr/bin/passwd
    Thus, when you call passwd, it takes on an effective uid of root and can modify the stored password data file (usually {/etc/shadow).

    Setting the setgid bit for a directory causes new files and folders created under it to take on the directory's gid, rather than the primary gid of the creating user. This is useful for a shared directory used by members working on the same project.

    The setuid bit on directories usually has no effect.

  • Page 175 section "Establishing a Group" line 9

    up a new group --> up a new group and add the members

  • Page 175 section "Establishing a Group" first code line of item 3, replace by

    chmod g+rwxs alpha (or simply g+rws)

  • Page 176, add new paragraph at end of section 6.5

    The command ls obtains and displays file status information from i-nodes. See Section 10.4 for direct access to i-node data from C programs.

  • Page 195, line -9

    nautilus network:///  --> nautilus network:

  • Page 196 3 lines before Section 7.5

    Here ae --> Here are

  • Page 197, line 1

    "hostiname" --> "hostname"

  • Page 200 line 8 Section Remote File Synchronization

    When source is a folder, given without the trailing /, the entire hierarchy rooted at the folder will be updated. Use the form source/ to sync all files inside the source folder to the destination folder.

  • Page 202, line 6 add after "ElGama key."

    The key uid is "Paul Wang", monkeykia, or the listed email address.

  • Page 202, line -8

    gpg --encrypt -r key_uid filename

  • Page 203, line 3 replace nano command with

    gpg --decrypt filename.gpg | more

  • Page 203 before line -2, add sentence

    The Linux mail client evolution can be set up to use GnuPG through the security preference under each of your email accounts.

  • Page 204, line -6

    "md5sum digestFile" --> "md5sum -c digestFile"

  • Page 205, line -3

    "HTML, Section 7.10" --> "HTML, Section 7.13"

  • Page 206, line 16

    efficient HTTP --> efficient protocol (HTTP) which is

  • Page 212, line -3

    the whoisjwhois.

  • Page 227 line -10 Add new paragraph

    On newer Linux distributions, the systemctl command is recommended to enable/disable, start/stop, and restart services:

    systemctl start  httpd.service}
    systemctl stop httpd.service}
    systemctl restart httpd.service
  • Page 247 line 7

    on your system, then, most likely, you have MySQL already. To be sure look for mysqld by starting system-config-services.

  • Page 248, line 3

    if present, which restricts the MySQL server to access from localhost only.

  • Page 248, end of page

    The command mysqladmin -h localhost -u root -pfoobar create lxux takes the hostname, userid, and password information and creates a new database lxux.

  • Page 248 before line 13 Add paragraph

    It is a good idea to tun the Linux command


    to improve the security of your MySQL installation.

  • Page 250 line -5, Replace the paragraph

    To install phpMyAdmin, access phpmyadmin/setup from your Web browser. You'll need the userid and password of the root admin user of the target MySQL system for the control user.

  • Page 251 just before section 8.23 add

    Be sure to install the latest version of phpMyAdmin, earlier versions have known security problems.

  • Page 258 line 1

    "Anjula" --> "Anjuta"

  • Page 266 line 12 in section Linking and Loading

    object /bin/bash: inking: command not found --> object modules are loaded and linked the same way.

  • Page 270 line 7

    must be called on the stream --> on the stream is usually needed to set the position for the next read/write operation.

  • Page 270 replace body of while in program with

     while ((c = fgetc(update)) != EOF) 
     { if ( isupper(c) )
       { ungetc(c, update);              /* back up 1 char  (a) */
         /* or instead of ungetc
          fpos = ftell(update);            get current pos  (b)
          fseek(update, fpos-1, SEEK_SET); pos for writing  (c) */
         fputc(tolower(c), update);
     }                                   /*                 (d) */

  • Page 271 1st paragraph

    Replace rest of paragraph starting with "This is done ..." --> This is done here by backing up one character with ungetc (line a) before putting out the lowercase character. With ungetc, only one pushback is guaranteed. Alternatively, recording the current position (line b) then setting the write position with fseek (line c) will work in general.

  • Page 285, section 9.9 last sentence 1st paragraph

    you can cause --> if enabled, you may cause

  • Page 295 section 10.3 line 9

    delete line: ssize_t read(int fd, void *buf, size_t count);

  • Page 316: end of page add line before #include <stdio.h>

    #include <stdlib.h>

  • Page 317: line -2

    "Type CTRL-D or ..." --> "Type exit followed by ENTER"

  • Page 331, line 14

    "A processes" --> "A process"

  • Page 355 first word Section 11.11

    Linus --> Linux

  • Page 356, line 5

    "hostent *?gethostbyname" --> remove "?"

  • Page 356, line -2

    "servent *getservbyname(...)?" --> remove "?"

  • Page 369 just before section 12.1

    Add line Alternatively, you can download and install Ruby-Gnome2.

  • Page 373 add before line 9

    Try ruby -e 'str = "Green"; print str[0]'

  • Page 386, line -7

    "amizer" --> "amixer"