<?xml version="1.0"?>
<!-- -*- DocBook -*- -->
<!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN"
    "/usr/share/sgml/docbook/dtd/xml/4.2/docbookx.dtd" [
 <!ENTITY % sgml.features "IGNORE">
 <!ENTITY % xml.features  "INCLUDE">
 <!ENTITY % dbcent PUBLIC
      "-//OASIS//ENTITIES DocBook Character Entities V4.2//EN"
      "/usr/share/sgml/docbook/dtd/xml/4.2/dbcentx.mod"> %dbcent;
 <!ENTITY % commondata     SYSTEM "common.ent"      > %commondata;
 <!ENTITY % popcon         SYSTEM "popcon.ent"      > %popcon;
 <!ENTITY % datadate1      SYSTEM "datadatepop.ent" > %datadate1;
 <!ENTITY % pkgsize        SYSTEM "pkgsize.ent"     > %pkgsize;
 <!ENTITY % datadate2      SYSTEM "datadatesize.ent"> %datadate2;
 <!ENTITY % urlsdata       SYSTEM "urls.ent"        > %urlsdata;
]>
<book lang="en">
  <bookinfo>
    <title>Debian Reference</title>
    <author>
      <firstname>Osamu</firstname>
      <surname>Aoki</surname>
    </author>
    <authorinitials>OA</authorinitials>
    <abstract>
      <para>This book is free; you may redistribute it and/or modify it under the terms of the GNU General Public License of any version compliant to the Debian Free Software Guidelines (DFSG).</para>
    </abstract>
    <copyright>
      <year>2007-2009</year>
      <holder>Osamu Aoki</holder>
    </copyright>
    <legalnotice>
      <para>This Debian Reference (v2) (&build-date;) is intended to provide a broad overview of the Debian system as a post-installation user's guide. It covers many aspects of system administration through shell-command examples for non-developers.</para>
    </legalnotice>
  </bookinfo>
  <preface id="_preface">
    <title>Preface</title>
    <simpara>This <ulink url="&debianreferenceversionc;">Debian Reference (version 2)</ulink> (&build-date;) is intended to provide a broad overview of Debian system administration as a post-installation user guide.</simpara>
    <simpara>The target reader is someone who is willing to learn shell scripts but who is not ready to read all the C sources to figure out how the <ulink url="&gnu;">GNU</ulink>/<ulink url="&linux;">Linux</ulink> system works.</simpara>
    <section id="_disclaimer">
      <title>Disclaimer</title>
      <simpara>All warranties are disclaimed.  All trademarks are property of their respective trademark owners.</simpara>
      <simpara>The Debian system itself is a moving target.  This makes its documentation difficult to be current and correct.  Although the current unstable version of Debian system was used as the basis for writing this, some contents may be already outdated by the time you read this.</simpara>
      <simpara>Please treat this document as the secondary reference. This document does not replace any authoritative guides. The author and contributors do not take responsibility for consequences of errors, omissions or ambiguity in this document.</simpara>
    </section>
    <section id="_what_is_debian">
      <title>What is Debian</title>
      <simpara>The <ulink url="&debianproject;">Debian Project</ulink> is an association of individuals who have made common cause to create a free operating system.  It's distribution is characterized by:</simpara>
      <itemizedlist>
        <listitem>
          <simpara>
Commitment to the software freedom: <ulink url="&debiansocialcontreguidelinesdfsg;">Debian Social Contract and Debian Free Software Guidelines (DFSG)</ulink>.
</simpara>
        </listitem>
        <listitem>
          <simpara>
Internet based distributed unpaid volunteer effort: <ulink url="&httpwwwdebianorg;">http://www.debian.org</ulink>
</simpara>
        </listitem>
        <listitem>
          <simpara>
Large number of pre-compiled high quality softwares.
</simpara>
        </listitem>
        <listitem>
          <simpara>
Focus on stability and security with easy access to the security updates.
</simpara>
        </listitem>
        <listitem>
          <simpara>
Focus on smooth upgrade to latest softwares with <literal>unstable</literal> and <literal>testing</literal> archives.
</simpara>
        </listitem>
        <listitem>
          <simpara>
Large number of supported hardware architectures.
</simpara>
        </listitem>
      </itemizedlist>
      <simpara>Free Software pieces in Debian come from <ulink url="&gnu;">GNU</ulink>, <ulink url="&linux;">Linux</ulink>, <ulink url="&bsd;">BSD</ulink>, <ulink url="&x;">X</ulink>, <ulink url="&isc;">ISC</ulink>, <ulink url="&apache;">Apache</ulink>, <ulink url="&ghostscript;">Ghostscript</ulink>, <ulink url="&commonunixprintingsystem;">Common Unix Printing System </ulink>, <ulink url="&samba;">Samba</ulink>, <ulink url="&gnome;">GNOME</ulink>, <ulink url="&kde;">KDE</ulink>, <ulink url="&mozilla;">Mozilla</ulink>, <ulink url="&openofficeorg;">OpenOffice.org</ulink>, <ulink url="&vim;">Vim</ulink>, <ulink url="&tex;">TeX</ulink>, <ulink url="&latex;">LaTeX</ulink>, <ulink url="&docbook;">DocBook</ulink>, <ulink url="&perl;">Perl</ulink>, <ulink url="&python;">Python</ulink>, <ulink url="&tcl;">Tcl</ulink>, <ulink url="&java;">Java</ulink>, <ulink url="&ruby;">Ruby</ulink>, <ulink url="&php;">PHP</ulink>, <ulink url="&berkeleydb;">Berkeley DB</ulink>, <ulink url="&mysql;">MySQL</ulink>, <ulink url="&postgresql;">PostgreSQL</ulink>, <ulink url="&exim;">Exim</ulink>, <ulink url="&postfix;">Postfix</ulink>, <ulink url="&mutt;">Mutt</ulink>, <ulink url="&freebsd;">FreeBSD</ulink>, <ulink url="&openbsd;">OpenBSD</ulink>, <ulink url="&planj;">Plan 9</ulink> and many more independent free software projects.  Debian integrates this diversity of Free Software into one system.</simpara>
    </section>
    <section id="_about_this_document">
      <title>About this document</title>
      <section id="_guiding_rules">
        <title>Guiding rules</title>
        <simpara>Following guiding rules were followed while compiling this document:</simpara>
        <itemizedlist>
          <listitem>
            <simpara>
don't explain in details what is well documented elsewhere (in the judgment of the author)
</simpara>
          </listitem>
          <listitem>
            <simpara>
Provide overview and skip corner cases (<emphasis role="strong">Big Picture</emphasis>)
</simpara>
          </listitem>
          <listitem>
            <simpara>
Keep It Short and Simple. (<emphasis role="strong">KISS</emphasis>)
</simpara>
          </listitem>
          <listitem>
            <simpara>
Focus on non-GUI tools and consoles. (Use <emphasis role="strong">shell examples</emphasis>)
</simpara>
          </listitem>
          <listitem>
            <simpara>
Do not reinvent the wheel. (Use pointers to <emphasis role="strong">the existing references</emphasis>)
</simpara>
          </listitem>
          <listitem>
            <simpara>
Be objective. (Use <ulink url="&popcon;">popcon</ulink> etc.)
</simpara>
          </listitem>
        </itemizedlist>
        <tip>
          <simpara>I tried to elucidate hierarchical aspects and lower levels of the system.</simpara>
        </tip>
      </section>
      <section id="_prerequisites">
        <title>Prerequisites</title>
        <warning>
          <simpara>You are expected to make good efforts to seek answers by yourself beyond this documentation.  This document only gives efficient starting points.</simpara>
        </warning>
        <simpara>You are required to seek help from (in approximate order of importance, starting with the most important sources):</simpara>
        <itemizedlist>
          <listitem>
            <simpara>
the Debian site at <ulink url="&httpwwwdebianorg;">http://www.debian.org</ulink> for the general information,
</simpara>
          </listitem>
          <listitem>
            <simpara>
the documentation under the "<literal>/usr/share/doc/&lt;package_name&gt;</literal>" directory,
</simpara>
          </listitem>
          <listitem>
            <simpara>
the Unix style <emphasis role="strong">manpage</emphasis>: "<literal>dpkg -L &lt;package_name&gt; |grep '/man/man.*/'</literal>",
</simpara>
          </listitem>
          <listitem>
            <simpara>
the GNU style <emphasis role="strong">info page</emphasis>: "<literal>dpkg -L &lt;package_name&gt; |grep '/info/'</literal>",
</simpara>
          </listitem>
          <listitem>
            <simpara>
the bug report: <ulink url="&httpbugsdebianorgpackage_name;">http://bugs.debian.org/&lt;package_name&gt;</ulink>,
</simpara>
          </listitem>
          <listitem>
            <simpara>
the Debian Wiki at <ulink url="&httpwikidebianorg;">http://wiki.debian.org/</ulink> for the moving and specific topics,
</simpara>
          </listitem>
          <listitem>
            <simpara>
the HOWTOs from The Linux Documentation Project (TLDP) at <ulink url="&httptldporg;">http://tldp.org/</ulink> ,
</simpara>
          </listitem>
          <listitem>
            <simpara>
the Single UNIX Specification from the Open Group's The UNIX System Home Page at <ulink url="&httpwwwunixorg;">http://www.unix.org/</ulink> , and
</simpara>
          </listitem>
          <listitem>
            <simpara>
the free encyclopedia from Wikipedia at <ulink url="&httpwikipediaorg;">http://wikipedia.org/</ulink>.
</simpara>
          </listitem>
        </itemizedlist>
        <note>
          <simpara>For detailed documentation, you may need to install the corresponding documentation package named with "<literal>-doc</literal>" as its suffix.</simpara>
        </note>
      </section>
      <section id="_conventions">
        <title>Conventions</title>
        <simpara>This document provides information through the following simplified presentation style with <literal>bash</literal>(1) shell command examples and bullets:</simpara>
        <screen># &lt;command in root account&gt;
$ &lt;command in user account&gt;</screen>
        <itemizedlist>
          <listitem>
            <simpara>
&lt;description of action&gt;
</simpara>
          </listitem>
        </itemizedlist>
        <simpara>These shell prompts distinguish account used and correspond to set environment variables as: "<literal>PS1='\$'</literal>" and "<literal>PS2=' '</literal>".  These values are chosen for the sake of readability of this document and are not typical on actual installed system.</simpara>
        <note>
          <simpara>See the meaning of the "<literal>$PS1</literal>" and "<literal>$PS2</literal>" environment variables in <literal>bash</literal>(1).</simpara>
        </note>
        <simpara>A <emphasis role="strong">command snippet</emphasis> quoted in a text paragraph is referred by the typewriter font between double quotation marks, such as "<literal>aptitude safe-upgrade</literal>".</simpara>
        <simpara>A <emphasis role="strong">text data</emphasis> from a configuration file quoted in a text paragraph is referred by the typewriter font between double quotation marks, such as "<literal>deb-src</literal>".</simpara>
        <simpara>A <emphasis role="strong">command</emphasis> is referred by its name in the typewriter font optionally followed by its manpage section number in parenthesis, such as <literal>bash</literal>(1).  You are encouraged to obtain information by typing:</simpara>
        <screen>$ man 1 bash</screen>
        <simpara>A <emphasis role="strong">manpage</emphasis> is referred by its name in the typewriter font followed by its manpage section number in parenthesis, such as <literal>sources.list</literal>(5).   You are encouraged to obtain information by typing:</simpara>
        <screen>$ man 5 sources.list</screen>
        <simpara>An <emphasis role="strong">info page</emphasis> is referred by its command snippet in the typewriter font between double quotation marks, such as "<literal>info make</literal>".  You are encouraged to obtain information by typing:</simpara>
        <screen>$ info make</screen>
        <simpara>A <emphasis role="strong">filename</emphasis> is referred by the typewriter font between double quotation marks, such as "<literal>/etc/passwd</literal>".  For configuration files, you are encouraged to obtain information by typing:</simpara>
        <screen>$ sensible-pager "/etc/passwd"</screen>
        <simpara>A <emphasis role="strong">directory name</emphasis> is referred by the typewriter font between double quotation marks, such as "<literal>/etc/init.d/</literal>".  You are encouraged to explore its contents by typing:</simpara>
        <screen>$ mc "/etc/init.d/"</screen>
        <simpara>A <emphasis role="strong">package name</emphasis> is referred by its name in the typewriter font, such as <literal>vim</literal>.  You are encouraged to obtain information by typing:</simpara>
        <screen>$ dpkg -L vim
$ apt-cache show vim
$ aptitude show vim</screen>
        <simpara>A <emphasis role="strong">documentation</emphasis> may indicate its location by the filename in the typewriter font between double quotation marks, such as "<literal>/usr/share/doc/sysv-rc/README.runlevels.gz</literal>" and "<literal>/usr/share/doc/base-passwd/users-and-groups.html</literal>"; or by its <ulink url="&url;">URL</ulink>, such as <ulink url="&httpwwwdebianorg;">http://www.debian.org</ulink>.  You are encouraged to read the documentation by typing:</simpara>
        <screen>$ zcat "/usr/share/doc/sysv-rc/README.runlevels.gz" | sensible-pager
$ sensible-browser "/usr/share/doc/base-passwd/users-and-groups.html"
$ sensible-browse "http://www.debian.org"</screen>
        <simpara>An <emphasis role="strong">environment variable</emphasis> is referred by its name with leading "<literal>$</literal>" in the typewriter font between double quotation marks, such as "<literal>$TERM</literal>".  You are encouraged to obtain its current value by typing:</simpara>
        <screen>$ echo "$TERM"</screen>
      </section>
      <section id="_the_popcon">
        <title>The popcon</title>
        <simpara>The <ulink url="&popcon;">popcon</ulink> data is presented as the objective measure for the popularity of each package.  It was downloaded on &pop-date; and contains the total submission of &pop-submissions; reports over &pop-packages; binary packages and &pop-architectures; architectures.</simpara>
        <note>
          <simpara>Please note that the <literal>&arch;</literal> <literal>unstable</literal> archive contains only &all-packages; packages currently.  The popcon data contains reports from many old system installations.</simpara>
        </note>
        <simpara>The popcon number preceded with "V:" for "votes" is calculated by "100 * (the popcon submissions for the package executed recently on the PC)/(the total popcon submissions)".</simpara>
        <simpara>The popcon number preceded with "I:"  for "installs" is calculated by "100 * (the popcon submissions for the package installed on the PC)/(the total popcon submissions)".</simpara>
        <note>
          <simpara>The popcon figures should not be considered as absolute measures of the importance of packages.  There are many factors which can skew statistics.  For example, some system participating popcon may have mounted directories such as "<literal>/bin</literal>" with "<literal>noatime</literal>" option for system performance improvement and effectively disabled "vote" from such system.</simpara>
        </note>
      </section>
      <section id="_the_package_size">
        <title>The package size</title>
        <simpara>The package size data is also presented as the objective measure for each package.  It is based on the "<literal>Installed-Size:</literal>" reported by "<literal>apt-cache show</literal>" or "<literal>aptitude show</literal>" command (currently on <literal>&arch;</literal> architecture for the <literal>unstable</literal> release).  The reported size is in KiB (<ulink url="&kibibyte;">Kibibyte</ulink> = unit for 1024 bytes).</simpara>
        <note>
          <simpara>A package with a small numerical package size may indicate that the package in the <literal>unstable</literal> release is a dummy package which installs other packages with significant contents by the dependency.  The dummy package enables a smooth transition or split of the package.</simpara>
        </note>
      </section>
      <section id="_bug_reports">
        <title>Bug reports</title>
        <simpara>Please file bug reports on the <literal>debian-reference</literal> package using <literal>reportbug</literal>(1) if you find any issues. Please include correction suggestion by "<literal>diff -u</literal>" to the plain text version or to the source.</simpara>
      </section>
    </section>
    <section id="_some_quotes_for_new_users">
      <title>Some quotes for new users</title>
      <simpara>Here are some interesting quotes from the Debian mailing list which may help enlighten new users:</simpara>
      <itemizedlist>
        <listitem>
          <simpara>
"This is Unix.  It gives you enough rope to hang yourself."  --- Miquel van Smoorenburg <literal>&lt;miquels at cistron.nl&gt;</literal>
</simpara>
        </listitem>
        <listitem>
          <simpara>
"Unix IS user friendly…  It's just selective about who its friends are." --- Tollef Fog Heen <literal>&lt;tollef at add.no&gt;</literal>
</simpara>
        </listitem>
      </itemizedlist>
    </section>
  </preface>
  <chapter id="_gnu_linux_tutorials">
    <title>GNU/Linux tutorials</title>
    <simpara>I think learning a computer system is like learning a new foreign language.  Although tutorial books and documentation are helpful, you have to practice it yourself.  In order to help you get started smoothly, I will elaborate a few basic points.</simpara>
    <simpara>The powerful design of <ulink url="&debian;">Debian</ulink> <ulink url="&gnu;">GNU</ulink>/<ulink url="&linux;">Linux</ulink> comes from the <ulink url="&unix;">Unix</ulink> operating system, i.e., a <ulink url="&multiuser;">multiuser</ulink>, <ulink url="&multitasking;">multitasking</ulink> operating system.  You must learn to take advantage of the power of these features and similarities between Unix and GNU/Linux.</simpara>
    <simpara>Don't shy away from Unix oriented texts and don't rely solely on GNU/Linux texts, as this will rob you of much useful information.</simpara>
    <simpara>"<ulink url="&ruteuserstutorialandexposition;">Rute User's Tutorial and Exposition</ulink>", in the Debian non-free archive as the <literal>rutebook</literal> package (popcon: &pop-rutebook;), provides a good online resource to the generic system administration.</simpara>
    <note>
      <simpara>If you have been using any <ulink url="&unixlike;">Unix-like</ulink> system for a while with command line tools, you probably know everything I explain here.  Please use this as a reality check and refresher.</simpara>
    </note>
    <section id="_console_basics">
      <title>Console basics</title>
      <section id="_the_shell_prompt">
        <title>The shell prompt</title>
        <simpara>Upon starting the system, you are presented with the character based login screen if you did not install <ulink url="&xwindowsystem;">X Window System</ulink> with the display manager such as <literal>gdm</literal>. Suppose your hostname is <literal>foo</literal>, the login prompt looks like:</simpara>
        <screen>foo login:</screen>
        <simpara>If you did install a <ulink url="&gui;">GUI</ulink> environment such as <ulink url="&gnome;">GNOME</ulink> or <ulink url="&kde;">KDE</ulink>, then you can get to a login prompt by Ctrl-Alt-F1, and you can return to the GUI environment via Alt-F7 (see <xref linkend="_virtual_consoles"/> below for more).</simpara>
        <simpara>At the login prompt, you type your username, e.g. <literal>penguin</literal>, and press the Enter-key, then type your password and press the Enter-key again.</simpara>
        <note>
          <simpara>Following the Unix tradition, the username and password of the Debian system are case sensitive.  The username is usually chosen only from the lowercase.  The first user account is usually created during the installation.  Additional user accounts can be created with <literal>adduser</literal>(8) by root.</simpara>
        </note>
        <simpara>The system starts with the greeting message stored in "<literal>/etc/motd</literal>" (Message Of The Day) and with the command prompt as:</simpara>
        <screen>Debian GNU/Linux lenny/sid foo tty1
foo login: penguin
Password:
Last login: Sun Apr 22 09:29:34 2007 on tty1
Linux snoopy 2.6.20-1-amd64 #1 SMP Sun Apr 15 20:25:49 UTC 2007 x86_64

The programs included with the Debian GNU/Linux system are free software;
the exact distribution terms for each program are described in the
individual files in /usr/share/doc/*/copyright.

Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent
permitted by applicable law.
foo:~$</screen>
        <simpara>Here, the main part of the greeting message can be customized by editing the "<literal>/etc/motd.tail</literal>" file. The first line is generated from the system information using "<literal>uname -snrvm</literal>".</simpara>
        <simpara>Now you are in the <ulink url="&shell;">shell</ulink>. The shell interprets your commands.</simpara>
      </section>
      <section id="_the_shell_prompt_under_x">
        <title>The shell prompt under X</title>
        <simpara>If you installed <ulink url="&xwindowsystem;">X Window System</ulink> with a display manager such as <ulink url="&gnome;">GNOME</ulink>'s <literal>gdm</literal> by selecting "Desktop environment" task during the installation, you will be presented with the graphical login screen upon starting your system.  You type your username and your password to login to the non-privileged user account.  Use tab to navigate between username and password, or use the mouse and primary click.</simpara>
        <simpara>You can gain the shell prompt under X by starting a <literal>x-terminal-emulator</literal> program such as <literal>gnome-terminal</literal>(1), <literal>rxvt</literal>(1) or <literal>xterm</literal>(1).  Under the GNOME Desktop environment, clicking "Applications" → "Accessories" → "Terminal" does the trick.</simpara>
        <simpara>You can also see the section below <xref linkend="_virtual_consoles"/>.</simpara>
        <simpara>Under some other Desktop systems (like <literal>fluxbox</literal>), there may be no obvious starting point for the menu.  If this happens, just try (right) clicking the center of the screen and hope for a menu to pop-up.</simpara>
      </section>
      <section id="_the_root_account">
        <title>The root account</title>
        <simpara>The root account is also called <ulink url="&superuser;">superuser</ulink> or privileged user.  From this account, you can perform the following system administration activities:</simpara>
        <itemizedlist>
          <listitem>
            <simpara>
read, write, and remove any files on the system irrespective of their file permissions
</simpara>
          </listitem>
          <listitem>
            <simpara>
set file ownership and permissions of any files on the system
</simpara>
          </listitem>
          <listitem>
            <simpara>
set the password of any non-privileged users on the system
</simpara>
          </listitem>
          <listitem>
            <simpara>
login to any accounts without their passwords
</simpara>
          </listitem>
        </itemizedlist>
        <simpara>This unlimited power of root account requires you to be considerate and responsible when using it.</simpara>
        <warning>
          <simpara>Never share the root password with others.</simpara>
        </warning>
        <note>
          <simpara>File permissions of a file (including hardware devices such as CD-ROM etc. which are just another file for the Debian system) may render it unusable or inaccessible by non-root users.  Although the use of root account is a quick way to test this kind of situation, its resolution should be done through proper setting of file permissions and user's group membership (see <xref linkend="_filesystem_permissions"/>).</simpara>
        </note>
      </section>
      <section id="_the_root_shell_prompt">
        <title>The root shell prompt</title>
        <simpara>Here are a few basic methods to gain the root shell prompt by using the root password:</simpara>
        <itemizedlist>
          <listitem>
            <simpara>
At the character based login prompt, you simply type <literal>root</literal>.
</simpara>
          </listitem>
          <listitem>
            <simpara>
Under the GNOME Desktop environment, click "Applications" → "Accessories" → "Root Terminal".
</simpara>
          </listitem>
          <listitem>
            <simpara>
From any user shell prompt, type "<literal>su -l</literal>".  (This does not preserve the environment of the current user)
</simpara>
          </listitem>
          <listitem>
            <simpara>
From any user shell prompt, type "<literal>su</literal>". (This preserves some of the environment of the current user)
</simpara>
          </listitem>
        </itemizedlist>
      </section>
      <section id="_gui_system_administration_tools">
        <title>GUI system administration tools</title>
        <simpara>When your desktop menu does not start GUI system administration tools automatically with the appropriate privilege, you can start them from the root shell prompt of the X terminal emulator, such as <literal>gnome-terminal</literal>(1), <literal>rxvt</literal>(1), or <literal>xterm</literal>(1). See <xref linkend="_the_root_shell_prompt"/> and <xref linkend="_running_x_clients_as_root"/>.</simpara>
        <warning>
          <simpara>Never start the X display/session manager under the root account by typing in <literal>root</literal> to the prompt of the display manager such as <literal>gdm</literal>(1).</simpara>
        </warning>
        <warning>
          <simpara>Never run untrusted remote GUI program under X window when critical information is displayed since it may eavesdrop your X screen.</simpara>
        </warning>
      </section>
      <section id="_virtual_consoles">
        <title>Virtual consoles</title>
        <simpara>In the default Debian system, there are six switchable <ulink url="&vtbaalike;">VT100-like</ulink> character consoles available to start the command shell directly on the Linux host.  Unless you are in a GUI environment, you can switch between the virtual consoles by pressing the <literal>Left-Alt-key</literal> and one of the <literal>F1</literal> — <literal>F6</literal> keys simultaneously.  Each character console allows independent login to the account and offers the multiuser environment.  This multiuser environment is a great Unix feature, and very addictive.</simpara>
        <simpara>If you are under the X Window System, you gain access to the character console 1 by pressing <literal>Ctrl-Alt-F1</literal> key, i.e., the <literal>left-Ctrl-key</literal>, the <literal>left-Alt-key</literal>, and the <literal>F1-key</literal> are pressed together.   You can get back to the X Window System, normally running on the virtual console 7, by pressing <literal>Alt-F7</literal>.</simpara>
        <simpara>You can alternatively change to another virtual console, e.g. to the console 1, by the command:</simpara>
        <screen># chvt 1</screen>
      </section>
      <section id="_how_to_leave_the_command_prompt">
        <title>How to leave the command prompt</title>
        <simpara>You type <literal>Ctrl-D</literal>, i.e., the <literal>left-Ctrl-key</literal> and the <literal>d-key</literal> pressed together, at the command prompt to close the shell activity.  If you are at the character console, you will return to the login prompt with this.  Even though these control characters are referred as "control D" with the upper case, you do not need to press the Shift-key. The short hand expression, <literal>^D</literal>, is also used for <literal>Ctrl-D</literal>.  Alternately, you can type "exit".</simpara>
        <simpara>If you are at <literal>x-terminal-emulator</literal>(1), you can close <literal>x-terminal-emulator</literal> window with this.</simpara>
      </section>
      <section id="_how_to_shutdown_the_system">
        <title>How to shutdown the system</title>
        <simpara>Just like any other modern OS where the file operation involves <ulink url="&cachingdata;">caching data</ulink> in memory for improved performance, the Debian system needs the proper shutdown procedure before power can safely be turned off. This is to maintain the integrity of files, by forcing all changes in memory to be written to disk. If the software power control is available, the shutdown procedure automatically turns off power of the system. (Otherwise, you may have to press power button for few seconds after the shutdown procedure.)</simpara>
        <simpara>Under the normal multiuser mode, use following from the root command prompt to shutdown the system:</simpara>
        <screen># shutdown -h now</screen>
        <simpara>Under the single-user mode, use following from the root command prompt to shutdown the system:</simpara>
        <screen># poweroff -i -f</screen>
        <simpara>Alternatively, you may type <literal>Ctrl-Alt-Delete</literal> (The <literal>left-Ctrl-key</literal>, the <literal>left-Alt-Key</literal>, and the <literal>Delete</literal> are pressed together) to shutdown if "<literal>/etc/inittab</literal>" contains "<literal>ca:12345:ctrlaltdel:/sbin/shutdown -t1 -a -h now</literal>" in it.  See <literal>inittab</literal>(5) for details.</simpara>
      </section>
      <section id="_recovering_a_sane_console">
        <title>Recovering a sane console</title>
        <simpara>When the screen goes berserk after doing some funny things such as "<literal>cat &lt;some-binary-file&gt;</literal>", type "<literal>reset</literal>" at the command prompt. You may not be able to see the command echoed as you type.  You may also issue "<literal>clear</literal>" to clean up the screen.</simpara>
      </section>
      <section id="_additional_package_suggestions_for_the_newbie">
        <title>Additional package suggestions for the newbie</title>
        <simpara>Although even the minimal installation of the Debian system without any desktop environment tasks provides the basic Unix functionality, it is a good idea to install few additional commandline and curses based character terminal packages such as <literal>mc</literal> and <literal>vim</literal> with <literal>aptitude</literal>(8) for beginners to get started.  From the shell prompt as root:</simpara>
        <screen># aptitude update
...
# aptitude install mc vim sudo
...</screen>
        <simpara>If you already had these packages installed, nothing will be installed.</simpara>
        <table id="listofinterestineprogrampackages" pgwide="0" frame="topbot" rowsep="1" colsep="1">
          <title>List of interesting text-mode program packages.</title>
          <tgroup cols="4">
            <colspec colwidth="20%*" align="left"/>
            <colspec colwidth="20%*" align="left"/>
            <colspec colwidth="20%*" align="left"/>
            <colspec colwidth="40%*" align="left"/>
            <thead>
              <row>
                <entry>
    package
    </entry>
                <entry>
    popcon
    </entry>
                <entry>
    size
    </entry>
                <entry>
    description
    </entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/mc">
                  <literal>mc</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/mc">&pop-mc;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/m/mc.html">&size-mc;</ulink></entry>
                <entry>
    A text-mode full-screen file manager
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/sudo">
                  <literal>sudo</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/sudo">&pop-sudo;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/s/sudo.html">&size-sudo;</ulink></entry>
                <entry>
    A program to allow limited root privileges to users
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/vim">
                  <literal>vim</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/vim">&pop-vim;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/v/vim.html">&size-vim;</ulink></entry>
                <entry>
    Unix text editor Vi IMproved, a programmers text editor (standard version)
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/vim-tiny">
                  <literal>vim-tiny</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/vim-tiny">&pop-vimtiny;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/v/vim-tiny.html">&size-vimtiny;</ulink></entry>
                <entry>
    Unix text editor Vi IMproved, a programmers text editor (compact version)
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/emacs21">
                  <literal>emacs21</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/emacs21">&pop-emacscb;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/e/emacs21.html">&size-emacscb;</ulink></entry>
                <entry>
    GNU project Emacs, the Lisp based extensible text editor (version 21)
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/emacs22">
                  <literal>emacs22</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/emacs22">&pop-emacscc;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/e/emacs22.html">&size-emacscc;</ulink></entry>
                <entry>
    GNU project Emacs, the Lisp based extensible text editor (version 22)
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/w3m">
                  <literal>w3m</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/w3m">&pop-wdm;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/w/w3m.html">&size-wdm;</ulink></entry>
                <entry>
    Text-mode WWW browsers
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/gpm">
                  <literal>gpm</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/gpm">&pop-gpm;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/g/gpm.html">&size-gpm;</ulink></entry>
                <entry>
    The Unix style cut-and-paste on the text console (daemon)
    </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
        <simpara>It may be a good idea to read some informative documentations.</simpara>
        <table id="listofinformativentationpackages" pgwide="0" frame="topbot" rowsep="1" colsep="1">
          <title>List of informative documentation packages.</title>
          <tgroup cols="4">
            <colspec colwidth="20%*" align="left"/>
            <colspec colwidth="20%*" align="left"/>
            <colspec colwidth="20%*" align="left"/>
            <colspec colwidth="40%*" align="left"/>
            <thead>
              <row>
                <entry>
    package
    </entry>
                <entry>
    popcon
    </entry>
                <entry>
    size
    </entry>
                <entry>
    description
    </entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/doc-debian">
                  <literal>doc-debian</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/doc-debian">&pop-docdebian;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/d/doc-debian.html">&size-docdebian;</ulink></entry>
                <entry>
    Debian Project documentation, (Debian FAQ) and other documents
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/debian-policy">
                  <literal>debian-policy</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/debian-policy">&pop-debianpolicy;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/d/debian-policy.html">&size-debianpolicy;</ulink></entry>
                <entry>
    Debian Policy Manual and related documents
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/developers-reference">
                  <literal>developers-reference</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/developers-reference">&pop-developersreference;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/d/developers-reference.html">&size-developersreference;</ulink></entry>
                <entry>
    Guidelines and information for Debian developers
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/maint-guide">
                  <literal>maint-guide</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/maint-guide">&pop-maintguide;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/m/maint-guide.html">&size-maintguide;</ulink></entry>
                <entry>
    Debian New Maintainers' Guide
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/debian-history">
                  <literal>debian-history</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/debian-history">&pop-debianhistory;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/d/debian-history.html">&size-debianhistory;</ulink></entry>
                <entry>
    History of the Debian Project
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/debian-faq">
                  <literal>debian-faq</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/debian-faq">&pop-debianfaq;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/d/debian-faq.html">&size-debianfaq;</ulink></entry>
                <entry>
    Debian FAQ
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/doc-linux-text">
                  <literal>doc-linux-text</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/doc-linux-text">&pop-doclinuxtext;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/d/doc-linux-text.html">&size-doclinuxtext;</ulink></entry>
                <entry>
    Linux HOWTOs and FAQ (text)
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/doc-linux-html">
                  <literal>doc-linux-html</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/doc-linux-html">&pop-doclinuxhtml;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/d/doc-linux-html.html">&size-doclinuxhtml;</ulink></entry>
                <entry>
    Linux HOWTOs and FAQ (html)
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/sysadmin-guide">
                  <literal>sysadmin-guide</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/sysadmin-guide">&pop-sysadminguide;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/s/sysadmin-guide.html">&size-sysadminguide;</ulink></entry>
                <entry>
    The Linux System Administrators' Guide
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/rutebook">
                  <literal>rutebook</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/rutebook">&pop-rutebook;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/r/rutebook.html">&size-rutebook;</ulink></entry>
                <entry>
    Linux: Rute User's Tutorial and Exposition (non-free)
    </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
        <simpara>You can install some of these packages by issuing the following command from the root shell prompt:</simpara>
        <screen># aptitude install package_name</screen>
      </section>
      <section id="_an_extra_user_account">
        <title>An extra user account</title>
        <simpara>If you do not want to use your main user account for the following training activities, you can create a training user account, e.g. <literal>fish</literal>.  Type at root shell prompt:</simpara>
        <screen># adduser fish</screen>
        <itemizedlist>
          <listitem>
            <simpara>
answer all the questions
</simpara>
          </listitem>
        </itemizedlist>
        <simpara>This will create a new account named as <literal>fish</literal>.  After your practice, you can remove this user account and its home directory by:</simpara>
        <screen># deluser --remove-home fish</screen>
      </section>
      <section id="_sudo_configuration">
        <title>sudo configuration</title>
        <simpara>For the typical single user workstation such as the desktop Debian system on the laptop PC, it is common to deploy simple configuration of <literal>sudo</literal>(8) as follows to let the non-privileged user, e.g. <literal>penguin</literal>, to gain administrative privilege just with his user password (not with the root password).</simpara>
        <screen># echo "penguin  ALL=(ALL) ALL" &gt;&gt; /etc/sudoers</screen>
        <simpara>This trick should only be used for the single user workstation which you administer and where you are the only user.</simpara>
        <warning>
          <simpara>Do not set up accounts of regular users on multiuser workstation like this because it would be very bad for system security.</simpara>
        </warning>
        <caution>
          <simpara>The password and the account of the <literal>penguin</literal> in the above example requires as much protection as the root password and the root account.</simpara>
        </caution>
        <caution>
          <simpara>Administrative privilege in this context belongs to someone authorized to perform the system administration task on the workstation.  Never give some manager in the Admin department of your company or your boss such privilege unless they are authorized and capable.</simpara>
        </caution>
        <note>
          <simpara>For providing access privilege to limited devices and limited files, you should consider to use <emphasis role="strong">group</emphasis> to provide limited access instead of using the <literal>root</literal> privilege via <literal>sudo</literal>(8).</simpara>
        </note>
        <note>
          <simpara>With more thoughtful and careful configuration, <literal>sudo</literal>(8) can grant limited administrative privileges to other users on a shared system without sharing the root password.  This can help with accountability with hosts with multiple administrators so you can tell who did what.  On the other hand, you might not want anyone else to have such privileges.</simpara>
        </note>
      </section>
      <section id="_play_time">
        <title>Play time</title>
        <simpara>Now you are ready to play with the Debian system without risks as long as you use the non-privileged user account.</simpara>
        <simpara>This is because the Debian system is, even after the default installation, configured with proper file permissions which prevent non-privileged users from damaging the system.  Of course, there may still be some holes which can be exploited but those who worry about these issues should not be reading this section but should be reading <ulink url="&securingdebianmanual;">Securing Debian Manual</ulink>.</simpara>
        <simpara>We will learn the Debian system as a <ulink url="&unixlike;">Unix-like</ulink> system with:</simpara>
        <itemizedlist>
          <listitem>
            <simpara><xref linkend="_unix_like_filesystem"/> (basic concept),
</simpara>
          </listitem>
          <listitem>
            <simpara><xref linkend="_midnight_commander_mc"/> (survival method),
</simpara>
          </listitem>
          <listitem>
            <simpara><xref linkend="_the_basic_unix_like_work_environment"/> (basic method),
</simpara>
          </listitem>
          <listitem>
            <simpara><xref linkend="_the_simple_shell_command"/> (shell mechanism), and
</simpara>
          </listitem>
          <listitem>
            <simpara><xref linkend="_unix_like_text_processing"/> (text processing method).
</simpara>
          </listitem>
        </itemizedlist>
      </section>
    </section>
    <section id="_unix_like_filesystem">
      <title>Unix-like filesystem</title>
      <simpara>In GNU/Linux and other <ulink url="&unixlike;">Unix-like</ulink> operating systems, <ulink url="&files;">files</ulink> are organized into <ulink url="&directories;">directories</ulink>.  All files and directories are arranged in one big tree rooted at "<literal>/</literal>". It's called a tree because if you draw the file system, it looks like a tree (upside down).</simpara>
      <simpara>These files and directories can be spread out over several devices. <literal>mount</literal>(8) serves to attach the file system found on some device to the big file tree.  Conversely, <literal>umount</literal>(8) will detach it again.  On recent Linux kernels, <literal>mount</literal>(8) with some options can bind part of a file tree somewhere else or can mount filesystem as shared, private, slave, or unbindable.  Supported mount options for each filesystem are available in "<literal>/share/doc/linux-doc-2.6.*/Documentation/filesystems/</literal>".</simpara>
      <simpara><emphasis role="strong">Directories</emphasis> on Unix systems are called <emphasis role="strong">folders</emphasis> on some other systems.  Please also note that there is no concept for <emphasis role="strong">drive</emphasis> such as "<literal>A:</literal>" on any Unix system.  There is one file system, and everything is included. This is a huge advantage compared to Windows.</simpara>
      <section id="_unix_file_basics">
        <title>Unix file basics</title>
        <simpara>Here are Unix file basics:</simpara>
        <itemizedlist>
          <listitem>
            <simpara>
Filenames are <emphasis role="strong">case sensitive</emphasis>.  That is, "<literal>MYFILE</literal>" and "<literal>MyFile</literal>" are different files.
</simpara>
          </listitem>
          <listitem>
            <simpara>
The <emphasis role="strong">root directory</emphasis> means root of the filesystem referred as simply "<literal>/</literal>".  Don't confuse this with the home directory for the root user: "<literal>/root</literal>".
</simpara>
          </listitem>
          <listitem>
            <simpara>
Every directory has a name which can contain any letters or symbols <emphasis role="strong">except "<literal>/</literal>"</emphasis>.  The root directory is an exception; its name is "<literal>/</literal>" (pronounced "slash" or "the root directory") and it cannot be renamed.
</simpara>
          </listitem>
          <listitem>
            <simpara>
Each file or directory is designated by a <emphasis role="strong">fully-qualified filename</emphasis>, <emphasis role="strong">absolute filename</emphasis>, or <emphasis role="strong">path</emphasis>, giving the sequence of directories which must be passed through to reach it.  The three terms are synonymous.
</simpara>
          </listitem>
          <listitem>
            <simpara>
All <emphasis role="strong">fully-qualified filenames</emphasis> begin with the "<literal>/</literal>" directory, and there's a "<literal>/</literal>" between each directory or file in the filename.  The first "<literal>/</literal>" is the top level directory, and the other "<literal>/</literal>"'s separate successive subdirectories, until we reach the last entry which is the name of the actual file.  The words used here can be confusing.  Take the following  <emphasis role="strong">fully-qualified filename</emphasis> as an example: "<literal>/usr/share/keytables/us.map.gz</literal>".  However, people will also refer to its basename "<literal>us.map.gz</literal>" alone as a filename.
</simpara>
          </listitem>
          <listitem>
            <simpara>
The root directory has a number of branches, such as "<literal>/etc/</literal>" and "<literal>/usr/</literal>".  These subdirectories in turn branch into still more subdirectories, such as "<literal>/etc/init.d/</literal>" and "<literal>/usr/local/</literal>".  The whole thing viewed collectively is called the <emphasis role="strong">directory tree</emphasis>.  You can think of an absolute filename as a route from the base of the tree ("<literal>/</literal>") to the end of some branch (a file).  You will also hear people talk about the directory tree as if it were a <emphasis role="strong">family</emphasis> tree: thus subdirectories have <emphasis role="strong">parents</emphasis>, and a path shows the complete ancestry of a file.  There are also relative paths that begin somewhere other than the root directory.  You should remember that the directory "<literal>../</literal>" refers to the parent directory.  This terminology also applies to other directory like structures, such as hierarchical data structures.
</simpara>
          </listitem>
          <listitem>
            <simpara>
There's no special directory path name component that corresponds to a physical device, such as your hard disk.  This differs from <ulink url="&rtbb;">RT-11</ulink>, <ulink url="&cpm;">CP/M</ulink>, <ulink url="&openvms;">OpenVMS</ulink>, <ulink url="&msdos;">MS-DOS</ulink>, <ulink url="&amigaos;">AmigaOS</ulink>, and <ulink url="&microsoftwindows;">Microsoft Windows</ulink>, where the path contains a device name such as "<literal>C:\</literal>".  (However, directory entries do exist that refer to physical devices as a part of the normal filesystem.  See <xref linkend="_filesystem_internals"/>.)
</simpara>
          </listitem>
        </itemizedlist>
        <note>
          <simpara>While you <emphasis role="strong">can</emphasis> use almost any letters or symbols in a file name, in practice it is a bad idea to do so.  It is better to avoid any characters that often have special meanings on the command line, including spaces, tabs, newlines, and other special characters: <literal>{ } ( ) [ ] ' ` " \ / &gt; &lt; | ; ! # &amp; ^ * % @ $</literal> .  If you want to separate words in a name, good choices are the period, hyphen, and underscore.  You could also capitalize each word, "<literal>LikeThis</literal>". Experienced Linux users tend to avoid spaces in filenames.</simpara>
        </note>
        <note>
          <simpara>The word "root" can mean either "root user" or "root directory".  The context of their usage should make it clear.</simpara>
        </note>
        <note>
          <simpara>The word <emphasis role="strong">path</emphasis> is used not only for <emphasis role="strong">fully-qualified filename</emphasis> as above but also for the <emphasis role="strong">command search path</emphasis>.  The intended meaning is usually clear from the context.</simpara>
        </note>
        <simpara>The detailed best practices for the file hierarchy are described in the Filesystem Hierarchy Standard ("<literal>/usr/share/doc/debian-policy/fhs/fhs-2.3.txt.gz</literal>" and <literal>hier</literal>(7)).  You should remember the following facts as the starter:</simpara>
        <table id="listofusageofkeydirectories" pgwide="0" frame="topbot" rowsep="1" colsep="1">
          <title>List of usage of key directories.</title>
          <tgroup cols="2">
            <colspec colwidth="30%*" align="left"/>
            <colspec colwidth="70%*" align="left"/>
            <thead>
              <row>
                <entry>
    directory
    </entry>
                <entry>
    usage
    </entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry>
                  <literal>/</literal>
                </entry>
                <entry>
    A simple "<literal>/</literal>" represents the root directory.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>/etc/</literal>
                </entry>
                <entry>
    This is the place for the system wide configuration files.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>/var/log/</literal>
                </entry>
                <entry>
    This is the place for the system log files.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>/home/</literal>
                </entry>
                <entry>
    This is the directory which contains all the home directories for all non-privileged users.
    </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
      </section>
      <section id="_filesystem_internals">
        <title>Filesystem internals</title>
        <simpara>Following the <emphasis role="strong">Unix tradition</emphasis>, the Debian GNU/Linux system provides the <ulink url="&filesystem;">filesystem</ulink> under which physical data on harddisks and other storage devices reside, and the interaction with the hardware devices such as console screens and remote serial consoles are represented in an unified manner under "<literal>/dev/</literal>".</simpara>
        <simpara>Each file, directory, named pipe (a way two programs can share data), or physical device on a Debian GNU/Linux system has a data structure called an <ulink url="&inode;">inode</ulink> which describes its associated attributes such as the user who owns it (owner), the group that it belongs to, the time last accessed, etc.  If you are really interested, see "<literal>/usr/include/linux/fs.h</literal>" for the exact definition of "<literal>struct inode</literal>" in the Debian GNU/Linux system. The idea of representing just about everything in the file system was a Unix innovation, and modern Linux kernels have developed this idea ever further. Now, even information about processes running in the computer can be found in the file system.</simpara>
        <simpara>This abstract and unified representation of physical entities and internal processes is very powerful since this allows us to use the same command for the same kind of operation on many totally different devices. It is even possible to change the way the kernel works by writing data to special files that are linked to running processes.</simpara>
        <tip>
          <simpara>If you need to identify the correspondence between the file tree and the physical entity, execute <literal>mount</literal>(8) with no arguments.</simpara>
        </tip>
      </section>
      <section id="_filesystem_permissions">
        <title>Filesystem permissions</title>
        <simpara><ulink url="&filesystempermissions;">Filesystem permissions</ulink> of <ulink url="&unixlike;">Unix-like</ulink> system are defined for three categories of affected users:</simpara>
        <itemizedlist>
          <listitem>
            <simpara>
the <emphasis role="strong">user</emphasis> who owns the file (<emphasis role="strong">u</emphasis>),
</simpara>
          </listitem>
          <listitem>
            <simpara>
other users in the <emphasis role="strong">group</emphasis> which the file belongs to (<emphasis role="strong">g</emphasis>), and
</simpara>
          </listitem>
          <listitem>
            <simpara>
all <emphasis role="strong">other</emphasis> users (<emphasis role="strong">o</emphasis>) also referred to as "world" and "everyone".
</simpara>
          </listitem>
        </itemizedlist>
        <simpara>For the file, each corresponding permission allows:</simpara>
        <itemizedlist>
          <listitem>
            <simpara><emphasis role="strong">read</emphasis> (<emphasis role="strong">r</emphasis>): to examine contents of the file,
</simpara>
          </listitem>
          <listitem>
            <simpara><emphasis role="strong">write</emphasis> (<emphasis role="strong">w</emphasis>): to modify the file, and
</simpara>
          </listitem>
          <listitem>
            <simpara><emphasis role="strong">execute</emphasis> (<emphasis role="strong">x</emphasis>): to run the file as a command.
</simpara>
          </listitem>
        </itemizedlist>
        <simpara>For the directory, each corresponding permission allows:</simpara>
        <itemizedlist>
          <listitem>
            <simpara><emphasis role="strong">read</emphasis> (<emphasis role="strong">r</emphasis>): to list contents of the directory,
</simpara>
          </listitem>
          <listitem>
            <simpara><emphasis role="strong">write</emphasis> (<emphasis role="strong">w</emphasis>): to add or remove files in the directory, and
</simpara>
          </listitem>
          <listitem>
            <simpara><emphasis role="strong">execute</emphasis> (<emphasis role="strong">x</emphasis>): to access files in the directory.
</simpara>
          </listitem>
        </itemizedlist>
        <simpara>Here, the <emphasis role="strong">execute</emphasis> permission on a directory means not only to allow reading of files in that directory but also to allow viewing their attributes, such as the size and the modification time.</simpara>
        <simpara><literal>ls</literal>(1) is used to display permission information (and more) for files and directories.  When it is invoked with the "<literal>-l</literal>" option, it displays the following information in the order given:</simpara>
        <itemizedlist>
          <listitem>
            <simpara>
the <emphasis role="strong">type of file</emphasis> (first character)
</simpara>
          </listitem>
          <listitem>
            <simpara>
the access <emphasis role="strong">permission</emphasis> of the file (nine characters, consisting of three characters each for user, group, and other in this order)
</simpara>
          </listitem>
          <listitem>
            <simpara>
the <emphasis role="strong">number of hard links</emphasis> to the file
</simpara>
          </listitem>
          <listitem>
            <simpara>
the name of the <emphasis role="strong">user</emphasis> who owns the file
</simpara>
          </listitem>
          <listitem>
            <simpara>
the name of the <emphasis role="strong">group</emphasis> which the file belongs to
</simpara>
          </listitem>
          <listitem>
            <simpara>
the <emphasis role="strong">size</emphasis> of the file in characters (bytes)
</simpara>
          </listitem>
          <listitem>
            <simpara>
the <emphasis role="strong">date and time</emphasis> of the file (mtime)
</simpara>
          </listitem>
          <listitem>
            <simpara>
the <emphasis role="strong">name</emphasis> of the file.
</simpara>
          </listitem>
        </itemizedlist>
        <table id="listofthefirstchacteroflsloutput" pgwide="0" frame="topbot" rowsep="1" colsep="1">
          <title>List of the first character of "<literal>ls -l</literal>" output</title>
          <tgroup cols="2">
            <colspec colwidth="30%*" align="left"/>
            <colspec colwidth="70%*" align="left"/>
            <thead>
              <row>
                <entry>
    character
    </entry>
                <entry>
    meaning
    </entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry>
                  <literal>-</literal>
                </entry>
                <entry>
    normal file
    </entry>
              </row>
              <row>
                <entry>
                  <literal>d</literal>
                </entry>
                <entry>
    directory
    </entry>
              </row>
              <row>
                <entry>
                  <literal>l</literal>
                </entry>
                <entry>
    symlink
    </entry>
              </row>
              <row>
                <entry>
                  <literal>c</literal>
                </entry>
                <entry>
    character device node
    </entry>
              </row>
              <row>
                <entry>
                  <literal>b</literal>
                </entry>
                <entry>
    block device node
    </entry>
              </row>
              <row>
                <entry>
                  <literal>p</literal>
                </entry>
                <entry>
    named pipe
    </entry>
              </row>
              <row>
                <entry>
                  <literal>s</literal>
                </entry>
                <entry>
    socket
    </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
        <simpara><literal>chown</literal>(1) is used from the root account to change the owner of the file.  <literal>chgrp</literal>(1) is used from the file's owner or root account to change the group of the file.  <literal>chmod</literal>(1) is used from the file's owner or root account to change file and directory access permissions.  Basic syntax to manipulate a <literal>foo</literal> file is:</simpara>
        <screen># chown &lt;newowner&gt; foo
# chgrp &lt;newgroup&gt; foo
# chmod  [ugoa][+-=][rwxXst][,...] foo</screen>
        <simpara>For example, in order to make a directory tree to be owned by a user <literal>foo</literal> and shared by a group <literal>bar</literal>, issue following commands from the root account:</simpara>
        <screen># cd /some/location/
# chown -R foo:bar .
# chmod -R ug+rwX,o=rX .</screen>
        <simpara>There are three more special permission bits:</simpara>
        <itemizedlist>
          <listitem>
            <simpara><emphasis role="strong">set user ID</emphasis> (<emphasis role="strong">s</emphasis> or <emphasis role="strong">S</emphasis> instead of user's <emphasis role="strong">x</emphasis>),
</simpara>
          </listitem>
          <listitem>
            <simpara><emphasis role="strong">set group ID</emphasis> (<emphasis role="strong">s</emphasis> or <emphasis role="strong">S</emphasis> instead of group's <emphasis role="strong">x</emphasis>), and
</simpara>
          </listitem>
          <listitem>
            <simpara><emphasis role="strong">sticky bit</emphasis> (<emphasis role="strong">t</emphasis> or <emphasis role="strong">T</emphasis> instead of other's <emphasis role="strong">x</emphasis>).
</simpara>
          </listitem>
        </itemizedlist>
        <simpara>Here the output of "<literal>ls -l</literal>" for these bits is <emphasis role="strong">capitalized</emphasis> if execution bits hidden by these outputs are <emphasis role="strong">unset</emphasis>.</simpara>
        <simpara>Setting <emphasis role="strong">set user ID</emphasis> on an executable file allows a user to execute the executable file with the owner ID of the file (for example <emphasis role="strong">root</emphasis>).  Similarly, setting <emphasis role="strong">set group ID</emphasis> on an executable file allows a user to execute the executable file with the group ID of the file (for example <emphasis role="strong">root</emphasis>).  Because these settings can cause security risks, enabling them requires extra caution.</simpara>
        <simpara>Setting <emphasis role="strong">set group ID</emphasis> on a directory enables the <ulink url="&bsdlike;">BSD-like</ulink> file creation scheme where all files created in the directory belong to the <emphasis role="strong">group</emphasis> of the directory.</simpara>
        <simpara>Setting the <emphasis role="strong">sticky bit</emphasis> on a directory prevents a file in the directory from being removed by a user who is not the owner of the file.  In order to secure contents of a file in world-writable directories such as "<literal>/tmp</literal>" or in group-writable directories, one must not only reset the <emphasis role="strong">write</emphasis> permission for the file but also set the <emphasis role="strong">sticky bit</emphasis> on the directory.  Otherwise, the file can be removed and a new file can be created with the same name by any user who has write access to the directory.</simpara>
        <simpara>Here are a few interesting examples of file permissions.</simpara>
        <screen>$ ls -l /etc/passwd /etc/shadow /dev/ppp /usr/sbin/exim4
crw------- 1 root root   108, 0 2007-04-29 07:00 /dev/ppp
-rw-r--r-- 1 root root     1427 2007-04-16 00:19 /etc/passwd
-rw-r----- 1 root shadow    943 2007-04-16 00:19 /etc/shadow
-rwsr-xr-x 1 root root   700056 2007-04-22 05:29 /usr/sbin/exim4
$ ls -ld /tmp /var/tmp /usr/local /var/mail /usr/src
drwxrwxrwt 10 root root  4096 2007-04-29 07:59 /tmp
drwxrwsr-x 10 root staff 4096 2007-03-24 18:48 /usr/local
drwxrwsr-x  4 root src   4096 2007-04-27 00:31 /usr/src
drwxrwsr-x  2 root mail  4096 2007-03-28 23:33 /var/mail
drwxrwxrwt  2 root root  4096 2007-04-29 07:11 /var/tmp</screen>
        <simpara>There is an alternative numeric mode to describe file permissions with <literal>chmod</literal>(1).  This numeric mode uses 3 to 4 digit wide octal (radix=8) numbers.</simpara>
        <table id="thenumericmodefoinchmodbcommands" pgwide="0" frame="topbot" rowsep="1" colsep="1">
          <title>The numeric mode for file permissions in <literal>chmod</literal>(1) commands.</title>
          <tgroup cols="2">
            <colspec colwidth="30%*" align="left"/>
            <colspec colwidth="70%*" align="left"/>
            <thead>
              <row>
                <entry>
    digit
    </entry>
                <entry>
    meaning
    </entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry>
    1st optional digit
    </entry>
                <entry>
    sum of <emphasis role="strong">set user ID</emphasis> (=4), <emphasis role="strong">set group ID</emphasis> (=2), and <emphasis role="strong">sticky bit</emphasis> (=1)
    </entry>
              </row>
              <row>
                <entry>
    2nd digit
    </entry>
                <entry>
    sum of <emphasis role="strong">read</emphasis> (=4), <emphasis role="strong">write</emphasis> (=2), and <emphasis role="strong">execute</emphasis> (=1) permissions for <emphasis role="strong">user</emphasis>
    </entry>
              </row>
              <row>
                <entry>
    3rd digit
    </entry>
                <entry>
    ditto for <emphasis role="strong">group</emphasis>
    </entry>
              </row>
              <row>
                <entry>
    4th digit
    </entry>
                <entry>
    ditto for <emphasis role="strong">other</emphasis>
    </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
        <simpara>This sounds complicated but it is actually quite simple.  If you look at the first few (2-10) columns from "<literal>ls -l</literal>" command output and read it as a binary (radix=2) representation of file permissions ("-" being "0" and "rwx" being "1"), the last 3 digit of the numeric mode value should make sense as an octal (radix=8) representation of file permissions to you.  For example, try:</simpara>
        <screen>$ touch foo bar
$ chmod u=rw,go=r foo
$ chmod 644 bar
$ ls -l foo bar
-rw-r--r-- 1 penguin penguin 17 2007-04-29 08:22 bar
-rw-r--r-- 1 penguin penguin 12 2007-04-29 08:22 foo</screen>
        <tip>
          <simpara>If you need to access information displayed by "<literal>ls -l</literal>" in shell script, you should use pertinent commands such as <literal>test</literal>(1), <literal>stat</literal>(1) and <literal>readlink</literal>(1).  The shell builtin such as "<literal>[</literal>" or "<literal>test</literal>" may be used too.</simpara>
        </tip>
      </section>
      <section id="_control_of_permissions_for_newly_created_files_umask">
        <title>Control of permissions for newly created files: umask</title>
        <simpara>What permissions are applied to a newly created file or directory is restricted by the <literal>umask</literal> shell builtin command.  See <literal>dash</literal>(1), <literal>bash</literal>(1), and <literal>builtins</literal>(7).</simpara>
        <screen> (file permissions) = (requested file permissions) &amp; ~(umask value)</screen>
        <table id="theumaskvalueexamples" pgwide="0" frame="topbot" rowsep="1" colsep="1">
          <title>The <emphasis role="strong">umask</emphasis> value examples.</title>
          <tgroup cols="4">
            <colspec colwidth="20%*" align="left"/>
            <colspec colwidth="20%*" align="left"/>
            <colspec colwidth="20%*" align="left"/>
            <colspec colwidth="40%*" align="left"/>
            <thead>
              <row>
                <entry>
    umask
    </entry>
                <entry>
    file permissions created
    </entry>
                <entry>
    directory permissions created
    </entry>
                <entry>
    usage
    </entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry>
                  <literal>0022</literal>
                </entry>
                <entry>
                  <literal>-rw-r--r--</literal>
                </entry>
                <entry>
                  <literal>-rwxr-xr-x</literal>
                </entry>
                <entry>
    writable only by the user
    </entry>
              </row>
              <row>
                <entry>
                  <literal>0002</literal>
                </entry>
                <entry>
                  <literal>-rw-rw-r--</literal>
                </entry>
                <entry>
                  <literal>-rwxrwxr-x</literal>
                </entry>
                <entry>
    writable by the group
    </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
        <simpara>The Debian system uses a user private group (UPG) scheme as its default. A UPG is created whenever a new user is added to the system. A UPG has the same name as the user for which it was created and that user is the only member of the UPG. UPG scheme makes it is safe to set umask to <literal>0002</literal> since every user has their own private group.  (In some Unix variants, it is quite common to setup all normal users belonging to a single <emphasis role="strong"><literal>users</literal></emphasis> group and is good idea to set umask to <literal>0022</literal> for security in such cases.)</simpara>
      </section>
      <section id="_permissions_for_groups_of_users_group">
        <title>Permissions for groups of users (group)</title>
        <simpara>In order to make group permissions to be applied to a particular user, that user needs to be made a member of the group using "<literal>sudo vigr</literal>".</simpara>
        <note>
          <simpara>Alternatively, you may dynamically add users to groups during the authentication process by adding "<literal>auth optional pam_group.so</literal>" line to "<literal>/etc/pam.d/common-auth</literal>" and setting "<literal>/etc/security/group.conf</literal>".  (See <xref linkend="_authentication"/>.)</simpara>
        </note>
        <simpara>The hardware devices are just another kind of file on the Debian system.  If you have problems accessing devices such as CD-ROM and USB memory stick from a user account, you should make that user a member of the relevant group.</simpara>
        <simpara>Some notable system-provided groups allow their members to access particular files and devices without <literal>root</literal> privilege.</simpara>
        <table id="listofnotablesysupsforfileaccess" pgwide="0" frame="topbot" rowsep="1" colsep="1">
          <title>List of notable system-provided groups for file access.</title>
          <tgroup cols="2">
            <colspec colwidth="30%*" align="left"/>
            <colspec colwidth="70%*" align="left"/>
            <thead>
              <row>
                <entry>
    group
    </entry>
                <entry>
    accessible files and devices
    </entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry>
                  <literal>dialout</literal>
                </entry>
                <entry>
    Full and direct access to serial ports ("<literal>/dev/ttyS[0-3]</literal>").
    </entry>
              </row>
              <row>
                <entry>
                  <literal>dip</literal>
                </entry>
                <entry>
    Limited access to serial ports for <emphasis role="strong">Dialup IP</emphasis> connection to trusted peers.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>cdrom</literal>
                </entry>
                <entry>
    CD-ROM, DVD+/-RW drives.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>audio</literal>
                </entry>
                <entry>
    An audio device.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>video</literal>
                </entry>
                <entry>
    A video device.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>scanner</literal>
                </entry>
                <entry>
    Scanner(s).
    </entry>
              </row>
              <row>
                <entry>
                  <literal>adm</literal>
                </entry>
                <entry>
    System monitoring logs.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>staff</literal>
                </entry>
                <entry>
    Some directories for junior administrative work: "<literal>/usr/local</literal>", "<literal>/home</literal>".
    </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
        <tip>
          <simpara>You need to belong to the <literal>dialout</literal> group to reconfigure modem, dial anywhere, etc.  But if <literal>root</literal> creates pre-defined configuration files for trusted peers in "<literal>/etc/ppp/peers/</literal>", you only need to belong to the <literal>dip</literal> group to create <emphasis role="strong">Dialup IP</emphasis> connection to those trusted peers using <literal>pppd</literal>(8), <literal>pon</literal>(1), and <literal>poff</literal>(1) commands.</simpara>
        </tip>
        <simpara>Some notable system-provided groups allow their members to execute particular commands without <literal>root</literal> privilege.</simpara>
        <table id="listofnotablesysommandexecutions" pgwide="0" frame="topbot" rowsep="1" colsep="1">
          <title>List of notable system provided groups for particular command executions.</title>
          <tgroup cols="2">
            <colspec colwidth="30%*" align="left"/>
            <colspec colwidth="70%*" align="left"/>
            <thead>
              <row>
                <entry>
    group
    </entry>
                <entry>
    accessible commands
    </entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry>
                  <literal>sudo</literal>
                </entry>
                <entry>
    execute <literal>sudo</literal> without their password.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>lpadmin</literal>
                </entry>
                <entry>
    execute commands to add, modify, and remove printers from printer databases.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>plugdev</literal>
                </entry>
                <entry>
    execute <literal>pmount</literal>(1) for removable devices such as USB memories.
    </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
        <simpara>For the full listing of the system provided users and groups, see the recent version of the "Users and Groups" document in "<literal>/usr/share/doc/base-passwd/users-and-groups.html</literal>" provided by the <literal>base-passwd</literal> package.</simpara>
        <simpara>See <literal>passwd</literal>(5), <literal>group</literal>(5), <literal>shadow</literal>(5), <literal>newgrp</literal>(1), <literal>vipw</literal>(8), <literal>vigr</literal>(8), and <literal>pam_group</literal>(8) for management commands of the user and group system.</simpara>
      </section>
      <section id="_timestamps">
        <title>Timestamps</title>
        <simpara>There are three types of timestamps for a GNU/Linux file.</simpara>
        <table id="listoftypesoftimestamps" pgwide="0" frame="topbot" rowsep="1" colsep="1">
          <title>List of types of timestamps.</title>
          <tgroup cols="2">
            <colspec colwidth="30%*" align="left"/>
            <colspec colwidth="70%*" align="left"/>
            <thead>
              <row>
                <entry>
    type
    </entry>
                <entry>
    meaning
    </entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry>
                  <emphasis role="strong">mtime</emphasis>
                </entry>
                <entry>
    the file modification time (<literal>ls -l</literal>)
    </entry>
              </row>
              <row>
                <entry>
                  <emphasis role="strong">ctime</emphasis>
                </entry>
                <entry>
    the file status change time (<literal>ls -lc</literal>)
    </entry>
              </row>
              <row>
                <entry>
                  <emphasis role="strong">atime</emphasis>
                </entry>
                <entry>
    the last file access time (<literal>ls -lu</literal>)
    </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
        <simpara>Note that <emphasis role="strong">ctime</emphasis> is not file creation time.</simpara>
        <itemizedlist>
          <listitem>
            <simpara>
Overwriting a file will change all of the <emphasis role="strong">mtime</emphasis>, <emphasis role="strong">ctime</emphasis>, and <emphasis role="strong">atime</emphasis> attributes of the file.
</simpara>
          </listitem>
          <listitem>
            <simpara>
Changing ownership or permissions of a file will change the <emphasis role="strong">ctime</emphasis> and <emphasis role="strong">atime</emphasis> attributes of the file.
</simpara>
          </listitem>
          <listitem>
            <simpara>
Reading a file will change the <emphasis role="strong">atime</emphasis> of the file.
Note that even simply reading a file on the Debian system will normally cause a file write operation to update <emphasis role="strong">atime</emphasis> information in the <emphasis role="strong">inode</emphasis>.  Mounting a filesystem with "<literal>noatime</literal>" or "<literal>relatime</literal>" option will let the system skip this operation and will result in faster file access for the read. This is often recommended for laptops, because it reduces hard drive activity and saves power. See <literal>mount</literal>(8).
</simpara>
          </listitem>
        </itemizedlist>
        <simpara>Use <literal>touch</literal>(1) command to change timestamps of existing files.</simpara>
        <simpara>For timestamps, the <literal>ls</literal> command outputs different strings under the modern English locale ("<literal>en_US.UTF-8</literal>") from under the old one ("<literal>C</literal>").</simpara>
        <screen>$ LANG=en_US.UTF-8  ls -l foo
-rw-r--r-- 1 penguin penguin 3 2008-03-05 00:47 foo
$ LANG=C  ls -l foo
-rw-r--r-- 1 penguin penguin 3 Mar  5 00:47 foo</screen>
        <tip>
          <simpara>See <xref linkend="_customized_display_of_time_and_date"/> to cutomize "<literal>ls -l</literal>" output.</simpara>
        </tip>
      </section>
      <section id="_links">
        <title>Links</title>
        <simpara>There are two methods of associating a file "<literal>foo</literal>" with a different filename "<literal>bar</literal>".</simpara>
        <itemizedlist>
          <listitem>
            <simpara>
a <ulink url="&hardlink;">hard link</ulink> is a duplicate name for an existing file (<literal>ln foo bar</literal>),
</simpara>
          </listitem>
          <listitem>
            <simpara>
a <ulink url="&symboliclink;">symbolic link</ulink>, or "symlink", is a special file that points to another file by name (<literal>ln -s foo bar</literal>).
</simpara>
          </listitem>
        </itemizedlist>
        <simpara>See the following example for changes in link counts and the subtle differences in the result of the <literal>rm</literal> command.</simpara>
        <screen>$ echo "Original Content" &gt; foo
$ ls -li foo
2398521 -rw-r--r-- 1 penguin penguin 17 2007-04-29 08:15 foo
$ ln foo bar     # hard link
$ ln -s foo baz  # symlink
$ ls -li foo bar baz
2398521 -rw-r--r-- 2 penguin penguin 17 2007-04-29 08:15 bar
2398538 lrwxrwxrwx 1 penguin penguin  3 2007-04-29 08:16 baz -&gt; foo
2398521 -rw-r--r-- 2 penguin penguin 17 2007-04-29 08:15 foo
$ rm foo
$ echo "New Content" &gt; foo
$ ls -li foo bar baz
2398521 -rw-r--r-- 1 penguin penguin 17 2007-04-29 08:15 bar
2398538 lrwxrwxrwx 1 penguin penguin  3 2007-04-29 08:16 baz -&gt; foo
2398540 -rw-r--r-- 1 penguin penguin 12 2007-04-29 08:17 foo
$ cat bar
Original Content
$ cat baz
New Content</screen>
        <simpara>The hardlink can be made within the same file system and shares the same inode number which the "<literal>-i</literal>" option with <literal>ls</literal>(1)  reveals.</simpara>
        <simpara>The symlink always has nominal file access permissions of "<literal>rwxrwxrwx</literal>", as shown in the above example, with the effective access permissions dictated by permissions of the file that it points to.</simpara>
        <caution>
          <simpara>It is generally good idea not to create complicated symbolic links or hardlinks at all unless you have a very good reason.  It may cause nightmares where the logical combination of the symbolic links results in loops in the filesystem.</simpara>
        </caution>
        <note>
          <simpara>It is generally preferable to use symbolic links rather than hardlinks unless you have a good reason for using a hardlink.</simpara>
        </note>
        <simpara>The "<literal>.</literal>"  directory links to the directory that it appears in, thus the link count of any new directory starts at 2.  The "<literal>..</literal>"  directory links to the parent directory, thus the link count of the directory increases with the addition of new subdirectories.</simpara>
        <simpara>If you are just moving to Linux from Windows, it will soon become clear how well-designed the filename linking of Unix is, compared with the nearest Windows equivalent of "shortcuts". Because it is implemented in the file system, applications can't see any difference between a linked file and the original. In the case of hardlinks, there really is no difference.</simpara>
      </section>
      <section id="_named_pipes_fifos">
        <title>Named pipes (FIFOs)</title>
        <simpara>A <ulink url="&namedpipe;">named pipe</ulink> is a file that acts like a pipe.  You put something into the file, and it comes out the other end.  Thus it's called a FIFO, or First-In-First-Out: the first thing you put in the pipe is the first thing to come out the other end.</simpara>
        <simpara>If you write to a named pipe, the process which is writing to the pipe doesn't terminate until the information being written is read from the pipe.  If you read from a named pipe, the reading process waits until there is nothing to read before terminating.  The size of the pipe is always zero --- it does not store data, it just links two processes like the shell "<literal>|</literal>".  However, since this pipe has a name, the two processes don't have to be on the same command line or even be run by the same user. Pipes were a very influential innovation of Unix.</simpara>
        <simpara>You can try it by doing the following:</simpara>
        <screen>$ cd; mkfifo mypipe
$ echo "hello" &gt;mypipe &amp; # put into background
[1] 8022
$ ls -l mypipe
prw-r--r-- 1 penguin penguin 0 2007-04-29 08:25 mypipe
$ cat mypipe
hello
[1]+  Done                    echo "hello" &gt;mypipe
$ ls mypipe
mypipe
$ rm mypipe</screen>
      </section>
      <section id="_sockets">
        <title>Sockets</title>
        <simpara>Sockets are used extensively by all the Internet communication, databases, and the operating system itself. It is similar to the named pipe (FIFO) and allows processes to exchange information even between different computers.  For the socket, those processes do not need to be running at the same time nor to be running as the children of the same ancestor process.  This is the endpoint for <ulink url="&theinterprocesscommunicationipc;">the inter process communication (IPC)</ulink>.  The exchange of information may occur over the network between different hosts.  The two most common ones are <ulink url="&theinternetsocket;">the Internet socket</ulink> and <ulink url="&theunixdomainsocket;">the Unix domain socket</ulink>.</simpara>
        <tip>
          <simpara>"<literal>netstat -an</literal>" will provide a very useful overview of sockets that are open on a given system.</simpara>
        </tip>
      </section>
      <section id="_device_files">
        <title>Device files</title>
        <simpara><ulink url="&devicefiles;">Device files</ulink> refer to physical or virtual devices on your system, such as your hard disk, video card, screen, or keyboard.  An example of a virtual device is the console, represented by "<literal>/dev/console</literal>".</simpara>
        <table id="thedevicetypes" pgwide="0" frame="topbot" rowsep="1" colsep="1">
          <title>The device types.</title>
          <tgroup cols="2">
            <colspec colwidth="30%*" align="left"/>
            <colspec colwidth="70%*" align="left"/>
            <thead>
              <row>
                <entry>
    device type
    </entry>
                <entry>
    meaning
    </entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry>
                  <emphasis role="strong">character device</emphasis>
                </entry>
                <entry>
    This can be accessed one character at a time, that is, the smallest unit of data which can be written to or read from the device is a character (byte).
    </entry>
              </row>
              <row>
                <entry>
                  <emphasis role="strong">block device</emphasis>
                </entry>
                <entry>
    This must be accessed in larger units called blocks, which contain a number of characters.  Your hard disk is a block device.
    </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
        <simpara>You can read and write device files, though the file may well contain binary data which may be an incomprehensible-to-humans gibberish.  Writing data directly to these files is sometimes useful for the troubleshooting of hardware connections.  For example, you can dump a text file to the printer device "<literal>/dev/lp0</literal>" or send modem commands to the appropriate serial port "<literal>/dev/ttyS0</literal>".  But, unless this is done carefully, it may cause a major disaster.  So be cautious.</simpara>
        <note>
          <simpara>For the normal access to a printer, use <literal>lp</literal>(1).</simpara>
        </note>
        <simpara>The device node number are displayed by executing <literal>ls</literal>(1) as:</simpara>
        <screen>$ ls -l /dev/hda /dev/ttyS0 /dev/zero
brw-rw---- 1 root cdrom   3,  0 2007-04-29 07:00 /dev/hda
crw-rw---- 1 root dialout 4, 64 2007-04-29 07:00 /dev/ttyS0
crw-rw-rw- 1 root root    1,  5 2007-04-29 07:00 /dev/zero</screen>
        <simpara>Here,</simpara>
        <itemizedlist>
          <listitem>
            <simpara>
"<literal>/dev/hda</literal>" has the major device number 3 and the minor device number 0.  This is read/write accessible by the user who belongs to <literal>disk</literal> group,
</simpara>
          </listitem>
          <listitem>
            <simpara>
"<literal>/dev/ttyS0</literal>" has the major device number 4 and the minor device number 64.  This is read/write accessible by the user who belongs to <literal>dialout</literal> group, and
</simpara>
          </listitem>
          <listitem>
            <simpara>
"<literal>/dev/zero</literal>" has the major device number 1 and the minor device number 5.  This is read/write accessible by anyone.
</simpara>
          </listitem>
        </itemizedlist>
        <simpara>In the Linux 2.6 system, the filesystem under "<literal>/dev/</literal>" is automatically populated by the <literal>udev</literal>(7) mechanism.</simpara>
      </section>
      <section id="_special_device_files">
        <title>Special device files</title>
        <simpara>There are some special device files.</simpara>
        <table id="listofspecialdevicefiles" pgwide="0" frame="topbot" rowsep="1" colsep="1">
          <title>List of special device files.</title>
          <tgroup cols="3">
            <colspec colwidth="30%*" align="left"/>
            <colspec colwidth="30%*" align="left"/>
            <colspec colwidth="40%*" align="left"/>
            <thead>
              <row>
                <entry>
    device file
    </entry>
                <entry>
    action
    </entry>
                <entry>
    response
    </entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry>
                  <literal>/dev/null</literal>
                </entry>
                <entry>
    read
    </entry>
                <entry>
    it returns "end-of-file (EOF) character".
    </entry>
              </row>
              <row>
                <entry>
                  <literal>/dev/null</literal>
                </entry>
                <entry>
    write
    </entry>
                <entry>
    it is a bottomless data dump pit.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>/dev/zero</literal>
                </entry>
                <entry>
    read
    </entry>
                <entry>
    it returns "the <literal>\0</literal> (NUL) character" (not the same as the number zero ASCII).
    </entry>
              </row>
              <row>
                <entry>
                  <literal>/dev/random</literal>
                </entry>
                <entry>
    read
    </entry>
                <entry>
    it returns random characters from a true random number generator, delivering real entropy. (slow)
    </entry>
              </row>
              <row>
                <entry>
                  <literal>/dev/urandom</literal>
                </entry>
                <entry>
    read
    </entry>
                <entry>
    it returns random characters from a cryptographically secure pseudorandom number generator.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>/dev/full</literal>
                </entry>
                <entry>
    write
    </entry>
                <entry>
    it returns the disk-full (ENOSPC) error.
    </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
        <simpara>These are frequently used in conjunction with the shell redirection (see <xref linkend="_typical_command_sequences_and_shell_redirection"/>).</simpara>
      </section>
      <section id="_procfs_and_sysfs">
        <title>procfs and sysfs</title>
        <simpara>The <ulink url="&procfs;">procfs</ulink> and <ulink url="&sysfs;">sysfs</ulink> mounted on "<literal>/proc</literal>" and "<literal>/sys</literal>" are the pseudo-filesystem and expose internal data structures of the kernel to the userspace.  In other word, these entries are virtual, meaning that they act as a convenient window into the operation of the operating system.</simpara>
        <simpara>The directory "<literal>/proc</literal>" contains (among other things) one subdirectory for each process running on the system, which is named after the process ID (PID). System utilities that access process information, such as <literal>ps</literal>(1), get their information from this directory structure.</simpara>
        <simpara>The directories under "<literal>/proc/sys/</literal>" contain interface to change certain kernel parameters at run time.  (You may do the same through specialized <literal>sysctl</literal>(8) command or its preload/configuration file "<literal>/etc/sysctrl.conf</literal>".)</simpara>
        <note>
          <simpara>The Linux kernel may complain "Too many open files".  You can fix this by increasing "<literal>file-max</literal>" value to a larger value from the root shell, e.g., "<literal>echo "65536"  &gt; /proc/sys/fs/file-max</literal>" (This was needed on older kernels).</simpara>
        </note>
        <simpara>People frequently panic when they notice one file in particular - "<literal>/proc/kcore</literal>" - which is generally huge.  This is (more or less) a copy of the content of your computer's memory.  It's used to debug the kernel.  It is a virtual file that points to computer memory, so don't worry about its size.</simpara>
        <simpara>The directory under "<literal>/sys</literal>" contains exported kernel data structures, their attributes, and their linkages between them. It also contains interface to change certain kernel parameters at run time.</simpara>
        <simpara>See "<literal>proc.txt(.gz)</literal>", "<literal>sysfs.txt(.gz)</literal>" and other related documents in the Linux kernel documentation ("<literal>/usr/share/doc/linux-doc-2.6.*/Documentation/filesystems/*</literal>") provided by the <literal>linux-doc-2.6.*</literal> package.</simpara>
      </section>
    </section>
    <section id="_midnight_commander_mc">
      <title>Midnight Commander (MC)</title>
      <simpara><ulink url="&midnightcommandermc;">Midnight Commander (MC)</ulink> is a GNU "Swiss army knife" for the Linux console and other terminal environments.  This gives newbie a menu driven console experience which is much easier to learn than standard Unix commands.</simpara>
      <simpara>You may need to install the Midnight Commander package which is titled "<literal>mc</literal>".</simpara>
      <screen>$ sudo aptitude install mc</screen>
      <simpara>Use the <literal>mc</literal>(1) command to explore the Debian system.  This is the best way to learn.  Please explore few interesting locations just using the cursor keys and Enter key:</simpara>
      <itemizedlist>
        <listitem>
          <simpara>
"<literal>/etc</literal>" and its subdirectories.
</simpara>
        </listitem>
        <listitem>
          <simpara>
"<literal>/var/log</literal>" and its subdirectories.
</simpara>
        </listitem>
        <listitem>
          <simpara>
"<literal>/usr/share/doc</literal>" and its subdirectories.
</simpara>
        </listitem>
        <listitem>
          <simpara>
"<literal>/sbin</literal>" and "<literal>/bin</literal>"
</simpara>
        </listitem>
      </itemizedlist>
      <section id="_customization_of_mc">
        <title>Customization of MC</title>
        <simpara>In order to make MC to change working directory upon exit and <literal>cd</literal> to the directory, I suggest to modify "<literal>~/.bashrc</literal>" to include:</simpara>
        <screen>. /usr/share/mc/bin/mc.sh</screen>
        <simpara>See <literal>mc</literal>(1) (under the "<literal>-P</literal>" option) for the reason. (If you do not understand what exactly I am talking here, you can do this later.)</simpara>
      </section>
      <section id="_starting_mc">
        <title>Starting MC</title>
        <simpara>MC can be started by:</simpara>
        <screen>$ mc</screen>
        <simpara>MC takes care of all file operations through its menu, requiring minimal user effort.  Just press F1 to get the help screen.  You can play with MC just by pressing cursor-keys and function-keys.</simpara>
        <note>
          <simpara>In some consoles such as <literal>gnome-terminal</literal>(1), key strokes of function-keys may be stolen by the console program.   You can disable these features by "Edit" → "Keyboard Shortcuts" for <literal>gnome-terminal</literal>.</simpara>
        </note>
        <simpara>If you encounter character encoding problem which displays garbage characters, adding "<literal>-a</literal>" to MC's command line may help prevent problems.</simpara>
        <simpara>If this doesn't clear up your display problems with MC, see <xref linkend="_the_terminal_configuration"/>.</simpara>
      </section>
      <section id="_file_manager_in_mc">
        <title>File manager in MC</title>
        <simpara>The default is two directory panels containing file lists.  Another useful mode is to set the right window to "information" to see file access privilege information, etc.  Following are some essential keystrokes.  With the <literal>gpm</literal>(8) daemon running, one can use a mouse on Linux character consoles, too.  (Make sure to press the shift-key to obtain the normal behavior of cut and paste in MC.)</simpara>
        <table id="thekeybindingsofmc" pgwide="0" frame="topbot" rowsep="1" colsep="1">
          <title>The key bindings of MC.</title>
          <tgroup cols="2">
            <colspec colwidth="30%*" align="left"/>
            <colspec colwidth="70%*" align="left"/>
            <thead>
              <row>
                <entry>
    key
    </entry>
                <entry>
    key binding
    </entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry>
                  <literal>F1</literal>
                </entry>
                <entry>
    Help menu
    </entry>
              </row>
              <row>
                <entry>
                  <literal>F3</literal>
                </entry>
                <entry>
    Internal file viewer
    </entry>
              </row>
              <row>
                <entry>
                  <literal>F4</literal>
                </entry>
                <entry>
    Internal editor
    </entry>
              </row>
              <row>
                <entry>
                  <literal>F9</literal>
                </entry>
                <entry>
    Activate pull down menu
    </entry>
              </row>
              <row>
                <entry>
                  <literal>F10</literal>
                </entry>
                <entry>
    Exit Midnight Commander
    </entry>
              </row>
              <row>
                <entry>
                  <literal>Tab</literal>
                </entry>
                <entry>
    Move between two windows
    </entry>
              </row>
              <row>
                <entry><literal>Insert</literal> or <literal>Ctrl-T</literal>
    </entry>
                <entry>
    Mark file for a multiple-file operation such as copy
    </entry>
              </row>
              <row>
                <entry>
                  <literal>Del</literal>
                </entry>
                <entry>
    Delete file (be careful---set MC to safe delete mode)
    </entry>
              </row>
              <row>
                <entry>
    Cursor keys
    </entry>
                <entry>
    Self-explanatory
    </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
      </section>
      <section id="_command_line_tricks_in_mc">
        <title>Command-line tricks in MC</title>
        <itemizedlist>
          <listitem>
            <simpara>
Any <literal>cd</literal> command will change the directory shown on the selected screen.
</simpara>
          </listitem>
          <listitem>
            <simpara><literal>Ctrl-Enter</literal> or <literal>Alt-Enter</literal> will copy a filename to the command line. Use this with <literal>cp</literal>(1) and <literal>mv</literal>(1) commands together with command-line editing.
</simpara>
          </listitem>
          <listitem>
            <simpara><literal>Alt-Tab</literal> will show shell filename expansion choices.
</simpara>
          </listitem>
          <listitem>
            <simpara>
One can specify the starting directory for both windows as arguments to MC; for example, "<literal>mc /etc /root</literal>".
</simpara>
          </listitem>
          <listitem>
            <simpara><literal>Esc</literal> + <literal>n-key</literal> → <literal>Fn</literal> (i.e., <literal>Esc</literal> + <literal>1</literal> → <literal>F1</literal>, etc.; <literal>Esc</literal> + <literal>0</literal> → <literal>F10</literal>)
</simpara>
          </listitem>
          <listitem>
            <simpara>
Pressing <literal>Esc</literal> before the key has the same effect as pressing the <literal>Alt</literal> and the key together.; i.e., type <literal>Esc</literal> + <literal>c</literal> for <literal>Alt-C</literal>.  <literal>Esc</literal> is called meta-key and sometimes noted as "<literal>M-</literal>"
</simpara>
          </listitem>
        </itemizedlist>
      </section>
      <section id="_the_internal_editor_in_mc">
        <title>The internal editor in MC</title>
        <simpara>The internal editor has an interesting cut-and-paste scheme.  Pressing <literal>F3</literal> marks the start of a selection, a second <literal>F3</literal> marks the end of selection and highlights the selection.  Then you can move your cursor.  If you press F6, the selected area will be moved to the cursor location.  If you press F5, the selected area will be copied and inserted at the cursor location.  <literal>F2</literal> will save the file.  <literal>F10</literal> will get you out.  Most cursor keys work intuitively.</simpara>
        <simpara>This editor can be directly started on a file:</simpara>
        <screen>$ mc -e filename_to_edit
$ mcedit filename_to_edit</screen>
        <simpara>This is not a multi-window editor, but one can use multiple Linux consoles to achieve the same effect.  To copy between windows, use Alt-F&lt;n&gt; keys to switch virtual consoles and use "File→Insert file" or "File→Copy to file" to move a portion of a file to another file.</simpara>
        <simpara>This internal editor can be replaced with any external editor of choice.</simpara>
        <simpara>Also, many programs use the environment variables "<literal>$EDITOR</literal>" or "<literal>$VISUAL</literal>" to decide which editor to use.  If you are uncomfortable with <literal>vim</literal>(1) or <literal>nano</literal>(1) initially, you may set these to "<literal>mcedit</literal>" by adding these lines to "<literal>~/.bashrc</literal>":</simpara>
        <screen>...
export EDITOR=mcedit
export VISUAL=mcedit
...</screen>
        <simpara>I do recommend setting these to "<literal>vim</literal>" if possible.</simpara>
        <simpara>If you are uncomfortable with <literal>vim</literal>(1), you can keep using <literal>mcedit</literal>(1) for most system maintenance tasks.</simpara>
      </section>
      <section id="_the_internal_viewer_in_mc">
        <title>The internal viewer in MC</title>
        <simpara>Very smart viewer.  This is a great tool for searching words in documents.  I always use this for files in the "<literal>/usr/share/doc</literal>" directory.  This is the fastest way to browse through masses of Linux information.  This viewer can be directly started like so:</simpara>
        <screen>$ mc -v path/to/filename_to_view
$ mcview path/to/filename_to_view</screen>
      </section>
      <section id="_auto_start_features_of_mc">
        <title>Auto-start features of MC</title>
        <simpara>Press Enter on a file, and the appropriate program will handle the content of the file (see <xref linkend="_customizing_program_to_be_started"/>).  This is a very convenient MC feature.</simpara>
        <table id="thereactiontotheenterkeyinmc" pgwide="0" frame="topbot" rowsep="1" colsep="1">
          <title>The reaction to the enter key in MC.</title>
          <tgroup cols="2">
            <colspec colwidth="30%*" align="left"/>
            <colspec colwidth="70%*" align="left"/>
            <thead>
              <row>
                <entry>
    file type
    </entry>
                <entry>
    reaction to enter key
    </entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry>
    executable file
    </entry>
                <entry>
    Execute command
    </entry>
              </row>
              <row>
                <entry>
    man file
    </entry>
                <entry>
    Pipe content to viewer software
    </entry>
              </row>
              <row>
                <entry>
    html file
    </entry>
                <entry>
    Pipe content to web browser
    </entry>
              </row>
              <row>
                <entry>
    "<literal>*.tar.gz</literal>" and "<literal>*.deb</literal>" file
    </entry>
                <entry>
    Browse its contents as if subdirectory
    </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
        <simpara>In order to allow these viewer and virtual file features to function, viewable files should not be set as executable.  Change their status using <literal>chmod</literal>(1) or via the MC file menu.</simpara>
      </section>
      <section id="_ftp_virtual_filesystem_of_mc">
        <title>FTP virtual filesystem of MC</title>
        <simpara>MC can be used to access files over the Internet using FTP.  Go to the menu by pressing <literal>F9</literal>, then type "<literal>p</literal>" to activate the FTP virtual filesystem.  Enter a URL in the form "<literal>username:passwd@hostname.domainname</literal>", which will retrieve a remote directory that appears like a local one.</simpara>
        <simpara>Try "[http.us.debian.org/debian]" as the URL and browse the Debian archive.</simpara>
      </section>
    </section>
    <section id="_the_basic_unix_like_work_environment">
      <title>The basic Unix-like work environment</title>
      <simpara>Although MC enables you to do almost everything, it is very important for you to learn how to use the command line tools invoked from the shell prompt and become familiar with the Unix-like work environment.</simpara>
      <section id="_the_login_shell">
        <title>The login shell</title>
        <simpara>You can select your login shell with <literal>chsh</literal>(1).</simpara>
        <table id="list-of-shell-programs" pgwide="0" frame="topbot" rowsep="1" colsep="1">
          <title>List of shell programs.</title>
          <tgroup cols="5">
            <colspec colwidth="10%*" align="left"/>
            <colspec colwidth="10%*" align="left"/>
            <colspec colwidth="10%*" align="left"/>
            <colspec colwidth="10%*" align="left"/>
            <colspec colwidth="60%*" align="left"/>
            <thead>
              <row>
                <entry>
    package
    </entry>
                <entry>
    popcon
    </entry>
                <entry>
    size
    </entry>
                <entry>
    POSIX shell
    </entry>
                <entry>
    description
    </entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/bash">
                  <literal>bash</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/bash">&pop-bash;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/b/bash.html">&size-bash;</ulink></entry>
                <entry>
    Yes
    </entry>
                <entry><ulink url="&bash;">Bash</ulink>: the GNU Bourne Again SHell. (de facto standard)
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/tcsh">
                  <literal>tcsh</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/tcsh">&pop-tcsh;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/t/tcsh.html">&size-tcsh;</ulink></entry>
                <entry>
    No
    </entry>
                <entry><ulink url="&tenexcshell;">TENEX C Shell</ulink>: an enhanced version of <ulink url="&berkeleycsh;">Berkeley csh</ulink>.
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/dash">
                  <literal>dash</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/dash">&pop-dash;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/d/dash.html">&size-dash;</ulink></entry>
                <entry>
    Yes
    </entry>
                <entry>
    The Debian <ulink url="&almquistshell;">Almquist Shell</ulink>. Good for shell script.
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/zsh">
                  <literal>zsh</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/zsh">&pop-zsh;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/z/zsh.html">&size-zsh;</ulink></entry>
                <entry>
    Yes
    </entry>
                <entry><ulink url="&zshell;">Z shell</ulink>: the standard shell with many enhancements.
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/pdksh">
                  <literal>pdksh</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/pdksh">&pop-pdksh;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/p/pdksh.html">&size-pdksh;</ulink></entry>
                <entry>
    Yes
    </entry>
                <entry>
    A public domain version of the <ulink url="&kornshell;">Korn shell</ulink>.
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/csh">
                  <literal>csh</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/csh">&pop-csh;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/c/csh.html">&size-csh;</ulink></entry>
                <entry>
    No
    </entry>
                <entry><ulink url="&openbsd;">OpenBSD</ulink> C Shell, a version of <ulink url="&berkeleycsh;">Berkeley csh</ulink>.
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/sash">
                  <literal>sash</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/sash">&pop-sash;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/s/sash.html">&size-sash;</ulink></entry>
                <entry>
    Yes
    </entry>
                <entry><ulink url="&standaloneshell;">Stand-alone shell</ulink> with builtin commands. (Not meant for standard "<literal>/bin/sh</literal>".)
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/ksh">
                  <literal>ksh</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/ksh">&pop-ksh;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/k/ksh.html">&size-ksh;</ulink></entry>
                <entry>
    Yes
    </entry>
                <entry>
    The real, AT&amp;T version of the <ulink url="&kornshell;">Korn shell</ulink>.
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/rc">
                  <literal>rc</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/rc">&pop-rc;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/r/rc.html">&size-rc;</ulink></entry>
                <entry>
    No
    </entry>
                <entry>
    An implementation of the <ulink url="&attplanj;">AT&amp;T Plan 9</ulink> <ulink url="&rcshell;">rc shell</ulink>.
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/posh">
                  <literal>posh</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/posh">&pop-posh;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/p/posh.html">&size-posh;</ulink></entry>
                <entry>
    Yes
    </entry>
                <entry>
    Policy-compliant Ordinary SHell. A <literal>pdksh</literal> derivative.
    </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
        <simpara>In this tutorial chapter, the interactive shell always means <literal>bash</literal>.</simpara>
      </section>
      <section id="_customizing_bash">
        <title>Customizing bash</title>
        <simpara>You can customize <literal>bash</literal>(1) behavior by "<literal>~/.bashrc</literal>".  For example, I added followings to "<literal>~/.bashrc</literal>":</simpara>
        <screen># CD upon exiting MC
. /usr/share/mc/bin/mc.sh

# set CDPATH to good one
CDPATH=.:/usr/share/doc:~/Desktop/src:~/Desktop:~
export CDPATH

PATH="${PATH}":/usr/sbin:/sbin
# set PATH so it includes user's private bin if it exists
if [ -d ~/bin ] ; then
  PATH=~/bin:"${PATH}"
fi
export PATH

EDITOR=vim
export EDITOR</screen>
        <tip>
          <simpara>You can find more <literal>bash</literal> customization tips, such as <xref linkend="_colorized_commands"/>, in <xref linkend="_system_tips"/>.</simpara>
        </tip>
      </section>
      <section id="_special_key_strokes">
        <title>Special key strokes</title>
        <simpara>In the <ulink url="&unixlike;">Unix-like</ulink> environment, there are few key strokes which have special meanings.  Please note that on a normal Linux character console, only the left-hand <literal>Ctrl</literal> and <literal>Alt</literal> keys work as expected.  Here are few notable key strokes to remember.</simpara>
        <table id="listofkeybindingsforbash" pgwide="0" frame="topbot" rowsep="1" colsep="1">
          <title>List of key bindings for bash.</title>
          <tgroup cols="2">
            <colspec colwidth="30%*" align="left"/>
            <colspec colwidth="70%*" align="left"/>
            <thead>
              <row>
                <entry>
    key
    </entry>
                <entry>
    key binding
    </entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry>
                  <literal>Ctrl-U</literal>
                </entry>
                <entry>
    Erase line before cursor.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>Ctrl-H</literal>
                </entry>
                <entry>
    Erase a character before cursor.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>Ctrl-D</literal>
                </entry>
                <entry>
    Terminate input.  (exit shell if you are using shell)
    </entry>
              </row>
              <row>
                <entry>
                  <literal>Ctrl-C</literal>
                </entry>
                <entry>
    Terminate a running program.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>Ctrl-Z</literal>
                </entry>
                <entry>
    Temporarily stop program by moving it to the background job
    </entry>
              </row>
              <row>
                <entry>
                  <literal>Ctrl-S</literal>
                </entry>
                <entry>
    Halt output to screen.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>Ctrl-Q</literal>
                </entry>
                <entry>
    Reactivate output to screen.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>Ctrl-Alt-Del</literal>
                </entry>
                <entry>
    Reboot/halt the system, see <literal>inittab</literal>(5).
    </entry>
              </row>
              <row>
                <entry><literal>Left-Alt-key</literal> (optionally, <literal>Windows-key</literal>)
    </entry>
                <entry>
    Meta-key for Emacs and the similar UI.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>Up-arrow</literal>
                </entry>
                <entry>
    Start command history search under <literal>bash</literal>.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>Ctrl-R</literal>
                </entry>
                <entry>
    Start incremental command history search under <literal>bash</literal>.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>Tab</literal>
                </entry>
                <entry>
    Complete input of the filename to the command line under <literal>bash</literal>.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>Ctrl-V</literal>
                  <literal>Tab</literal>
                </entry>
                <entry>
    Input <literal>Tab</literal> without expansion to the command line under <literal>bash</literal>.
    </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
        <tip>
          <simpara>The terminal feature of <literal>Ctrl-S</literal> can be disabled using <literal>stty</literal>(1).</simpara>
        </tip>
      </section>
      <section id="_unix_style_mouse_operations">
        <title>Unix style mouse operations</title>
        <simpara>Unix style mouse operations are based on the 3 button mouse system.</simpara>
        <table id="listofunixstylemouseoperations" pgwide="0" frame="topbot" rowsep="1" colsep="1">
          <title>List of Unix style mouse operations.</title>
          <tgroup cols="2">
            <colspec colwidth="30%*" align="left"/>
            <colspec colwidth="70%*" align="left"/>
            <thead>
              <row>
                <entry>
    action
    </entry>
                <entry>
    response
    </entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry>
    Left-click-and-drag mouse
    </entry>
                <entry>
    Select and copy to the clipboard.
    </entry>
              </row>
              <row>
                <entry>
    Left-click
    </entry>
                <entry>
    Select the start of selection.
    </entry>
              </row>
              <row>
                <entry>
    Right-click
    </entry>
                <entry>
    Select the end of selection and copy to the clipboard.
    </entry>
              </row>
              <row>
                <entry>
    Middle-click
    </entry>
                <entry>
    Paste clipboard at the cursor.
    </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
        <simpara>The center wheel on the modern wheel mouse is considered middle mouse button and can be used for middle-click.  Clicking left and right mouse buttons together serves as the middle-click under the 2 button mouse system situation.  In order to use a mouse in Linux character consoles, you need to have <literal>gpm</literal>(8) running as daemon.</simpara>
      </section>
      <section id="_the_pager">
        <title>The pager</title>
        <simpara><literal>less</literal>(1) is the enhanced pager (file content browser).  Hit "<literal>h</literal>" for help.  It can do much more than <literal>more</literal>(1) and can be supercharged by executing "<literal>eval $(lesspipe)</literal>" or "<literal>eval $(lessfile)</literal>" in the shell startup script. See more in "<literal>/usr/share/doc/lessf/LESSOPEN</literal>".  The "<literal>-R</literal>" option allows raw character output and enables ANSI color escape sequences.  See <literal>less</literal>(1).</simpara>
      </section>
      <section id="_the_text_editor">
        <title>The text editor</title>
        <simpara>You should become proficient in one of variants of <ulink url="&vim;">Vim</ulink> or <ulink url="&emacs;">Emacs</ulink> programs which are popular in the Unix-like system.</simpara>
        <simpara>I think getting used to Vim commands is the right thing to do, since Vi-editor is always there in the Linux/Unix world.  (Actually, original <literal>vi</literal> or new <literal>nvi</literal> are programs you find everywhere.  I chose Vim instead for newbie since it offers you help through <literal>F1</literal> key while it is similar enough and more powerful.)</simpara>
        <simpara>If you chose either <ulink url="&emacs;">Emacs</ulink> or <ulink url="&xemacs;">XEmacs</ulink> instead as your choice of the editor, that is another good choice indeed, particularly for programming.  Emacs has a plethora of other features as well, including functioning as a newsreader, directory editor, mail program, etc..  When used for programming or editing shell scripts, it intelligently recognizes the format of what you are working on, and tries to provide assistance.  Some people maintain that the only program they need on Linux is Emacs.  Ten minutes learning Emacs now can save hours later.  Having the GNU Emacs manual for reference when learning Emacs is highly recommended.</simpara>
        <simpara>All these programs usually come with tutoring program for you to learn them by practice.  Start Vim by typing "<literal>vim</literal>" and press F1-key.  You should at least read the first 35 lines.  Then do the online training course by moving cursor to "<literal>|tutor|</literal>" and pressing <literal>Ctrl-]</literal>.</simpara>
        <note>
          <simpara>Good editors, such as Vim and Emacs, can be used to handle UTF-8 and other exotic encoding texts correctly with proper option in the x-terminal-emulator on X under UTF-8 locale with proper font settings.  Please refer to their documentation on multibyte text.</simpara>
        </note>
      </section>
      <section id="_setting_a_default_text_editor">
        <title>Setting a default text editor</title>
        <simpara>Debian comes with a number of different editors. We recommend to install the <literal>vim</literal> package, as mentioned above.</simpara>
        <simpara>Debian provides unified access to the system default editor via command "<literal>/usr/bin/editor</literal>" so other programs (e.g., <literal>reportbug</literal>(1)) can invoke it.  You can change it by:</simpara>
        <screen>$ sudo update-alternatives --config editor</screen>
        <simpara>The choice "<literal>/usr/bin/vim.basic</literal>" over "<literal>/usr/bin/vim.tiny</literal>" is my recommendation for newbies since it supports syntax highlighting.</simpara>
        <tip>
          <simpara>Many programs use the environment variables "<literal>$EDITOR</literal>" or "<literal>$VISUAL</literal>" to decide which editor to use (see <xref linkend="_the_internal_editor_in_mc"/> and <xref linkend="_customizing_program_to_be_started"/>).  For the consistency on Debian system, set these to "<literal>/usr/bin/editor</literal>". (Historically, "<literal>$EDITOR</literal>" was "<literal>ed</literal>" and "<literal>$VISUAL</literal>" was "<literal>vi</literal>".)</simpara>
        </tip>
      </section>
      <section id="_customizing_vim">
        <title>Customizing vim</title>
        <simpara>You can customize <literal>vim</literal>(1) behavior by "<literal>~/.vimrc</literal>".  For example, I use:</simpara>
        <screen>" -------------------------------
" Local configuration
"
set nocompatible
set nopaste
set pastetoggle=&lt;f2&gt;
syn on
if $USER == "root"
 set nomodeline
 set noswapfile
else
 set modeline
 set swapfile
endif
" filler to avoid the line above being recognized as a modeline
" filler
" filler</screen>
      </section>
      <section id="_recording_the_shell_activities">
        <title>Recording the shell activities</title>
        <simpara>The output of the shell command may roll off your screen and may be lost forever.  It is good practice to log shell activities into the file for you to review them later.  This kind of record is essential when you perform any system administration tasks.</simpara>
        <simpara>The basic method of recording the shell activity is to run it under <literal>script</literal>(1).</simpara>
        <screen>$ script
Script started, file is typescript</screen>
        <itemizedlist>
          <listitem>
            <simpara>
do whatever shell commands …
</simpara>
          </listitem>
          <listitem>
            <simpara>
press <literal>Ctrl-D</literal> to exit <literal>script</literal>.
</simpara>
          </listitem>
        </itemizedlist>
        <screen>$ vim typescript</screen>
        <simpara>See <xref linkend="_recording_the_shell_activities_cleanly"/> .</simpara>
      </section>
      <section id="_basic_unix_commands">
        <title>Basic Unix commands</title>
        <simpara>Let's learn basic Unix commands.  Here I use "Unix" in its generic sense.  Any Unix clone OSs usually offer equivalent commands.  The Debian system is no exception.  Do not worry if some commands do not work as you wish now. If <literal>alias</literal> is used in the shell, its corresponding command outputs are different.  These examples are not meant to be executed in this order.</simpara>
        <simpara>Try all following commands from the non-privileged user account:</simpara>
        <table id="listofbasicunixcommands" pgwide="0" frame="topbot" rowsep="1" colsep="1">
          <title>List of basic Unix commands.</title>
          <tgroup cols="2">
            <colspec colwidth="30%*" align="left"/>
            <colspec colwidth="70%*" align="left"/>
            <thead>
              <row>
                <entry>
    command
    </entry>
                <entry>
    description
    </entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry>
                  <literal>pwd</literal>
                </entry>
                <entry>
    Display name of current/working directory.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>whoami</literal>
                </entry>
                <entry>
    Display current user name.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>id</literal>
                </entry>
                <entry>
    Display current user identity (name, uid, gid, and associated groups).
    </entry>
              </row>
              <row>
                <entry>
                  <literal>file &lt;foo&gt;</literal>
                </entry>
                <entry>
    Display a type of file for the file "<literal>&lt;foo&gt;</literal>".
    </entry>
              </row>
              <row>
                <entry>
                  <literal>type -p &lt;commandname&gt;</literal>
                </entry>
                <entry>
    Display a file location of command "<literal>&lt;commandname&gt;</literal>".
    </entry>
              </row>
              <row>
                <entry>
                  <literal>which &lt;commandname&gt;</literal>
                </entry>
                <entry>
    , ,
    </entry>
              </row>
              <row>
                <entry>
                  <literal>type &lt;commandname&gt;</literal>
                </entry>
                <entry>
    Display information on command "<literal>&lt;commandname&gt;</literal>".
    </entry>
              </row>
              <row>
                <entry>
                  <literal>apropos &lt;key-word&gt;</literal>
                </entry>
                <entry>
    Find commands related to "<literal>&lt;key-word&gt;</literal>".
    </entry>
              </row>
              <row>
                <entry>
                  <literal>man -k &lt;key-word&gt;</literal>
                </entry>
                <entry>
    , ,
    </entry>
              </row>
              <row>
                <entry>
                  <literal>whatis &lt;commandname&gt;</literal>
                </entry>
                <entry>
    Display one line explanation on command "<literal>&lt;commandname&gt;</literal>".
    </entry>
              </row>
              <row>
                <entry>
                  <literal>man -a &lt;commandname&gt;</literal>
                </entry>
                <entry>
    Display explanation on command "<literal>&lt;commandname&gt;</literal>". (Unix style)
    </entry>
              </row>
              <row>
                <entry>
                  <literal>info &lt;commandname&gt;</literal>
                </entry>
                <entry>
    Display rather long explanation on command "<literal>&lt;commandname&gt;</literal>". (GNU style)
    </entry>
              </row>
              <row>
                <entry>
                  <literal>ls</literal>
                </entry>
                <entry>
    List contents of directory.  (non-dot files and directories)
    </entry>
              </row>
              <row>
                <entry>
                  <literal>ls -a</literal>
                </entry>
                <entry>
    List contents of directory.  (all files and directories)
    </entry>
              </row>
              <row>
                <entry>
                  <literal>ls -A</literal>
                </entry>
                <entry>
    List contents of directory.  (almost all files and directories, i.e., skip "<literal>..</literal>" and "<literal>.</literal>")
    </entry>
              </row>
              <row>
                <entry>
                  <literal>ls -la</literal>
                </entry>
                <entry>
    List all contents of directory with detail information.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>ls -lai</literal>
                </entry>
                <entry>
    List all contents of directory with inode number and detail information.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>ls -d</literal>
                </entry>
                <entry>
    List all directories under the current directory.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>tree</literal>
                </entry>
                <entry>
    Display file tree contents.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>lsof &lt;foo&gt;</literal>
                </entry>
                <entry>
    List open status of file "<literal>&lt;foo&gt;</literal>".
    </entry>
              </row>
              <row>
                <entry>
                  <literal>lsof -p &lt;pid&gt;</literal>
                </entry>
                <entry>
    List files opened by the process ID: "<literal>&lt;pid&gt;</literal>".
    </entry>
              </row>
              <row>
                <entry>
                  <literal>mkdir &lt;foo&gt;</literal>
                </entry>
                <entry>
    Make a new directory "<literal>&lt;foo&gt;</literal>" in the current directory.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>rmdir &lt;foo&gt;</literal>
                </entry>
                <entry>
    Remove a directory "<literal>&lt;foo&gt;</literal>" in the current directory.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>cd &lt;foo&gt;</literal>
                </entry>
                <entry>
    Change directory to the directory "<literal>&lt;foo&gt;</literal>" in the current directory or in the directory listed in the variable "<literal>$CDPATH</literal>".
    </entry>
              </row>
              <row>
                <entry>
                  <literal>cd /</literal>
                </entry>
                <entry>
    Change directory to the root directory.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>cd</literal>
                </entry>
                <entry>
    Change directory to the current user's home directory.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>cd /&lt;foo&gt;</literal>
                </entry>
                <entry>
    Change directory to the absolute path directory "<literal>/&lt;foo&gt;</literal>".
    </entry>
              </row>
              <row>
                <entry>
                  <literal>cd ..</literal>
                </entry>
                <entry>
    Change directory to the parent directory.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>cd ~&lt;foo&gt;</literal>
                </entry>
                <entry>
    Change directory to the home directory of the user "<literal>&lt;foo&gt;</literal>".
    </entry>
              </row>
              <row>
                <entry>
                  <literal>cd -</literal>
                </entry>
                <entry>
    Change directory to the previous directory.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>&lt;/etc/motd pager</literal>
                </entry>
                <entry>
    Display contents of "<literal>/etc/motd</literal>" using the default pager.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>touch &lt;junkfile&gt;</literal>
                </entry>
                <entry>
    Create a empty file "<literal>&lt;junkfile&gt;</literal>".
    </entry>
              </row>
              <row>
                <entry>
                  <literal>cp &lt;foo&gt; &lt;bar&gt;</literal>
                </entry>
                <entry>
    Copy a existing file "<literal>&lt;foo&gt;</literal>" to a new file "<literal>&lt;bar&gt;</literal>".
    </entry>
              </row>
              <row>
                <entry>
                  <literal>rm &lt;junkfile&gt;</literal>
                </entry>
                <entry>
    Remove a file "<literal>&lt;junkfile&gt;</literal>".
    </entry>
              </row>
              <row>
                <entry>
                  <literal>mv &lt;foo&gt; &lt;bar&gt;</literal>
                </entry>
                <entry>
    Rename an existing file "<literal>&lt;foo&gt;</literal>" to a new name "<literal>&lt;bar&gt;</literal>". The directory "<literal>&lt;bar&gt;</literal>" must not exist.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>mv &lt;foo&gt; &lt;bar&gt;</literal>
                </entry>
                <entry>
    Move an existing file "<literal>&lt;foo&gt;</literal>" to a new location "<literal>&lt;bar&gt;/&lt;foo&gt;</literal>". The directory "<literal>&lt;bar&gt;</literal>" must exist.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>mv &lt;foo&gt; &lt;bar&gt;/&lt;baz&gt;</literal>
                </entry>
                <entry>
    Move an existing file "<literal>&lt;foo&gt;</literal>" to a new location with a new name "<literal>&lt;bar&gt;/&lt;baz&gt;</literal>".  The directory "<literal>&lt;bar&gt;</literal>" must exist but the directory "<literal>&lt;bar&gt;/&lt;baz&gt;</literal>" must not exist.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>chmod 600 &lt;foo&gt;</literal>
                </entry>
                <entry>
    Make an existing file "<literal>&lt;foo&gt;</literal>" to be non-readable and non-writable by the other people.  (non-executable for all)
    </entry>
              </row>
              <row>
                <entry>
                  <literal>chmod 644 &lt;foo&gt;</literal>
                </entry>
                <entry>
    Make an existing file "<literal>&lt;foo&gt;</literal>" to be readable but non-writable by the other people.  (non-executable for all)
    </entry>
              </row>
              <row>
                <entry>
                  <literal>chmod 755 &lt;foo&gt;</literal>
                </entry>
                <entry>
    Make an existing file "<literal>&lt;foo&gt;</literal>" to be readable but non-writable by the other people.  (executable for all)
    </entry>
              </row>
              <row>
                <entry>
                  <literal>find .  -name &lt;pattern&gt;</literal>
                </entry>
                <entry>
    find matching filenames using shell "<literal>&lt;pattern&gt;</literal>". (slower)
    </entry>
              </row>
              <row>
                <entry>
                  <literal>locate -d .  &lt;pattern&gt;</literal>
                </entry>
                <entry>
    find matching filenames using shell "<literal>&lt;pattern&gt;</literal>". (quicker using regularly generated database)
    </entry>
              </row>
              <row>
                <entry>
                  <literal>grep -e "&lt;pattern&gt;" *.html</literal>
                </entry>
                <entry>
    Find a "&lt;pattern&gt;" in all files ending with "<literal>.html</literal>" in current directory and display them all.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>top</literal>
                </entry>
                <entry>
    Display process information using full screen.  Type "<literal>q</literal>" to quit.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>ps aux | pager</literal>
                </entry>
                <entry>
    Display information on all the running processes using BSD style output.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>ps -ef | pager</literal>
                </entry>
                <entry>
    Display information on all the running processes using Unix system-V style output.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>ps aux | grep -e "[e]xim4*"</literal>
                </entry>
                <entry>
    Display all processes running "<literal>exim</literal>" and "<literal>exim4</literal>".
    </entry>
              </row>
              <row>
                <entry>
                  <literal>ps axf | pager</literal>
                </entry>
                <entry>
    Display information on all the running processes with ASCII art output.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>kill &lt;1234&gt;</literal>
                </entry>
                <entry>
    Kill a process identified by the process ID: "&lt;1234&gt;".
    </entry>
              </row>
              <row>
                <entry>
                  <literal>gzip &lt;foo&gt;</literal>
                </entry>
                <entry>
    Compress "<literal>&lt;foo&gt;</literal>" to create "<literal>&lt;foo&gt;.gz</literal>" using the Lempel-Ziv coding (LZ77).
    </entry>
              </row>
              <row>
                <entry>
                  <literal>gunzip &lt;foo&gt;.gz</literal>
                </entry>
                <entry>
    Decompress "<literal>&lt;foo&gt;.gz</literal>" to create "<literal>&lt;foo&gt;</literal>".
    </entry>
              </row>
              <row>
                <entry>
                  <literal>bzip2 &lt;foo&gt;</literal>
                </entry>
                <entry>
    Compress "<literal>&lt;foo&gt;</literal>" to create "<literal>&lt;foo&gt;.bz2</literal>" using the Burrows-Wheeler block sorting text compression algorithm, and Huffman coding.  (Better compression than <literal>gzip</literal>)
    </entry>
              </row>
              <row>
                <entry>
                  <literal>bunzip2 &lt;foo&gt;.bz2</literal>
                </entry>
                <entry>
    Decompress "<literal>&lt;foo&gt;.bz2</literal>" to create "<literal>&lt;foo&gt;</literal>".
    </entry>
              </row>
              <row>
                <entry>
                  <literal>tar -xvf &lt;foo&gt;.tar</literal>
                </entry>
                <entry>
    Extract files from "<literal>&lt;foo&gt;.tar</literal>" archive.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>tar -xvzf &lt;foo&gt;.tar.gz</literal>
                </entry>
                <entry>
    Extract files from gzipped "<literal>&lt;foo&gt;.tar.gz</literal>" archive.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>tar -xvf -j &lt;foo&gt;.tar.bz2</literal>
                </entry>
                <entry>
    Extract files from "<literal>&lt;foo&gt;.tar.bz2</literal>" archive.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>tar -cvf &lt;foo&gt;.tar &lt;bar&gt;/</literal>
                </entry>
                <entry>
    Archive contents of folder "<literal>&lt;bar&gt;/</literal>" in "<literal>&lt;foo&gt;.tar</literal>" archive.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>tar -cvzf &lt;foo&gt;.tar.gz &lt;bar&gt;/</literal>
                </entry>
                <entry>
    Archive contents of folder "<literal>&lt;bar&gt;/</literal>" in compressed "<literal>&lt;foo&gt;.tar.gz</literal>" archive.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>tar -cvjf &lt;foo&gt;.tar.bz2 &lt;bar&gt;/</literal>
                </entry>
                <entry>
    Archive contents of folder "<literal>&lt;bar&gt;/</literal>" in "<literal>&lt;foo&gt;.tar.bz2</literal>" archive.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>zcat README.gz | pager</literal>
                </entry>
                <entry>
    Display contents of compressed "<literal>README.gz</literal>" using the default pager.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>zcat README.gz &gt; foo</literal>
                </entry>
                <entry>
    Create a file "<literal>foo</literal>" with the decompressed content of "<literal>README.gz</literal>".
    </entry>
              </row>
              <row>
                <entry>
                  <literal>zcat README.gz &gt;&gt; foo</literal>
                </entry>
                <entry>
    Append the decompressed content of "<literal>README.gz</literal>" to the end of the file "<literal>foo</literal>".  (If it does not exist, create it first.)
    </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
        <note>
          <simpara>Unix has a tradition to hide filenames which start with "<literal>.</literal>".  They are traditionally files that contain configuration information and user preferences.</simpara>
        </note>
        <note>
          <simpara>For <literal>cd</literal> command, see <literal>builtins</literal>(7).</simpara>
        </note>
        <note>
          <simpara>The default pager of the bare bone Debian system is <literal>more</literal>(1) which cannot scroll back.  By installing the <literal>less</literal> package using command line "<literal>aptitude install less</literal>", <literal>less</literal>(1) becomes default pager and you can scroll back with cursor keys.</simpara>
        </note>
        <note>
          <simpara>The "<literal>[</literal>" and "<literal>]</literal>" in the regular expression of the "<literal>ps aux | grep -e "[e]xim4*"</literal>" command above enable <literal>grep</literal> to avoid matching itself.  The "<literal>4*</literal>" in the regular expression means 0 or more repeats of character "<literal>4</literal>" thus enables <literal>grep</literal> to match both "<literal>exim</literal>" and "<literal>exim4</literal>".  Although "<literal>*</literal>" is used in the shell filename glob and the regular expression, their meanings are different.  Learn the regular expression from <literal>grep</literal>(1).</simpara>
        </note>
        <simpara>Please traverse directories and peek into the system using the above commands as training.  If you have questions on any of console commands, please make sure to read the manual page.  For example, these commands are the good start:</simpara>
        <screen>$ man man
$ man bash
$ man builtins
$ man grep
$ man ls</screen>
        <simpara>The style of man pages may be a little hard to get used to, because they are rather terse, particularly the older, very traditional ones. But once you get used to it, you come to appreciate their succinctness.</simpara>
        <simpara>Please note that many Unix-like commands including ones from GNU and BSD will display brief help information if you invoke them in one of the following ways (or without any arguments in some cases):</simpara>
        <screen>$ &lt;commandname&gt; --help
$ &lt;commandname&gt; -h</screen>
      </section>
    </section>
    <section id="_the_simple_shell_command">
      <title>The simple shell command</title>
      <simpara>Now you have some feel on how to use the Debian system.  Let's look deep into the mechanism of the command execution in the Debian system. Here, I have simplified reality for the newbie.  See <literal>bash</literal>(1) for the exact explanation.</simpara>
      <simpara>A simple command is a sequence of:</simpara>
      <orderedlist>
        <listitem>
          <simpara>
variable assignments (optional)
</simpara>
        </listitem>
        <listitem>
          <simpara>
command name
</simpara>
        </listitem>
        <listitem>
          <simpara>
arguments (optional)
</simpara>
        </listitem>
        <listitem>
          <simpara>
redirections (optional: <literal>&gt;</literal> , <literal>&gt;&gt;</literal> , <literal>&lt;</literal> , <literal>&lt;&lt;</literal> , etc.)
</simpara>
        </listitem>
        <listitem>
          <simpara>
control operator (optional: <literal>&amp;&amp;</literal> , <literal>||</literal> , &lt;newline&gt; , <literal>;</literal> , <literal>&amp;</literal> , <literal>(</literal> , <literal>)</literal> )
</simpara>
        </listitem>
      </orderedlist>
      <section id="_command_execution_and_environment_variable">
        <title>Command execution and environment variable</title>
        <simpara>Values of some <ulink url="&environmentvariables;">environment variables</ulink> change the behavior of some Unix commands.</simpara>
        <simpara>Default values of environment variables are initially set by the PAM system and then some of them may be reset by some application programs:</simpara>
        <itemizedlist>
          <listitem>
            <simpara>
the display manager such as <literal>gdm</literal>, and
</simpara>
          </listitem>
          <listitem>
            <simpara>
the shell in its start up codes "<literal>~/bash_profile</literal>" and "<literal>~/.bashrc</literal>".
</simpara>
          </listitem>
        </itemizedlist>
        <section id="_lang_variable">
          <title>"$LANG" variable</title>
          <simpara>The full locale value given to "<literal>$LANG</literal>" variable consists of 3 parts: "<literal>xx_YY.ZZZZ</literal>".</simpara>
          <table id="dpartsoflocalevalue" pgwide="0" frame="topbot" rowsep="1" colsep="1">
            <title>3 parts of locale value.</title>
            <tgroup cols="2">
              <colspec colwidth="30%*" align="left"/>
              <colspec colwidth="70%*" align="left"/>
              <thead>
                <row>
                  <entry>
    locale value
    </entry>
                  <entry>
    meaning
    </entry>
                </row>
              </thead>
              <tbody>
                <row>
                  <entry>
                    <literal>xx</literal>
                  </entry>
                  <entry>
                    <ulink url="&isogdjlanguagecoowercasesuchasen;">ISO 639 language codes (lower case) such as "en"</ulink>
                  </entry>
                </row>
                <row>
                  <entry>
                    <literal>YY</literal>
                  </entry>
                  <entry>
                    <ulink url="&isodbggcountrycoppercasesuchasus;">ISO 3166 country codes (upper case) such as "US"</ulink>
                  </entry>
                </row>
                <row>
                  <entry>
                    <literal>ZZZZ</literal>
                  </entry>
                  <entry>
                    <ulink url="&codesetalwayssettoutfi;">codeset, always set to "UTF-8"</ulink>
                  </entry>
                </row>
              </tbody>
            </tgroup>
          </table>
          <simpara>For language codes and country codes, see pertinent description in the "<literal>info gettext</literal>".</simpara>
          <simpara>For the codeset on the modern Debian system, you should always set it to <emphasis role="strong"><literal>UTF-8</literal></emphasis> unless you specifically want to use the historic one with good reason and background knowledge.</simpara>
          <simpara>For fine details of the locale configuration, see <xref linkend="_the_locale"/>.</simpara>
          <note>
            <simpara>The "<literal>LANG=en_US</literal>" is not "<literal>LANG=C</literal>" nor "<literal>LANG=en_US.UTF-8</literal>". It is "<literal>LANG=en_US.ISO-8859-1</literal>" (see <xref linkend="_basics_of_encoding"/>).</simpara>
          </note>
          <table id="listoflocalerecommendations" pgwide="0" frame="topbot" rowsep="1" colsep="1">
            <title>List of locale recommendations.</title>
            <tgroup cols="2">
              <colspec colwidth="30%*" align="left"/>
              <colspec colwidth="70%*" align="left"/>
              <thead>
                <row>
                  <entry>
    locale recommendation
    </entry>
                  <entry>
    Language (area)
    </entry>
                </row>
              </thead>
              <tbody>
                <row>
                  <entry>
                    <literal>en_US.UTF-8</literal>
                  </entry>
                  <entry>
    English(USA)
    </entry>
                </row>
                <row>
                  <entry>
                    <literal>en_GB.UTF-8</literal>
                  </entry>
                  <entry>
    English(Great_Britain)
    </entry>
                </row>
                <row>
                  <entry>
                    <literal>fr_FR.UTF-8</literal>
                  </entry>
                  <entry>
    French(France)
    </entry>
                </row>
                <row>
                  <entry>
                    <literal>de_DE.UTF-8</literal>
                  </entry>
                  <entry>
    German(Germany)
    </entry>
                </row>
                <row>
                  <entry>
                    <literal>it_IT.UTF-8</literal>
                  </entry>
                  <entry>
    Italian(Italy)
    </entry>
                </row>
                <row>
                  <entry>
                    <literal>es_ES.UTF-8</literal>
                  </entry>
                  <entry>
    Spanish(Spain)
    </entry>
                </row>
                <row>
                  <entry>
                    <literal>ca_ES.UTF-8</literal>
                  </entry>
                  <entry>
    Catalan(Spain)
    </entry>
                </row>
                <row>
                  <entry>
                    <literal>sv_SE.UTF-8</literal>
                  </entry>
                  <entry>
    Swedish(Sweden)
    </entry>
                </row>
                <row>
                  <entry>
                    <literal>pt_BR.UTF-8</literal>
                  </entry>
                  <entry>
    Portuguese(Brasil)
    </entry>
                </row>
                <row>
                  <entry>
                    <literal>ru_RU.UTF-8</literal>
                  </entry>
                  <entry>
    Russian(Russia)
    </entry>
                </row>
                <row>
                  <entry>
                    <literal>zh_CN.UTF-8</literal>
                  </entry>
                  <entry>
    Chinese(P.R._of_China)
    </entry>
                </row>
                <row>
                  <entry>
                    <literal>zh_TW.UTF-8</literal>
                  </entry>
                  <entry>
    Chinese(Taiwan_R.O.C.)
    </entry>
                </row>
                <row>
                  <entry>
                    <literal>ja_JP.UTF-8</literal>
                  </entry>
                  <entry>
    Japanese(Japan)
    </entry>
                </row>
                <row>
                  <entry>
                    <literal>ko_KR.UTF-8</literal>
                  </entry>
                  <entry>
    Korean(Republic_of_Korea)
    </entry>
                </row>
                <row>
                  <entry>
                    <literal>vi_VN.UTF-8</literal>
                  </entry>
                  <entry>
    Vietnamese(Vietnam)
    </entry>
                </row>
              </tbody>
            </tgroup>
          </table>
          <simpara>Typical command execution uses a shell line sequence like the following:</simpara>
          <screen>$ date
Sun Jun  3 10:27:39 JST 2007
$ LANG=fr_FR.UTF-8 date
dimanche 3 juin 2007, 10:27:33 (UTC+0900)</screen>
          <simpara>Here, the program <literal>date</literal>(1) is executed in the foreground job.  The environment variable "<literal>$LANG</literal>" is:</simpara>
          <itemizedlist>
            <listitem>
              <simpara>
set to system default <ulink url="&locale;">locale</ulink> (such as "<literal>en_US.UTF-8</literal>" depending on your configuration) for the first command, and
</simpara>
            </listitem>
            <listitem>
              <simpara>
set to "<literal>fr_FR.UTF-8</literal>" (French UTF-8 <ulink url="&locale;">locale</ulink> assuming it is available on your system) for the second command.
</simpara>
            </listitem>
          </itemizedlist>
          <simpara>Most command executions usually do not have preceding environment variable definition.  For the above example, you can alternatively execute:</simpara>
          <screen>$ LANG=fr_FR.UTF-8
$ date
dimanche 3 juin 2007, 10:27:33 (UTC+0900)</screen>
          <simpara>As you can see here, the output of command is affected by the environment variable to produce French output.  If you want the environment variable to be inherited to subprocesses (e.g., when calling shell script), you need to "export" it instead by using:</simpara>
          <screen>$ export LANG</screen>
          <tip>
            <simpara>When filing a bug report, running and checking the command under "<literal>LANG=en_US.UTF-8</literal>" is good idea if you use non-English environment.</simpara>
          </tip>
          <simpara>See <literal>locale</literal>(5) and <literal>locale</literal>(7) for "<literal>$LANG</literal>" and related environment variables.</simpara>
          <note>
            <simpara>I recommend you to configure the system environment just by the "<literal>$LANG</literal>" variable and to stay away from "<literal>$LC_*</literal>" variables unless it is absolutely needed.</simpara>
          </note>
        </section>
        <section id="_path_variable">
          <title>"$PATH" variable</title>
          <simpara>When you type a command into the shell, the shell searches the command in the list of directories contained in the "<literal>$PATH</literal>" environment variable.  The value of the "<literal>$PATH</literal>" environment variable is also called the shell's search path.</simpara>
          <simpara>In the default Debian installation, the "<literal>$PATH</literal>" environment variable of user accounts may not include "<literal>/sbin</literal>" and "<literal>/usr/sbin</literal>".  For example, the <literal>ifconfig</literal> command needs to be issued with full path as "<literal>/sbin/ifconfig</literal>". (Similar <literal>ip</literal> command is located in "<literal>/bin</literal>".)</simpara>
          <simpara>You can change the "<literal>$PATH</literal>" environment variable of Bash shell by "<literal>~/.bash_profile</literal>" or "<literal>~/.bashrc</literal>" files.</simpara>
        </section>
        <section id="_home_variable">
          <title>"$HOME" variable</title>
          <simpara>Many commands stores user specific configuration in the home directory and changes their behavior by their contents.  The home directory is identified by the environment variable "<literal>$HOME</literal>":</simpara>
          <table id="listofhomevalues" pgwide="0" frame="topbot" rowsep="1" colsep="1">
            <title>List of "<literal>$HOME</literal>" values.</title>
            <tgroup cols="2">
              <colspec colwidth="30%*" align="left"/>
              <colspec colwidth="70%*" align="left"/>
              <thead>
                <row>
                  <entry>
    value of "<literal>$HOME</literal>"
    </entry>
                  <entry>
    program execution situation
    </entry>
                </row>
              </thead>
              <tbody>
                <row>
                  <entry>
                    <literal>/</literal>
                  </entry>
                  <entry>
    program run by the init process (daemon)
    </entry>
                </row>
                <row>
                  <entry>
                    <literal>/root</literal>
                  </entry>
                  <entry>
    program run from the normal root shell
    </entry>
                </row>
                <row>
                  <entry>
                    <literal>/home/&lt;normal_user&gt;</literal>
                  </entry>
                  <entry>
    program run from the normal user shell
    </entry>
                </row>
                <row>
                  <entry>
                    <literal>/home/&lt;normal_user&gt;</literal>
                  </entry>
                  <entry>
    program run from the normal user GUI desktop menu
    </entry>
                </row>
                <row>
                  <entry>
                    <literal>/home/&lt;normal_user&gt;</literal>
                  </entry>
                  <entry>
    program run as root with "<literal>sudo program</literal>"
    </entry>
                </row>
                <row>
                  <entry>
                    <literal>/root</literal>
                  </entry>
                  <entry>
    program run as root with "<literal>sudo -H program</literal>"
    </entry>
                </row>
              </tbody>
            </tgroup>
          </table>
          <tip>
            <simpara>Shell expands "<literal>~/</literal>" to current user’s home directory, i.e., "<literal>$HOME/</literal>". Shell expands "<literal>~foo/</literal>" to <literal>foo</literal>'s home directory, i.e., "<literal>/home/foo/</literal>".</simpara>
          </tip>
        </section>
      </section>
      <section id="_command_line_options">
        <title>Command line options</title>
        <simpara>Some commands take arguments.  Arguments starting with "<literal>-</literal>" or "<literal>--</literal>" are called options and control the behavior of the command.</simpara>
        <screen>$ date
Mon Oct 27 23:02:09 CET 2003
$ date -R
Mon, 27 Oct 2003 23:02:40 +0100</screen>
        <simpara>Here the command-line argument "<literal>-R</literal>" changes <literal>date</literal>(1) behavior to output <ulink url="&rfccicc;">RFC2822</ulink> compliant date string.</simpara>
      </section>
      <section id="_shell_glob">
        <title>Shell glob</title>
        <simpara>Often you want a command to work with a group of files without typing all of them.  The filename expansion pattern using the shell <emphasis role="strong">glob</emphasis>, (sometimes referred as <emphasis role="strong">wildcards</emphasis>), facilitate this need.</simpara>
        <table id="shellglobpatterns" pgwide="0" frame="topbot" rowsep="1" colsep="1">
          <title>Shell glob patterns.</title>
          <tgroup cols="2">
            <colspec colwidth="30%*" align="left"/>
            <colspec colwidth="70%*" align="left"/>
            <thead>
              <row>
                <entry>
    shell glob pattern
    </entry>
                <entry>
    match
    </entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry>
                  <literal>*</literal>
                </entry>
                <entry>
    This matches filename (segment) not started with "<literal>.</literal>".
    </entry>
              </row>
              <row>
                <entry>
                  <literal>.*</literal>
                </entry>
                <entry>
    This matches filename (segment) started with "<literal>.</literal>".
    </entry>
              </row>
              <row>
                <entry>
                  <literal>?</literal>
                </entry>
                <entry>
    This matches exactly one character.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>[…]</literal>
                </entry>
                <entry>
    This matches exactly one character with any character enclosed in brackets.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>[a-z]</literal>
                </entry>
                <entry>
    This matches exactly one character with any character between "<literal>a</literal>" and "<literal>z</literal>".
    </entry>
              </row>
              <row>
                <entry>
                  <literal>[^…]</literal>
                </entry>
                <entry>
    This matches exactly one character other than any character enclosed in brackets (excluding "<literal>^</literal>").
    </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
        <simpara>For example, try the following and think for yourself:</simpara>
        <screen>$ mkdir junk; cd junk; .[^.]*touch 1.txt 2.txt 3.c 4.h .5.txt ..6.txt
$ echo *.txt
1.txt 2.txt
$ echo *
1.txt 2.txt 3.c 4.h
$ echo *.[hc]
3.c 4.h
$ echo .*
. .. .5.txt ..6.txt
$ echo .*[^.]*
.5.txt ..6.txt
$ echo [^1-3]*
4.h
$ cd ..; rm -rf junk</screen>
        <simpara>See <literal>glob</literal>(7) for more.</simpara>
        <note>
          <simpara>Unlike normal filename expansion by the shell, the shell pattern "<literal>*</literal>" tested in <literal>find</literal>(1) with "<literal>-name</literal>" test etc., matches the initial "<literal>.</literal>" of the filename. (New <ulink url="&posix;">POSIX</ulink> feature)</simpara>
        </note>
        <note>
          <simpara>BASH can be tweaked to change its glob behavior with its shopt builtin options such as "<literal>dotglob</literal>", "<literal>noglob</literal>", "<literal>nocaseglob</literal>", "<literal>nullglob</literal>", "<literal>nocaseglob</literal>", "<literal>extglob</literal>", etc.  See <literal>bash</literal>(1).</simpara>
        </note>
      </section>
      <section id="_return_value_of_the_command">
        <title>Return value of the command</title>
        <simpara>Each command returns its exit status (variable: "<literal>$?</literal>") as the return value.</simpara>
        <table id="commandexitcodes" pgwide="0" frame="topbot" rowsep="1" colsep="1">
          <title>Command exit codes.</title>
          <tgroup cols="3">
            <colspec colwidth="30%*" align="left"/>
            <colspec colwidth="30%*" align="left"/>
            <colspec colwidth="40%*" align="left"/>
            <thead>
              <row>
                <entry>
    command exit status
    </entry>
                <entry>
    numeric return value
    </entry>
                <entry>
    logical return value
    </entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry>
    success
    </entry>
                <entry>
    zero, 0
    </entry>
                <entry>
                  <emphasis role="strong">TRUE</emphasis>
                </entry>
              </row>
              <row>
                <entry>
    error
    </entry>
                <entry>
    non-zero, -1
    </entry>
                <entry>
                  <emphasis role="strong">FALSE</emphasis>
                </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
        <simpara>Thus:</simpara>
        <screen>$ [ 1 = 1 ] ; echo $?
0
$ [ 1 = 2 ] ; echo $?
1</screen>
        <note>
          <simpara>Please note that, in the logical context for the shell, <emphasis role="strong">success</emphasis> is treated as the logical <emphasis role="strong">TRUE</emphasis> which has 0 (zero) as its value.  This is somewhat non-intuitive and needs to be reminded here.</simpara>
        </note>
      </section>
      <section id="_typical_command_sequences_and_shell_redirection">
        <title>Typical command sequences and shell redirection</title>
        <simpara>Let's try to remember following shell command idioms.</simpara>
        <table id="shellcommandidioms" pgwide="0" frame="topbot" rowsep="1" colsep="1">
          <title>Shell command idioms.</title>
          <tgroup cols="2">
            <colspec colwidth="30%*" align="left"/>
            <colspec colwidth="70%*" align="left"/>
            <thead>
              <row>
                <entry>
    command idiom (type in one line)
    </entry>
                <entry>
    description
    </entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry>
                  <literal>command &amp;</literal>
                </entry>
                <entry>
    The <literal>command</literal> is executed in the subshell in the <emphasis role="strong">background</emphasis>.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>command1 | command2</literal>
                </entry>
                <entry>
    The standard output of <literal>command1</literal> is piped to the standard input of <literal>command2</literal> .  Both commands may be running <emphasis role="strong">concurrently</emphasis>.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>command1 2&gt;&amp;1 | command2</literal>
                </entry>
                <entry>
    Both standard output and standard error of <literal>command1</literal> are piped to the standard input of <literal>command2</literal>.  Both commands may be running <emphasis role="strong">concurrently</emphasis>.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>command1 ; command2</literal>
                </entry>
                <entry>
    The <literal>command1</literal> and <literal>command2</literal> are executed <emphasis role="strong">sequentially</emphasis>.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>command1 &amp;&amp; command2</literal>
                </entry>
                <entry>
    The <literal>command1</literal> is executed.  If successful, <literal>command2</literal> is also executed <emphasis role="strong">sequentially</emphasis>.  Return success if both <literal>command1</literal> <emphasis role="strong">and</emphasis> <literal>command2</literal> are successful.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>command1 || command2</literal>
                </entry>
                <entry>
    The <literal>command1</literal> is executed.  If not successful, <literal>command2</literal> is also executed <emphasis role="strong">sequentially</emphasis>.  Return success if <literal>command1</literal> <emphasis role="strong">or</emphasis> <literal>command2</literal> are successful.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>command &gt; foo</literal>
                </entry>
                <entry>
    Redirect standard output of <literal>command</literal> to a file <literal>foo</literal>.  (overwrite)
    </entry>
              </row>
              <row>
                <entry>
                  <literal>command 2&gt; foo</literal>
                </entry>
                <entry>
    Redirect standard error of <literal>command</literal> to a file <literal>foo</literal>.  (overwrite)
    </entry>
              </row>
              <row>
                <entry>
                  <literal>command &gt;&gt; foo</literal>
                </entry>
                <entry>
    Redirect standard output of <literal>command</literal> to a file <literal>foo</literal>.  (append)
    </entry>
              </row>
              <row>
                <entry>
                  <literal>command 2&gt;&gt; foo</literal>
                </entry>
                <entry>
    Redirect standard error of <literal>command</literal> to a file <literal>foo</literal>.  (append)
    </entry>
              </row>
              <row>
                <entry>
                  <literal>command &gt; foo 2&gt;&amp;1</literal>
                </entry>
                <entry>
    Redirect both standard output and standard error of <literal>command</literal> to a file "<literal>foo</literal>".
    </entry>
              </row>
              <row>
                <entry>
                  <literal>command &lt; foo</literal>
                </entry>
                <entry>
    Redirect standard input of <literal>command</literal> to a file <literal>foo</literal>.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>command &lt;&lt; delimiter</literal>
                </entry>
                <entry>
    Redirect standard input of <literal>command</literal> to the following lines until "<literal>delimiter</literal>" is met.  (Here documents)
    </entry>
              </row>
              <row>
                <entry>
                  <literal>command &lt;&lt;- delimiter</literal>
                </entry>
                <entry>
    Redirect standard input of <literal>command</literal> to the following lines until "<literal>delimiter</literal>" is met.  The leading tab characters are stripped from input lines. (Here documents)
    </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
        <simpara>The Debian system is a multi-tasking system. Background jobs allow users to run multiple programs in a single shell.  The management of the background process involves the shell builtins: <literal>jobs</literal>, <literal>fg</literal>, <literal>bg</literal>, and <literal>kill</literal>.  Please read sections of bash(1) under "SIGNALS", and "JOB CONTROL", and <literal>builtins</literal>(1).</simpara>
        <simpara>Let's try simple examples of redirection:</simpara>
        <screen>$ &lt;/etc/motd pager</screen>
        <screen>$ pager &lt;/etc/motd</screen>
        <screen>$ pager /etc/motd</screen>
        <screen>$ cat /etc/motd | pager</screen>
        <simpara>Although all 4 examples display the same thing, the last example runs an extra <literal>cat</literal> command and wastes resources with no reason.</simpara>
        <simpara>The shell allows you to open files using the <literal>exec</literal> builtin with an arbitrary file descriptor.</simpara>
        <screen>$ echo Hello &gt;foo
$ exec 3&lt;foo 4&gt;bar  # open files
$ cat &lt;&amp;3 &gt;&amp;4       # redirect stdin to 3, stdout to 4
$ exec 3&lt;&amp;- 4&gt;&amp;-    # close files
$ cat bar
Hello</screen>
        <simpara>Here, "<literal><emphasis>n</emphasis>&lt;&amp;-</literal>" and "<literal><emphasis>n</emphasis>&gt;&amp;-</literal>" mean to close the file descriptor "<literal><emphasis>n</emphasis></literal>".</simpara>
        <simpara>The file descriptor 0-2 are predefined:</simpara>
        <table id="predefinedfiledescriptors" pgwide="0" frame="topbot" rowsep="1" colsep="1">
          <title>Predefined file descriptors.</title>
          <tgroup cols="3">
            <colspec colwidth="30%*" align="left"/>
            <colspec colwidth="30%*" align="left"/>
            <colspec colwidth="40%*" align="left"/>
            <thead>
              <row>
                <entry>
    device
    </entry>
                <entry>
    description
    </entry>
                <entry>
    file descriptor
    </entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry>
                  <literal>stdin</literal>
                </entry>
                <entry>
    standard input
    </entry>
                <entry>
    0
    </entry>
              </row>
              <row>
                <entry>
                  <literal>stdout</literal>
                </entry>
                <entry>
    standard output
    </entry>
                <entry>
    1
    </entry>
              </row>
              <row>
                <entry>
                  <literal>stderr</literal>
                </entry>
                <entry>
    standard error
    </entry>
                <entry>
    2
    </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
      </section>
      <section id="_command_alias">
        <title>Command alias</title>
        <simpara>You can set an alias for the frequently used command.  For example:</simpara>
        <screen>$ alias la='ls -la'</screen>
        <simpara>Now, "<literal>la</literal>" works as a short hand for "<literal>ls -la</literal>" which lists all files in the long listing format.</simpara>
        <simpara>You can list any existing aliases:</simpara>
        <screen>$ alias</screen>
        <simpara>You can identity exact path or identity of the command using <literal>type</literal> builtins command.  For example:</simpara>
        <screen>$ type ls
ls is hashed (/bin/ls)
$ type la
la is aliased to ls -la
$ type echo
echo is a shell builtin
$ type file
file is /usr/bin/file</screen>
        <simpara>Here <literal>ls</literal> was recently searched while "<literal>file</literal>" was not, thus "<literal>ls</literal>" is "hashed", i.e., the shell has an internal record for the quick access to the location of the "<literal>ls</literal>" command.</simpara>
        <tip>
          <simpara>See <xref linkend="_colorized_commands"/>.</simpara>
        </tip>
      </section>
    </section>
    <section id="_unix_like_text_processing">
      <title>Unix-like text processing</title>
      <simpara>In Unix-like work environment, text processing is done by piping text through chains of standard text processing tools. This was another crucial Unix innovation.</simpara>
      <section id="_unix_text_tools">
        <title>Unix text tools</title>
        <simpara>There are few standard text processing tools which are used very often on the Unix-like system.</simpara>
        <itemizedlist>
          <listitem>
            <simpara>
No regular expression is used:
</simpara>
            <itemizedlist>
              <listitem>
                <simpara><literal>cat</literal>(1) concatenates files and outputs the whole content.
</simpara>
              </listitem>
              <listitem>
                <simpara><literal>tac</literal>(1) concatenates files and outputs in reverse.
</simpara>
              </listitem>
              <listitem>
                <simpara><literal>cut</literal>(1) selects parts of lines and outputs.
</simpara>
              </listitem>
              <listitem>
                <simpara><literal>head</literal>(1) outputs the first part of files.
</simpara>
              </listitem>
              <listitem>
                <simpara><literal>tail</literal>(1) outputs the last part of files.
</simpara>
              </listitem>
              <listitem>
                <simpara><literal>sort</literal>(1) sorts lines of text files.
</simpara>
              </listitem>
              <listitem>
                <simpara><literal>uniq</literal>(1) removes duplicate lines from a sorted file.
</simpara>
              </listitem>
              <listitem>
                <simpara><literal>tr</literal>(1) translates or deletes characters.
</simpara>
              </listitem>
              <listitem>
                <simpara><literal>diff</literal>(1) compares files line by line.
</simpara>
              </listitem>
            </itemizedlist>
          </listitem>
          <listitem>
            <simpara>
Basic regular expression (<emphasis role="strong">BRE</emphasis>) is used:
</simpara>
            <itemizedlist>
              <listitem>
                <simpara><literal>grep</literal>(1) matches text with patterns.
</simpara>
              </listitem>
              <listitem>
                <simpara><literal>ed</literal>(1) is a primitive line editor.
</simpara>
              </listitem>
              <listitem>
                <simpara><literal>sed</literal>(1) is a stream editor.
</simpara>
              </listitem>
              <listitem>
                <simpara><literal>vim</literal>(1) is a screen editor.
</simpara>
              </listitem>
              <listitem>
                <simpara><literal>emacs</literal>(1) is a screen editor. (somewhat extended <emphasis role="strong">BRE</emphasis>)
</simpara>
              </listitem>
            </itemizedlist>
          </listitem>
          <listitem>
            <simpara>
Extended regular expression (<emphasis role="strong">ERE</emphasis>) is used:
</simpara>
            <itemizedlist>
              <listitem>
                <simpara><literal>egrep</literal>(1) matches text with patterns.
</simpara>
              </listitem>
              <listitem>
                <simpara><literal>awk</literal>(1) does simple text processing.
</simpara>
              </listitem>
              <listitem>
                <simpara><literal>tcl</literal>(3tcl) can do every conceivable text processing: <literal>re_syntax</literal>(3). Often used with <literal>tk</literal>(3tk).
</simpara>
              </listitem>
              <listitem>
                <simpara><literal>perl</literal>(1) can do every conceivable text processing.  <literal>perlre</literal>(1).
</simpara>
              </listitem>
              <listitem>
                <simpara><literal>pcregrep</literal>(1) from the <literal>pcregrep</literal> package matches text with <ulink url="&perlcompatiblererexpressionspcre;">Perl Compatible Regular Expressions (PCRE)</ulink> pattern.
</simpara>
              </listitem>
              <listitem>
                <simpara><literal>python</literal>(1) with the <literal>re</literal> module can do every conceivable text processing. See "<literal>/usr/share/doc/python/html/index.html</literal>".
</simpara>
              </listitem>
            </itemizedlist>
          </listitem>
        </itemizedlist>
        <simpara>If you are not sure what exactly these commands do, please use "<literal>man command</literal>" to figure it out by yourself.</simpara>
        <note>
          <simpara>Sort order and range expression are locale dependent.  If you wish to obtain traditional behavior for a command, use <emphasis role="strong">C</emphasis> locale instead of <emphasis role="strong">UTF-8</emphasis> ones by prepnding command with "<literal>LANG=C</literal>" (see <xref linkend="_lang_variable"/> and <xref linkend="_the_locale"/>).</simpara>
        </note>
        <note>
          <simpara><ulink url="&perl;">Perl</ulink> regular expressions (<literal>perlre</literal>(1)), <ulink url="&perlcompatiblererexpressionspcre;">Perl Compatible Regular Expressions (PCRE)</ulink>, and <ulink url="&python;">Python</ulink> regular expressions offered by the <literal>re</literal> module have many common extensions to the normal <emphasis role="strong">ERE</emphasis>.</simpara>
        </note>
      </section>
      <section id="_regular_expressions">
        <title>Regular expressions</title>
        <simpara><ulink url="&regularexpressions;">Regular expressions</ulink> are used in many text processing tools.  They are analogous to the shell globs, but they are more complicated and powerful.</simpara>
        <simpara>The regular expression describes the matching pattern and is made up of text characters and <emphasis role="strong">metacharacters</emphasis>.</simpara>
        <simpara>The <emphasis role="strong">metacharacter</emphasis> is just a character with a special meaning.  There are 2 major styles, <emphasis role="strong">BRE</emphasis> and <emphasis role="strong">ERE</emphasis>, depending on the text tools as described above.</simpara>
        <table id="metacharactersforbreandere" pgwide="0" frame="topbot" rowsep="1" colsep="1">
          <title>Metacharacters for BRE and ERE.</title>
          <tgroup cols="3">
            <colspec colwidth="30%*" align="left"/>
            <colspec colwidth="30%*" align="left"/>
            <colspec colwidth="40%*" align="left"/>
            <thead>
              <row>
                <entry>
    BRE
    </entry>
                <entry>
    ERE
    </entry>
                <entry>
    The meaning of the regular expression
    </entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry>
                  <literal> \ .  [ ] ^ $ *  </literal>
                </entry>
                <entry>
                  <literal>\ .  [ ] ^ $ *</literal>
                </entry>
                <entry>
    Common <emphasis role="strong">metacharacters</emphasis>
    </entry>
              </row>
              <row>
                <entry>
                  <literal>\+ \? \( \) \{ \} \|</literal>
                </entry>
                <entry>
     
    </entry>
                <entry>
    BRE only "<literal>\</literal>" escaped <emphasis role="strong">metacharacters</emphasis>
    </entry>
              </row>
              <row>
                <entry>
     
    </entry>
                <entry>
                  <literal>+ ? ( ) { } |</literal>
                </entry>
                <entry>
    ERE only non-"<literal>\</literal>" escaped <emphasis role="strong">metacharacters</emphasis>
    </entry>
              </row>
              <row>
                <entry>
                  <literal>c</literal>
                </entry>
                <entry>
                  <literal>c</literal>
                </entry>
                <entry>
    This matches the <emphasis role="strong">non-metacharacter</emphasis> "<literal>c</literal>".
    </entry>
              </row>
              <row>
                <entry>
                  <literal>\c</literal>
                </entry>
                <entry>
                  <literal>\c</literal>
                </entry>
                <entry>
    This sequence matches the literal character "<literal>c</literal>" even if "<literal>c</literal>" is <emphasis role="strong">metacharacter</emphasis> by itself.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>.</literal>
                </entry>
                <entry>
                  <literal>.</literal>
                </entry>
                <entry>
    This matches any character including newline.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>^</literal>
                </entry>
                <entry>
                  <literal>^</literal>
                </entry>
                <entry>
    This matches the beginning of a string.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>$</literal>
                </entry>
                <entry>
                  <literal>$</literal>
                </entry>
                <entry>
    This matches the end of a string.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>\&lt;</literal>
                </entry>
                <entry>
                  <literal>\&lt;</literal>
                </entry>
                <entry>
    This matches the beginning of a word.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>\&gt;</literal>
                </entry>
                <entry>
                  <literal>\&gt;</literal>
                </entry>
                <entry>
    This matches the end of a word.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>\[abc…\]</literal>
                </entry>
                <entry>
                  <literal>[abc…]</literal>
                </entry>
                <entry>
    This character list matches any characters "<literal>abc…</literal>".
    </entry>
              </row>
              <row>
                <entry>
                  <literal>\[^abc…\]</literal>
                </entry>
                <entry>
                  <literal>[^abc…]</literal>
                </entry>
                <entry>
    This negated character list matches any characters except "<literal>abc…</literal>".
    </entry>
              </row>
              <row>
                <entry>
                  <literal>r*</literal>
                </entry>
                <entry>
                  <literal>r*</literal>
                </entry>
                <entry>
    This matches zero or more regular expressions identified by "<literal>r</literal>".
    </entry>
              </row>
              <row>
                <entry>
                  <literal>r\+</literal>
                </entry>
                <entry>
                  <literal>r+</literal>
                </entry>
                <entry>
    This matches one or more regular expressions identified by "<literal>r</literal>".
    </entry>
              </row>
              <row>
                <entry>
                  <literal>r\?</literal>
                </entry>
                <entry>
                  <literal>r?</literal>
                </entry>
                <entry>
    This matches zero or one regular expressions identified by "<literal>r</literal>".
    </entry>
              </row>
              <row>
                <entry>
                  <literal>r1\|r2</literal>
                </entry>
                <entry>
                  <literal>r1|r2</literal>
                </entry>
                <entry>
    This matches one of the regular expressions identified by "<literal>r1</literal>" or "<literal>r2</literal>".
    </entry>
              </row>
              <row>
                <entry>
                  <literal>\(r1\|r2\)</literal>
                </entry>
                <entry>
                  <literal>(r1|r2)</literal>
                </entry>
                <entry>
    This matches one of the regular expressions identified by "<literal>r1</literal>" or "<literal>r2</literal>" and treats it as a <emphasis role="strong">bracketed</emphasis> regular expression.
    </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
        <simpara>The regular expression of <emphasis role="strong"><literal>emacs</literal></emphasis> is basically <emphasis role="strong">BRE</emphasis> but has been extended to treat "<literal>+</literal>"and "<literal>?</literal>" as the <emphasis role="strong">metacharacters</emphasis> as in <emphasis role="strong">ERE</emphasis>.  Thus, there are no needs to escape them with "<literal>\</literal>" in the regular expression of <literal>emacs</literal>.</simpara>
        <simpara>For example, <literal>grep</literal>(1) can be used to perform the text search using the regular expression:</simpara>
        <screen>$ egrep 'GNU.*LICENSE|Yoyodyne' /usr/share/common-licenses/GPL
GNU GENERAL PUBLIC LICENSE
GNU GENERAL PUBLIC LICENSE
Yoyodyne, Inc., hereby disclaims all copyright interest in the program</screen>
        <tip>
          <simpara>See <xref linkend="_colorized_commands"/>.</simpara>
        </tip>
      </section>
      <section id="_replacement_expressions">
        <title>Replacement expressions</title>
        <simpara>For the replacement expression, following characters have special meanings:</simpara>
        <table id="thereplacementexpression" pgwide="0" frame="topbot" rowsep="1" colsep="1">
          <title>The replacement expression.</title>
          <tgroup cols="2">
            <colspec colwidth="30%*" align="left"/>
            <colspec colwidth="70%*" align="left"/>
            <thead>
              <row>
                <entry>
    character
    </entry>
                <entry>
    meaning
    </entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry>
                  <literal>&amp;</literal>
                </entry>
                <entry>
    This represents what the regular expression matched.  (use <literal>\&amp;</literal> in <literal>emacs</literal>)
    </entry>
              </row>
              <row>
                <entry>
                  <literal>\n</literal>
                </entry>
                <entry>
    This represents what the n-th <emphasis role="strong">bracketed</emphasis> regular expression matched. ("n" being number)
    </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
        <simpara>For Perl replacement string, "<literal>$n</literal>" is used instead of "<literal>\n</literal>" and "<literal>&amp;</literal>" has no special meaning.</simpara>
        <simpara>For example:</simpara>
        <screen>$ echo zzz1abc2efg3hij4 | \
sed -e 's/\(1[a-z]*\)[0-9]*\(.*\)$/=&amp;=/'
zzz=1abc2efg3hij4=
$ echo zzz1abc2efg3hij4 | \
sed -e 's/\(1[a-z]*\)[0-9]*\(.*\)$/\2===\1/'
zzzefg3hij4===1abc
$ echo zzz1abc2efg3hij4 | \
perl -pe 's/(1[a-z]*)[0-9]*(.*)$/$2===$1/'
zzzefg3hij4===1abc
$ echo zzz1abc2efg3hij4 | \
perl -pe 's/(1[a-z]*)[0-9]*(.*)$/=&amp;=/'
zzz=&amp;=</screen>
        <simpara>Here please pay extra attention to the style of the <emphasis role="strong">bracketed</emphasis> regular expression and how the matched strings are used in the text replacement process on different tools.</simpara>
        <simpara>These regular expressions can be used for cursor movements and text replacement actions in some editors too.</simpara>
        <simpara>The back slash "<literal>\</literal>" at the end of line in the shell commandline escapes newline as a white space character and continues shell command line input to the next line.</simpara>
        <simpara>Please read all the related manual pages to learn these commands.</simpara>
      </section>
      <section id="_global_substitution_with_regular_expressions">
        <title>Global substitution with regular expressions</title>
        <simpara>The <literal>ed</literal>(1) command can replace all instances of "<literal>FROM_REGEX</literal>" with "<literal>TO_TEXT</literal>" in "<literal>file</literal>" by:</simpara>
        <screen>$ ed file &lt;&lt;EOF
,s/FROM_REGEX/TO_TEXT/g
w
q
EOF</screen>
        <simpara>The <literal>vim</literal>(1) command can replace all instances of "<literal>FROM_REGEX</literal>" with "<literal>TO_TEXT</literal>" in "<literal>file</literal>" by using <literal>ex</literal>(1) commands:</simpara>
        <screen>$ vim '+%s/FROM_REGEX/TO_TEXT/gc' '+w' '+q' file</screen>
        <tip>
          <simpara>The "<literal>c</literal>" flag in the above ensures interactive confirmation for each substitution.</simpara>
        </tip>
        <simpara>Multiple files ("<literal>file1</literal>", "<literal>file2</literal>", and "<literal>file3</literal>") can be processed with regular expressions similarly with <literal>vim</literal>(1) or <literal>perl</literal>(1):</simpara>
        <screen>$ vim '+argdo %s/FROM_REGEX/TO_TEXT/ge|update' '+q' file1 file2 file3</screen>
        <tip>
          <simpara>The "<literal>e</literal>" flag in the above prevents the "No match" error from breaking a mapping.</simpara>
        </tip>
        <screen>$ perl -i -p -e 's/FROM_REGEX/TO_TEXT/g;' file1 file2 file3</screen>
        <simpara>In the perl(1) example, "<literal>-i</literal>" is for in-place editing, "<literal>-p</literal>" is for implicit loop over files.</simpara>
        <tip>
          <simpara>Use of argument "<literal>-i.bak</literal>" instead of "<literal>-i</literal>" will keep each original file by adding "<literal>.bak</literal>" to its filename.  This makes recovery from errors easier for complex substitutions.</simpara>
        </tip>
        <note>
          <simpara>While <literal>ed</literal>(1) and <literal>vim</literal>(1) are <emphasis role="strong">BRE</emphasis>, <literal>perl</literal>(1) is <emphasis role="strong">ERE</emphasis>.</simpara>
        </note>
      </section>
      <section id="_extract_data_from_text_file_table">
        <title>Extract data from text file table</title>
        <simpara>Let's consider a text file called "<literal>DPL</literal>" in which some pre-2004 Debian project leader's names and their initiation days are listed in a
space-separated format.</simpara>
        <screen>Ian     Murdock   August  1993
Bruce   Perens    April   1996
Ian     Jackson   January 1998
Wichert Akkerman  January 1999
Ben     Collins   April   2001
Bdale   Garbee    April   2002
Martin  Michlmayr March   2003</screen>
        <tip>
          <simpara>See <ulink url="&abriefhistoryofdebian;">"A Brief History of Debian"</ulink> for the latest <ulink url="&debianleadershiphistory;">Debian leadership history</ulink>.</simpara>
        </tip>
        <simpara>Awk is frequently used to extract data from these types of files:</simpara>
        <screen>$ awk '{ print $3 }' &lt;DPL                   # month started
August
April
January
January
April
April
March
$ awk '($1=="Ian") { print }' &lt;DPL          # DPL called Ian
Ian     Murdock   August  1993
Ian     Jackson   January 1998
$ awk '($2=="Perens") { print $3,$4 }' &lt;DPL # When Perens started
April 1996</screen>
        <simpara>Shells such as Bash can be also used to parse this kind of file:</simpara>
        <screen>$ while read first last month year; do
    echo $month
  done &lt;DPL</screen>
        <itemizedlist>
          <listitem>
            <simpara>
same output as the first Awk example.
</simpara>
          </listitem>
        </itemizedlist>
        <simpara>Here, the <literal>read</literal> builtin command uses characters in "<literal>$IFS</literal>" (internal field
separators) to split lines into words.</simpara>
        <simpara>If you change "<literal>$IFS</literal>" to "<literal>:</literal>", you can parse "<literal>/etc/passwd</literal>" with shell nicely:</simpara>
        <screen>$ oldIFS="$IFS"   # save old value
$ IFS=':'
$ while read user password uid gid rest_of_line; do
    if [ "$user" = "bozo" ]; then
      echo "$user's ID is $uid"
    fi
  done &lt; /etc/passwd
bozo's ID is 1000
$ IFS="$oldIFS"   # restore old value</screen>
        <simpara>(If Awk is used to do the equivalent, use "<literal>FS=':'</literal>" to set the field separator.)</simpara>
        <simpara>IFS is also used by the shell to split results of parameter expansion, command substitution, and arithmetic expansion.  These do not occur within double or single quoted words.  The default value of IFS is &lt;space&gt;, &lt;tab&gt;, and &lt;newline&gt; combined.</simpara>
        <simpara>Be careful about using this shell IFS tricks.  Strange things may happen, when
shell interprets some parts of the script as its <emphasis role="strong">input</emphasis>.</simpara>
        <screen>$ IFS=":,"                        # use ":" and "," as IFS
$ echo IFS=$IFS,   IFS="$IFS"     # echo is a Bash builtin
IFS=  , IFS=:,
$ date -R                         # just a command output
Sat, 23 Aug 2003 08:30:15 +0200
$ echo $(date -R)                 # sub shell --&gt; input to main shell
Sat  23 Aug 2003 08 30 36 +0200
$ unset IFS                       # reset IFS to the default
$ echo $(date -R)
Sat, 23 Aug 2003 08:30:50 +0200</screen>
      </section>
      <section id="_script_snippets_for_piping_commands">
        <title>Script snippets for piping commands</title>
        <simpara>The following scripts will do nice things as a part of a pipe.</simpara>
        <table id="listofscriptsniporpipingcommands" pgwide="0" frame="topbot" rowsep="1" colsep="1">
          <title>List of script snippets for piping commands.</title>
          <tgroup cols="2">
            <colspec colwidth="30%*" align="left"/>
            <colspec colwidth="70%*" align="left"/>
            <thead>
              <row>
                <entry>
    script snippet (type in one line)
    </entry>
                <entry>
    effect of command
    </entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry>
                  <literal>find /usr -print</literal>
                </entry>
                <entry>
    find all files under "<literal>/usr</literal>".
    </entry>
              </row>
              <row>
                <entry>
                  <literal>seq 1 100</literal>
                </entry>
                <entry>
    print 1 to 100.
    </entry>
              </row>
              <row>
                <entry>
                  <literal> | xargs -n 1 &lt;command&gt;</literal>
                </entry>
                <entry>
    run command repeatedly with each item from pipe as its argument.
    </entry>
              </row>
              <row>
                <entry>
                  <literal> | xargs -n 1 echo</literal>
                </entry>
                <entry>
    split white-space-separated items from pipe into lines.
    </entry>
              </row>
              <row>
                <entry>
                  <literal> | xargs echo</literal>
                </entry>
                <entry>
    merge all lines from pipe into a line.
    </entry>
              </row>
              <row>
                <entry>
                  <literal> | grep -e &lt;regex_pattern&gt;</literal>
                </entry>
                <entry>
    extract lines from pipe containing &lt;regex_pattern&gt;.
    </entry>
              </row>
              <row>
                <entry>
                  <literal> | grep -v -e &lt;regex_pattern&gt;</literal>
                </entry>
                <entry>
    extract lines from pipe not containing &lt;regex_pattern&gt;.
    </entry>
              </row>
              <row>
                <entry>
                  <literal> | cut -d: -f3 -</literal>
                </entry>
                <entry>
    extract third field from pipe separated by "<literal>:</literal>" (passwd file etc.).
    </entry>
              </row>
              <row>
                <entry>
                  <literal> | awk '{ print $3 }'</literal>
                </entry>
                <entry>
    extract third field from pipe separated by whitespaces.
    </entry>
              </row>
              <row>
                <entry>
                  <literal> | awk -F'\t' '{ print $3 }'</literal>
                </entry>
                <entry>
    extract third field from pipe separated by tab.
    </entry>
              </row>
              <row>
                <entry>
                  <literal> | col -bx</literal>
                </entry>
                <entry>
    remove backspace and expand tabs to spaces.
    </entry>
              </row>
              <row>
                <entry>
                  <literal> | expand -</literal>
                </entry>
                <entry>
    expand tabs.
    </entry>
              </row>
              <row>
                <entry>
                  <literal> | sort| uniq</literal>
                </entry>
                <entry>
    sort and remove duplicates.
    </entry>
              </row>
              <row>
                <entry>
                  <literal> | tr 'A-Z' 'a-z'</literal>
                </entry>
                <entry>
    convert uppercase to lowercase.
    </entry>
              </row>
              <row>
                <entry>
                  <literal> | tr -d '\n'</literal>
                </entry>
                <entry>
    concatenate lines into one line.
    </entry>
              </row>
              <row>
                <entry>
                  <literal> | tr -d '\r'</literal>
                </entry>
                <entry>
    remove CR.
    </entry>
              </row>
              <row>
                <entry>
                  <literal> | sed 's/^/# /'</literal>
                </entry>
                <entry>
    add "<literal>#</literal>" to the start of each line.
    </entry>
              </row>
              <row>
                <entry>
                  <literal> | sed 's/\.ext//g'</literal>
                </entry>
                <entry>
    remove "<literal>.ext</literal>".
    </entry>
              </row>
              <row>
                <entry>
                  <literal> | sed -n -e 2p</literal>
                </entry>
                <entry>
    print the second line.
    </entry>
              </row>
              <row>
                <entry>
                  <literal> | head -n 2 -</literal>
                </entry>
                <entry>
    print the first 2 lines.
    </entry>
              </row>
              <row>
                <entry>
                  <literal> | tail -n 2 -</literal>
                </entry>
                <entry>
    print the last 2 lines.
    </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
        <simpara>One-line shell script can loop over many files using <literal>find</literal>(1) and <literal>xargs</literal>(1) to perform quite complicated tasks.  See <xref linkend="_idioms_for_the_selection_of_files"/> and <xref linkend="_repeating_a_command_looping_over_files"/>.</simpara>
        <simpara>When using the shell interactive mode becomes too complicated, please consider to write a shell script (see <xref linkend="_the_shell_script"/>).</simpara>
      </section>
    </section>
  </chapter>
  <chapter id="_debian_package_management">
    <title>Debian package management</title>
    <note>
      <simpara>This chapter is written assuming the latest stable release is codename: <literal>&codename-stable;</literal>.</simpara>
    </note>
    <simpara><ulink url="&debian;">Debian</ulink> is a volunteer organization which builds <emphasis role="strong">consistent</emphasis> distributions of pre-compiled binary packages of free software and distributes them from its archive.</simpara>
    <simpara><ulink url="&thedebianarchive;">The Debian archive</ulink> is offered by <ulink url="&manyremotemirrorsites;">many remote mirror sites</ulink> for access through HTTP and FTP methods. It is also available as <ulink url="&cdromdvd;">CD-ROM/DVD</ulink>.</simpara>
    <simpara>The Debian package management system, <emphasis role="strong">when used properly</emphasis>, offers the user to install <emphasis role="strong">consistent sets of binary packages</emphasis> to the system from the archive.  Currently, there are &all-packages; packages available for the &arch; architecture.</simpara>
    <simpara>The Debian package management system has a rich history and many choices for the front end user program and back end archive access method to be used.  Currently, we recommend <literal>aptitude</literal>(8) as the main front end program for the Debian package management activity.</simpara>
    <table id="listofdebianpackemanagementtools" pgwide="0" frame="topbot" rowsep="1" colsep="1">
      <title>List of Debian package management tools.</title>
      <tgroup cols="4">
        <colspec colwidth="20%*" align="left"/>
        <colspec colwidth="20%*" align="left"/>
        <colspec colwidth="20%*" align="left"/>
        <colspec colwidth="40%*" align="left"/>
        <thead>
          <row>
            <entry>
    package
    </entry>
            <entry>
    popcon
    </entry>
            <entry>
    size
    </entry>
            <entry>
    description
    </entry>
          </row>
        </thead>
        <tbody>
          <row>
            <entry><ulink url="http://packages.debian.org/sid/aptitude">
              <literal>aptitude</literal>
            </ulink></entry>
            <entry><ulink url="http://bugs.debian.org/aptitude">&pop-aptitude;</ulink></entry>
            <entry><ulink url="http://packages.qa.debian.org/a/aptitude.html">&size-aptitude;</ulink></entry>
            <entry>
    terminal-based package manager (current standard, front-end for <literal>apt</literal>)
    </entry>
          </row>
          <row>
            <entry><ulink url="http://packages.debian.org/sid/apt">
              <literal>apt</literal>
            </ulink></entry>
            <entry><ulink url="http://bugs.debian.org/apt">&pop-apt;</ulink></entry>
            <entry><ulink url="http://packages.qa.debian.org/a/apt.html">&size-apt;</ulink></entry>
            <entry>
    Advanced Packaging Tool (APT), front-end for <literal>dpkg</literal> providing "<literal>http</literal>", "<literal>ftp</literal>", and "<literal>file</literal>" archive access methods (<literal>apt-get</literal>/<literal>apt-cache</literal> commands included)
    </entry>
          </row>
          <row>
            <entry><ulink url="http://packages.debian.org/sid/tasksel">
              <literal>tasksel</literal>
            </ulink></entry>
            <entry><ulink url="http://bugs.debian.org/tasksel">&pop-tasksel;</ulink></entry>
            <entry><ulink url="http://packages.qa.debian.org/t/tasksel.html">&size-tasksel;</ulink></entry>
            <entry>
    tool for selecting tasks for installation on Debian system (front-end for APT)
    </entry>
          </row>
          <row>
            <entry><ulink url="http://packages.debian.org/sid/unattended-upgrades">
              <literal>unattended-upgrades</literal>
            </ulink></entry>
            <entry><ulink url="http://bugs.debian.org/unattended-upgrades">&pop-unattendedupgrades;</ulink></entry>
            <entry><ulink url="http://packages.qa.debian.org/u/unattended-upgrades.html">&size-unattendedupgrades;</ulink></entry>
            <entry>
    enhancement package for APT to enable automatic installation of security upgrades
    </entry>
          </row>
          <row>
            <entry><ulink url="http://packages.debian.org/sid/dselect">
              <literal>dselect</literal>
            </ulink></entry>
            <entry><ulink url="http://bugs.debian.org/dselect">&pop-dselect;</ulink></entry>
            <entry><ulink url="http://packages.qa.debian.org/d/dselect.html">&size-dselect;</ulink></entry>
            <entry>
    terminal-based package manager (previous standard, front-end for APT and other old access methods)
    </entry>
          </row>
          <row>
            <entry><ulink url="http://packages.debian.org/sid/dpkg">
              <literal>dpkg</literal>
            </ulink></entry>
            <entry><ulink url="http://bugs.debian.org/dpkg">&pop-dpkg;</ulink></entry>
            <entry><ulink url="http://packages.qa.debian.org/d/dpkg.html">&size-dpkg;</ulink></entry>
            <entry>
    package management system for Debian
    </entry>
          </row>
          <row>
            <entry><ulink url="http://packages.debian.org/sid/dpkg-ftp">
              <literal>dpkg-ftp</literal>
            </ulink></entry>
            <entry><ulink url="http://bugs.debian.org/dpkg-ftp">&pop-dpkgftp;</ulink></entry>
            <entry><ulink url="http://packages.qa.debian.org/d/dpkg-ftp.html">&size-dpkgftp;</ulink></entry>
            <entry>
    older ftp method for <literal>dselect</literal>
    </entry>
          </row>
          <row>
            <entry><ulink url="http://packages.debian.org/sid/synaptic">
              <literal>synaptic</literal>
            </ulink></entry>
            <entry><ulink url="http://bugs.debian.org/synaptic">&pop-synaptic;</ulink></entry>
            <entry><ulink url="http://packages.qa.debian.org/s/synaptic.html">&size-synaptic;</ulink></entry>
            <entry>
    graphical package manager (GNOME front-end for APT)
    </entry>
          </row>
          <row>
            <entry><ulink url="http://packages.debian.org/sid/gnome-apt">
              <literal>gnome-apt</literal>
            </ulink></entry>
            <entry><ulink url="http://bugs.debian.org/gnome-apt">&pop-gnomeapt;</ulink></entry>
            <entry><ulink url="http://packages.qa.debian.org/g/gnome-apt.html">&size-gnomeapt;</ulink></entry>
            <entry>
    graphical package manager (GNOME front-end for APT)
    </entry>
          </row>
          <row>
            <entry><ulink url="http://packages.debian.org/sid/kpackage">
              <literal>kpackage</literal>
            </ulink></entry>
            <entry><ulink url="http://bugs.debian.org/kpackage">&pop-kpackage;</ulink></entry>
            <entry><ulink url="http://packages.qa.debian.org/k/kpackage.html">&size-kpackage;</ulink></entry>
            <entry>
    graphical package manager (KDE front-end for APT)
    </entry>
          </row>
          <row>
            <entry><ulink url="http://packages.debian.org/sid/apt-utils">
              <literal>apt-utils</literal>
            </ulink></entry>
            <entry><ulink url="http://bugs.debian.org/apt-utils">&pop-aptutils;</ulink></entry>
            <entry><ulink url="http://packages.qa.debian.org/a/apt-utils.html">&size-aptutils;</ulink></entry>
            <entry>
    APT utility programs: <literal>apt-extracttemplates</literal>(1), <literal>apt-ftparchive</literal>(1), and <literal>apt-sortpkgs</literal>(1)
    </entry>
          </row>
          <row>
            <entry><ulink url="http://packages.debian.org/sid/apt-listchanges">
              <literal>apt-listchanges</literal>
            </ulink></entry>
            <entry><ulink url="http://bugs.debian.org/apt-listchanges">&pop-aptlistchanges;</ulink></entry>
            <entry><ulink url="http://packages.qa.debian.org/a/apt-listchanges.html">&size-aptlistchanges;</ulink></entry>
            <entry>
    package change history notification tool
    </entry>
          </row>
          <row>
            <entry><ulink url="http://packages.debian.org/sid/apt-listbugs">
              <literal>apt-listbugs</literal>
            </ulink></entry>
            <entry><ulink url="http://bugs.debian.org/apt-listbugs">&pop-aptlistbugs;</ulink></entry>
            <entry><ulink url="http://packages.qa.debian.org/a/apt-listbugs.html">&size-aptlistbugs;</ulink></entry>
            <entry>
    lists critical bugs before each APT installation
    </entry>
          </row>
          <row>
            <entry><ulink url="http://packages.debian.org/sid/apt-file">
              <literal>apt-file</literal>
            </ulink></entry>
            <entry><ulink url="http://bugs.debian.org/apt-file">&pop-aptfile;</ulink></entry>
            <entry><ulink url="http://packages.qa.debian.org/a/apt-file.html">&size-aptfile;</ulink></entry>
            <entry>
    APT package searching utility — command-line interface
    </entry>
          </row>
          <row>
            <entry><ulink url="http://packages.debian.org/sid/apt-rdepends">
              <literal>apt-rdepends</literal>
            </ulink></entry>
            <entry><ulink url="http://bugs.debian.org/apt-rdepends">&pop-aptrdepends;</ulink></entry>
            <entry><ulink url="http://packages.qa.debian.org/a/apt-rdepends.html">&size-aptrdepends;</ulink></entry>
            <entry>
    recursively lists package dependencies
    </entry>
          </row>
        </tbody>
      </tgroup>
    </table>
    <note>
      <simpara>The annoying <ulink url="&bugebbbcd;">bug #411123</ulink> for the mixed use of <literal>aptitude</literal>(8) and <literal>apt-get</literal>(8) commands has been resolved.  If this kept you from using <literal>aptitude</literal>, please reconsider.</simpara>
    </note>
    <section id="_debian_package_management_prerequisites">
      <title>Debian package management prerequisites</title>
      <section id="_package_configuration">
        <title>Package configuration</title>
        <simpara>Here are some key points for package configuration on the Debian system:</simpara>
        <itemizedlist>
          <listitem>
            <simpara>
The manual configuration by the system administrator is respected. In other words, the package configuration system makes no intrusive configuration for the sake of convenience.
</simpara>
          </listitem>
          <listitem>
            <simpara>
Each package comes with its own configuration script with standardized user interface called <literal>debconf</literal>(7) to help initial installation process of the package.
</simpara>
          </listitem>
          <listitem>
            <simpara>
Debian Developers try their best to make your upgrade experience flawless with package configuration scripts.
</simpara>
          </listitem>
          <listitem>
            <simpara>
Full functionalities of packaged software are available to the system administrator.  But ones with security risks are disabled in the default installation.
</simpara>
          </listitem>
          <listitem>
            <simpara>
If you manually activate a service with some security risks, you are responsible for the risk containment.
</simpara>
          </listitem>
          <listitem>
            <simpara>
Esoteric configuration may be manually enabled by the system administrator.  This may creates interference with popular generic helper programs for the system configuration.
</simpara>
          </listitem>
        </itemizedlist>
      </section>
      <section id="_basic_precautions">
        <title>Basic precautions</title>
        <warning>
          <simpara>Do not install packages from random mixture of suites.  It probably will break the package consistency which requires deep system management knowledge, such as compiler <ulink url="&abi;">ABI</ulink>, <ulink url="&library;">library</ulink> version, interpreter features, etc.</simpara>
        </warning>
        <simpara>The <ulink url="&newbie;">newbie</ulink> Debian system administrator should stay with the <emphasis role="strong"><literal>stable</literal></emphasis> release of Debian while applying only security updates.  I mean that some of the following valid actions are better avoided, as a precaution, until you understand the Debian system very well:</simpara>
        <itemizedlist>
          <listitem>
            <simpara>
Do not include <emphasis role="strong"><literal>testing</literal></emphasis> or <emphasis role="strong"><literal>unstable</literal></emphasis> in "<literal>/etc/apt/sources.list</literal>",
</simpara>
          </listitem>
          <listitem>
            <simpara>
Do not mix standard Debian with other non-Debian archives such as Ubuntu in "<literal>/etc/apt/sources.list</literal>",
</simpara>
          </listitem>
          <listitem>
            <simpara>
Do not create "<literal>/etc/apt/preferences</literal>",
</simpara>
          </listitem>
          <listitem>
            <simpara>
Do not change default behavior of package management tools through configuration files without knowing their full impacts,
</simpara>
          </listitem>
          <listitem>
            <simpara>
Do not install random packages by "<literal>dpkg -i &lt;random_package&gt;</literal>",
</simpara>
          </listitem>
          <listitem>
            <simpara>
Do not ever install random packages by  "<literal>dpkg --force-all -i &lt;random_package&gt;</literal>",
</simpara>
          </listitem>
          <listitem>
            <simpara>
Do not erase or alter files in "<literal>/var/lib/dpkg/</literal>", or
</simpara>
          </listitem>
          <listitem>
            <simpara>
Do not overwrite system files by installing software programs directly compiled from source. (Install them into "<literal>/usr/local</literal>" or "<literal>/opt</literal>".)
</simpara>
          </listitem>
        </itemizedlist>
        <simpara>The non-compatible effects caused by above actions to the Debian package management system may leave your system unusable.</simpara>
        <simpara>The serious Debian system administrator who runs mission critical servers, should use extra precautions:</simpara>
        <itemizedlist>
          <listitem>
            <simpara>
Do not install any packages including security updates from Debian without thoroughly testing them with your particular configuration under safe conditions. (Although Debian has been offering an extremely stable system for a long time, you as the system administrator are responsible for your system in the end.)
</simpara>
          </listitem>
        </itemizedlist>
      </section>
      <section id="_life_with_eternal_upgrades">
        <title>Life with eternal upgrades</title>
        <simpara>Despite my warnings above, I know many readers of this document wish to run the <literal>testing</literal> or <literal>unstable</literal> suites of Debian as their main system for <emphasis role="strong">self-administered Desktop environments</emphasis>. This is because they work very well, are updated frequently, and offer the latest features.</simpara>
        <caution>
          <simpara>For your <emphasis role="strong">production server</emphasis>, the <literal>stable</literal> suite with the security updates is recommended.  The same can be said for desktop PCs on which you can spend limited administration efforts, e.g. for your mother's PC.</simpara>
        </caution>
        <simpara>It takes no more than simply setting the distribution string in the "<literal>/etc/apt/sources.list</literal>" to the suite name: "<literal>testing</literal>" or "<literal>unstable</literal>"; or the codename:  "<literal>&codename-testing;</literal>" or "<literal>&codename-unstable;</literal>". This will let you live <emphasis role="strong">the life of eternal upgrades</emphasis>.</simpara>
        <simpara>The use of <literal>testing</literal> or <literal>unstable</literal> is <emphasis role="strong">a lot of fun</emphasis> but comes with some risks.  Even though the <literal>unstable</literal> suite of Debian system looks very stable for most of the times, there have been some package problems on the <literal>testing</literal> and <literal>unstable</literal> suite of Debian system and a few of them were not so trivial to resolve. It may be <emphasis role="strong">quite painful</emphasis> for you. Sometimes, you may have a broken package or missing functionality for a few weeks.</simpara>
        <simpara>Here are some ideas to ensure quick and easy recovery from bugs in Debian packages:</simpara>
        <itemizedlist>
          <listitem>
            <simpara>
make the system <emphasis role="strong">dual bootable</emphasis> by installing the <literal>stable</literal> suite of Debian system to another partition.
</simpara>
          </listitem>
          <listitem>
            <simpara>
make the installation CD handy for the <emphasis role="strong">rescue boot</emphasis>.
</simpara>
          </listitem>
          <listitem>
            <simpara>
consider installing <literal>apt-listbugs</literal> to check the <ulink url="&debianbugtrackingsystembts;">Debian Bug Tracking System (BTS)</ulink> information before the upgrade.
</simpara>
          </listitem>
          <listitem>
            <simpara>
learn the package system infrastructure enough to work around the problem.
</simpara>
          </listitem>
          <listitem>
            <simpara>
create a chroot or similar environment and run the latest system in it in advance. (optional)
</simpara>
          </listitem>
        </itemizedlist>
        <simpara>(If you can not do any one of these precautionary actions, you are probably not ready for the <literal>testing</literal> and <literal>unstable</literal> suites.)</simpara>
        <simpara><ulink url="&enlightenment;">Enlightenment</ulink> with the following will save a person from the eternal <ulink url="&karmic;">karmic</ulink> struggle of upgrade <ulink url="&hell;">hell</ulink> and let him reach Debian <ulink url="&nirvana;">nirvana</ulink>.</simpara>
      </section>
      <section id="_debian_archive_basics">
        <title>Debian archive basics</title>
        <simpara>Let's look into <ulink url="&thedebianarchive;">the Debian archive</ulink> from a system user's perspective.</simpara>
        <tip>
          <simpara>Official policy of the Debian archive is defined at <ulink url="&debianpolicymanuthedebianarchive;">Debian Policy Manual, Chapter 2 - The Debian Archive</ulink>.</simpara>
        </tip>
        <simpara>For the typical HTTP access, the archive is specified in the "<literal>/etc/apt/sources.list</literal>" file as, e.g. for the current <literal>stable</literal> = <literal>&codename-stable;</literal> system:</simpara>
        <screen>deb http://ftp.XX.debian.org/debian/ &codename-stable; main contrib non-free
deb-src http://ftp.XX.debian.org/debian/ &codename-stable; main contrib non-free

deb http://security.debian.org/ &codename-stable;/updates main contrib
deb-src http://security.debian.org/ &codename-stable;/updates main contrib</screen>
        <simpara>Please note "<literal>ftp.XX.debian.org</literal>" must be replaced with appropriate mirror site URL for your location, for USA "<literal>ftp.us.debian.org</literal>", which can be found in <ulink url="&thelistofdebianwdwidemirrorsites;">the list of Debian worldwide mirror sites</ulink>.  The status of these servers can be checked at <ulink url="&debianmirrorcheckersite;">Debian Mirror Checker site</ulink>.</simpara>
        <simpara>Here, I tend to use codename "<literal>&codename-stable;</literal>" instead of suite name "<literal>stable</literal>" to avoid surprises when the next <literal>stable</literal> is released.</simpara>
        <simpara>The meaning of "<literal>/etc/apt/sources.list</literal>" is described in <literal>sources.list</literal>(5) and key points are:</simpara>
        <itemizedlist>
          <listitem>
            <simpara>
The "<literal>deb</literal>" line defines for the binary packages.
</simpara>
          </listitem>
          <listitem>
            <simpara>
The "<literal>deb-src</literal>" line defines for the source packages.
</simpara>
          </listitem>
          <listitem>
            <simpara>
The 1st argument is the root URL of the Debian archive.
</simpara>
          </listitem>
          <listitem>
            <simpara>
The 2nd argument is the distribution name: either the suite name or the codename.
</simpara>
          </listitem>
          <listitem>
            <simpara>
The 3rd and following arguments are the list of valid archive component names of the Debian archive.
</simpara>
          </listitem>
        </itemizedlist>
        <simpara>The "<literal>deb-src</literal>" lines can safely be omitted (or commented out by placing "#" at the start of the line) if it is just for <literal>aptitude</literal> which does not access source related meta data. It will speed up the updates of the archive meta data. The URL can be "<literal>http://</literal>", "<literal>ftp://</literal>", "<literal>file://</literal>", ….</simpara>
        <tip>
          <simpara>If "<literal>sid</literal>" is used in the above example instead of "<literal>&codename-stable;</literal>", the "<literal>deb: <ulink url="&httpsecuritydebianorg;">http://security.debian.org/</ulink> …</literal>" line for security updates in the "<literal>/etc/apt/sources.list</literal>" is not required.  Security updates are only available for <literal>stable</literal> and <literal>testing</literal> (i.e., <literal>&codename-stable;</literal> and <literal>&codename-testing;</literal>).</simpara>
        </tip>
        <simpara>Here is the list of URL of the Debian archive sites and suite name or codename used in the configuration file:</simpara>
        <table id="listofdebianarchivesites" pgwide="0" frame="topbot" rowsep="1" colsep="1">
          <title>List of Debian archive sites.</title>
          <tgroup cols="3">
            <colspec colwidth="30%*" align="left"/>
            <colspec colwidth="30%*" align="left"/>
            <colspec colwidth="40%*" align="left"/>
            <thead>
              <row>
                <entry>
    archive URL
    </entry>
                <entry>
    suite name (codename)
    </entry>
                <entry>
    purpose
    </entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry>
                  <ulink url="&httpftpxxdebianorgdebian;">http://ftp.XX.debian.org/debian/</ulink>
                </entry>
                <entry><literal>stable</literal> (<literal>&codename-stable;</literal>)
    </entry>
                <entry>
    stable (&codename-stable;) release
    </entry>
              </row>
              <row>
                <entry>
                  <ulink url="&httpftpxxdebianorgdebian;">http://ftp.XX.debian.org/debian/</ulink>
                </entry>
                <entry><literal>testing</literal> (<literal>&codename-testing;</literal>)
    </entry>
                <entry>
    testing (&codename-testing;) release
    </entry>
              </row>
              <row>
                <entry>
                  <ulink url="&httpftpxxdebianorgdebian;">http://ftp.XX.debian.org/debian/</ulink>
                </entry>
                <entry><literal>unstable</literal> (<literal>&codename-unstable;</literal>)
    </entry>
                <entry>
    unstable (&codename-unstable;) release
    </entry>
              </row>
              <row>
                <entry>
                  <ulink url="&httpftpxxdebianorgdebian;">http://ftp.XX.debian.org/debian/</ulink>
                </entry>
                <entry>
                  <literal>experimental</literal>
                </entry>
                <entry>
    experimental pre-release (optional, only for developer)
    </entry>
              </row>
              <row>
                <entry>
                  <ulink url="&httpftpxxdebianorgdebian;">http://ftp.XX.debian.org/debian/</ulink>
                </entry>
                <entry>
                  <literal>stable-proposed-updates</literal>
                </entry>
                <entry>
    Updates for the next stable point release (optional)
    </entry>
              </row>
              <row>
                <entry>
                  <ulink url="&httpsecuritydebianorg;">http://security.debian.org/</ulink>
                </entry>
                <entry>
                  <literal>stable/updates</literal>
                </entry>
                <entry>
    Security updates for stable release (important)
    </entry>
              </row>
              <row>
                <entry>
                  <ulink url="&httpsecuritydebianorg;">http://security.debian.org/</ulink>
                </entry>
                <entry>
                  <literal>testing/updates</literal>
                </entry>
                <entry>
    Security updates for testing release (important)
    </entry>
              </row>
              <row>
                <entry>
                  <ulink url="&httpvolatiledebirgdebianvolatile;">http://volatile.debian.org/debian-volatile/</ulink>
                </entry>
                <entry>
                  <literal>volatile</literal>
                </entry>
                <entry>
    Compatible updates for spam filter, IM clients, etc.
    </entry>
              </row>
              <row>
                <entry>
                  <ulink url="&httpvolatiledebirgdebianvolatile;">http://volatile.debian.org/debian-volatile/</ulink>
                </entry>
                <entry>
                  <literal>volatile-sloppy</literal>
                </entry>
                <entry>
    Non-compatible updates for spam filter, IM clients, etc.
    </entry>
              </row>
              <row>
                <entry>
                  <ulink url="&httpbackportsorgdebian;">http://backports.org/debian/</ulink>
                </entry>
                <entry>
                  <literal>&codename-stable;-backports</literal>
                </entry>
                <entry>
    Newer backported packages for &codename-stable;. (non-official, optional)
    </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
        <caution>
          <simpara>Only pure <emphasis role="strong"><literal>stable</literal></emphasis> release with security updates provides the best stability. Running mostly <emphasis role="strong"><literal>stable</literal></emphasis> release mixed with some packages from <emphasis role="strong"><literal>testing</literal></emphasis> or <emphasis role="strong"><literal>unstable</literal></emphasis> release is riskier than running pure <emphasis role="strong"><literal>unstable</literal></emphasis> release.  If you really need the latest version of some programs under <emphasis role="strong"><literal>stable</literal></emphasis> release, please use packages from <ulink url="&thedebianvolatileproject;">the debian-volatile project</ulink> and <ulink url="&backportsorg;">backports.org</ulink> (see <xref linkend="_volatile_and_backports_org"/>) services.  These services must be used with extra care.</simpara>
        </caution>
        <caution>
          <simpara>You should basically list only one of <literal>stable</literal>, <literal>testing</literal>, or <literal>unstable</literal> suites in the "<literal>deb</literal>" line.  If you list any combination of <literal>stable</literal>, <literal>testing</literal>, and <literal>unstable</literal> suites in the "<literal>deb</literal>" line, APT programs slow down while only the latest archive is effective.  Multiple listing makes sense for these when the "<literal>/etc/apt/preferences</literal>" file is used with clear objectives (see <xref linkend="_tweaking_candidate_version"/>).</simpara>
        </caution>
        <note>
          <simpara>For the Debian system with the <literal>stable</literal> and <literal>testing</literal> suites, it is a good idea to include lines with "<literal>http://security.debian.org/</literal>" in the "<literal>/etc/apt/sources.list</literal>" to enable security updates as in the example above.</simpara>
        </note>
        <simpara>Each Debian archive consists of 3 components. Components are alternatively called <ulink url="&categoriesindebianpolicy;">categories in "Debian Policy"</ulink> or areas in <ulink url="&debiansocialcontract;">"Debian Social Contract"</ulink>.  The component is grouped by the compliance to <ulink url="&thedebianfreesofreguidelinesdfsg;">"The Debian Free Software Guidelines" (DFSG)</ulink>:</simpara>
        <table id="listofdebianarchivecomponents" pgwide="0" frame="topbot" rowsep="1" colsep="1">
          <title>List of Debian archive components.</title>
          <tgroup cols="3">
            <colspec colwidth="30%*" align="left"/>
            <colspec colwidth="30%*" align="left"/>
            <colspec colwidth="40%*" align="left"/>
            <thead>
              <row>
                <entry>
    component
    </entry>
                <entry>
    number of packages
    </entry>
                <entry>
    criteria
    </entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry>
                  <literal>main</literal>
                </entry>
                <entry>
    &main-packages;
    </entry>
                <entry>
    The package is fully compliant to DSFG and does not depend the <literal>non-free</literal> package.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>contrib</literal>
                </entry>
                <entry>
    &contrib-packages;
    </entry>
                <entry>
    The package is compliant to the DSFG but depends on the <literal>non-free</literal> package.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>non-free</literal>
                </entry>
                <entry>
    &non-free-packages;
    </entry>
                <entry>
    The package is not compliant to the DSFG but distributable and useful.
    </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
        <simpara>Here the number of packages in the above is for the &arch; architecture.  Strictly speaking, only the <literal>main</literal> component archive shall be considered as the Debian system.</simpara>
        <simpara>The Debian archive organization can be studied best by pointing your browser to the each archive URL appended with <literal>dists</literal> or <literal>pool</literal>.</simpara>
        <simpara>The distribution is referred by two ways, the suite or <ulink url="&codename;">codename</ulink>. The word distribution is alternatively used as the synonym to the suite in many documentations. The relationship between the suite and the codename can be summarized as:</simpara>
        <table id="therelationshipbsuiteandcodename" pgwide="0" frame="topbot" rowsep="1" colsep="1">
          <title>The relationship between suite and codename.</title>
          <tgroup cols="4">
            <colspec colwidth="20%*" align="left"/>
            <colspec colwidth="20%*" align="left"/>
            <colspec colwidth="20%*" align="left"/>
            <colspec colwidth="40%*" align="left"/>
            <thead>
              <row>
                <entry>
    Timing
    </entry>
                <entry>
    suite = <literal>stable</literal>
    </entry>
                <entry>
    suite = <literal>testing</literal>
    </entry>
                <entry>
    suite = <literal>unstable</literal>
    </entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry>
    after the <literal>&codename-stable;</literal> release
    </entry>
                <entry>
    codename = <literal>&codename-stable;</literal>
    </entry>
                <entry>
    codename = <literal>&codename-testing;</literal>
    </entry>
                <entry>
    codename = <literal>sid</literal>
    </entry>
              </row>
              <row>
                <entry>
    after the <literal>&codename-testing;</literal> release
    </entry>
                <entry>
    codename = <literal>&codename-testing;</literal>
    </entry>
                <entry>
    codename = <literal>&codename-nexttesting;</literal>
    </entry>
                <entry>
    codename = <literal>sid</literal>
    </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
        <simpara>The history of codenames are described in <ulink url="&debianfaqgdbwhiceenusedinthepast;">Debian FAQ: 6.3.1 Which other codenames have been used in the past?</ulink></simpara>
        <simpara>In the stricter Debian archive terminology, the word "section" is specifically used for the categorization of packages by the application area.  (Although, the word "main section" may sometimes be used to describe the Debian archive section which provides the main component.)</simpara>
        <simpara>Every time a new upload is done by the Debian developer (DD) to the <literal>unstable</literal> archive (via <ulink url="&incoming;">incoming</ulink> processing), DD is required to ensure uploaded packages to be compatible with the latest set of packages in the latest <literal>unstable</literal> archive.</simpara>
        <simpara>If DD breaks this compatibility intentionally for important library upgrade etc, there is usually announcement to <ulink url="&thedebiandevelmailinglist;">the debian-devel mailing list</ulink> etc.</simpara>
        <simpara>Before a set of packages are moved by the Debian archive maintenance script from the <literal>unstable</literal> archive to the <literal>testing</literal> archive, the archive maintenance script not only checks the maturity (about 10 days old) and the status of the RC bug reports for the packages but also tries to ensure them to be compatible with the latest set of packages in the <literal>testing</literal> archive. This process makes the <literal>testing</literal> archive very current and usable.</simpara>
        <simpara>Through the gradual archive freeze process led by the release team, the <literal>testing</literal> archive will be matured to make it completely consistent and bug free with some manual interventions.  Then the new <literal>stable</literal> release is created by assigning the codename for the old <literal>testing</literal> archive to the new <literal>stable</literal> archive and creating the new codename for the new <literal>testing</literal> archive.  The initial contents of the new <literal>testing</literal> archive is exactly the same as that of the newly released <literal>stable</literal> archive.</simpara>
        <simpara>Both the <literal>unstable</literal> and the <literal>testing</literal> archives may suffer temporary glitches due to:</simpara>
        <itemizedlist>
          <listitem>
            <simpara>
broken package upload to the archive (mostly for <literal>unstable</literal>),
</simpara>
          </listitem>
          <listitem>
            <simpara>
delay of accepting the new packages to the archive (mostly for <literal>unstable</literal>),
</simpara>
          </listitem>
          <listitem>
            <simpara>
archive synchronization timing issue (both for <literal>testing</literal> and <literal>unstable</literal>),
</simpara>
          </listitem>
          <listitem>
            <simpara>
manual intervention to the archive such as package removal (more for <literal>testing</literal>), etc.
</simpara>
          </listitem>
        </itemizedlist>
        <simpara>So if you ever decide to use these archives, you should be able to fix or work around these kinds of glitches.</simpara>
        <caution>
          <simpara>For about few months after a new <literal>stable</literal> release, most desktop users should use the <literal>stable</literal> archive with its security updates even if they usually use <literal>unstable</literal> or <literal>testing</literal> archives.  For this transition period, both <literal>unstable</literal> and <literal>testing</literal> archives are not good for most people. Your system is difficult to keep in good working condition with the <literal>unstable</literal> archive since it suffers surges of major upgrades for core packages.  The <literal>testing</literal> archive is not useful either since it contains mostly the same content as the <literal>stable</literal> archive without its security support (<ulink url="&debiantestingsectyannouncecaaibc;">Debian testing-security-announce 2008-12</ulink>). After a month or so, the <literal>unstable</literal> archive may be usable if you are careful.</simpara>
        </caution>
        <tip>
          <simpara>When tracking the <literal>testing</literal> archive, problem caused by a removed package is usually worked around by installing corresponding package from the <literal>unstable</literal> archive which is uploaded for bug fix.</simpara>
        </tip>
        <simpara>See <ulink url="&debianpolicymanual;">Debian Policy Manual</ulink> for definition of:</simpara>
        <itemizedlist>
          <listitem>
            <simpara>
"<ulink url="&sections;">Sections</ulink>",
</simpara>
          </listitem>
          <listitem>
            <simpara>
"<ulink url="&priorities;">Priorities</ulink>",
</simpara>
          </listitem>
          <listitem>
            <simpara>
"<ulink url="&basesystem;">Base system</ulink>", and
</simpara>
          </listitem>
          <listitem>
            <simpara>
"<ulink url="&essentialpackages;">Essential packages</ulink>".
</simpara>
          </listitem>
        </itemizedlist>
      </section>
      <section id="_package_dependencies">
        <title>Package dependencies</title>
        <simpara>The Debian system offers a consistent set of binary packages through its versioned binary dependency declaration mechanism in the control file fields.   Here is a bit over simplified definition for them.</simpara>
        <table id="listofpackagedependencies" pgwide="0" frame="topbot" rowsep="1" colsep="1">
          <title>List of package dependencies.</title>
          <tgroup cols="2">
            <colspec colwidth="30%*" align="left"/>
            <colspec colwidth="70%*" align="left"/>
            <thead>
              <row>
                <entry>
    dependency
    </entry>
                <entry>
    meaning
    </entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry>
    Depends
    </entry>
                <entry>
    This declares an absolute dependency and all of the packages listed in this field must be installed at the same time or in advance.
    </entry>
              </row>
              <row>
                <entry>
    Pre-Depends
    </entry>
                <entry>
    This is like Depends, except that it requires completed installation of the listed packages in advance.
    </entry>
              </row>
              <row>
                <entry>
    Recommends
    </entry>
                <entry>
    This declares a strong, but not absolute, dependency.  Most users would not want the package unless all of the packages listed in this field are installed.
    </entry>
              </row>
              <row>
                <entry>
    Suggests
    </entry>
                <entry>
    This declares a weak dependency.  Many users of this package may benefit from installing packages listed in this field but can have reasonable functions without them.
    </entry>
              </row>
              <row>
                <entry>
    Enhances
    </entry>
                <entry>
    This declares a week dependency like Suggests but works in the opposite direction.
    </entry>
              </row>
              <row>
                <entry>
    Conflicts
    </entry>
                <entry>
    This declares an absolute incompatibility.  All of the packages listed in this field must be removed to install this package.
    </entry>
              </row>
              <row>
                <entry>
    Replaces
    </entry>
                <entry>
    This is declared when files installed by this package replace files in the listed packages.
    </entry>
              </row>
              <row>
                <entry>
    Provides
    </entry>
                <entry>
    This is declared when this package provide all of the files and functionality in the listed packages.
    </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
        <note>
          <simpara>Please note that defining, Provides, Conflicts and Replaces simultaneously to an virtual package is the sane configuration.  This ensures that only one real package providing this virtual package can be installed at any one time.</simpara>
        </note>
        <simpara>The official definition including source dependency can be found in <ulink url="&thepolicymanualcsbetweenpackages;">the Policy Manual: Chapter 7 - Declaring relationships between packages</ulink>.</simpara>
      </section>
      <section id="_the_event_flow_of_the_package_management">
        <title>The event flow of the package management</title>
        <simpara>Here is a summary of the simplified event flow of the package management by APT.</simpara>
        <itemizedlist>
          <listitem>
            <simpara><emphasis role="strong">update</emphasis> ("<literal>aptitude update</literal>" or "<literal>apt-get update</literal>"):
</simpara>
            <orderedlist>
              <listitem>
                <simpara>
fetch archive metadata from remote archive.
</simpara>
              </listitem>
              <listitem>
                <simpara>
reconstruct and update local metadata for use by APT.
</simpara>
              </listitem>
            </orderedlist>
          </listitem>
          <listitem>
            <simpara><emphasis role="strong">upgrade</emphasis> ("<literal>aptitude safe-upgrade</literal>" and "<literal>aptitude full-upgrade</literal>", or "<literal>apt-get upgrade</literal>" and "<literal>apt-get dist-upgrade</literal>"):
</simpara>
            <orderedlist>
              <listitem>
                <simpara>
chose candidate version which is usually the latest available version for all installed packages. (See <xref linkend="_tweaking_candidate_version"/> for exception.)
</simpara>
              </listitem>
              <listitem>
                <simpara>
make package dependency resolution.
</simpara>
              </listitem>
              <listitem>
                <simpara>
fetch selected binary packages from remote archive if candidate version is different from installed version.
</simpara>
              </listitem>
              <listitem>
                <simpara>
unpack fetched binary packages.
</simpara>
              </listitem>
              <listitem>
                <simpara>
run <emphasis role="strong">preinst</emphasis> script.
</simpara>
              </listitem>
              <listitem>
                <simpara>
install binary files.
</simpara>
              </listitem>
              <listitem>
                <simpara>
run <emphasis role="strong">postinst</emphasis> script.
</simpara>
              </listitem>
            </orderedlist>
          </listitem>
          <listitem>
            <simpara><emphasis role="strong">install</emphasis> ("<literal>aptitude install …</literal>" or "<literal>apt-get install …</literal>"):
</simpara>
            <orderedlist>
              <listitem>
                <simpara>
chose packages listed on the command line.
</simpara>
              </listitem>
              <listitem>
                <simpara>
make package dependency resolution.
</simpara>
              </listitem>
              <listitem>
                <simpara>
fetch selected binary packages from remote archive.
</simpara>
              </listitem>
              <listitem>
                <simpara>
unpack fetched binary packages.
</simpara>
              </listitem>
              <listitem>
                <simpara>
run <emphasis role="strong">preinst</emphasis> script.
</simpara>
              </listitem>
              <listitem>
                <simpara>
install binary files.
</simpara>
              </listitem>
              <listitem>
                <simpara>
run <emphasis role="strong">postinst</emphasis> script.
</simpara>
              </listitem>
            </orderedlist>
          </listitem>
          <listitem>
            <simpara><emphasis role="strong">remove</emphasis> ("<literal>aptitude remove …</literal>" or "<literal>apt-get remove …</literal>"):
</simpara>
            <orderedlist>
              <listitem>
                <simpara>
chose packages listed on the command line.
</simpara>
              </listitem>
              <listitem>
                <simpara>
make package dependency resolution.
</simpara>
              </listitem>
              <listitem>
                <simpara>
run <emphasis role="strong">prerm</emphasis> script.
</simpara>
              </listitem>
              <listitem>
                <simpara>
remove installed files <emphasis role="strong">except</emphasis> configuration files.
</simpara>
              </listitem>
              <listitem>
                <simpara>
run <emphasis role="strong">postrm</emphasis> script.
</simpara>
              </listitem>
            </orderedlist>
          </listitem>
          <listitem>
            <simpara><emphasis role="strong">purge</emphasis> ("<literal>aptitude purge …</literal>" or "<literal>apt-get purge …</literal>"):
</simpara>
            <orderedlist>
              <listitem>
                <simpara>
chose packages listed on the command line.
</simpara>
              </listitem>
              <listitem>
                <simpara>
make package dependency resolution.
</simpara>
              </listitem>
              <listitem>
                <simpara>
run <emphasis role="strong">prerm</emphasis> script.
</simpara>
              </listitem>
              <listitem>
                <simpara>
remove installed files <emphasis role="strong">including</emphasis> configuration files.
</simpara>
              </listitem>
              <listitem>
                <simpara>
run <emphasis role="strong">postrm</emphasis> script.
</simpara>
              </listitem>
            </orderedlist>
          </listitem>
        </itemizedlist>
        <simpara>Here, I intentionally skipped technical details for the sake of big picture.</simpara>
      </section>
      <section id="_first_response_to_package_management_troubles">
        <title>First response to package management troubles</title>
        <simpara>You should read the fine official documentation.  The first document to read is the Debian specific "<literal>/usr/share/doc/&lt;package_name&gt;/README.Debian</literal>".  Other documentation in "<literal>/usr/share/doc/&lt;package_name&gt;/</literal>" should be consulted too. If you set shell as <xref linkend="_customizing_bash"/>, type:</simpara>
        <screen>$ cd &lt;package_name&gt;
$ pager README.Debian
$ mc</screen>
        <simpara>You may need to install the corresponding documentation package named with "<literal>-doc</literal>" suffix for detailed information.</simpara>
        <simpara>If you are experiencing problems with a specific package, make sure to check out these sites first:</simpara>
        <table id="listofkeywebsiteaspecificpackage" pgwide="0" frame="topbot" rowsep="1" colsep="1">
          <title>List of key web site to resolving problems with a specific package.</title>
          <tgroup cols="2">
            <colspec colwidth="30%*" align="left"/>
            <colspec colwidth="70%*" align="left"/>
            <thead>
              <row>
                <entry>
    site
    </entry>
                <entry>
    command
    </entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry>
    Home page of <ulink url="&thedebianbugtrackingsystembts;">the Debian bug tracking system (BTS)</ulink>.
    </entry>
                <entry>
                  <literal>sensible-browser "http://bugs.debian.org/"</literal>
                </entry>
              </row>
              <row>
                <entry>
    The bug report of a known package name.
    </entry>
                <entry>
                  <literal>sensible-browser "http://bugs.debian.org/&lt;package_name&gt;"</literal>
                </entry>
              </row>
              <row>
                <entry>
    The bug report of known bug number.
    </entry>
                <entry>
                  <literal>sensible-browser "http://bugs.debian.org/&lt;bug_number&gt;"</literal>
                </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
        <simpara>Search <ulink url="&google;">Google</ulink> with search words including "<literal>site:debian.org</literal>", "<literal>site:wiki.debian.org</literal>", "<literal>site:lists.debian.org</literal>", etc..</simpara>
        <simpara>When you file a bug report, please use <literal>reportbug</literal>(1) command.</simpara>
      </section>
    </section>
    <section id="_basic_package_management_operations">
      <title>Basic package management operations</title>
      <simpara>Aptitude is the current preferred package management tool for the Debian system.  It can be used as the commandline alternative to <literal>apt-get</literal> / <literal>apt-cache</literal> and also as the full screen interactive package management tool.</simpara>
      <simpara>For the package management operation which involves package installation or updates package metadata, you need to have root privilege.</simpara>
      <section id="_basic_package_management_operations_with_commandline">
        <title>Basic package management operations with commandline</title>
        <simpara>Here are package management operations with commandline using <literal>aptitude</literal>(8) and <literal>apt-get</literal>(8) /<literal>apt-cache</literal>(8).</simpara>
        <table id="packagemanagemenndaptgetaptcache" pgwide="0" frame="topbot" rowsep="1" colsep="1">
          <title>Package management operations with commandline using aptitude and apt-get / apt-cache.</title>
          <tgroup cols="3">
            <colspec colwidth="30%*" align="left"/>
            <colspec colwidth="30%*" align="left"/>
            <colspec colwidth="40%*" align="left"/>
            <thead>
              <row>
                <entry><literal>aptitude</literal> syntax
    </entry>
                <entry><literal>apt-get</literal>/<literal>apt-cache</literal> syntax
    </entry>
                <entry>
    description
    </entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry>
                  <literal>aptitude update</literal>
                </entry>
                <entry>
                  <literal>apt-get update</literal>
                </entry>
                <entry>
    Update package archive metadata.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>aptitude install foo</literal>
                </entry>
                <entry>
                  <literal>apt-get install foo</literal>
                </entry>
                <entry>
    Install candidate version of "<literal>foo</literal>" package with its dependencies.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>aptitude safe-upgrade</literal>
                </entry>
                <entry>
                  <literal>apt-get upgrade</literal>
                </entry>
                <entry>
    Install candidate version of installed packages without removing any other packages.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>aptitude full-upgrade</literal>
                </entry>
                <entry>
                  <literal>apt-get dist-upgrade &lt;package&gt;</literal>
                </entry>
                <entry>
    Install candidate version of installed packages while removing other packages if needed.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>aptitude remove foo</literal>
                </entry>
                <entry>
                  <literal>apt-get remove foo</literal>
                </entry>
                <entry>
    Remove "<literal>foo</literal>" package while leaving its configuration files.
    </entry>
              </row>
              <row>
                <entry>
    N/A
    </entry>
                <entry>
                  <literal>apt-get autoremove</literal>
                </entry>
                <entry>
    Remove auto-installed packages which is no longer required.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>aptitude purge foo</literal>
                </entry>
                <entry>
                  <literal>apt-get purge foo</literal>
                </entry>
                <entry>
    Purge "<literal>foo</literal>" package with its configuration files.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>aptitude clean</literal>
                </entry>
                <entry>
                  <literal>apt-get clean</literal>
                </entry>
                <entry>
    Clear out the local repository of retrieved package files completely.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>aptitude autoclean</literal>
                </entry>
                <entry>
                  <literal>apt-get autoclean</literal>
                </entry>
                <entry>
    Clear out the local repository of retrieved package files for outdated packages.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>aptitude show foo</literal>
                </entry>
                <entry>
                  <literal>apt-cache show &lt;package&gt;</literal>
                </entry>
                <entry>
    Display detailed information about "<literal>foo</literal>" package.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>aptitude search &lt;regex&gt;</literal>
                </entry>
                <entry>
                  <literal>apt-cache search &lt;regex&gt;</literal>
                </entry>
                <entry>
    Search packages which match &lt;regex&gt;.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>aptitude why &lt;regex&gt;</literal>
                </entry>
                <entry>
    N/A
    </entry>
                <entry>
    Explain the reason why &lt;regex&gt; matching packages should be installed.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>aptitude why-not &lt;regex&gt;</literal>
                </entry>
                <entry>
    N/A
    </entry>
                <entry>
    Explain the reason why &lt;regex&gt; matching packages can not be installed.
    </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
        <simpara>Although it is now safe to mix different package tools on the Debian system, it is best to continue using <literal>aptitude</literal> as much as possible.</simpara>
        <simpara>The difference between "<literal>safe-upgrade</literal>"/"<literal>upgrade</literal>" and "<literal>full-upgrade</literal>"/"<literal>dist-upgrade</literal>" only appears when new versions of packages stand in different dependency relationships from old versions of those packages.  The "<literal>aptitude safe-upgrade</literal>" command will never install new packages nor remove installed packages.</simpara>
        <simpara>The "<literal>aptitude why &lt;regex&gt;</literal>" can list more information by "<literal>aptitude -v why &lt;regex&gt;</literal>".  Similar information can be obtained by "<literal>apt-cache rdepends &lt;package&gt;</literal>".</simpara>
        <simpara>When <literal>aptitude</literal> command is started in the commandline mode and faces some issues such as package conflicts, you can switch to the full screen interactive mode by pressing "<literal>e</literal>"-key later at the prompt.</simpara>
        <simpara>You may provide command options right after "<literal>aptitude</literal>".</simpara>
        <table id="notablecommandopionsforaptitudei" pgwide="0" frame="topbot" rowsep="1" colsep="1">
          <title>Notable command options for <literal>aptitude</literal>(8).</title>
          <tgroup cols="2">
            <colspec colwidth="30%*" align="left"/>
            <colspec colwidth="70%*" align="left"/>
            <thead>
              <row>
                <entry>
    command option
    </entry>
                <entry>
    description
    </entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry>
                  <literal>-s</literal>
                </entry>
                <entry>
    simulate the result of the command.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>-d</literal>
                </entry>
                <entry>
    download only but no install/upgrade.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>-D</literal>
                </entry>
                <entry>
    show brief explanations before the automatic installations and removals.
    </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
        <simpara>See <literal>aptitude</literal>(8) and "aptitude user's manual" at "<literal>/usr/share/doc/aptitude/README</literal>" for more.</simpara>
        <tip>
          <simpara>The <literal>dselect</literal> package is still available and was the preferred full screen interactive package management tool in previous releases.</simpara>
        </tip>
      </section>
      <section id="_interactive_use_of_aptitude">
        <title>Interactive use of aptitude</title>
        <simpara>For the interactive package management, you start <literal>aptitude</literal> in interactive mode from the console shell prompt as:</simpara>
        <screen>$ sudo aptitude -u
Password:</screen>
        <simpara>This will update the local copy of the archive information and display the package list in the full screen with menu.  Aptitude places its configuration at "<literal>~/.aptitude/config</literal>".</simpara>
        <tip>
          <simpara>If you want to use root's configuration instead of user's one, use "<literal>sudo -H aptitude …</literal>" instead of "<literal>sudo aptitude …</literal>" in the above expression.</simpara>
        </tip>
        <tip>
          <simpara><literal>Aptitude</literal> automatically sets <emphasis role="strong">pending actions</emphasis> as it is started interactively. If you do not like it, you can reset it from menu: "Action" → "Cancel pending actions".</simpara>
        </tip>
      </section>
      <section id="_key_bindings_of_aptitude">
        <title>Key bindings of aptitude</title>
        <simpara>Notable key strokes to browse status of packages and to set "planned action" on them in this full screen mode are:</simpara>
        <table id="listofkeybindingsforaptitude" pgwide="0" frame="topbot" rowsep="1" colsep="1">
          <title>List of key bindings for aptitude.</title>
          <tgroup cols="2">
            <colspec colwidth="30%*" align="left"/>
            <colspec colwidth="70%*" align="left"/>
            <thead>
              <row>
                <entry>
    key
    </entry>
                <entry>
    key binding
    </entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry><literal>F10</literal> or <literal>Ctrl-t</literal>
    </entry>
                <entry>
    Menu
    </entry>
              </row>
              <row>
                <entry>
                  <literal>?</literal>
                </entry>
                <entry>
    Display <emphasis role="strong">help</emphasis> for keystroke (more complete listing)
    </entry>
              </row>
              <row>
                <entry><literal>F10</literal> → Help → User's Manual
    </entry>
                <entry>
    Display User's Manual
    </entry>
              </row>
              <row>
                <entry>
                  <literal>u</literal>
                </entry>
                <entry>
    Update package archive information
    </entry>
              </row>
              <row>
                <entry>
                  <literal>+</literal>
                </entry>
                <entry>
    Mark the package for the <emphasis role="strong">upgrade</emphasis> or the <emphasis role="strong">install</emphasis>
    </entry>
              </row>
              <row>
                <entry>
                  <literal>-</literal>
                </entry>
                <entry>
    Mark the package for the <emphasis role="strong">remove</emphasis> (keep configuration files)
    </entry>
              </row>
              <row>
                <entry>
                  <literal>_</literal>
                </entry>
                <entry>
    Mark the package for the <emphasis role="strong">purge</emphasis> (remove configuration files)
    </entry>
              </row>
              <row>
                <entry>
                  <literal>=</literal>
                </entry>
                <entry>
    Place the package on <emphasis role="strong">hold</emphasis>
    </entry>
              </row>
              <row>
                <entry>
                  <literal>U</literal>
                </entry>
                <entry>
    Mark all upgradable packages (function as <emphasis role="strong">full-upgrade</emphasis>)
    </entry>
              </row>
              <row>
                <entry>
                  <literal>g</literal>
                </entry>
                <entry>
    Start <emphasis role="strong">downloading</emphasis> and <emphasis role="strong">installing</emphasis> selected packages
    </entry>
              </row>
              <row>
                <entry>
                  <literal>q</literal>
                </entry>
                <entry>
    Quit current screen and save changes
    </entry>
              </row>
              <row>
                <entry>
                  <literal>x</literal>
                </entry>
                <entry>
    Quit current screen and discard changes
    </entry>
              </row>
              <row>
                <entry>
                  <literal>Enter</literal>
                </entry>
                <entry>
    View information about a package
    </entry>
              </row>
              <row>
                <entry>
                  <literal>C</literal>
                </entry>
                <entry>
    View a package's changelog
    </entry>
              </row>
              <row>
                <entry>
                  <literal>l</literal>
                </entry>
                <entry>
    Change the limit for the displayed packages
    </entry>
              </row>
              <row>
                <entry>
                  <literal>/</literal>
                </entry>
                <entry>
    Search for the first match
    </entry>
              </row>
              <row>
                <entry>
                  <literal>\</literal>
                </entry>
                <entry>
    Repeat the last search
    </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
        <simpara>The file name specification of the command line and the menu prompt after pressing "<literal>l</literal>" and "<literal>//</literal>" take the aptitude regex as described below.  Aptitude regex can explicitly match a package name using a string started by "<literal>~n</literal> and followed by the package name.</simpara>
        <tip>
          <simpara>You need to press "<literal>U</literal>" to get all the installed packages upgraded to the <emphasis role="strong">candidate version</emphasis> in the visual interface.  Otherwise only the selected packages and certain packages with versioned dependency to them are upgraded to the <emphasis role="strong">candidate version</emphasis>.</simpara>
        </tip>
      </section>
      <section id="_package_views_under_aptitude">
        <title>Package views under aptitude</title>
        <simpara>In the interactive full screen mode of <literal>aptitude</literal>(8), packages in the package list are displayed like this by default:</simpara>
        <screen>idA   libsmbclient                             -2220kB 3.0.25a-1  3.0.25a-2</screen>
        <simpara>Here, this line means from the left as:</simpara>
        <itemizedlist>
          <listitem>
            <simpara>
The "current state" flag (the first letter)
</simpara>
          </listitem>
          <listitem>
            <simpara>
The "planned action" flag (the second letter)
</simpara>
          </listitem>
          <listitem>
            <simpara>
The "automatic" flag (the  third letter)
</simpara>
          </listitem>
          <listitem>
            <simpara>
The package name
</simpara>
          </listitem>
          <listitem>
            <simpara>
The change in disk space usage attributed to "planned action"
</simpara>
          </listitem>
          <listitem>
            <simpara>
The current version of the package
</simpara>
          </listitem>
          <listitem>
            <simpara>
The candidate version of the package
</simpara>
          </listitem>
        </itemizedlist>
        <tip>
          <simpara>The full list of flags are given at the bottom of <emphasis role="strong">Help</emphasis> screen shown by pressing "<literal>?</literal>".</simpara>
        </tip>
        <simpara>The <emphasis role="strong">candidate version</emphasis> is chosen according to the current local preferences (see <literal>apt_preferences</literal>(5) and <xref linkend="_tweaking_candidate_version"/>).</simpara>
        <simpara>Several types of package views are available under the menu "<literal>Views</literal>":</simpara>
        <table id="listofviewsforaptitude" pgwide="0" frame="topbot" rowsep="1" colsep="1">
          <title>List of views for aptitude.</title>
          <tgroup cols="3">
            <colspec colwidth="30%*" align="left"/>
            <colspec colwidth="30%*" align="left"/>
            <colspec colwidth="40%*" align="left"/>
            <thead>
              <row>
                <entry>
    view
    </entry>
                <entry>
    status
    </entry>
                <entry>
    categorization
    </entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry>
                  <literal>Package View</literal>
                </entry>
                <entry>
    Good
    </entry>
                <entry>
    See <xref linkend="standard-package-views"/>. (default)
    </entry>
              </row>
              <row>
                <entry>
                  <literal>Audit Recommendations</literal>
                </entry>
                <entry>
    Good
    </entry>
                <entry>
    Packages which are recommended by some installed packages but not yet installed are listed.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>Flat Package List</literal>
                </entry>
                <entry>
    Good
    </entry>
                <entry>
    Packages are listed without categorization (for use with regex).
    </entry>
              </row>
              <row>
                <entry>
                  <literal>Debtags Browser</literal>
                </entry>
                <entry>
    Very usable
    </entry>
                <entry>
    Packages are categorized according to their <ulink url="&debtags;">debtags</ulink> entries.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>Categorical Browser</literal>
                </entry>
                <entry>
    Deprecated (Use <ulink url="&debtags;">debtags</ulink>!)
    </entry>
                <entry>
    Packages are categorized according to their category.
    </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
        <note>
          <simpara>Please help us <ulink url="&improvingtaggingkageswithdebtags;">improving tagging packages with debtags!</ulink></simpara>
        </note>
        <simpara>The standard "<literal>Package View</literal>" categorizes packages somewhat like <literal>dselect</literal> with few extra features.</simpara>
        <table id="standard-package-views" pgwide="0" frame="topbot" rowsep="1" colsep="1">
          <title>The categorization of standard package views.</title>
          <tgroup cols="2">
            <colspec colwidth="30%*" align="left"/>
            <colspec colwidth="70%*" align="left"/>
            <thead>
              <row>
                <entry>
    category
    </entry>
                <entry>
    organization
    </entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry>
                  <literal>Upgradable Packages</literal>
                </entry>
                <entry>
    Organized as section → component → package
    </entry>
              </row>
              <row>
                <entry>
                  <literal>New Packages</literal>
                </entry>
                <entry>
    , ,
    </entry>
              </row>
              <row>
                <entry>
                  <literal>Installed Packages</literal>
                </entry>
                <entry>
    , ,
    </entry>
              </row>
              <row>
                <entry>
                  <literal>Not Installed Packages</literal>
                </entry>
                <entry>
    , ,
    </entry>
              </row>
              <row>
                <entry>
                  <literal>Obsolete and Locally Created Packages</literal>
                </entry>
                <entry>
    , ,
    </entry>
              </row>
              <row>
                <entry>
                  <literal>Virtual Packages</literal>
                </entry>
                <entry>
    You can pick a particular package from a set of packages with the same function.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>Tasks</literal>
                </entry>
                <entry>
    You can cherry pick particular packages from a set of packages of a task.
    </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
      </section>
      <section id="_search_method_options_with_aptitude">
        <title>Search method options with aptitude</title>
        <simpara>Aptitude offers several options for you to search packages using its regex formula:</simpara>
        <itemizedlist>
          <listitem>
            <simpara>
"<literal>aptitude search '&lt;aptitude_regex&gt;'</literal>" to list installation status, package name and short description of matching packages.
</simpara>
          </listitem>
          <listitem>
            <simpara>
"<literal>aptitude show '&lt;package_name&gt;'</literal>" to list detailed description of the package.
</simpara>
          </listitem>
          <listitem>
            <simpara>
limit view to matching packages: Type "<literal>l</literal>" in the full screen mode.
</simpara>
          </listitem>
          <listitem>
            <simpara>
search the first found package: type "<literal>/</literal>" in the full screen mode.  "<literal>n</literal>" for find-next, "<literal>\</literal>" for backward search.
</simpara>
          </listitem>
        </itemizedlist>
        <simpara>Here, the string for &lt;package_name&gt; is treated as the exact string match to the package name unless it is started explicitly with "<literal>~</literal>" to be the regex formula.</simpara>
      </section>
      <section id="_the_aptitude_regex_formula">
        <title>The aptitude regex formula</title>
        <simpara>The aptitude regex formula is mutt-like extended <emphasis role="strong">ERE</emphasis> (see <xref linkend="_regular_expressions"/>) and the meanings of the <literal>aptitude</literal> specific special match rule extensions are as below:</simpara>
        <table id="listoftheaptituderegexformula" pgwide="0" frame="topbot" rowsep="1" colsep="1">
          <title>List of the aptitude regex formula.</title>
          <tgroup cols="2">
            <colspec colwidth="30%*" align="left"/>
            <colspec colwidth="70%*" align="left"/>
            <thead>
              <row>
                <entry>
    meaning of the extended match rule
    </entry>
                <entry>
    regex formula
    </entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry>
    match on package name
    </entry>
                <entry>
                  <literal>~n&lt;regex_name&gt;</literal>
                </entry>
              </row>
              <row>
                <entry>
    match on description
    </entry>
                <entry>
                  <literal>~d&lt;regex_description&gt;</literal>
                </entry>
              </row>
              <row>
                <entry>
    match on task name
    </entry>
                <entry>
                  <literal>~t&lt;regex_task&gt;</literal>
                </entry>
              </row>
              <row>
                <entry>
    match on debtag
    </entry>
                <entry>
                  <literal>~G&lt;regex_debtag&gt;</literal>
                </entry>
              </row>
              <row>
                <entry>
    match on maintainer
    </entry>
                <entry>
                  <literal>~m&lt;regex_maintainer&gt;</literal>
                </entry>
              </row>
              <row>
                <entry>
    match on package section
    </entry>
                <entry>
                  <literal>~s&lt;regex_section&gt;</literal>
                </entry>
              </row>
              <row>
                <entry>
    match on package version
    </entry>
                <entry>
                  <literal>~V&lt;regex_version&gt;</literal>
                </entry>
              </row>
              <row>
                <entry>
    match archive
    </entry>
                <entry><literal>~A{sarge,etch,sid</literal>}
    </entry>
              </row>
              <row>
                <entry>
    match origin
    </entry>
                <entry><literal>~O{debian,…</literal>}
    </entry>
              </row>
              <row>
                <entry>
    match priority
    </entry>
                <entry><literal>~p{extra,important,optional,required,standard</literal>}
    </entry>
              </row>
              <row>
                <entry>
    match essential packages
    </entry>
                <entry>
                  <literal>~E</literal>
                </entry>
              </row>
              <row>
                <entry>
    match virtual packages
    </entry>
                <entry>
                  <literal>~v</literal>
                </entry>
              </row>
              <row>
                <entry>
    match new packages
    </entry>
                <entry>
                  <literal>~N</literal>
                </entry>
              </row>
              <row>
                <entry>
    match with pending action
    </entry>
                <entry><literal>~a{install,upgrade,downgrade,remove,purge,hold,keep</literal>}
    </entry>
              </row>
              <row>
                <entry>
    match installed packages
    </entry>
                <entry>
                  <literal>~i</literal>
                </entry>
              </row>
              <row>
                <entry>
    match installed packages with <emphasis role="strong">A</emphasis>-mark (auto installed package)
    </entry>
                <entry>
                  <literal>~M</literal>
                </entry>
              </row>
              <row>
                <entry>
    match installed packages without <emphasis role="strong">A</emphasis>-mark (administrator selected package)
    </entry>
                <entry>
                  <literal>~i!~M</literal>
                </entry>
              </row>
              <row>
                <entry>
    match installed and upgradable packages
    </entry>
                <entry>
                  <literal>~U</literal>
                </entry>
              </row>
              <row>
                <entry>
    match removed but not purged packages
    </entry>
                <entry>
                  <literal>~c</literal>
                </entry>
              </row>
              <row>
                <entry>
    match removed, purged or can-be-removed packages
    </entry>
                <entry>
                  <literal>~g</literal>
                </entry>
              </row>
              <row>
                <entry>
    match packages with broken relation
    </entry>
                <entry>
                  <literal>~b</literal>
                </entry>
              </row>
              <row>
                <entry>
    match packages with broken depends/predepends/conflict
    </entry>
                <entry>
                  <literal>~B&lt;type&gt;</literal>
                </entry>
              </row>
              <row>
                <entry>
    match packages whose control files define relation &lt;type&gt; to the &lt;term&gt; package
    </entry>
                <entry>
                  <literal>~D[&lt;type&gt;:]&lt;term&gt;</literal>
                </entry>
              </row>
              <row>
                <entry>
    match packages whose control files define <emphasis role="strong">broken</emphasis> relation &lt;type&gt; to the &lt;term&gt; package
    </entry>
                <entry>
                  <literal>~DB[&lt;type&gt;:]&lt;term&gt;</literal>
                </entry>
              </row>
              <row>
                <entry>
    match packages to which the &lt;term&gt; package defines relation &lt;type&gt;
    </entry>
                <entry>
                  <literal>~R[&lt;type&gt;:]&lt;term&gt;</literal>
                </entry>
              </row>
              <row>
                <entry>
    match packages to which the &lt;term&gt; package defines <emphasis role="strong">broken</emphasis> relation &lt;type&gt;
    </entry>
                <entry>
                  <literal>~RB[&lt;type&gt;:]&lt;term&gt;</literal>
                </entry>
              </row>
              <row>
                <entry>
    match packages to which some other installed packages depend on
    </entry>
                <entry>
                  <literal>~R~i</literal>
                </entry>
              </row>
              <row>
                <entry>
    match packages to which no other installed packages depend on
    </entry>
                <entry>
                  <literal>!~R~i</literal>
                </entry>
              </row>
              <row>
                <entry>
    match packages to which some other installed packages depend or recommend on
    </entry>
                <entry>
                  <literal>~R~i|~Rrecommends:~i</literal>
                </entry>
              </row>
              <row>
                <entry>
    match &lt;term&gt; package with filtered version
    </entry>
                <entry>
                  <literal>~S filter &lt;term&gt;</literal>
                </entry>
              </row>
              <row>
                <entry>
    match all packages (true)
    </entry>
                <entry>
                  <literal>~T</literal>
                </entry>
              </row>
              <row>
                <entry>
    match no packages (false)
    </entry>
                <entry>
                  <literal>~F</literal>
                </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
        <simpara>Here,</simpara>
        <itemizedlist>
          <listitem>
            <simpara>
regex part is the same <emphasis role="strong">ERE</emphasis> as the one used in typical Unix-like text tools using "<literal>^</literal>", "<literal>.*</literal>", "<literal>$</literal>" etc. as in <literal>egrep</literal>(1), <literal>awk</literal>(1) and <literal>perl</literal>(1).
</simpara>
          </listitem>
          <listitem>
            <simpara>
relation &lt;type&gt; is one of (depends, predepends, recommends, suggests, conflicts, replaces, provides).
</simpara>
          </listitem>
          <listitem>
            <simpara>
the default relation type is "depends".
</simpara>
          </listitem>
        </itemizedlist>
        <tip>
          <simpara>When &lt;regex_pattern&gt; is a null string, place "<literal>~T</literal>" immediately after the command.</simpara>
        </tip>
        <simpara>Short cuts:</simpara>
        <itemizedlist>
          <listitem>
            <simpara>
"<literal>~P&lt;term&gt;</literal>" == "<literal>~Dprovides:&lt;term&gt;</literal>"
</simpara>
          </listitem>
          <listitem>
            <simpara>
"<literal>~C&lt;term&gt;</literal>" == "<literal>~Dconflicts:&lt;term&gt;</literal>"
</simpara>
          </listitem>
          <listitem>
            <simpara>
"<literal>…~W term</literal>" == "<literal>(…|term)</literal>"
</simpara>
          </listitem>
        </itemizedlist>
        <simpara>Users familiar with <literal>mutt</literal> will pick up quickly, as mutt was the inspiration for the expression syntax. See "SEARCHING, LIMITING, AND EXPRESSIONS" in the "User's Manual" "<literal>/usr/share/doc/aptitude/README</literal>".</simpara>
        <note>
          <simpara>With the <literal>lenny</literal> version of <literal>aptitude</literal>(8), the new <emphasis role="strong">long form</emphasis> syntax such as "<literal>?broken</literal>" may be used for regex matching in place for its old <emphasis role="strong">short form</emphasis> equivalent "<literal>~b</literal>". Now space character "<literal> </literal>" is considered as one of the regex terminating character in addition to tilde character "<literal>~</literal>".  See "User's Manual" for the new <emphasis role="strong">long form</emphasis> syntax.</simpara>
        </note>
      </section>
      <section id="_dependency_resolution_of_aptitude">
        <title>Dependency resolution of aptitude</title>
        <simpara>The selection of a package in <literal>aptitude</literal> not only pulls in packages which are defined in its "<literal>Depends:</literal>" list but also defined in the "<literal>Recommends:</literal>" list if the menu "<literal>F10</literal> → Options → Dependency handling" is set accordingly.  These auto installed packages are removed automatically if they are no longer needed under <literal>aptitude</literal>.</simpara>
        <note>
          <simpara>Before the <literal>lenny</literal> release, <literal>apt-get</literal> and other standard APT tools did not offer the autoremove functionality.</simpara>
        </note>
      </section>
      <section id="_package_activity_logs">
        <title>Package activity logs</title>
        <simpara>You can check package activity history in the log files.</simpara>
        <table id="thelogfilesforpackageactivities" pgwide="0" frame="topbot" rowsep="1" colsep="1">
          <title>The log files for package activities.</title>
          <tgroup cols="2">
            <colspec colwidth="30%*" align="left"/>
            <colspec colwidth="70%*" align="left"/>
            <thead>
              <row>
                <entry>
    file
    </entry>
                <entry>
    content
    </entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry>
                  <literal>/var/log/dpkg.log</literal>
                </entry>
                <entry>
    Log of <literal>dpkg</literal> level activity for all package activities.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>/var/log/apt/term.log</literal>
                </entry>
                <entry>
    Log of generic APT activity.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>/var/log/aptitude</literal>
                </entry>
                <entry>
    Log of <literal>aptitude</literal> command activity.
    </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
        <simpara>In reality, it is not so easy to get meaningful understanding quickly out from these logs.  See <xref linkend="_recording_changes_in_configuration_files"/> for easier way.</simpara>
      </section>
      <section id="_aptitude_advantages">
        <title>Aptitude advantages</title>
        <simpara>Aptitude has advantages over other APT based packaging systems (apt-get, apt-cache, synaptic, …):</simpara>
        <itemizedlist>
          <listitem>
            <simpara><literal>aptitude</literal> removes unused auto installed packages automatically using its own extra layer of package state file (<literal>/var/lib/aptitude/pkgstates</literal>). (For new "<literal>lenny</literal>", other APT does the same.)
</simpara>
          </listitem>
          <listitem>
            <simpara><literal>aptitude</literal> makes it easy to resolve package conflicts and to add recommended packages.
</simpara>
          </listitem>
          <listitem>
            <simpara><literal>aptitude</literal> makes it easy to keep track of obsolete software by listing under "Obsolete and Locally Created Packages".
</simpara>
          </listitem>
          <listitem>
            <simpara><literal>aptitude</literal> gives a log of its history in "<literal>/var/log/aptitude</literal>".
</simpara>
          </listitem>
          <listitem>
            <simpara><literal>aptitude</literal> offers access to all versions of the package if available.
</simpara>
          </listitem>
          <listitem>
            <simpara><literal>aptitude</literal> includes a fairly powerful regex based system for searching particular packages and limiting the package display.
</simpara>
          </listitem>
          <listitem>
            <simpara><literal>aptitude</literal> in the full screen mode has <literal>su</literal> functionality embedded and can be run from normal user until you really need administrative privileges.
</simpara>
          </listitem>
        </itemizedlist>
        <simpara>For the old <literal>etch</literal> release version, <literal>synaptic</literal> also gives you the history log; <literal>apt-get</literal> did not but you can rely on the log of <literal>dpkg</literal>.</simpara>
        <simpara>Anyway, <literal>aptitude</literal> is nice for interactive console use.</simpara>
      </section>
    </section>
    <section id="_examples_of_aptitude_operations">
      <title>Examples of aptitude operations</title>
      <simpara>Here are few examples of <literal>aptitude</literal>(8) operations.</simpara>
      <section id="_list_packages_with_regex_matching_package_name">
        <title>List packages with regex matching package name</title>
        <simpara>The following command lists packages with regex matching names.</simpara>
        <screen>$ aptitude search '~n(pam|nss).*ldap'
p libnss-ldap - NSS module for using LDAP as a naming service
p libpam-ldap - Pluggable Authentication Module allowing LDAP interfaces</screen>
        <simpara>This is quite handy for you to find the exact name of a package.</simpara>
      </section>
      <section id="_browse_with_the_regex_matching">
        <title>Browse with the regex matching</title>
        <simpara>The regex "<literal>~dipv6</literal>" in the "New Flat Package List" view with "<literal>l</literal>" prompt, limits view to packages with the matching description and let you browse their information interactively.</simpara>
      </section>
      <section id="_purge_removed_packages_for_good">
        <title>Purge removed packages for good</title>
        <simpara>You can purge all remaining configuration files of removed packages:</simpara>
        <screen># aptitude search '~c'</screen>
        <itemizedlist>
          <listitem>
            <simpara>
check results
</simpara>
          </listitem>
        </itemizedlist>
        <screen># aptitude purge '~c'</screen>
        <simpara>You may want to do the similar in the interactive mode for fine grained control.</simpara>
        <simpara>You provide the regex "<literal>~c</literal>" in the "New Flat Package List" view with "<literal>l</literal>" prompt.  This limits the package view only to regex matched packages, i.e., "removed but not purged".  All these regex matched packages can be shown by pressing "<literal>[</literal>" at top level headings.</simpara>
        <simpara>Then you press "<literal>_</literal>" at top level headings such as "Installed Packages".  Only regex matched packages under the heading are marked to be purged by this.  You can exclude some packages to be purged by pressing "<literal>=</literal>" interactively for each of them.</simpara>
        <simpara>This technique is quite handy and works for many other command keys.</simpara>
      </section>
      <section id="_tidy_auto_manual_install_status">
        <title>Tidy auto/manual install status</title>
        <simpara>Here is how I tidy auto/manual install status for packages (after using non-aptitude package installer etc.):</simpara>
        <itemizedlist>
          <listitem>
            <simpara>
Start <literal>aptitude</literal> in interactive mode as root.
</simpara>
          </listitem>
          <listitem>
            <simpara>
Type "<literal>u</literal>", "<literal>U</literal>", "<literal>f</literal>" and "<literal>g</literal>" to update and upgrade package list and packages.
</simpara>
          </listitem>
          <listitem>
            <simpara>
Type "<literal>l</literal>" to enter the package display limit as "<literal>~i(~R~i|~Rrecommends:~i)</literal>" and type "<literal>M</literal>" over "<literal>Installed Packages</literal>" as auto installed.
</simpara>
          </listitem>
          <listitem>
            <simpara>
Type "<literal>l</literal>" to enter the package display limit as "<literal>~prequired|~pimportant|~pstandard|~E</literal>" and type "<literal>m</literal>" over "<literal>Installed Packages</literal>" as manual installed.
</simpara>
          </listitem>
          <listitem>
            <simpara>
Type "<literal>l</literal>" to enter the package display limit as "<literal>~i!~M</literal>" and remove unused package by typing "<literal>-</literal>" over each of them after exposing them by typing "<literal>[</literal>" over "<literal>Installed Packages</literal>".
</simpara>
          </listitem>
          <listitem>
            <simpara>
Type "<literal>l</literal>" to enter the package display limit as "<literal>~i</literal>" and type "<literal>m</literal>" over "<literal>Tasks</literal>" as manual installed.
</simpara>
          </listitem>
          <listitem>
            <simpara>
Exit <literal>aptitude</literal>.
</simpara>
          </listitem>
          <listitem>
            <simpara>
Start "<literal>apt-get -s autoremove|less</literal>" as root to check what are not used.
</simpara>
          </listitem>
          <listitem>
            <simpara>
Restart <literal>aptitude</literal> in interactive mode and mark needed packages as "<literal>m</literal>".
</simpara>
          </listitem>
          <listitem>
            <simpara>
Restart "<literal>apt-get -s autoremove|less</literal>" as root to recheck REMOVED contain only expected packages.
</simpara>
          </listitem>
          <listitem>
            <simpara>
Start "<literal>apt-get autoremove|less</literal>" as root to autoremove unused packages.
</simpara>
          </listitem>
        </itemizedlist>
        <simpara>The "<literal>m</literal>" action over "<literal>Tasks</literal>" is an optional one to prevent mass package removal situation in future.</simpara>
      </section>
      <section id="_system_wide_upgrade_with_aptitude">
        <title>System wide upgrade with aptitude</title>
        <note>
          <simpara>When moving to a new release etc, you should consider to perform a clean installation of new system even though Debian is upgradable as described below.  This provides you a chance to remove garbages collected and exposes you to the best combination of latest packages.  Of course, you should make a full backup of system to a safe place (see <xref linkend="_backup_and_recovery"/>) before doing this. I recommend to make a dual boot configuration using different partition to have the smoothest transition.</simpara>
        </note>
        <simpara>You can perform system wide upgrade to a newer release by changing contents of the "<literal>/etc/apt/sources.list</literal>" file pointing to a new release and running the "<literal>aptitude update; aptitude full-upgrade</literal>" command.</simpara>
        <simpara>To upgrade from <literal>stable</literal> to <literal>testing</literal> or <literal>unstable</literal>, you replace "<literal>&codename-stable;</literal>" in the "<literal>/etc/apt/sources.list</literal>" example of <xref linkend="_debian_archive_basics"/> with "<literal>&codename-testing;</literal>" or "<literal>sid</literal>".</simpara>
        <simpara>In reality, you may face some complications due to some package transition issues, mostly due to package dependencies.  The larger the difference of the upgrade, the more likely you face larger troubles.  For the transition from the old <literal>stable</literal> to the new <literal>stable</literal> after its release, you can read its new <ulink url="&releasenotes;">Release Notes</ulink> and follow the exact procedure described in it to minimize troubles.</simpara>
        <simpara>When you decide to move from <literal>stable</literal> to <literal>testing</literal> before its formal release, there are no <ulink url="&releasenotes;">Release Notes</ulink> to help you. The difference between <literal>stable</literal> and <literal>testing</literal> could have grown quite large after the previous <literal>stable</literal> release and makes upgrade situation complicated.</simpara>
        <simpara>You should make some precautionary moves while gathering latest information from mailing list and using common sense:</simpara>
        <itemizedlist>
          <listitem>
            <simpara>
read previous "Release Notes".
</simpara>
          </listitem>
          <listitem>
            <simpara>
back up entire system (especially data and configuration information).
</simpara>
          </listitem>
          <listitem>
            <simpara>
have bootable media handy for broken bootloader.
</simpara>
          </listitem>
          <listitem>
            <simpara>
inform users on the system well in advance.
</simpara>
          </listitem>
          <listitem>
            <simpara>
record upgrade activity with <literal>script</literal>(1).
</simpara>
          </listitem>
          <listitem>
            <simpara>
apply "unmarkauto" to required packages, e.g., "<literal>aptitude unmarkauto vim</literal>", to prevent removal.
</simpara>
          </listitem>
          <listitem>
            <simpara>
minimize installed packages to reduce chance of package conflicts, e.g., remove desktop task packages.
</simpara>
          </listitem>
          <listitem>
            <simpara>
remove the "<literal>/etc/apt/preferences</literal>" file. (disable apt-pinning)
</simpara>
          </listitem>
          <listitem>
            <simpara>
try to upgrade step wise: <literal>oldstable</literal> → <literal>stable</literal> → <literal>testing</literal> → <literal>unstable</literal>.
</simpara>
          </listitem>
          <listitem>
            <simpara>
update the "<literal>/etc/apt/sources.list</literal>" file to point to new archive only and run "<literal>aptitude update</literal>".
</simpara>
          </listitem>
          <listitem>
            <simpara>
install, optionally, new <emphasis role="strong">core packages</emphasis> first, e.g., "<literal>aptitude install perl</literal>".
</simpara>
          </listitem>
          <listitem>
            <simpara>
run the "<literal>aptitude full-upgrade -s</literal>" command to assess impact.
</simpara>
          </listitem>
          <listitem>
            <simpara>
run the "<literal>aptitude full-upgrade</literal>" command.
</simpara>
          </listitem>
        </itemizedlist>
        <caution>
          <simpara>It is not wise to skip major Debian release when upgrading between <literal>stable</literal> releases.</simpara>
        </caution>
        <caution>
          <simpara>In previous "Release Notes", GCC, Linux Kernel, initrd-tools, Glibc, Perl, APT tool chain, etc. have required some special attention for system wide upgrade.</simpara>
        </caution>
        <simpara>For daily upgrade in <literal>unstable</literal>, see <xref linkend="_safeguard_for_package_problems"/>.</simpara>
      </section>
    </section>
    <section id="_advanced_package_management_operations">
      <title>Advanced package management operations</title>
      <section id="_advanced_package_management_operations_with_commandline">
        <title>Advanced package management operations with commandline</title>
        <simpara>Here are list of other package management operations for which <literal>aptitude</literal> is too high-level or lacks required functionalities.</simpara>
        <table id="listofadvancedpagementoperations" pgwide="0" frame="topbot" rowsep="1" colsep="1">
          <title>List of advanced package management operations.</title>
          <tgroup cols="2">
            <colspec colwidth="30%*" align="left"/>
            <colspec colwidth="70%*" align="left"/>
            <thead>
              <row>
                <entry>
    command
    </entry>
                <entry>
    action
    </entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry>
                  <literal>COLUMNS=120 dpkg -l &lt;package_name_pattern&gt;</literal>
                </entry>
                <entry>
    list status of an installed package for the bug report.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>dpkg -L &lt;package_name&gt;</literal>
                </entry>
                <entry>
    list contents of an installed package.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>dpkg -L &lt;package_name&gt; | egrep '/usr/share/man/man.*/.+'</literal>
                </entry>
                <entry>
    list manpages for an installed package.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>dpkg -S &lt;file_name_pattern&gt;</literal>
                </entry>
                <entry>
    list installed packages which have matching file name.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>apt-file search &lt;file_name_pattern&gt;</literal>
                </entry>
                <entry>
    list packages in archive which have matching file name.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>apt-file list &lt;package_name_pattern&gt;</literal>
                </entry>
                <entry>
    list contents of matching packages in archive.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>dpkg-reconfigure &lt;package_name&gt;</literal>
                </entry>
                <entry>
    reconfigure the exact package .
    </entry>
              </row>
              <row>
                <entry>
                  <literal>dpkg-reconfigure -p=low &lt;package_name&gt;</literal>
                </entry>
                <entry>
    reconfigure the exact package with the most detailed question.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>configure-debian</literal>
                </entry>
                <entry>
    reconfigure packages from the full screen menu.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>dpkg --audit</literal>
                </entry>
                <entry>
    audit system for partially installed packages.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>dpkg --configure -a</literal>
                </entry>
                <entry>
    configures all partially installed packages.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>apt-cache policy &lt;binary_package_name&gt;</literal>
                </entry>
                <entry>
    show available version, priority, and archive information of a binary package.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>apt-cache madison &lt;package_name&gt;</literal>
                </entry>
                <entry>
    show available version, archive information of a package.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>apt-cache showsrc &lt;binary_package_name&gt;</literal>
                </entry>
                <entry>
    show source package information of a binary package.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>apt-get build-dep &lt;package_name&gt;</literal>
                </entry>
                <entry>
    install required packages to build package.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>apt-get source &lt;package_name&gt;</literal>
                </entry>
                <entry>
    download a source. (from standard archive)
    </entry>
              </row>
              <row>
                <entry>
                  <literal>dget &lt;URL for dsc file&gt;</literal>
                </entry>
                <entry>
    download a source packages. (from other archive)
    </entry>
              </row>
              <row>
                <entry>
                  <literal>dpkg-source -x &lt;package_name&gt;_&lt;version&gt;-&lt;debian_version&gt;.dsc</literal>
                </entry>
                <entry>
    build a source tree from a set of source packages ("<literal>*.tar.gz</literal>" and "<literal>*.diff.gz</literal>").
    </entry>
              </row>
              <row>
                <entry>
                  <literal>debuild binary</literal>
                </entry>
                <entry>
    build package(s) from a local source tree.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>make-kpkg kernel_image</literal>
                </entry>
                <entry>
    build a kernel package from a kernel source tree.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>make-kpkg --initrd kernel_image</literal>
                </entry>
                <entry>
    build a kernel package from a kernel source tree with initramfs enabled.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>dpkg -i &lt;package_name&gt;<emphasis>&lt;version&gt;-&lt;debian_version&gt;</emphasis>&lt;arch&gt;.deb</literal>
                </entry>
                <entry>
    install a local package to the system.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>debi &lt;package_name&gt;<emphasis>&lt;version&gt;-&lt;debian_version&gt;</emphasis>&lt;arch&gt;.dsc</literal>
                </entry>
                <entry>
    install local package(s) to the system.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>dpkg --get-selection '*' &gt;selection.txt</literal>
                </entry>
                <entry>
    save <literal>dpkg</literal> level package selection state information.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>dpkg --set-selection &lt;selection.txt</literal>
                </entry>
                <entry>
    set <literal>dpkg</literal> level package selection state information.
    </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
        <caution>
          <simpara>Lower level package tools such as "<literal>dpkg -i …</literal>" and "<literal>debi …</literal>" should be carefully used by the system administrator.  It does not automatically take care required package dependencies. Dpkg's commandline options "<literal>--force-all</literal>" and similar (see <literal>dpkg</literal>(1)) are intended to be used by experts only.  Using them without fully understanding their effects may break your whole system.</simpara>
        </caution>
        <simpara>Please note:</simpara>
        <itemizedlist>
          <listitem>
            <simpara>
All system configuration and installation commands require to be run from root.
</simpara>
          </listitem>
          <listitem>
            <simpara>
Unlike <literal>aptitude</literal> which uses regex (see <xref linkend="_regular_expressions"/>), other package management commands use pattern like shell glob (see <xref linkend="_shell_glob"/>).
</simpara>
          </listitem>
          <listitem>
            <simpara><literal>apt-file</literal>(1) provided by the <literal>apt-file</literal> package must run "<literal>apt-file update</literal>" in advance.
</simpara>
          </listitem>
          <listitem>
            <simpara><literal>configure-debian</literal>(8) provided by the <literal>configure-debian</literal> package runs <literal>dpkg-reconfigure</literal>(8) as its backend.
</simpara>
          </listitem>
          <listitem>
            <simpara><literal>dpkg-reconfigure</literal>(8) runs package scripts using <literal>debconf</literal>(1) as its backend.
</simpara>
          </listitem>
          <listitem>
            <simpara>
"<literal>apt-get build-dep</literal>", "<literal>apt-get source</literal>" and "<literal>apt-cache showsrc</literal>" commands require "<literal>deb-src</literal>" entry in "<literal>/etc/apt/sources.list</literal>".
</simpara>
          </listitem>
          <listitem>
            <simpara><literal>dget</literal>(1), <literal>debuild</literal>(1), and <literal>debi</literal>(1) require <literal>devscripts</literal> package.
</simpara>
          </listitem>
          <listitem>
            <simpara>
see (re)packaging procedure using "<literal>apt-get source</literal>" in <xref linkend="_port_a_package_to_the_stable_system"/>.
</simpara>
          </listitem>
          <listitem>
            <simpara><literal>make-kpkg</literal> command requires the <literal>kernel-package</literal> package (see <xref linkend="_the_kernel"/>).
</simpara>
          </listitem>
          <listitem>
            <simpara>
see <xref linkend="_making_debian_package"/> for general packaging.
</simpara>
          </listitem>
        </itemizedlist>
        <tip>
          <simpara>The source package format described here as a set of source packages ("<literal>*.tar.gz</literal>" and "<literal>*.diff.gz</literal>") is format 1.0 which is still popular.  See more on <literal>dpkg-source</literal>(1) for other newer formats.</simpara>
        </tip>
      </section>
      <section id="_verify_installed_package_files">
        <title>Verify installed package files</title>
        <simpara>The installation of <literal>debsums</literal> enables verification of installed package files against MD5sum values in the "<literal>/var/lib/dpkg/info/*.md5sums</literal>" file with <literal>debsums</literal>(1).  See <xref linkend="_the_md5_sum"/> for how MD5sum works.</simpara>
        <note>
          <simpara>Because MD5sum database may be tampered by the intruder, <literal>debsums</literal>(1) is of limited use as a security tool. It is only good for checking local modifications by the administrator or damage due to media errors.</simpara>
        </note>
      </section>
      <section id="_safeguard_for_package_problems">
        <title>Safeguard for package problems</title>
        <simpara>Many users prefer to follow the <emphasis role="strong">unstable</emphasis> release of the Debian system for its new features and packages.  This makes the system more prone to be hit by the critical package bugs.</simpara>
        <simpara>The installation of the <literal>apt-listbugs</literal> package will provide safeguard to the critical bugs by checking Debian BTS automatically for critical bugs when upgrading with APT system.</simpara>
        <simpara>The installation of the <literal>apt-listchanges</literal> package will provide important news in "<literal>NEWS.Debian</literal>" when upgrading with APT system.</simpara>
      </section>
      <section id="_search_on_the_package_meta_data">
        <title>Search on the package meta data</title>
        <simpara>Although visiting Debian site <ulink url="&httppackagesdebianorg;">http://packages.debian.org/</ulink> facilitates easy ways to search on the package meta data these days, let's look into more traditional ways.</simpara>
        <simpara>The <literal>grep-dctrl</literal>(1), <literal>grep-status</literal>(1), and <literal>grep-available</literal>(1) commands can be used to search any file which has the general format of a Debian package control file.</simpara>
        <simpara>The "<literal>dpkg -S &lt;file_name_pattern&gt;</literal>" can be used search package names which contain files with the matching name installed by <literal>dpkg</literal>.  But this overlooks files created by the maintainer scripts.</simpara>
        <simpara>If you need to make more elaborate search on the dpkg meta data, you need to run "<literal>grep -e regex_pattern *</literal>" command in the "<literal>/var/lib/dpkg/info/</literal>" directory.  This will let you identify:</simpara>
        <itemizedlist>
          <listitem>
            <simpara>
the package name which installs, creates or modifies particular file which match pattern.
</simpara>
          </listitem>
          <listitem>
            <simpara>
the package name which asks the installation query words which match pattern.
</simpara>
          </listitem>
        </itemizedlist>
        <simpara>If you wish to look up package dependency recursively, you should use <literal>apt-rdepends</literal>(8).</simpara>
      </section>
    </section>
    <section id="_debian_package_management_internals">
      <title>Debian package management internals</title>
      <simpara>Let's learn how the Debian package management system works internally.  This should help you to create your own solution to some package problems.</simpara>
      <section id="_archive_meta_data">
        <title>Archive meta data</title>
        <simpara>Meta data files for each distribution are stored under "<literal>dist/&lt;codename&gt;</literal>" on each Debian mirror sites, e.g., "<literal>http://ftp.us.debian.org/debian/</literal>".  Its archive structure can be browsed by the web browser. There are 6 types of key meta data:</simpara>
        <table id="thecontentofthednarchivemetadata" pgwide="0" frame="topbot" rowsep="1" colsep="1">
          <title>The content of the Debian archive meta data.</title>
          <tgroup cols="3">
            <colspec colwidth="30%*" align="left"/>
            <colspec colwidth="30%*" align="left"/>
            <colspec colwidth="40%*" align="left"/>
            <thead>
              <row>
                <entry>
    file
    </entry>
                <entry>
    location
    </entry>
                <entry>
    content
    </entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry>
                  <literal>Release</literal>
                </entry>
                <entry>
    top of distribution
    </entry>
                <entry>
    archive description and integrity information
    </entry>
              </row>
              <row>
                <entry>
                  <literal>Release.gpg</literal>
                </entry>
                <entry>
    top of distribution
    </entry>
                <entry>
    signature file for the "<literal>Release</literal>" file signed with the archive key
    </entry>
              </row>
              <row>
                <entry>
                  <literal>Contents-&lt;architecture&gt;</literal>
                </entry>
                <entry>
    top of distribution
    </entry>
                <entry>
    list of all files for all the packages in the pertinent archive
    </entry>
              </row>
              <row>
                <entry>
                  <literal>Release</literal>
                </entry>
                <entry>
    top of each distribution/component/architecture combination
    </entry>
                <entry>
    archive description used for the rule of <literal>apt_preferences</literal>(5)
    </entry>
              </row>
              <row>
                <entry>
                  <literal>Packages</literal>
                </entry>
                <entry>
    top of each distribution/component/binary-architecture combination
    </entry>
                <entry>
    concatenated <literal>debian/control</literal> for binary packages
    </entry>
              </row>
              <row>
                <entry>
                  <literal>Sources</literal>
                </entry>
                <entry>
    top of each distribution/component/source combination
    </entry>
                <entry>
    concatenated <literal>debian/control</literal> for source packages
    </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
        <simpara>In the recent archive, these meta data are stored as the compressed and differential files to reduce network traffic.</simpara>
      </section>
      <section id="_top_level_release_file_and_authenticity">
        <title>Top level "Release" file and authenticity</title>
        <tip>
          <simpara>The top level "<literal>Release</literal>" file is used for signing the archive under the <emphasis role="strong">secure APT</emphasis> system.</simpara>
        </tip>
        <simpara>Each suite of the Debian archive has a top level "<literal>Release</literal>" file, e.g., "<literal>http://ftp.us.debian.org/debian/dists/unstable/Release</literal>":</simpara>
        <screen>Origin: Debian
Label: Debian
Suite: unstable
Codename: sid
Date: Sat, 26 Jan 2008 20:13:58 UTC
Architectures: alpha amd64 arm hppa hurd-i386 i386 ia64 m68k mips mipsel powerpc s390 sparc
Components: main contrib non-free
Description: Debian x.y Unstable - Not Released
MD5Sum:
 e9f11bc50b12af7927d6583de0a3bd06 22788722 main/binary-alpha/Packages
 43524d07f7fa21b10f472c426db66168  6561398 main/binary-alpha/Packages.gz
...</screen>
        <note>
          <simpara>Here, you can find my rationale to use the "suite", "codeneme", and "components" in <xref linkend="_debian_archive_basics"/>.  The "distribution" is used when referring to both "suite" and "codeneme".</simpara>
        </note>
        <simpara>The integrity of the top level "<literal>Release</literal>" file is verified by cryptographic infrastructure called the <ulink url="&secureapt;">secure apt</ulink>.</simpara>
        <itemizedlist>
          <listitem>
            <simpara>
The cryptographic signature file "<literal>Release.gpg</literal>" is created from the authentic top level "<literal>Release</literal>" file and the secret Debian archive key.
</simpara>
          </listitem>
          <listitem>
            <simpara>
The public Debian archive key can be seeded into "<literal>/etc/apt/trusted.gpg</literal>":
</simpara>
            <itemizedlist>
              <listitem>
                <simpara>
automatically by installing the keyring with the latest <literal>base-files</literal> package, or
</simpara>
              </listitem>
              <listitem>
                <simpara>
manually by <literal>gpg</literal> or <literal>apt-key</literal> tool with <ulink url="&thelatestpublicapmasterdebianorg;">the latest public archive key posted on the ftp-master.debian.org</ulink> .
</simpara>
              </listitem>
            </itemizedlist>
          </listitem>
          <listitem>
            <simpara>
The <emphasis role="strong">secure APT</emphasis> system verifies the integrity of the downloaded top level "<literal>Release</literal>" file cryptographically by this "<literal>Release.gpg</literal>" file and the public Debian archive key in "<literal>/etc/apt/trusted.gpg</literal>".
</simpara>
          </listitem>
        </itemizedlist>
        <simpara>The integrity of all the "<literal>Packages</literal>" and "<literal>Sources</literal>" files are verified by using MD5sum values in its top level "<literal>Release</literal>" file.  The integrity of all package files are verified by using MD5sum values in the "<literal>Packages</literal>" and "<literal>Sources</literal>" files.  See <literal>debsums</literal>(1) and <xref linkend="_verify_installed_package_files"/>.</simpara>
        <simpara>Since the cryptographic signature verification is very CPU intensive process than the MD5sum value calculation, use of MD5sum value for each package while using cryptographic signature for the top level "<literal>Release</literal>" file provides <ulink url="&thegoodsecuritywththeperformance;">the good security with the performance</ulink> (see <xref linkend="_data_security_infrastructure"/>).</simpara>
      </section>
      <section id="_archive_level_release_files">
        <title>Archive level "Release" files</title>
        <tip>
          <simpara>The archive level "<literal>Release</literal>" files are used for the rule of <literal>apt_preferences</literal>(5).</simpara>
        </tip>
        <simpara>There are archive level "<literal>Release</literal>" files for all archive locations specified by "<literal>deb</literal>" line in "<literal>/etc/apt/sources.list</literal>", such as "<literal>http://ftp.us.debian.org/debian/dists/unstable/main/binary-amd64/Release</literal>" or "<literal>http://ftp.us.debian.org/debian/dists/sid/main/binary-amd64/Release</literal>":</simpara>
        <screen>Archive: unstable
Component: main
Origin: Debian
Label: Debian
Architecture: amd64</screen>
        <caution>
          <simpara>For "<literal>Archive:</literal>" stanza, suite names ("<literal>stable</literal>", "<literal>testing</literal>", "<literal>unstable</literal>", …) are used in <ulink url="&thedebianarchive;">the Debian archive</ulink> while codenames ("<literal>dapper</literal>", "<literal>feisty</literal>", "<literal>gutsy</literal>", "<literal>hardy</literal>", "<literal>intrepid</literal>", …) are used in <ulink url="&theubuntuarchive;">the Ubuntu archive</ulink>.</simpara>
        </caution>
        <simpara>For some archives, such as <literal>experimental</literal>, <literal>volatile-sloppy</literal>, and <literal>&codename-stable;-backports</literal>, which contain packages which should not be installed automatically, there is an extra line, e.g., "<literal>http://ftp.us.debian.org/debian/dists/experimental/main/binary-amd64/Release</literal>":</simpara>
        <screen>Archive: experimental
Component: main
Origin: Debian
Label: Debian
NotAutomatic: yes
Architecture: amd64</screen>
        <simpara>Please note that for normal archives without "<literal>NotAutomatic: yes</literal>", the default Pin-Priority value is 500, while for special archives with "<literal>NotAutomatic: yes</literal>", the default Pin-Priority value is 1 (see <literal>apt_preferences</literal>(5) and <xref linkend="_tweaking_candidate_version"/>).</simpara>
      </section>
      <section id="_fetching_of_the_meta_data_for_the_package">
        <title>Fetching of the meta data for the package</title>
        <simpara>When APT tools, such as <literal>aptitude</literal>, <literal>apt-get</literal>, <literal>synaptic</literal>, <literal>apt-file</literal>, <literal>auto-apt</literal>…, are used, we need to update the local copies of the meta data containing the Debian archive information. These local copies have file names corresponding to the specified <literal>distribution</literal>, <literal>component</literal>, and <literal>architecture</literal> names in the "<literal>/etc/apt/sources.list</literal>" (see <xref linkend="_debian_archive_basics"/>) as:</simpara>
        <itemizedlist>
          <listitem>
            <simpara>
"<literal>/var/lib/apt/lists/ftp.us.debian.org_debian_dists_&lt;distribution&gt;_Release</literal>",
</simpara>
          </listitem>
          <listitem>
            <simpara>
"<literal>/var/lib/apt/lists/ftp.us.debian.org_debian_dists_&lt;distribution&gt;_Release.gpg</literal>",
</simpara>
          </listitem>
          <listitem>
            <simpara>
"<literal>/var/lib/apt/lists/ftp.us.debian.org_debian_dists_&lt;distribution&gt;_&lt;component&gt;_binary-&lt;architecture&gt;_Packages</literal>",
</simpara>
          </listitem>
          <listitem>
            <simpara>
"<literal>/var/lib/apt/lists/ftp.us.debian.org_debian_dists_&lt;distribution&gt;_&lt;component&gt;_source_Sources</literal>", and
</simpara>
          </listitem>
          <listitem>
            <simpara>
"<literal>/var/cache/apt/apt-file/ftp.us.debian.org_debian_dists_&lt;distribution&gt;_Contents-&lt;architecture&gt;.gz</literal>" (for <literal>apt-file</literal>).
</simpara>
          </listitem>
        </itemizedlist>
        <simpara>First 4 types of files are shared by all the pertinent APT commands and updated from command line by "<literal>apt-get update</literal>" and "<literal>aptitude update</literal>".  The "<literal>Packages</literal>" meta data are updated if there is the "<literal>deb</literal>" line in "<literal>/etc/apt/sources.list</literal>". The "<literal>Sources</literal>" meta data are updated if there is the "<literal>deb-src</literal>" line in "<literal>/etc/apt/sources.list</literal>".</simpara>
        <simpara>The "<literal>Packages</literal>" and "<literal>Sources</literal>" meta data contain "<literal>Filename:</literal>" stanza pointing to the file location of the binary and source packages.  Currently, these packages are located under the "<literal>pool/</literal>" directory tree for the improved transition over the releases.</simpara>
        <simpara>Local copies of "<literal>Packages</literal>" meta data can be interactively searched with the help of <literal>aptitude</literal>.  The specialized search command <literal>grep-dctrl</literal>(1) can search local copies of "<literal>Packages</literal>" and "<literal>Sources</literal>" meta data.</simpara>
        <simpara>Local copy of "<literal>Contents-&lt;architecture&gt;</literal>" meta data can be updated by "<literal>apt-file update</literal>" and its location is different from other 4 ones. See <literal>apt-file</literal>(1). (The <literal>auto-apt</literal> uses different location for local copy of "<literal>Contents-&lt;architecture&gt;.gz</literal>" as default.)</simpara>
      </section>
      <section id="_the_package_state_for_apt">
        <title>The package state for APT</title>
        <simpara>In addition to the remotely fetched meta data, the APT tool after <literal>lenny</literal> stores its locally generated installation state information in the "<literal>/var/lib/apt/extended_states</literal>" which is used by all APT tools to track all auto installed packages.</simpara>
      </section>
      <section id="_the_package_state_for_aptitude">
        <title>The package state for aptitude</title>
        <simpara>In addition to the remotely fetched meta data, the <literal>aptitude</literal> command stores its locally generated installation state information in the "<literal>/var/lib/aptitude/pkgstates</literal>" which is used only by it.</simpara>
      </section>
      <section id="_local_copies_of_the_fetched_packages">
        <title>Local copies of the fetched packages</title>
        <simpara>All the remotely fetched packages via APT mechanism are stored in the "<literal>/var/cache/apt/packages</literal>" until they are cleaned.</simpara>
      </section>
      <section id="_the_debian_package_file_name">
        <title>The Debian package file name</title>
        <simpara>The Debian package files has particular name structures:</simpara>
        <table id="thenamestructureofdebianpackages" pgwide="0" frame="topbot" rowsep="1" colsep="1">
          <title>The name structure of Debian packages.</title>
          <tgroup cols="2">
            <colspec colwidth="30%*" align="left"/>
            <colspec colwidth="70%*" align="left"/>
            <thead>
              <row>
                <entry>
    package type
    </entry>
                <entry>
    name structure
    </entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry>
    The binary package (a.k.a deb)
    </entry>
                <entry>
                  <literal>&lt;package-name&gt;_&lt;epoch&gt;:&lt;upstream-version&gt;-&lt;debian.version&gt;-&lt;architecture&gt;.deb</literal>
                </entry>
              </row>
              <row>
                <entry>
    The binary package for the debian-installer (a.k.a udeb)
    </entry>
                <entry>
                  <literal>&lt;package-name&gt;_&lt;epoch&gt;:&lt;upstream-version&gt;-&lt;debian.version&gt;-&lt;architecture&gt;.udeb</literal>
                </entry>
              </row>
              <row>
                <entry>
    The source package (upstream source)
    </entry>
                <entry>
                  <literal>&lt;package-name&gt;_&lt;epoch&gt;:&lt;upstream-version&gt;-&lt;debian.version&gt;.tar.gz</literal>
                </entry>
              </row>
              <row>
                <entry>
    The source package (Debian changes)
    </entry>
                <entry>
                  <literal>&lt;package-name&gt;_&lt;epoch&gt;:&lt;upstream-version&gt;-&lt;debian.version&gt;.diff.gz</literal>
                </entry>
              </row>
              <row>
                <entry>
    The source package (description)
    </entry>
                <entry>
                  <literal>&lt;package-name&gt;_&lt;epoch&gt;:&lt;upstream-version&gt;-&lt;debian.version&gt;.dsc</literal>
                </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
        <simpara>where,</simpara>
        <table id="theusablecharactbianpackagenames" pgwide="0" frame="topbot" rowsep="1" colsep="1">
          <title>The usable characters for each component in the Debian package names.</title>
          <tgroup cols="3">
            <colspec colwidth="30%*" align="left"/>
            <colspec colwidth="30%*" align="left"/>
            <colspec colwidth="40%*" align="left"/>
            <thead>
              <row>
                <entry>
    name component
    </entry>
                <entry>
    usable characters (regex)
    </entry>
                <entry>
    existance
    </entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry>
                  <literal>&lt;package-name&gt;</literal>
                </entry>
                <entry>
                  <literal>[a-z,A-Z,0-9,.,<literal>,-]</literal></literal>
                </entry>
                <entry>
    required
    </entry>
              </row>
              <row>
                <entry>
                  <literal>&lt;epoch&gt;:</literal>
                </entry>
                <entry>
                  <literal>[0-9]+:</literal>
                </entry>
                <entry>
    optional
    </entry>
              </row>
              <row>
                <entry>
                  <literal>&lt;upstream-version&gt;</literal>
                </entry>
                <entry>
                  <literal>[a-z,A-Z,0-9,.,<literal>,-,:]</literal></literal>
                </entry>
                <entry>
    required
    </entry>
              </row>
              <row>
                <entry>
                  <literal>&lt;debian.version&gt;</literal>
                </entry>
                <entry>
                  <literal>[a-z,A-Z,0-9,.,<literal>,~]</literal></literal>
                </entry>
                <entry>
    optional
    </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
        <note>
          <simpara>You can check package version order by <literal>dpkg</literal>(1), e.g., "<literal>dpkg --compare-versions 7.0 gt 7.~pre1 ; echo $?</literal>" .</simpara>
        </note>
        <note>
          <simpara><ulink url="&thedebianinstallerdi;">The debian-installer (d-i)</ulink> uses <literal>udeb</literal> as the file extension for its binary package instead of normal <literal>deb</literal>.  An <literal>udeb</literal> package is a stripped down <literal>deb</literal> package which removes few non-essential contents such as documentation to save space while relaxing the package policy requirements.  Both <literal>deb</literal> and <literal>udeb</literal> packages share the same package structure.  The "<literal>u</literal>" stands for micro.</simpara>
        </note>
      </section>
      <section id="_the_dpkg_command">
        <title>The dpkg command</title>
        <simpara><literal>dpkg</literal>(1) is the lowest level tool for the Debian package management.  This is very powerful and needs to be used with care.</simpara>
        <simpara>The fetched package is processed by <literal>dpkg</literal> in the following order:</simpara>
        <orderedlist>
          <listitem>
            <simpara>
unpack the deb file ("<literal>ar -x</literal>" equivalent)
</simpara>
          </listitem>
          <listitem>
            <simpara>
preinst using <literal>debconf</literal>(1)
</simpara>
          </listitem>
          <listitem>
            <simpara>
install the package content to the system ("<literal>tar -x</literal>" equivalent)
</simpara>
          </listitem>
          <listitem>
            <simpara>
postinst using <literal>debconf</literal>(1)
</simpara>
          </listitem>
        </orderedlist>
        <simpara>The <literal>debconf</literal> system provides standardized user interaction with I18N and L10N (<xref linkend="_i18n_and_l10n"/>) supports.</simpara>
        <simpara>While installing package called "<literal>&lt;package_name&gt;</literal>", <literal>dpkg</literal> creates several files and executes several scripts.</simpara>
        <table id="thenotablefilesfordpkg" pgwide="0" frame="topbot" rowsep="1" colsep="1">
          <title>The notable files for dpkg.</title>
          <tgroup cols="2">
            <colspec colwidth="30%*" align="left"/>
            <colspec colwidth="70%*" align="left"/>
            <thead>
              <row>
                <entry>
    file
    </entry>
                <entry>
    contents
    </entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry>
                  <literal>/var/lib/dpkg/info/&lt;package_name&gt;.conffiles</literal>
                </entry>
                <entry>
    list of configuration files. (user modifiable)
    </entry>
              </row>
              <row>
                <entry>
                  <literal>/var/lib/dpkg/info/&lt;package_name&gt;.list</literal>
                </entry>
                <entry>
    list of files and directories installed by the package.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>/var/lib/dpkg/info/&lt;package_name&gt;.md5sums</literal>
                </entry>
                <entry>
    list of MD5 hash values for files installed by the package.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>/var/lib/dpkg/info/&lt;package_name&gt;.preinst</literal>
                </entry>
                <entry>
    package script run before the package installation.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>/var/lib/dpkg/info/&lt;package_name&gt;.postinst</literal>
                </entry>
                <entry>
    package script run after the package installation.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>/var/lib/dpkg/info/&lt;package_name&gt;.prerm</literal>
                </entry>
                <entry>
    package script run before the package removal.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>/var/lib/dpkg/info/&lt;package_name&gt;.postrm</literal>
                </entry>
                <entry>
    package script run after the package removal.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>/var/lib/dpkg/info/&lt;package_name&gt;.config</literal>
                </entry>
                <entry>
    package script for <literal>debconf</literal> system.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>/var/lib/dpkg/alternatives/&lt;package_name&gt;</literal>
                </entry>
                <entry>
    the alternative information used by the <literal>update-alternatives</literal> command.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>/var/lib/dpkg/available</literal>
                </entry>
                <entry>
    the availability information for all the package.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>/var/lib/dpkg/diversions</literal>
                </entry>
                <entry>
    the diversions information used by <literal>dpkg</literal>(1) and set by`dpkg-divert`(8)
    </entry>
              </row>
              <row>
                <entry>
                  <literal>/var/lib/dpkg/statoverride</literal>
                </entry>
                <entry>
    the stat override information used by <literal>dpkg</literal>(1) and set by`dpkg-statoverride`(8)
    </entry>
              </row>
              <row>
                <entry>
                  <literal>/var/lib/dpkg/status</literal>
                </entry>
                <entry>
    the status information for all the packages.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>/var/lib/dpkg/status-old</literal>
                </entry>
                <entry>
    the first-generation backup of the "<literal>var/lib/dpkg/status</literal>" file.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>/var/backups/dpkg.status*</literal>
                </entry>
                <entry>
    the second-generation backup and older ones of the "<literal>var/lib/dpkg/status</literal>" file.
    </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
        <simpara>The "<literal>status</literal>" file is also used by the tools such as <literal>dpkg</literal>(1), "<literal>dselect update</literal>" and "<literal>apt-get -u dselect-upgrade</literal>".</simpara>
        <simpara>The specialized search command <literal>grep-dctrl</literal>(1) can search the local copies of "<literal>status</literal>" and "<literal>available</literal>" meta data.</simpara>
        <tip>
          <simpara>In <ulink url="&thedebianinstaller;">the debian-installer</ulink> environment, the <literal>udpkg</literal> command is used to open <literal>udeb</literal> packages.  The <literal>udpkg</literal> command is a stripped down version of the <literal>dpkg</literal> command.</simpara>
        </tip>
      </section>
      <section id="_the_update_alternative_command">
        <title>The update-alternative command</title>
        <simpara>The Debian system has mechanism to install somewhat overlapping programs peacefully using <literal>update-alternatives</literal>(8).  For example, you can make the <literal>vi</literal> command select to run <literal>vim</literal> while installing both <literal>vim</literal> and <literal>nvi</literal> packages:</simpara>
        <screen>$ ls -l $(type -p vi)
lrwxrwxrwx 1 root root 20 2007-03-24 19:05 /usr/bin/vi -&gt; /etc/alternatives/vi
$ sudo update-alternatives --display vi
...
$ sudo update-alternatives --config vi
  Selection    Command
 ----------------------------------------------
      1        /usr/bin/vim
*+    2        /usr/bin/nvi

Enter to keep the default[*], or type selection number: 1</screen>
        <simpara>The Debian alternatives system keeps its selection as symlinks in "<literal>/etc/alternatives/</literal>".  The selection process uses corresponding file in "<literal>/var/lib/dpkg/alternatives/</literal>".</simpara>
      </section>
      <section id="_the_dpkg_statoverride_command">
        <title>The dpkg-statoverride command</title>
        <simpara><emphasis role="strong">Stat overrides</emphasis> provided by the <literal>dpkg-statoverride</literal>(8) command are a way to tell <literal>dpkg</literal>(1) to use a different owner or mode for a <emphasis role="strong">file</emphasis> when a package is installed. If "<literal>--update</literal>" is specified and file exists, it is immediately set to the new owner and mode.</simpara>
        <caution>
          <simpara>The direct alteration of owner or mode for a <emphasis role="strong">file</emphasis> owned by the package using <literal>chmod</literal> or <literal>chown</literal> commands by the system administrator will be reset by the next upgrade of the package.</simpara>
        </caution>
        <note>
          <simpara>I use the word <emphasis role="strong">file</emphasis> here, but in reality this can be any filesystem object that <literal>dpkg</literal> handles, including directories, devices, etc.</simpara>
        </note>
      </section>
      <section id="_the_dpkg_divert_command">
        <title>The dpkg-divert command</title>
        <simpara>File <emphasis role="strong">diversions</emphasis> provided by the <literal>dpkg-divert</literal>(8) command are a way of forcing <literal>dpkg</literal>(1) not to install a file into its default location, but to a <emphasis role="strong">diverted</emphasis> location.  The use of <literal>dpkg-divert</literal>  is meant for the package maintenance scripts.  Its use by the system administrator is deprecated.</simpara>
      </section>
    </section>
    <section id="_recovery_from_a_broken_system">
      <title>Recovery from a broken system</title>
      <simpara>When running <literal>unstable</literal> system, the administrator is expected to recover from broken package management situation.</simpara>
      <caution>
        <simpara>Some methods described here are high risk actions.  You have been warned!</simpara>
      </caution>
      <section id="_incompatibility_with_old_user_configuration">
        <title>Incompatibility with old user configuration</title>
        <simpara>If a desktop GUI program experienced instability after significant upstream version upgrade, you should suspect interferences with old local configuration files created by it. If it is stable under newly created user account, this hypothesis is confirmed.  (This is a bug of packaging and usually avoided by the packager.)</simpara>
        <simpara>To recover stability, you should move corresponding local configuration files and restart the GUI program.  You may need to read old configuration file contents to recover configuration information later.  (Do not erase them too quickly.)</simpara>
      </section>
      <section id="_different_packages_with_overlapped_files">
        <title>Different packages with overlapped files</title>
        <simpara>Archive level package management systems, such as <literal>aptitude</literal>(8) or <literal>apt-get</literal>(1), will not even try to install packages with overlapped files using package dependencies (see <xref linkend="_package_dependencies"/>).</simpara>
        <simpara>Errors by the package maintainer or deployment of inconsistently mixed source of archives (see <xref linkend="_packages_from_mixed_source_of_archives"/>) by the system administrator may create situation with incorrectly defined package dependencies. When you install a package with overlapped files using <literal>aptitude</literal>(8) or <literal>apt-get</literal>(1) under such situation, <literal>dpkg</literal>(1) which unpacks package ensures to return error to the calling program without overwriting existing files.</simpara>
        <caution>
          <simpara>The use of third party packages introduces significant system risks via maintainer scripts which are run with root privilege and can do anything to your system.  The <literal>dpkg</literal>(1) command only protects against overwriting by the unpacking.</simpara>
        </caution>
        <simpara>You can work around such broken installation by removing the old offending package, <literal>&lt;old-package&gt;</literal>, first:</simpara>
        <screen>$ sudo dpkg -P &lt;old-package&gt;</screen>
      </section>
      <section id="_fixing_broken_package_script">
        <title>Fixing broken package script</title>
        <simpara>When a command in the package script returns error for some reason and the script exits with error, the package management system aborts their action and ends up with partially installed packages.  When a package contains bugs in its removal scripts, the package may become impossible to remove and quite nasty.</simpara>
        <simpara>For the package script problem of "<literal>&lt;package_name&gt;</literal>", you should look for:</simpara>
        <itemizedlist>
          <listitem>
            <simpara>
"<literal>/var/lib/dpkg/info/&lt;package_name&gt;.preinst</literal>",
</simpara>
          </listitem>
          <listitem>
            <simpara>
"<literal>/var/lib/dpkg/info/&lt;package_name&gt;.postinst</literal>",
</simpara>
          </listitem>
          <listitem>
            <simpara>
"<literal>/var/lib/dpkg/info/&lt;package_name&gt;.prerm</literal>", and
</simpara>
          </listitem>
          <listitem>
            <simpara>
"<literal>/var/lib/dpkg/info/&lt;package_name&gt;.postrm</literal>".
</simpara>
          </listitem>
        </itemizedlist>
        <simpara>You edit the offending part of the script from the root:</simpara>
        <itemizedlist>
          <listitem>
            <simpara>
by prepending it with "<literal>#</literal>" or,
</simpara>
          </listitem>
          <listitem>
            <simpara>
by appending it with "<literal>|| true</literal>".
</simpara>
          </listitem>
        </itemizedlist>
        <simpara>Then configures all partially installed packages by:</simpara>
        <screen># dpkg --configure -a</screen>
      </section>
      <section id="_rescue_using_the_dpkg_command">
        <title>Rescue using the dpkg command</title>
        <simpara>Since <literal>dpkg</literal> is very low level package tool, it can function under the very bad situation such as unbootable system without network connection.  Let's assume <literal>foo</literal> package was broken and needs to be replaced.</simpara>
        <simpara>You may still find cached copies of older bug free version of <literal>foo</literal> package in the package cache directory: "<literal>/var/cache/apt/archives/</literal>".  (If not, you can download it from archve of <ulink url="&httpsnapshotdebiannet;">http://snapshot.debian.net/</ulink> or copy it from package cache of a functioning machine.)</simpara>
        <simpara>If you can boot the system, you may install it by:</simpara>
        <screen># dpkg -i /path/to/foo_&lt;old_version&gt;_&lt;arch&gt;.deb</screen>
        <tip>
          <simpara>If system breakage is minor, you may alternatively downgrade the whole system as <xref linkend="_emergency_downgrading"/> using the higher level APT system.</simpara>
        </tip>
        <simpara>If your system is unbootable from harddisk, you should seek other ways to boot it.  For example, you can:</simpara>
        <itemizedlist>
          <listitem>
            <simpara>
boot the system using the debian-installer CD in rescue mode,
</simpara>
          </listitem>
          <listitem>
            <simpara>
mount the unbootable system on the harddisk to "<literal>/target</literal>",
</simpara>
          </listitem>
          <listitem>
            <simpara>
install older version of <literal>foo</literal> package by:
</simpara>
          </listitem>
        </itemizedlist>
        <screen># dpkg --root /target -i /path/to/foo_&lt;old_version&gt;_&lt;arch&gt;.deb</screen>
        <simpara>This second example works even if the <literal>dpkg</literal> command on the harddisk is broken.</simpara>
        <tip>
          <simpara>Any GNU/Linux system started by another system on harddisk, live GNU/Linux CD, bootable USB-key drive, or netboot can be used similarly to rescue broken system.</simpara>
        </tip>
        <simpara>If attempting to install a package this way fails due to some dependency violations and you really need to do this as the last resort, you can override dependency using <literal>dpkg</literal>'s "<literal>--ignore-depends</literal>", "<literal>--force-depends</literal>" and other options.    If you do this, you need to make serious effort to restore proper dependency later. See <literal>dpkg</literal>(8) for details.</simpara>
        <note>
          <simpara>When your system is seriously broken, you should make a full backup of system to a safe place (see <xref linkend="_backup_and_recovery"/>) and should perform a clean installation.  This is less time consuming and produces better results in the end.</simpara>
        </note>
      </section>
      <section id="_recover_package_selection_data">
        <title>Recover package selection data</title>
        <simpara>If "<literal>/var/lib/dpkg/status</literal>" becomes corrupt for any reason, the Debian system loses package selection data and suffers severely.  Look for the old "<literal>/var/lib/dpkg/status</literal>" file at "<literal>/var/lib/dpkg/status-old</literal>" or "<literal>/var/backups/dpkg.status.*</literal>".</simpara>
        <simpara>Keeping "<literal>/var/backups/</literal>" in a separate partition may be a good idea since this directory contains lots of important system data.</simpara>
        <simpara>For serious breakage, I recommend to make fresh re-install after making backup of the system. Even if everything in "<literal>/var/</literal>" is gone, you can still recover some information from directories in "<literal>/usr/share/doc/</literal>" to guide your new installation.</simpara>
        <itemizedlist>
          <listitem>
            <simpara>
reinstall minimal (desktop) system
</simpara>
          </listitem>
          <listitem>
            <simpara>
place old system at "<literal>/path/to/old/system/</literal>"
</simpara>
          </listitem>
        </itemizedlist>
        <screen># cd /path/to/old/system/usr/share/doc
# ls -1 &gt;~/ls1.txt
# cd /usr/share/doc
# ls -1 &gt;&gt;~/ls1.txt
# cd
# sort ls1.txt | uniq | less</screen>
        <simpara>Then you will be presented with package names to install.  (There may be some non-package names such as "<literal>texmf</literal>".)</simpara>
      </section>
    </section>
    <section id="_tips_for_the_package_management">
      <title>Tips for the package management</title>
      <section id="_how_to_pick_debian_packages">
        <title>How to pick Debian packages</title>
        <simpara>You can seek packages which satisfy your needs with <literal>aptitude</literal> from the package description or from the list under "Tasks".</simpara>
        <simpara>When you encounter more than 2 similar packages and wonder which one to install without "trial and error" efforts, you should use some <emphasis role="strong">common sense</emphasis>.  I consider following points are good indications of preferred packages.</simpara>
        <itemizedlist>
          <listitem>
            <simpara>
essential: yes &gt; no
</simpara>
          </listitem>
          <listitem>
            <simpara>
component: main &gt; contrib &gt; non-free
</simpara>
          </listitem>
          <listitem>
            <simpara>
priorities: required &gt; important &gt; standard &gt; optional &gt; extra
</simpara>
          </listitem>
          <listitem>
            <simpara>
tasks: packages listed in tasks such as "Desktop environment"
</simpara>
          </listitem>
          <listitem>
            <simpara>
packages selected by the dependency package (e.g., <literal>python2.4</literal> by <literal>python</literal>)
</simpara>
          </listitem>
          <listitem>
            <simpara>
popcon: higher in the vote and install number
</simpara>
          </listitem>
          <listitem>
            <simpara>
changelog: regular updates by the maintainer
</simpara>
          </listitem>
          <listitem>
            <simpara>
BTS: No RC bugs (no critical, no grave, and no serious bugs)
</simpara>
          </listitem>
          <listitem>
            <simpara>
BTS: responsive maintainer to bug reports
</simpara>
          </listitem>
          <listitem>
            <simpara>
BTS: higher number of the recently fixed bugs
</simpara>
          </listitem>
          <listitem>
            <simpara>
BTS: lower number of remaining non-wishlist bugs
</simpara>
          </listitem>
        </itemizedlist>
        <simpara>Debian being a volunteer project with distributed development model, its archive contains many packages with different focus and quality.  You must make your own decision what to do with them.</simpara>
      </section>
      <section id="_packages_from_mixed_source_of_archives">
        <title>Packages from mixed source of archives</title>
        <caution>
          <simpara>Installing packages from mixed source of archives is not supported by the official Debian distribution except for officially supported particular combinations of archives such as <literal>stable</literal> with <ulink url="&securityupdates;">security updates</ulink> and <ulink url="&volatileupdates;">volatile updates</ulink>.</simpara>
        </caution>
        <simpara>Here is an example of operations to include specific newer upstream version packages found in <literal>unstable</literal> while tracking <literal>testing</literal> for single occasion:</simpara>
        <itemizedlist>
          <listitem>
            <simpara>
change the "<literal>/etc/apt/sources.list</literal>" file temporarily to single "<literal>unstable</literal>" entry
</simpara>
          </listitem>
          <listitem>
            <simpara>
run "<literal>aptitude update</literal>"
</simpara>
          </listitem>
          <listitem>
            <simpara>
run "<literal>aptitude install &lt;package-name&gt;</literal>"
</simpara>
          </listitem>
          <listitem>
            <simpara>
recover the original "<literal>/etc/apt/sources.list</literal>" file for <literal>testing</literal>
</simpara>
          </listitem>
          <listitem>
            <simpara>
run "<literal>aptitude update</literal>"
</simpara>
          </listitem>
        </itemizedlist>
        <simpara>You do not create the "<literal>/etc/apt/preferences</literal>" file nor need to worry about apt-pinning with this manual approach.  But this is very cumbersome.</simpara>
        <caution>
          <simpara>When using mixed source of archives, you must ensure compatibility of packages by yourself since the Debian does not guarantee it. If package incompatibility exists, you may break system. You must be able to judge these technical requirements. The use of mixed source of random archives is completely optional operation and its use is not something I encourage you to use.</simpara>
        </caution>
        <simpara>General rules for installing packages from different archives are:</simpara>
        <simpara>Non-binary packages ("<literal>Architecture: all</literal>") are <emphasis role="strong">safer</emphasis> to install.</simpara>
        <itemizedlist>
          <listitem>
            <simpara>
documentation packages: no special requirements
</simpara>
          </listitem>
          <listitem>
            <simpara>
interpreter program packages: compatible interpreter must be available
</simpara>
          </listitem>
        </itemizedlist>
        <simpara>Completely statically linked binary packages are <emphasis role="strong">safe</emphasis> to install.</simpara>
        <simpara>Binary packages (non "<literal>Architecture: all</literal>") usually face many road blocks and <emphasis role="strong">unsafe</emphasis> to install.</simpara>
        <itemizedlist>
          <listitem>
            <simpara>
library version compatibility (including "<literal>libc</literal>")
</simpara>
          </listitem>
          <listitem>
            <simpara>
related utility program version compatibility
</simpara>
          </listitem>
          <listitem>
            <simpara>
Kernel <ulink url="&abi;">ABI</ulink> compatibility
</simpara>
          </listitem>
          <listitem>
            <simpara>
C++ <ulink url="&abi;">ABI</ulink> compatibility
</simpara>
          </listitem>
          <listitem>
            <simpara>
…
</simpara>
          </listitem>
        </itemizedlist>
        <note>
          <simpara>Except to avoid broken package for a short term, installing binary packages from officially unsupported archives is generally bad idea.  This is true even if you use apt-pinning (see <xref linkend="_tweaking_candidate_version"/>).  You should consider chroot or similar techniques (see <xref linkend="_chroot_system"/>) to run programs from different archives.</simpara>
        </note>
      </section>
      <section id="_tweaking_candidate_version">
        <title>Tweaking candidate version</title>
        <warning>
          <simpara>In <literal>lenny</literal>, <literal>aptitude</literal>(8) has a bug for handling "<literal>/etc/apt/preferences</literal>" file. (<ulink url="&bugfbejda;">Bug#514930</ulink>)</simpara>
        </warning>
        <simpara>Without the "<literal>/etc/apt/preferences</literal>" file, APT system choses the latest available version as the <emphasis role="strong">candidate version</emphasis> using the version string.  This is the normal state and most recommended usage of APT system.  All officially supported combinations of archives do not require the "<literal>/etc/apt/preferences</literal>" file since some archives which should not be used as the automatic source of upgrades are marked as <emphasis role="strong">NotAutomatic</emphasis> and dealt properly.</simpara>
        <tip>
          <simpara>The version string comparison rule can be verified with, e.g., "<literal>dpkg  --compare-versions ver1.1 gt ver1.1~1; echo $?</literal>" (see <literal>dpkg</literal>(1)).</simpara>
        </tip>
        <simpara>When you install packages from mixed source of archives (see <xref linkend="_packages_from_mixed_source_of_archives"/>) regularly, you can automate these complicated operations by creating the "<literal>/etc/apt/preferences</literal>" file with proper entries and tweaking the package selection rule for <emphasis role="strong">candidate version</emphasis> as described in <literal>apt_preferences</literal>(5).  This is called <emphasis role="strong">apt-pinning</emphasis>.</simpara>
        <warning>
          <simpara>Use of apt-pinning by a novice user is sure call for major troubles.  You must avoid using apt-pinning except when you absolutely need it.</simpara>
        </warning>
        <caution>
          <simpara>When using apt-pinning, you must ensure compatibility of packages by yourself since the Debian does not guarantee it.  The apt-pinning is completely optional operation and its use is not something I encourage you to use.</simpara>
        </caution>
        <caution>
          <simpara>Archive level Release files (see <xref linkend="_archive_level_release_files"/>) are used for the rule of <literal>apt_preferences</literal>(5).  Thus apt-pinning works only with "suite" name for <ulink url="&normaldebianarchives;">normal Debian archives</ulink> and <ulink url="&securitydebianarchives;">security Debian archives</ulink>. (This is different from <ulink url="&ubuntu;">Ubuntu</ulink> archives).  For example, you can do "<literal>Pin: release a=unstable</literal>" but can not do "<literal>Pin: release a=sid</literal>" in the "<literal>/etc/apt/preferences</literal>" file.</simpara>
        </caution>
        <caution>
          <simpara>When you use non-Debian archive as a part of apt-pinning, you should check what they are intended for and also check their credibility.  For example, Ubuntu and Debian are not meant to be mixed.</simpara>
        </caution>
        <note>
          <simpara>Even if you do not create the "<literal>/etc/apt/preferences</literal>" file, you can do fairly complex system operations (see <xref linkend="_rescue_using_the_dpkg_command"/> and <xref linkend="_packages_from_mixed_source_of_archives"/>) without apt-pinning.</simpara>
        </note>
        <simpara>Here is a simplified explanation of <emphasis role="strong">apt-pinning</emphasis> technique.</simpara>
        <simpara>APT system choses highest Pin-Priority <emphasis role="strong">upgrading</emphasis> package from available package sources defined in the "<literal>/etc/apt/sources.list</literal>" file as the <emphasis role="strong">candidate version</emphasis> package.  If the Pin-Priority of the package is larger than 1000, this version restriction for <emphasis role="strong">upgrading</emphasis> is dropped to enable downgrading (see <xref linkend="_emergency_downgrading"/>).</simpara>
        <simpara>Pin-Priority value of each package is defined by "Pin-Priority" entries in the "<literal>/etc/apt/preferences</literal>" file or uses its default value.</simpara>
        <table id="listofthedefaultackagesourcetype" pgwide="0" frame="topbot" rowsep="1" colsep="1">
          <title>List of the default Pin-Priority value for each package source type.</title>
          <tgroup cols="2">
            <colspec colwidth="30%*" align="left"/>
            <colspec colwidth="70%*" align="left"/>
            <thead>
              <row>
                <entry>
    default Pin-Priority
    </entry>
                <entry>
    package source type
    </entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry>
    990
    </entry>
                <entry>
    the <emphasis role="strong">target release</emphasis> archive
    </entry>
              </row>
              <row>
                <entry>
    500
    </entry>
                <entry>
    the <emphasis role="strong">normal</emphasis> archive
    </entry>
              </row>
              <row>
                <entry>
    100
    </entry>
                <entry>
    the <emphasis role="strong">installed</emphasis> package
    </entry>
              </row>
              <row>
                <entry>
    1
    </entry>
                <entry>
    the <emphasis role="strong">NotAutomatic</emphasis> archive
    </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
        <simpara>The <emphasis role="strong">target release</emphasis> archive can be set:</simpara>
        <itemizedlist>
          <listitem>
            <simpara>
by "<literal>/etc/apt/apt.conf</literal>", e.g., "<literal>APT::Default-Release "stable";</literal>" line in it, or
</simpara>
          </listitem>
          <listitem>
            <simpara>
by "<literal>-t</literal>" option argument, e.g., "<literal>apt-get install -t testing some-package</literal>".
</simpara>
          </listitem>
        </itemizedlist>
        <simpara>The  <emphasis role="strong">NotAutomatic</emphasis> archive can be set:</simpara>
        <itemizedlist>
          <listitem>
            <simpara>
by the archive level Release file (see <xref linkend="_archive_level_release_files"/>) containing "<literal>NotAutomatic: yes</literal>" in archive.
</simpara>
          </listitem>
        </itemizedlist>
        <simpara>The <emphasis role="strong">apt-pinning situation</emphasis> of &lt;package&gt; from multiple archive sources is displayed by "<literal>apt-cache policy &lt;package&gt;</literal>":</simpara>
        <itemizedlist>
          <listitem>
            <simpara>
A line started with "<literal>Package pin:</literal>" lists the package version of <emphasis role="strong">pin</emphasis> if association just with &lt;package&gt; is defined, e.g., "<literal>Package pin: 0.190</literal>".
</simpara>
          </listitem>
          <listitem>
            <simpara>
No line with "<literal>Package pin:</literal>" exists if no association just with &lt;package&gt; is defined.
</simpara>
          </listitem>
          <listitem>
            <simpara>
The Pin-Priority value associated just with &lt;package&gt; is listed right side of all version strings, e.g., "<literal>0.181 700</literal>".
</simpara>
          </listitem>
          <listitem>
            <simpara>
"<literal>0</literal>" is listed right side of all version strings if no association just with &lt;package&gt; is defined, e.g., "<literal>0.181 0</literal>".
</simpara>
          </listitem>
          <listitem>
            <simpara>
The Pin-Priority values of archives (defined as "<literal>Package: *</literal>" in the "<literal>/etc/apt/preferences</literal>" file) are listed left side of all archive paths, e.g., "<literal>200 http://backports.org etch-backports/main Packages</literal>".
</simpara>
          </listitem>
        </itemizedlist>
        <simpara>Here is an example of <emphasis role="strong">apt-pinning</emphasis> technique to include specific newer upstream version packages found in <literal>unstable</literal> regularly upgraded while tracking <literal>testing</literal>.  You list all required archives in the "<literal>/etc/apt/sources.list</literal>" file as:</simpara>
        <screen>deb http://ftp.us.debian.org/debian/ testing main contrib non-free
deb http://ftp.us.debian.org/debian/ unstable main contrib non-free
deb http://security.debian.org/ testing/updates main contrib</screen>
        <simpara>and set the "<literal>/etc/apt/preferences</literal>" file as:</simpara>
        <screen>Package: *
Pin: release a=testing
Pin-Priority: 500

Package: *
Pin: release a=unstable
Pin-Priority: 200</screen>
        <simpara>When you wish to install a package named "<literal>&lt;package-name&gt;</literal>" with its dependencies from <literal>unstable</literal> archive under this configuration, you issue the following command which switches target release with "<literal>-t</literal>" option (Pin-Priority of <literal>unstable</literal> becomes 990.):</simpara>
        <screen>$ sudo apt-get install -t unstable &lt;package-name&gt;</screen>
        <simpara>With this configuration, usual execution of "<literal>apt-get upgrade</literal>" and "<literal>apt-get dist-upgrade</literal>" (or "<literal>aptitude safe-upgrade</literal>" and "<literal>aptitude full-upgrade</literal>" for <literal>squeeze</literal>) will upgrade packages which were installed from <literal>testing</literal> archive using current <literal>testing</literal> archive and packages which were installed from <literal>unstable</literal> archive using current <literal>unstable</literal> archive.</simpara>
        <caution>
          <simpara>Be careful not to remove "<literal>testing</literal>" entry from the "<literal>/etc/apt/sources.list</literal>" file.  Without "<literal>testing</literal>" entry in it, APT system will upgrade packages using newer <literal>unstable</literal> archive.</simpara>
        </caution>
        <tip>
          <simpara>I usually edit the "<literal>/etc/apt/sources.list</literal>" file to comment out "<literal>unstable</literal>" archive entry right after above operation.  This avoids slow update process of having too many entries in the "<literal>/etc/apt/sources.list</literal>" file although this prevents upgrading packages which were installed from <literal>unstable</literal> archive using current <literal>unstable</literal> archive.</simpara>
        </tip>
        <tip>
          <simpara>If "<literal>Pin-Priority: 20</literal>" is used instead of "<literal>Pin-Priority: 200</literal>" for the "<literal>/etc/apt/preferences</literal>" file, already installed packages having Pin-Priority value of 100 will never be upgraded by <literal>unstable</literal> archive even if "<literal>testing</literal>" entry in the "<literal>/etc/apt/sources.list</literal>" file is removed.</simpara>
        </tip>
        <simpara>If you wish to track particular packages in <literal>unstable</literal> automatically without initial "<literal>-t unstable</literal>" installation, you must create the "<literal>/etc/apt/preferences</literal>" file and explicitly lists all those packages at the top of it as:</simpara>
        <screen>Package: &lt;package-1&gt;
Pin: release a=unstable
Pin-Priority: 700

Package: &lt;package-2&gt;
Pin: release a=unstable
Pin-Priority: 700

...</screen>
        <simpara>These will set Pin-Priority value for each specific package.  For example, in order to track the latest <literal>unstable</literal> version of this "Debian Reference" in English, you should have following entries in the "<literal>/etc/apt/preferences</literal>" file:</simpara>
        <screen>Package: debian-reference-en
Pin: release a=unstable
Pin-Priority: 700

Package: debian-reference-common
Pin: release a=unstable
Pin-Priority: 700</screen>
        <tip>
          <simpara>This apt-pinning technique is valid even when you are tracking <literal>stable</literal> archive.  Documentation packages have been always safe to install from <literal>unstable</literal> archive in my experience, so far.</simpara>
        </tip>
        <simpara>Here is another example of <emphasis role="strong">apt-pinning</emphasis> technique to include specific newer upstream version packages found in <literal>experimental</literal> while tracking <literal>unstable</literal>.  You list all required archives in the "<literal>/etc/apt/sources.list</literal>" file as:</simpara>
        <screen>deb http://ftp.us.debian.org/debian/ unstable main contrib non-free
deb http://ftp.us.debian.org/debian/ experimental main contrib non-free
deb http://security.debian.org/ testing/updates main contrib</screen>
        <simpara>The default Pin-Priority value for <literal>experimental</literal> archive is always 1 (&lt;&lt;100) since it is <emphasis role="strong">NotAutomatic</emphasis> archive (see <xref linkend="_archive_level_release_files"/>).  There is no need to set Pin-Priority value explicitly in the "<literal>/etc/apt/preferences</literal>" file just to use <literal>experimental</literal> archive unless you wish to track particular packages in it automatically for next upgrading.</simpara>
      </section>
      <section id="_volatile_and_backports_org">
        <title>Volatile and Backports.org</title>
        <simpara>There are <ulink url="&debianvolatileproject;">debian-volatile project</ulink> and <ulink url="&backportsorg;">backports.org</ulink> archives which provide updgrade packages for <literal>stable</literal>.</simpara>
        <warning>
          <simpara>Do not use all packages available in the <emphasis role="strong">NotAutomatic</emphasis> archives such as <literal>&codename-stable;-backports</literal> and <literal>volatile-sloppy</literal>.  Use only selected packages which fits your needs.</simpara>
        </warning>
        <caution>
          <simpara><ulink url="&backportsorg;">backports.org</ulink> is a non-Debian archive, although its packages are signed by Debian developers.</simpara>
        </caution>
        <caution>
          <simpara>Archive level Release files (see <xref linkend="_archive_level_release_files"/>) are used for the rule of <literal>apt_preferences</literal>(5).  Thus apt-pinning works only with "code" name for <ulink url="&volatiledebianarchives;">volatile Debian archives</ulink>. This is different from other Debian archives.  For example, you can do "<literal>Pin: release a=&codename-stable;</literal>" but can not do "<literal>Pin: release a=stable</literal>" in the "<literal>/etc/apt/preferences</literal>" file for volatile Debian archives.</simpara>
        </caution>
        <simpara>Here is an example of <emphasis role="strong">apt-pinning</emphasis> technique to include specific newer upstream version packages found in <literal>&codename-stable;-backports</literal> while tracking <literal>&codename-stable;</literal> and <literal>volatile</literal>.  You list all required archives in the "<literal>/etc/apt/sources.list</literal>" file as:</simpara>
        <screen>deb http://ftp.us.debian.org/debian/ &codename-stable; main contrib non-free
deb http://security.debian.org/ &codename-stable;/updates main contrib
deb http://volatile.debian.org/debian-volatile/ &codename-stable;/volatile main contrib non-free
deb http://volatile.debian.org/debian-volatile/ &codename-stable;/volatile-sloppy main contrib non-free
deb http://backports.org/debian/ &codename-stable;-backports main contrib non-free</screen>
        <simpara>The default Pin-Priority value for <ulink url="&backportsorg;">backports.org</ulink> and <literal>volatile-sloppy</literal> archives are always 1 (&lt;&lt;100) since they are <emphasis role="strong">NotAutomatic</emphasis> archive (see <xref linkend="_archive_level_release_files"/>).  There is no need to set Pin-Priority value explicitly in the "<literal>/etc/apt/preferences</literal>" file just to use for <ulink url="&backportsorg;">backports.org</ulink> and <literal>volatile-sloppy</literal> archive unless you wish to track packages automatically for next upgrading.</simpara>
        <simpara>So whenever you wish to install a package named "<literal>&lt;package-name&gt;</literal>" with its dependency from <literal>&codename-stable;-backports</literal> archive, you use following command while switching target release with "<literal>-t</literal>" option:</simpara>
        <screen>$ sudo apt-get install -t &codename-stable;-backports &lt;package-name&gt;</screen>
        <simpara>If you wish to upgrade particular packages, you must create the "<literal>/etc/apt/preferences</literal>" file and explicitly lists all packages in it as:</simpara>
        <screen>Package: &lt;package-1&gt;
Pin: release o=Backports.org archive
Pin-Priority: 700

Package: &lt;package-2&gt;
Pin: release o=volatile.debian.org
Pin-Priority: 700

...</screen>
        <simpara>Alternatively, with the "<literal>/etc/apt/preferences</literal>" file as:</simpara>
        <screen>Package: *
Pin: release a=stable , o=Debian
Pin-Priority: 500

Package: *
Pin: release a=&codename-stable;, o=volatile.debian.org
Pin-Priority: 500

Package: *
Pin: release a=&codename-stable;-backports, o=Backports.org archive
Pin-Priority: 200

Package: *
Pin: release a=&codename-stable;-sloppy, o=volatile.debian.org
Pin-Priority: 200</screen>
        <simpara>execution of "<literal>apt-get upgrade</literal>" and "<literal>apt-get dist-upgrade</literal>" (or "<literal>aptitude safe-upgrade</literal>" and "<literal>aptitude full-upgrade</literal>" for <literal>squeeze</literal>) will upgrade packages which were installed from <literal>stable</literal> archive using current <literal>stable</literal> archive and packages which were installed from other archives using current corresponding archive for all archives in the "<literal>/etc/apt/sources.list</literal>" file.</simpara>
      </section>
      <section id="_automatic_download_and_upgrade_of_packages">
        <title>Automatic download and upgrade of packages</title>
        <simpara>The <literal>apt</literal> package comes with its own cron script "<literal>/etc/cron.daily/apt</literal>" to support the automatic download of packages.  This script can be enhanced to perform the automatic upgrade of packages by installing the <literal>unattended-upgrades</literal> package. These can be customized by parameters in "<literal>/etc/apt/apt.conf.d/02backup</literal>" and "<literal>/etc/apt/apt.conf.d/50unattended-upgrades</literal>" as described in "<literal>/usr/share/doc/unattended-upgrades/README</literal>".</simpara>
        <simpara>The <literal>unattended-upgrades</literal> package is mainly intended for the security upgrade for the <literal>stable</literal> system.  If the risk of breaking an existing <literal>stable</literal> system by the automatic upgrade is smaller than that of the system broken by the intruder using its security hole which has been closed by the security update, you should consider using this automatic upgrade with configuration parameters:</simpara>
        <screen>APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Download-Upgradeable-Packages "1";
APT::Periodic::Unattended-Upgrade "1";</screen>
        <simpara>If you are running an <literal>unstable</literal> system, you do not want to use the automatic upgrade since it will certainly break system some day.  Even for such <literal>unstable</literal> case, you may still want to download packages in advance to save time for the interactive upgrade with configuration parameters:</simpara>
        <screen>APT::Periodic::Update-Package-Lists "1";
APT::Periodic::Download-Upgradeable-Packages "1";
APT::Periodic::Unattended-Upgrade "0";</screen>
      </section>
      <section id="_limit_download_bandwidth_for_apt">
        <title>Limit download bandwidth for APT</title>
        <simpara>If you want to limit the download bandwidth for APT to e.g. 800Kib/sec (=100kiB/sec), you should configure APT with its configuration parameter with:</simpara>
        <screen>APT::Acquire::http::Dl-Limit "800";</screen>
      </section>
      <section id="_emergency_downgrading">
        <title>Emergency downgrading</title>
        <caution>
          <simpara>Downgrading is not officially supported by the Debian by design.  It should be done only as a part of emergency recovery process.  Despite of this situation, it is known to work well in many incidents.  For critical systems, You should backup all important data on the system after the recovery operation and re-install the new system from the scratch.</simpara>
        </caution>
        <simpara>You may be lucky to downgrade from newer archive to older archive to recover from broken system upgrade by manipulating <emphasis role="strong">candidate version</emphasis> (see <xref linkend="_tweaking_candidate_version"/>).  This is lazy alternative to tedious actions of many "<literal>dpkg -i &lt;broken-package&gt;_&lt;old-version&gt;.deb</literal>" commands (see <xref linkend="_rescue_using_the_dpkg_command"/>).</simpara>
        <simpara>For downgrading system tracking <literal>unstable</literal> to <literal>testing</literal>, change the "<literal>/etc/apt/sources.list</literal>" file from:</simpara>
        <screen>deb http://ftp.us.debian.org/debian/ &codename-unstable; main contrib non-free</screen>
        <simpara>to:</simpara>
        <screen>deb http://ftp.us.debian.org/debian/ &codename-testing; main contrib</screen>
        <simpara>and set the "<literal>/etc/apt/preferences</literal>" file as:</simpara>
        <screen>Package: *
Pin: release a=testing
Pin-Priority: 1010</screen>
        <simpara>Then run "<literal>apt-get dist-upgrade</literal>" to force downgrading of packages across the system. You should remove this special "<literal>/etc/apt/preferences</literal>" file after the downgrading.</simpara>
        <tip>
          <simpara>It is good idea to remove (not purge!) as much packages to minimize dependency problems.  You may need to manually remove and install some packages to get system downgraded.  Linux kernel, bootloader, udev, PAM, APT, and networking related packages and their configuration files require special attention.</simpara>
        </tip>
      </section>
      <section id="_who_uploaded_the_package">
        <title>Who uploaded the package?</title>
        <simpara>Although the maintainer name listed in "<literal>/var/lib/dpkg/available</literal>" and "<literal>/usr/share/doc/package_name/changelog</literal>" provide some information on "who is behind the packaging activity", the actual uploader of the package is somewhat obscure.  <literal>who-uploads</literal>(1) in the <literal>devscripts</literal> package identifies the actual uploader of Debian source packages.</simpara>
      </section>
      <section id="_the_equivs_package">
        <title>The equivs package</title>
        <simpara>If you are to compile a program from source to replace the Debian package, it is best to make it into a real local debianized package (<literal>*.deb</literal>) and use private archive.</simpara>
        <simpara>If you chose to compile a program from source and to install them under "<literal>/usr/local</literal>" instead, you may need to use <literal>equivs</literal> as a last resort to satisfy the missing package dependency.</simpara>
        <screen>Package: equivs
Priority: extra
Section: admin
Description: Circumventing Debian package dependencies
 This is a dummy package which can be used to create Debian
 packages, which only contain dependency information.</screen>
      </section>
      <section id="_port_a_package_to_the_stable_system">
        <title>Port a package to the stable system</title>
        <simpara>For partial upgrades of the <literal>stable</literal> system, rebuilding a package within its environment using the source package is desirable.  This avoids massive package upgrades due to their dependencies.  First, add the following entries to the "<literal>/etc/apt/sources.list</literal>" of a <literal>stable</literal> system:</simpara>
        <screen>deb-src http://http.us.debian.org/debian unstable  main contrib non-free</screen>
        <simpara>Then install required packages for the compilation and download the source package by:</simpara>
        <screen># apt-get update
# apt-get dist-upgrade
# apt-get install fakeroot devscripts build-essential
$ apt-get build-dep foo
$ apt-get source foo
$ cd foo*</screen>
        <itemizedlist>
          <listitem>
            <simpara>
adjust package if needed.
</simpara>
          </listitem>
        </itemizedlist>
        <screen>$ dch -i</screen>
        <itemizedlist>
          <listitem>
            <simpara>
bump package version, e.g. one appended with "<literal>+bp1</literal>".
</simpara>
          </listitem>
        </itemizedlist>
        <screen>$ debuild
$ cd ..
# debi foo*.changes</screen>
      </section>
      <section id="_proxy_server_for_apt">
        <title>Proxy server for APT</title>
        <simpara>Since mirroring whole subsection of Debian archive wastes disk space and network bandwidth, deployment of a local proxy server for APT is desirable consideration when you administer many systems on <ulink url="&lan;">LAN</ulink>.  APT can be configure to use generic web (http) proxy servers such as <literal>squid</literal> (see <xref linkend="_other_network_application_servers"/>) as described in <literal>apt.conf</literal>(5) and in "<literal>/usr/share/doc/apt/examples/configure-index.gz</literal>".  The "<literal>$http_proxy</literal>" environment variable can be used to override proxy server setting in the "<literal>/etc/apt/apt.conf</literal>" file.</simpara>
        <simpara>There are proxy tools specially for Debian archive.  You should check BTS before using them.</simpara>
        <table id="listoftheproxytofordebianarchive" pgwide="0" frame="topbot" rowsep="1" colsep="1">
          <title>List of the proxy tools specially for Debian archive</title>
          <tgroup cols="4">
            <colspec colwidth="20%*" align="left"/>
            <colspec colwidth="20%*" align="left"/>
            <colspec colwidth="20%*" align="left"/>
            <colspec colwidth="40%*" align="left"/>
            <thead>
              <row>
                <entry>
    package
    </entry>
                <entry>
    popcon
    </entry>
                <entry>
    size
    </entry>
                <entry>
    description
    </entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/approx">
                  <literal>approx</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/approx">&pop-approx;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/a/approx.html">&size-approx;</ulink></entry>
                <entry>
    caching proxy server for Debian archive files (compiled <ulink url="&ocaml;">OCaml</ulink> program)
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/apt-proxy">
                  <literal>apt-proxy</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/apt-proxy">&pop-aptproxy;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/a/apt-proxy.html">&size-aptproxy;</ulink></entry>
                <entry>
    Debian archive proxy and partial mirror builder (Python program)
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/apt-cacher">
                  <literal>apt-cacher</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/apt-cacher">&pop-aptcacher;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/a/apt-cacher.html">&size-aptcacher;</ulink></entry>
                <entry>
    Caching proxy for Debian package and source files (Perl program)
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/apt-cacher-ng">
                  <literal>apt-cacher-ng</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/apt-cacher-ng">&pop-aptcacherng;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/a/apt-cacher-ng.html">&size-aptcacherng;</ulink></entry>
                <entry>
    Caching proxy for distribution of software packages (compiled C++ program)
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/debtorrent">
                  <literal>debtorrent</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/debtorrent">&pop-debtorrent;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/d/debtorrent.html">&size-debtorrent;</ulink></entry>
                <entry>
    Bittorrent proxy for downloading Debian packages (Python program)
    </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
        <caution>
          <simpara>When Debian reorganizes its archive structure, these specialized proxy tools tend to require code rewrites by the package maintainer and may not be functional for a while.  On the other hand, generic web (http) proxy servers are more robust and easier to cope with such changes.</simpara>
        </caution>
      </section>
      <section id="_small_public_package_archive">
        <title>Small public package archive</title>
        <simpara>Here is an example for creating a small public package archive compatible with the modern <emphasis role="strong">secure APT</emphasis> system (see <xref linkend="_top_level_release_file_and_authenticity"/>). Let's assume few things:</simpara>
        <itemizedlist>
          <listitem>
            <simpara>
Account name: "<literal>foo</literal>"
</simpara>
          </listitem>
          <listitem>
            <simpara>
Host name: "<literal>www.example.com</literal>"
</simpara>
          </listitem>
          <listitem>
            <simpara>
Required packages:  <literal>apt-utils</literal>, <literal>gnupg</literal>, and other packages.
</simpara>
          </listitem>
          <listitem>
            <simpara>
URL: "<literal>http://www.example.com/~foo/</literal>" displays "<literal>/home/foo/public_html/index.html</literal>"
</simpara>
          </listitem>
          <listitem>
            <simpara>
Architecture of packages: "<literal>amd64</literal>"
</simpara>
          </listitem>
        </itemizedlist>
        <simpara>One time setup of APT archive on your server system:</simpara>
        <itemizedlist>
          <listitem>
            <simpara>
Create an archive key of Foo on server system:
</simpara>
          </listitem>
        </itemizedlist>
        <screen>$ ssh foo@www.example.com
$ gpg --gen-key
...
$ gpg -K
...
sec   1024D/3A3CB5A6 2008-08-14
uid                  Foo (ARCHIVE KEY) &lt;foo@www.example.com&gt;
ssb   2048g/6856F4A7 2008-08-14
$ gpg --export -a 3A3CB5A6 &gt;foo.public.key</screen>
        <itemizedlist>
          <listitem>
            <simpara>
The archive key of Foo is "<literal>3A3CB5A6</literal>"
</simpara>
          </listitem>
          <listitem>
            <simpara>
Publish "<literal>foo.public.key</literal>" file.
</simpara>
          </listitem>
          <listitem>
            <simpara>
Create an archive tree called "Origin: Foo":
</simpara>
          </listitem>
        </itemizedlist>
        <screen>$ umask 022
$ mkdir -p ~/public_html/debian/pool/main
$ mkdir -p ~/public_html/debian/dists/unstable/main/binary-amd64
$ mkdir -p ~/public_html/debian/dists/unstable/main/source
$ cd ~/public_html/debian
$ cat &gt; dists/unstable/main/binary-amd64/Release &lt;&lt; EOF
Archive: unstable
Version: 4.0
Component: main
Origin: Foo
Label: Foo
Architecture: amd64
EOF
$ cat &gt; dists/unstable/main/source/Release &lt;&lt; EOF
Archive: unstable
Version: 4.0
Component: main
Origin: Foo
Label: Foo
Architecture: source
EOF
$ cat &gt;aptftp.conf &lt;&lt;EOF
APT::FTPArchive::Release {
  Origin "Foo";
  Label "Foo";
  Suite "unstable";
  Codename "sid";
  Architectures "amd64";
  Components "main";
  Description "Public archive for Foo";
};
EOF
$ cat &gt;aptgenerate.conf &lt;&lt;EOF
Dir::ArchiveDir ".";
Dir::CacheDir ".";
TreeDefault::Directory "pool/";
TreeDefault::SrcDirectory "pool/";
Default::Packages::Extensions ".deb";
Default::Packages::Compress ". gzip bzip2";
Default::Sources::Compress "gzip bzip2";
Default::Contents::Compress "gzip bzip2";

BinDirectory "dists/unstable/main/binary-amd64" {
  Packages "dists/unstable/main/binary-amd64/Packages";
  Contents "dists/unstable/Contents-amd64";
  SrcPackages "dists/unstable/main/source/Sources";
};

Tree "dists/unstable" {
  Sections "main";
  Architectures "amd64 source";
};
EOF</screen>
        <simpara>Repetitive update of APT archive contents on your server system:</simpara>
        <itemizedlist>
          <listitem>
            <simpara>
Place all package files into "<literal>~foo/public_html/debian/pool/main/</literal>" by executing "<literal>dupload -t foo changes_file</literal>" in client while having "<literal>~/.dupload.conf</literal>" containing:
</simpara>
          </listitem>
        </itemizedlist>
        <screen>$cfg{'foo'} = {
  fqdn =&gt; "www.example.com",
  method =&gt; "scpb",
  incoming =&gt; "/home/foo/public_html/debian/pool/main",
  # The dinstall on ftp-master sends emails itself
  dinstall_runs =&gt; 1,
};

$cfg{'foo'}{postupload}{'changes'} = "
  echo 'cd public_html/debian ;
  apt-ftparchive generate -c=aptftp.conf aptgenerate.conf;
  apt-ftparchive release -c=aptftp.conf dists/unstable &gt;dists/unstable/Release ;
  rm -f dists/unstable/Release.gpg ;
  gpg -u 3A3CB5A6 -bao dists/unstable/Release.gpg dists/unstable/Release'|
  ssh foo@www.example.com  2&gt;/dev/null ;
  echo 'Package archive created!'";</screen>
        <simpara>The <emphasis role="strong">postupload</emphasis> hook script initiated by  <literal>dupload</literal>(1) creates updated archive files for each upload.</simpara>
        <simpara>You can add this small public archive to the apt-line of your client system:</simpara>
        <screen>$ sudo bash
# echo "deb http://www.example.com/~foo/debian/ unstable main" \
   &gt;&gt; /etc/apt/sources.list
# apt-key add foo.public.key</screen>
        <tip>
          <simpara>If the archive is located on the local file system, you can use "<literal>deb file:///home/foo/debian/ …</literal>" instead.</simpara>
        </tip>
      </section>
      <section id="_record_copy_system_configuration">
        <title>Record/copy system configuration</title>
        <simpara>To make a local copy of the package and debconf selection states:</simpara>
        <screen># dpkg --get-selections '*' &gt; selection.dpkg
# debconf-get-selections    &gt; selection.debconf</screen>
        <simpara>Here, "<literal>*</literal>" makes "<literal>selection.dpkg</literal>" to include package entries for "purge" too.</simpara>
        <simpara>You can transfer these 2 files to another computer, and install there with:</simpara>
        <screen># dselect update
# debconf-set-selections &lt; myselection.debconf
# dpkg --set-selections  &lt; myselection.dpkg
# apt-get -u dselect-upgrade    # or dselect install</screen>
        <simpara>If you are thinking about managing many servers in a cluster with practically the same configuration, you should consider to use specialized package such as <literal>fai</literal> to manage the whole system.</simpara>
      </section>
      <section id="_convert_or_install_an_alien_binary_package">
        <title>Convert or install an alien binary package</title>
        <simpara><literal>alien</literal>(1) enables the conversion of binary packages provided in Red Hat <literal>rpm</literal>, Stampede <literal>slp</literal>, Slackware <literal>tgz</literal>, and Solaris <literal>pkg</literal> file formats into a Debian <literal>deb</literal> package.  If you want to use a package from another Linux distribution than the one you have installed on your system, you can use <literal>alien</literal> to convert it from your preferred package format and install it.  <literal>alien</literal> also supports LSB packages.</simpara>
        <warning>
          <simpara><literal>alien</literal>(1) should not be used to replace essential system packages, such as <literal>sysvinit</literal>, <literal>libc6</literal>, <literal>libpam-modules</literal>, etc.  Practically, <literal>alien</literal>(1) should only used for <emphasis role="strong">non-free</emphasis> binary-only packages which are LSB complient or statically linked.  For free softwares, you should use their source packages to make real Debian packages.</simpara>
        </warning>
      </section>
      <section id="_extract_package_without_dpkg">
        <title>Extract package without dpkg</title>
        <simpara>The current "<literal>*.deb</literal>" package contents can be extracted without using <literal>dpkg</literal>(1) on any <ulink url="&unixlike;">Unix-like</ulink> environment using standard <literal>ar</literal>(1) and <literal>tar</literal>(1).</simpara>
        <screen># ar x /path/to/dpkg_&lt;version&gt;_&lt;arch&gt;.deb
# ls
total 24
-rw-r--r-- 1 bozo bozo  1320 2007-05-07 00:11 control.tar.gz
-rw-r--r-- 1 bozo bozo 12837 2007-05-07 00:11 data.tar.gz
-rw-r--r-- 1 bozo bozo     4 2007-05-07 00:11 debian-binary
# mkdir control
# mkdir data
# tar xvzf control.tar.gz -C control
# tar xvzf data.tar.gz -C data</screen>
        <simpara>You can also browse package content using the <literal>mc</literal> command.</simpara>
      </section>
      <section id="_more_readings_for_the_package_management">
        <title>More readings for the package management</title>
        <simpara>You should read:</simpara>
        <itemizedlist>
          <listitem>
            <simpara><literal>aptitude</literal>(8), <literal>dpkg</literal>(1), <literal>tasksel</literal>(8), <literal>apt-get</literal>(8), <literal>apt-config</literal>(8), <literal>apt-key</literal>(8), <literal>sources.list</literal>(5), <literal>apt.conf</literal>(5), and <literal>apt_preferences</literal>(5);
</simpara>
          </listitem>
          <listitem>
            <simpara>
"<literal>/usr/share/doc/apt-doc/guide.html/index.html</literal>" and "<literal>/usr/share/doc/apt-doc/offline.html/index.html</literal>" from the <literal>apt-doc</literal> package; and
</simpara>
          </listitem>
          <listitem>
            <simpara>
"<literal>/usr/share/doc/aptitude/html/en/index.html</literal>" from the <literal>aptitude-doc-en</literal> package.
</simpara>
          </listitem>
        </itemizedlist>
        <simpara>The official and detailed secondary information on the Debian archive are given by:</simpara>
        <itemizedlist>
          <listitem>
            <simpara><ulink url="&debianpolicymanuthedebianarchive;">"Debian Policy Manual Chapter 2 - The Debian Archive"</ulink>,
</simpara>
          </listitem>
          <listitem>
            <simpara><ulink url="&debiandevelopersthedebianarchive;">"Debian Developer's Reference, Chapter 4 - Resources for Debian Developers 4.6 The Debian archive"</ulink>, and
</simpara>
          </listitem>
          <listitem>
            <simpara><ulink url="&thedebiangnulinuebianftparchives;">"The Debian GNU/Linux FAQ, Chapter 5 - The Debian FTP archives"</ulink>.
</simpara>
          </listitem>
        </itemizedlist>
        <simpara>The tutorial for building of a Debian package for Debian users is given by:</simpara>
        <itemizedlist>
          <listitem>
            <simpara><ulink url="&debiannewmaintainersguide;">"Debian New Maintainers' Guide"</ulink>.
</simpara>
          </listitem>
        </itemizedlist>
      </section>
    </section>
  </chapter>
  <chapter id="_the_system_initialization">
    <title>The system initialization</title>
    <simpara>It is wise for you as the system administrator to know roughly how the Debian system is started and configured.  Although the exact details are in the source files of the packages installed and their documentations, it is a bit overwhelming for most of us.</simpara>
    <simpara>I did my best to provide a quick overview of the key points of the Debian system and their configuration for your reference, based on the current and previous knowledge of mine and others. Since the Debian system is a moving target, the situation over the system may have been changed.  Before making any changes to the system, you should refer to the latest documentation for each package.</simpara>
    <section id="_an_overview_of_the_boot_strap_process">
      <title>An overview of the boot strap process</title>
      <simpara>The computer system undergoes several phases of <ulink url="&bootstrapprocesses;">boot strap processes</ulink> from the power-on event until it offers the fully functional operating system (OS) to the user.</simpara>
      <simpara>For simplicity, I will limit discussion to the typical PC platform with the default installation.</simpara>
      <simpara>The typical boot strap process is like a four-stage rocket.  Each stage rocket hands over the system control to the next stage one.  Here each stage corresponds to:</simpara>
      <itemizedlist>
        <listitem>
          <simpara>
Stage 1: the BIOS
</simpara>
        </listitem>
        <listitem>
          <simpara>
Stage 2: the boot loader
</simpara>
        </listitem>
        <listitem>
          <simpara>
Stage 3: the mini-Debian system
</simpara>
        </listitem>
        <listitem>
          <simpara>
Stage 4: the normal Debian system
</simpara>
        </listitem>
      </itemizedlist>
      <simpara>Of course, these can be configured differently.  For example, if you compiled your own kernel, you may be skipping the step with the mini-Debian system.  So please do not assume this is the case for your system until you check it yourself.</simpara>
      <note>
        <simpara>For non-legacy PC platform such as the SUN or the Macintosh system, the BIOS on ROM and the partition on the disk may be quite different (<xref linkend="_partition_configuration"/>).  Please seek the platform specific documentations elsewhere for such a case.</simpara>
      </note>
    </section>
    <section id="_stage_1_the_bios">
      <title>Stage 1: the BIOS</title>
      <simpara>The <ulink url="&bios;">BIOS</ulink> is the 1st stage of the boot process which is started by the power-on event. The <ulink url="&bios;">BIOS</ulink> residing on the <ulink url="&readonlymemoryrom;">read only memory (ROM)</ulink> is excuted from the particular memory address to which the program counter of CPU is initialized by the power-on event.</simpara>
      <simpara>This BIOS performs the basic initialization of the hardware (<ulink url="&postpoweronselftest;">POST: power on self test</ulink>) and hands the system control to the next step which you provide.  The BIOS is usually provided with the hardware.</simpara>
      <simpara>The BIOS startup screen usually indicates what key(s) to press to enter the BIOS setup screen to configure the BIOS behavior. Popular keys used are F1, F2, F10, Esc, Ins, and Del. If your BIOS startup screen is hidden by a nice graphics screen, you may press some keys such as Esc to disable this.  These keys are highly dependent on the hardware.</simpara>
      <simpara>The hardware location and the priority of the code started by the BIOS can be selected from the BIOS setup screen.  Typically, the first few sectors of the first found selected device (hard disk, floppy disk, CD-ROM, …) are loaded to the memory and this initial code is executed.  This initial code can be:</simpara>
      <itemizedlist>
        <listitem>
          <simpara>
the boot loader code,
</simpara>
        </listitem>
        <listitem>
          <simpara>
the kernel code of the stepping stone OS such as <ulink url="&freedos;">FreeDOS</ulink>, or
</simpara>
        </listitem>
        <listitem>
          <simpara>
the kernel code of the target OS if it fits in this small space.
</simpara>
        </listitem>
      </itemizedlist>
      <simpara>Typically, the system is booted from the specified partition of the primary hard disk partition. First 2 sectors of the hard disk on legacy PC contain the <ulink url="&masterbootrecordmbr;">master boot record (MBR)</ulink>.  The disk partition information including the boot selection is recorded at the end of this MBR. The first boot loader code executed from the BIOS occupies the rest of this MBR.</simpara>
    </section>
    <section id="_stage_2_the_boot_loader">
      <title>Stage 2: the boot loader</title>
      <simpara>The <ulink url="&bootloader;">boot loader</ulink> is the 2nd stage of the boot process which is started by the BIOS.  It loads the system kernel image and the <ulink url="&initrd;">initrd</ulink> image to the memory and hands control over to them.  This initrd image is the root filesystem image and its support depends on the bootloader used.</simpara>
      <simpara>The Debian system normally uses the Linux kernel as the default system kernel. The initrd image for the current 2.6 Linux kernel is technically the initramfs (initial RAM filesystem) image. The initramfs image is a gzipped cpio archive of files in the root filesystem.</simpara>
      <simpara>The default install of the Debian system places first-stage GRUB boot loader code into the <ulink url="&mbr;">MBR</ulink> for the PC platform. There are many boot loaders and configuration options available.</simpara>
      <table id="listofbootloaders" pgwide="0" frame="topbot" rowsep="1" colsep="1">
        <title>List of boot loaders.</title>
        <tgroup cols="6">
          <colspec colwidth="10%*" align="left"/>
          <colspec colwidth="10%*" align="left"/>
          <colspec colwidth="10%*" align="left"/>
          <colspec colwidth="10%*" align="left"/>
          <colspec colwidth="10%*" align="left"/>
          <colspec colwidth="50%*" align="left"/>
          <thead>
            <row>
              <entry>
    bootloader
    </entry>
              <entry>
    package
    </entry>
              <entry>
    popcon
    </entry>
              <entry>
    size
    </entry>
              <entry>
    initrd
    </entry>
              <entry>
    description
    </entry>
            </row>
          </thead>
          <tbody>
            <row>
              <entry>
                <ulink url="&grublegacy;">GRUB Legacy</ulink>
              </entry>
              <entry><ulink url="http://packages.debian.org/sid/grub">
    grub
    </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/grub">&pop-grub;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/g/grub.html">&size-grub;</ulink></entry>
              <entry>
    Supported
    </entry>
              <entry>
    This is smart enough to understand disk partitions and file systems such as vfat, ext3, …. (<literal>lenny</literal> default)
    </entry>
            </row>
            <row>
              <entry>
                <ulink url="&grubc;">GRUB 2</ulink>
              </entry>
              <entry><ulink url="http://packages.debian.org/sid/grub-pc">
    grub-pc
    </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/grub-pc">&pop-grubpc;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/g/grub-pc.html">&size-grubpc;</ulink></entry>
              <entry>
    Supported
    </entry>
              <entry>
    This is smart enough to understand disk partitions and file systems such as vfat, ext3, ….
    </entry>
            </row>
            <row>
              <entry>
                <ulink url="&grubc;">GRUB 2</ulink>
              </entry>
              <entry><ulink url="http://packages.debian.org/sid/grub-rescue-pc">
    grub-rescue-pc
    </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/grub-rescue-pc">&pop-grubrescuepc;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/g/grub-rescue-pc.html">&size-grubrescuepc;</ulink></entry>
              <entry>
    Supported
    </entry>
              <entry>
    This is GRUB 2 bootable rescue images (CD and floppy) (PC/BIOS version)
    </entry>
            </row>
            <row>
              <entry>
                <ulink url="&lilo;">Lilo</ulink>
              </entry>
              <entry><ulink url="http://packages.debian.org/sid/lilo">
    lilo
    </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/lilo">&pop-lilo;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/l/lilo.html">&size-lilo;</ulink></entry>
              <entry>
    Supported
    </entry>
              <entry>
    This relies on the sector locations of data on the hard disk. (Old)
    </entry>
            </row>
            <row>
              <entry>
                <ulink url="&isolinux;">Isolinux</ulink>
              </entry>
              <entry><ulink url="http://packages.debian.org/sid/syslinux">
    syslinux
    </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/syslinux">&pop-syslinux;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/s/syslinux.html">&size-syslinux;</ulink></entry>
              <entry>
    Supported
    </entry>
              <entry>
    This understands the ISO9660 file system.  This is used by the boot CD.
    </entry>
            </row>
            <row>
              <entry>
                <ulink url="&syslinux;">Syslinux</ulink>
              </entry>
              <entry><ulink url="http://packages.debian.org/sid/syslinux">
    syslinux
    </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/syslinux">&pop-syslinux;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/s/syslinux.html">&size-syslinux;</ulink></entry>
              <entry>
    Supported
    </entry>
              <entry>
    This understands the <ulink url="&msdosfilesystemfat;">MSDOS file system (FAT)</ulink>.  This is used by the boot floppy.
    </entry>
            </row>
            <row>
              <entry>
                <ulink url="&loadlin;">Loadlin</ulink>
              </entry>
              <entry><ulink url="http://packages.debian.org/sid/loadlin">
    loadlin
    </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/loadlin">&pop-loadlin;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/l/loadlin.html">&size-loadlin;</ulink></entry>
              <entry>
    Supported
    </entry>
              <entry>
    New system is started from the FreeDOS/MSDOS system.
    </entry>
            </row>
            <row>
              <entry>
                <ulink url="&mbrbyneilturton;">MBR by Neil Turton</ulink>
              </entry>
              <entry><ulink url="http://packages.debian.org/sid/mbr">
    mbr
    </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/mbr">&pop-mbr;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/m/mbr.html">&size-mbr;</ulink></entry>
              <entry>
    Not supported
    </entry>
              <entry>
    This is free software which substitutes MSDOS <ulink url="&mbr;">MBR</ulink>.  This only understands disk partitions.
    </entry>
            </row>
          </tbody>
        </tgroup>
      </table>
      <warning>
        <simpara>Do not play with boot loaders without having bootable rescue media (CD or floppy) created from images in the <literal>grub-rescue-pc</literal> package.  It will let you boot your system even without functioning bootloader on the harddisk.</simpara>
      </warning>
      <simpara>For GRUB Legacy, the menu configuration file is located at "<literal>/boot/grub/menu.lst</literal>".  For example, it has entries like:</simpara>
      <screen>title           Debian GNU/Linux
root            (hd0,2)
kernel          /vmlinuz root=/dev/hda3 ro
initrd          /initrd.img</screen>
      <simpara>For GRUB 2, the menu configuration file is located at "<literal>/boot/grub/grub.cfg</literal>". It is automatically generated by "<literal>/usr/sbin/update-grub</literal>" using templates from "<literal>/etc/grub.d/*</literal>" and settings from "<literal>/etc/default/grub</literal>".  For example, it has entries like:</simpara>
      <screen>menuentry "Debian GNU/Linux" {
        set root=(hd0,3)
        linux /vmlinuz root=/dev/hda3
        initrd /initrd.img
}</screen>
      <simpara>For these examples, these GRUB parameters mean:</simpara>
      <table id="themeaningofgrubparameters" pgwide="0" frame="topbot" rowsep="1" colsep="1">
        <title>The meaning of GRUB parameters.</title>
        <tgroup cols="2">
          <colspec colwidth="30%*" align="left"/>
          <colspec colwidth="70%*" align="left"/>
          <thead>
            <row>
              <entry>
    GRUB parameter
    </entry>
              <entry>
    meaning
    </entry>
            </row>
          </thead>
          <tbody>
            <row>
              <entry>
                <literal>root</literal>
              </entry>
              <entry>
    Use 3rd partition on the primary disk by setting it as "<literal>(hd0,2)</literal>" in GRUB legacy or as "<literal>(hd0,3)</literal>" in GRUB 2.
    </entry>
            </row>
            <row>
              <entry>
                <literal>kernel</literal>
              </entry>
              <entry>
    Use kernel located at "<literal>/vmlinuz</literal>" with kernel parameter: "<literal>root=/dev/hda3 ro</literal>".
    </entry>
            </row>
            <row>
              <entry>
                <literal>initrd</literal>
              </entry>
              <entry>
    Use <ulink url="&initrdinitramfs;">initrd/initramfs</ulink> image located at "<literal>/initrd.img</literal>".
    </entry>
            </row>
          </tbody>
        </tgroup>
      </table>
      <note>
        <simpara>The value of the partition number used by GRUB legacy program is one less than normal one used by Linux kernel and utility tools.  GRUB 2 program fixes this problem.</simpara>
      </note>
      <tip>
        <simpara><ulink url="&uuid;">UUID</ulink> (see <xref linkend="_accessing_partition_using_uuid"/>) may be used to identify a block special device instead of its file name such as "<literal>/dev/hda3</literal>", e.g."<literal>root=UUID=81b289d5-4341-4003-9602-e254a17ac232 ro</literal>".</simpara>
      </tip>
      <tip>
        <simpara>You can start a boot loader from another boot loader using techniques called <ulink url="&chainloading;">chain loading</ulink>.</simpara>
      </tip>
      <simpara>See "<literal>info grub</literal>" and <literal>grub-install</literal>(8).</simpara>
    </section>
    <section id="_stage_3_the_mini_debian_system">
      <title>Stage 3: the mini-Debian system</title>
      <simpara>The mini-Debian system is the 3rd stage of the boot process which is started by the boot loader.  It runs the system kernel with its root filesystem on the memory. This is an optional preparatory stage of the boot process.</simpara>
      <note>
        <simpara>The term "the mini-Debian system" is coined by the author to describe this 3rd stage boot process for this document.  This system is commonly referred as the <ulink url="&initrd;">initrd</ulink> or initramfs system. Similar system on the memory is used by <ulink url="&thedebianinstaller;">the Debian Installer</ulink>.</simpara>
      </note>
      <simpara>The "<literal>/init</literal>" script is executed as the first program in this root filesystem on the memory.  It is a shell script program which initializes the kernel in user space and hands control over to the next stage. This mini-Debian system offers flexibility to the boot process such as adding kernel modules before the main boot process or mounting the root file system as an encrypted one.</simpara>
      <simpara>You can interrupt this part of the boot process to gain root shell by providing "<literal>break=init</literal>" etc. to the kernel boot parameter. See the "<literal>/init</literal>" script for more break conditions.  This shell environment is sophisticated enough to make a good inspection of your machine's hardware.</simpara>
      <simpara>Commands available in this mini-Debian system are stripped down ones and mainly provided by a GNU tool called <literal>busybox</literal>(1).</simpara>
      <caution>
        <simpara>You need to use "<literal>-n</literal>" option for <literal>mount</literal> command when you are on the readonly root file system.</simpara>
      </caution>
    </section>
    <section id="_stage_4_the_normal_debian_system">
      <title>Stage 4: the normal Debian system</title>
      <simpara>The normal Debian system is the 4th stage of the boot process which is started by the mini-Debian system.  The system kernel for the mini-Debian system continues to run in this environment. The root filesystem is switched from the one on the memory to the one on the real harddisk filesystem.</simpara>
      <simpara>The "<literal>/sbin/init</literal>" program is executed as the first program and performs the main boot process. The Debian normally uses the traditional sysvinit scheme with the <literal>sysv-rc</literal> package.  See <literal>init</literal>(8), <literal>inittab</literal>(5), and "<literal>/usr/share/doc/sysv-rc/README.runlevels.gz</literal>" for the exact explanation.  Following is a simplified overview of this main boot process:</simpara>
      <orderedlist>
        <listitem>
          <simpara>
The Debian system goes into <emphasis role="strong">runlevel N</emphasis> (none) to initialize the system by following the "<literal>/etc/inittab</literal>" description.
</simpara>
        </listitem>
        <listitem>
          <simpara>
The Debian system goes into <emphasis role="strong">runlevel S</emphasis> to initialize the system under the single-user mode to complete hardware initialization etc.
</simpara>
        </listitem>
        <listitem>
          <simpara>
The Debian system goes into one of the specified <emphasis role="strong">multi-user runlevels (2 to 5)</emphasis> to start the system services.
</simpara>
        </listitem>
      </orderedlist>
      <simpara>The initial runlevel used for multi-user mode is specified with the "<literal>init=</literal>" kernel boot parameter or in the "initdefault" line of the "<literal>/etc/inittab</literal>". The Debian system as installed starts at the <emphasis role="strong">runlevel 2</emphasis>.</simpara>
      <simpara>All scripts executed by the init system are located in the directory "<literal>/etc/init.d/</literal>".</simpara>
      <tip>
        <simpara>For alternative boot mechanism to the <literal>sysv-rc</literal> package using a single configuration file "<literal>/etc/runlevel.conf</literal>", see the <literal>file-rc</literal> package. Both mechanisms are compatible through "<literal>/etc/init.d/rc</literal>", "<literal>/etc/init.d/rcS</literal>", "<literal>/usr/sbin/update-rc.d</literal>", and "<literal>/usr/sbin/invoke-rc.d</literal>" scripts.</simpara>
      </tip>
      <section id="_the_meaning_of_the_runlevel">
        <title>The meaning of the runlevel</title>
        <simpara>Each <ulink url="&runlevel;">runlevel</ulink> uses a directory for its configuration and has specific meaning:</simpara>
        <table id="listofrunlevelsandmeanings" pgwide="0" frame="topbot" rowsep="1" colsep="1">
          <title>List of runlevels and meanings.</title>
          <tgroup cols="3">
            <colspec colwidth="30%*" align="left"/>
            <colspec colwidth="30%*" align="left"/>
            <colspec colwidth="40%*" align="left"/>
            <thead>
              <row>
                <entry>
    runlevel
    </entry>
                <entry>
    directory
    </entry>
                <entry>
    meaning
    </entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry>
                  <literal>N</literal>
                </entry>
                <entry>
    none
    </entry>
                <entry>
    System bootup (NONE). There is no "<literal>/etc/rcN.d/</literal>" directory.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>0</literal>
                </entry>
                <entry>
                  <literal>/etc/rc0.d/</literal>
                </entry>
                <entry>
    Halt the system.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>S</literal>
                </entry>
                <entry>
                  <literal>/etc/rcS.d/</literal>
                </entry>
                <entry>
    Single-user mode on boot. The lower case "<literal>s</literal>" can be used as alias.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>1</literal>
                </entry>
                <entry>
                  <literal>/etc/rc1.d/</literal>
                </entry>
                <entry>
    Single-user mode switched from multi-user mode.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>2</literal>
                </entry>
                <entry>
                  <literal>/etc/rc2.d/</literal>
                </entry>
                <entry>
    Multi-user mode.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>3</literal>
                </entry>
                <entry>
                  <literal>/etc/rc3.d/</literal>
                </entry>
                <entry>
    ,,
    </entry>
              </row>
              <row>
                <entry>
                  <literal>4</literal>
                </entry>
                <entry>
                  <literal>/etc/rc4.d/</literal>
                </entry>
                <entry>
    ,,
    </entry>
              </row>
              <row>
                <entry>
                  <literal>5</literal>
                </entry>
                <entry>
                  <literal>/etc/rc5.d/</literal>
                </entry>
                <entry>
    ,,
    </entry>
              </row>
              <row>
                <entry>
                  <literal>6</literal>
                </entry>
                <entry>
                  <literal>/etc/rc6.d/</literal>
                </entry>
                <entry>
    Reboot the system.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>7</literal>
                </entry>
                <entry>
                  <literal>/etc/rc7.d/</literal>
                </entry>
                <entry>
    Valid multi-user mode but not normally used.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>8</literal>
                </entry>
                <entry>
                  <literal>/etc/rc8.d/</literal>
                </entry>
                <entry>
    ,,
    </entry>
              </row>
              <row>
                <entry>
                  <literal>9</literal>
                </entry>
                <entry>
                  <literal>/etc/rc9.d/</literal>
                </entry>
                <entry>
    ,,
    </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
        <simpara>You can change the runlevel from the console to, e.g., 4 by:</simpara>
        <screen>$ sudo telinit 4</screen>
        <caution>
          <simpara><emphasis role="strong">The Debian system does not pre-assign any special meaning differences among the <ulink url="&runlevels;">runlevels</ulink> between 2 and 5.</emphasis> The system administrator on the Debian system may change this.  (I.e., Debian is not <ulink url="&redhatlinux;">Red Hat Linux</ulink> nor <ulink url="&solarisbysunmicrosystems;">Solaris by Sun Microsystems</ulink> nor <ulink url="&hpuxbyhewlettpackard;">HP-UX by Hewlett Packard</ulink> nor <ulink url="&aixbyibm;">AIX by IBM</ulink> nor …)</simpara>
        </caution>
        <caution>
          <simpara>The Debian system does not populate directories for the <ulink url="&runlevels;">runlevels</ulink> between 7 and 9 when the package is installed.  Traditional <ulink url="&unixvariants;">Unix variants</ulink> don’t use these <ulink url="&runlevels;">runlevels</ulink>.</simpara>
        </caution>
      </section>
      <section id="_the_configuration_of_the_runlevel">
        <title>The configuration of the runlevel</title>
        <simpara>The names of the symlinks in the runlevel directories have the form "<literal>S&lt;2-digit-number&gt;&lt;original-name&gt;</literal>" or "<literal>K&lt;2-digit-number&gt;&lt;original-name&gt;</literal>". The 2-digit-number is used to determine the order in which to run the scripts. "<literal>S</literal>" is for "Start" and "<literal>K</literal>" is for "Kill".</simpara>
        <simpara>When <literal>init</literal>(8) or <literal>telinit</literal>(8) commands goes into the runlevel to "&lt;n&gt;":</simpara>
        <orderedlist>
          <listitem>
            <simpara>
the script names starting with a "<literal>K</literal>" in "<literal>/etc/rc&lt;n&gt;.d/</literal>" are executed in alphabetical order with the single argument "<literal>stop</literal>". (killing services)
</simpara>
          </listitem>
          <listitem>
            <simpara>
the script names starting with an "<literal>S</literal>" in "<literal>/etc/rc&lt;n&gt;.d/</literal>" are executed in alphabetical order with the single argument "<literal>start</literal>". (starting services)
</simpara>
          </listitem>
        </orderedlist>
        <simpara>For example, if you had the links "<literal>S10sysklogd</literal>" and "<literal>S20exim4</literal>" in a runlevel directory, "<literal>S10sysklogd</literal>" would run before "<literal>S20exim4</literal>".</simpara>
        <warning>
          <simpara>It is not advisable to make any changes to symlinks in "<literal>/etc/rcS.d/</literal>" unless you know better than the maintainer.</simpara>
        </warning>
      </section>
      <section id="_the_runlevel_management_example">
        <title>The runlevel management example</title>
        <simpara>For example, let's set up runlevel system somewhat like <ulink url="&redhatlinux;">Red Hat Linux</ulink>, i.e.:</simpara>
        <itemizedlist>
          <listitem>
            <simpara>
to start the system in runlevel=3 as the default,
</simpara>
          </listitem>
          <listitem>
            <simpara>
not to start <literal>gdm</literal>(1) in runlevel=(0,1,2,6), and
</simpara>
          </listitem>
          <listitem>
            <simpara>
to start <literal>gdm</literal>(1) in runlevel=(3,4,5).
</simpara>
          </listitem>
        </itemizedlist>
        <simpara>This can be done by using editor on the "<literal>/etc/inittab</literal>" file to change starting runlevel and using user friendly runlevel management tools such as <literal>sysv-rc-conf</literal> or <literal>bum</literal> to edit the runlevel.  If you are to use command line only instead, here is how you do it (after the default installation of the <literal>gdm</literal> package and selecting it to be the choice of display manager):</simpara>
        <screen># cd /etc/rc2.d ; mv S21gdm K21gdm
# cd /etc ; perl -i -p -e 's/^id:.:/id:3:/' inittab</screen>
        <simpara>Please note the "<literal>/etc/X11/default-display-manager</literal>" file is checked when starting the display manager daemons: <literal>xdm</literal>, <literal>gdm</literal>, <literal>kdm</literal>, and <literal>wdm</literal>.</simpara>
        <note>
          <simpara>You can still start X from any console shell with the <literal>startx</literal>(1) command.</simpara>
        </note>
      </section>
      <section id="_the_default_parameter_for_each_init_script">
        <title>The default parameter for each init script</title>
        <simpara>The default parameter for each init script in "<literal>/etc/init.d/</literal>" is given by the corresponding file in "<literal>/etc/default/</literal>" which contains environment variable assignments <emphasis role="strong">only</emphasis>. This choice of directory name is specific to the Debian system.  It is roughly the equivalent of the "<literal>/etc/sysconfig</literal>" directory found in <ulink url="&redhatlinux;">Red Hat Linux</ulink> and other distributions.  For example, "<literal>/etc/default/cron</literal>" can be used to control how "<literal>/etc/init.d/cron</literal>" works.</simpara>
        <simpara>The "<literal>/etc/default/rcS</literal>" file can be used to customize boot-time defaults for <literal>motd</literal>(5), <literal>sulogin</literal>(8), etc.</simpara>
        <simpara>If you cannot get the behavior you want by changing such variables then you may <ulink url="&modifytheinitscripts;">modify the init scripts</ulink> themselves.  These are configuration files editable by system administrators.</simpara>
      </section>
      <section id="_the_hostname">
        <title>The hostname</title>
        <simpara>The kernel maintains the system <emphasis role="strong">hostname</emphasis>.  The initscript "<literal>/etc/init.d/hostname.sh</literal>" sets the system hostname at boot time (using the <literal>hostname</literal> command) to the name stored in "<literal>/etc/hostname</literal>".  This file should contain <emphasis role="strong">only</emphasis> the system hostname, not a fully qualified domain name.</simpara>
        <simpara>To print out the current hostname run <literal>hostname</literal>(1) without an argument.</simpara>
      </section>
      <section id="_network_interface_initialization">
        <title>Network interface initialization</title>
        <simpara>Network interfaces are initialized under single-user mode on boot by the initscript "<literal>/etc/init.d/ifupdown-clean</literal>" and "<literal>/etc/init.d/ifupdown</literal>".  See <xref linkend="_network_setup"/> for how to configure them.</simpara>
      </section>
      <section id="_network_service_initialization">
        <title>Network service initialization</title>
        <simpara>Many network services (see <xref linkend="_network_applications"/>) are started directly as daemon processes at boot time by the initscript, e.g., "<literal>/etc/rc2.d/S20exim4</literal>" (for RUNLEVEL=2) which is a symlink to "<literal>/etc/init.d/exim4</literal>".</simpara>
        <simpara>Some network services can be started on demand using the <ulink url="&superserver;">super-server</ulink>, <literal>inetd</literal> (or its equivalents).  The <literal>inetd</literal> is started at boot time by "<literal>/etc/rc2.d/S20inetd</literal>" (for RUNLEVEL=2) which is a symlink to "<literal>/etc/init.d/inetd</literal>".  Essentially, <literal>inetd</literal> allows one running daemon to invoke several others, reducing load on the system.</simpara>
        <simpara>Whenever a request for service arrives, its protocol and service are identified by looking them up in the databases in "<literal>/etc/protocols</literal>" and "<literal>/etc/services</literal>".  <literal>inetd</literal> then looks up a normal Internet service in the "<literal>/etc/inetd.conf</literal>" database, or a <ulink url="&opennetworkcompucalloncrpcsunrpc;">Open Network Computing Remote Procedure Call (ONC RPC)/Sun RPC</ulink> based service in "<literal>/etc/rpc.conf</literal>".</simpara>
        <simpara>For system security, make sure to disable unused services in "<literal>/etc/inetd.conf</literal>".  Sun-RPC services need to be active for NFS and other RPC-based programs.</simpara>
        <simpara>Sometimes, <literal>inetd</literal> does not start the intended server directly but starts the <ulink url="&tcpwrapper;">TCP wrapper</ulink>, <literal>tcpd</literal>,  with the intended server name as its argument in "<literal>/etc/inetd.conf</literal>".  In this case, <literal>tcpd</literal> runs the appropriate server program after logging the request and doing some additional checks using "<literal>/etc/hosts.deny</literal>" and "<literal>/etc/hosts.allow</literal>".</simpara>
        <simpara>If you have problems with remote access in a recent Debian system, comment out "ALL: PARANOID" in "<literal>/etc/hosts.deny</literal>" if it exists.  (But you must be careful on security risks involved with this kind of action.)</simpara>
        <simpara>For details, see <literal>inetd</literal>(8), <literal>inetd.conf</literal>(5), <literal>protocols</literal>(5), <literal>services</literal>(5), <literal>tcpd</literal>(8), <literal>hosts_access</literal>(5), and <literal>hosts_options</literal>(5).</simpara>
        <simpara>For more information on Sun-RPC, see <literal>rpcinfo</literal>(8), <literal>portmap</literal>(8), and "<literal>/usr/share/doc/portmap/portmapper.txt.gz</literal>".</simpara>
      </section>
      <section id="_the_system_message">
        <title>The system message</title>
        <simpara>The system message can be customized by "<literal>/etc/syslog.conf</literal>" for both the log file and on-screen display. See <literal>syslogd</literal>(8) and <literal>syslog.conf</literal>(5).  See also <xref linkend="_log_analyzer"/>.</simpara>
      </section>
      <section id="_the_kernel_message">
        <title>The kernel message</title>
        <simpara>The kernel message can be customized by "<literal>/etc/init.d/klogd</literal>" for both the log file and on-screen display.  Set "<literal>KLOGD='-c 3'</literal>" in this script and run "<literal>/etc/init.d/klogd restart</literal>".  See <literal>klogd</literal>(8).</simpara>
        <simpara>You may directly change the error message level by:</simpara>
        <screen># dmesg -n3</screen>
        <simpara>Here:</simpara>
        <table id="listofkernelerrorlevels" pgwide="0" frame="topbot" rowsep="1" colsep="1">
          <title>List of kernel error levels.</title>
          <tgroup cols="3">
            <colspec colwidth="30%*" align="left"/>
            <colspec colwidth="30%*" align="left"/>
            <colspec colwidth="40%*" align="left"/>
            <thead>
              <row>
                <entry>
    error level value
    </entry>
                <entry>
    error level name
    </entry>
                <entry>
    meaning
    </entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry>
    0
    </entry>
                <entry>
    KERN_EMERG
    </entry>
                <entry>
    system is unusable
    </entry>
              </row>
              <row>
                <entry>
    1
    </entry>
                <entry>
    KERN_ALERT
    </entry>
                <entry>
    action must be taken immediately
    </entry>
              </row>
              <row>
                <entry>
    2
    </entry>
                <entry>
    KERN_CRIT
    </entry>
                <entry>
    critical conditions
    </entry>
              </row>
              <row>
                <entry>
    3
    </entry>
                <entry>
    KERN_ERR
    </entry>
                <entry>
    error conditions
    </entry>
              </row>
              <row>
                <entry>
    4
    </entry>
                <entry>
    KERN_WARNING
    </entry>
                <entry>
    warning conditions
    </entry>
              </row>
              <row>
                <entry>
    5
    </entry>
                <entry>
    KERN_NOTICE
    </entry>
                <entry>
    normal but significant condition
    </entry>
              </row>
              <row>
                <entry>
    6
    </entry>
                <entry>
    KERN_INFO
    </entry>
                <entry>
    informational
    </entry>
              </row>
              <row>
                <entry>
    7
    </entry>
                <entry>
    KERN_DEBUG
    </entry>
                <entry>
    debug-level messages
    </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
      </section>
      <section id="_the_udev_system">
        <title>The udev system</title>
        <simpara>For Linux kernel 2.6, <ulink url="&theudevsystem;">the udev system</ulink> provides mechanism for the automatic hardware discovery and initialization (see <literal>udev</literal>(7)). Upon discovery of each device by the kernel, the udev system starts a user process which uses information from the <ulink url="&sysfs;">sysfs</ulink> filesystem (see <xref linkend="_procfs_and_sysfs"/>), loads required kernel modules supporting it using the <literal>modprobe</literal>(8) program (see <xref linkend="_the_kernel_module_initialization"/>), and creates corresponding device nodes.</simpara>
        <tip>
          <simpara>If "<literal>/lib/modules/&lt;kernel-version&gt;/modules.dep</literal>" was not generated properly by <literal>depmod</literal>(8) for some reason, modules may not be loaded as expected by the udev system. Execute "<literal>depmod -a</literal>" to fix it.</simpara>
        </tip>
        <simpara>The name of device nodes can be configured by files in "<literal>/etc/udev/rules.d/</literal>" (see "<literal>/usr/share/doc/udev/writing_udev_rules/index.html</literal>").</simpara>
        <simpara>Since the udev system is somewhat a moving target, I leave details to other documentations and describe the minimum information here.</simpara>
      </section>
      <section id="_the_kernel_module_initialization">
        <title>The kernel module initialization</title>
        <simpara>The <literal>modprobe</literal>(8) program enables us to configure running Linux kernel from user process by adding and removing kernel modules.  The udev system (see <xref linkend="_the_udev_system"/>) automates its invocation to help the kernel module initialization.</simpara>
        <simpara>There are non-hardware modules and special hardware driver modules, such as:</simpara>
        <itemizedlist>
          <listitem>
            <simpara><ulink url="&tuntap;">TUN/TAP</ulink> modules providing virtual Point-to-Point network device (TUN) and virtual Ethernet network device (TAP),
</simpara>
          </listitem>
          <listitem>
            <simpara><ulink url="&netfilter;">netfilter</ulink> modules providing netfilter firewall capabilities (<literal>iptables</literal>(8), <xref linkend="_netfilter"/>),
</simpara>
          </listitem>
          <listitem>
            <simpara><ulink url="&watchdogtimer;">watchdog timer</ulink> driver modules
need to be pre-loaded by listing them in the "<literal>/etc/modules</literal>" file (see <literal>modules</literal>(5)).
</simpara>
          </listitem>
        </itemizedlist>
        <simpara>The configuration files for the <literal>modprobe</literal>(8) program are located under the "<literal>/etc/modprobes.d/</literal>" directory as explained in <literal>modprobe.conf</literal>(5).   (If you want to avoid some kernel modules to be auto-loaded, consider to blacklist them in the "<literal>/etc/modprobes.d/blacklist</literal>" file.)</simpara>
        <simpara>The "<literal>/lib/modules/&lt;version&gt;/modules.dep</literal>" file generated by the <literal>depmod</literal>(8) program describes module dependencies used by the <literal>modprobe</literal>(8) program.</simpara>
        <note>
          <simpara>If you experience module loading issues with boot time module loading or with <literal>modprobe</literal>(8), "<literal>depmod -a</literal>" may resolve these issues by reconstructing "<literal>modules.dep</literal>".</simpara>
        </note>
        <simpara>The <literal>modinfo</literal>(8) program shows information about a Linux kernel module.</simpara>
        <simpara>The <literal>lsmod</literal>(8) program nicely formats the contents of the "<literal>/proc/modules</literal>", showing what kernel modules are currently loaded.</simpara>
        <tip>
          <simpara>You can identify exact hardware on your system.  See <xref linkend="_hardware_identification"/>.</simpara>
        </tip>
        <tip>
          <simpara>You may configure hardware at boot time to activate expected hardware features. See <xref linkend="_hardware_configuration"/>.</simpara>
        </tip>
        <tip>
          <simpara>You can add support for your device by recompiling kernel.  See <xref linkend="_the_kernel"/>.</simpara>
        </tip>
      </section>
    </section>
  </chapter>
  <chapter id="_authentication">
    <title>Authentication</title>
    <simpara>When a person (or a program) requests access to the system, authentication confirms the identity to be a trusted one.</simpara>
    <warning>
      <simpara>Configuration errors of PAM may lock you out of your own system.  You must have a rescue CD handy or setup an alternative boot partition.  To recover, boot the system with them and correct things from there.</simpara>
    </warning>
    <section id="_normal_unix_authentication">
      <title>Normal Unix authentication</title>
      <simpara>Normal Unix authentication is provided by the <literal>pam_unix</literal>(8) module under the <ulink url="&pampluggableauthnticationmodules;">PAM (Pluggable Authentication Modules)</ulink>. Its 3 important configuration files, with "<literal>:</literal>" separated entries, are:</simpara>
      <table id="dimportantconfigilesforpam_unixi" pgwide="0" frame="topbot" rowsep="1" colsep="1">
        <title>3 important configuration files for <literal>pam_unix</literal>(8).</title>
        <tgroup cols="5">
          <colspec colwidth="10%*" align="left"/>
          <colspec colwidth="10%*" align="left"/>
          <colspec colwidth="10%*" align="left"/>
          <colspec colwidth="10%*" align="left"/>
          <colspec colwidth="60%*" align="left"/>
          <thead>
            <row>
              <entry>
    file
    </entry>
              <entry>
    permission
    </entry>
              <entry>
    user
    </entry>
              <entry>
    group
    </entry>
              <entry>
    description
    </entry>
            </row>
          </thead>
          <tbody>
            <row>
              <entry>
                <literal>/etc/passwd</literal>
              </entry>
              <entry>
                <literal>-rw-r--r--</literal>
              </entry>
              <entry>
                <literal>root</literal>
              </entry>
              <entry>
                <literal>root</literal>
              </entry>
              <entry>
    The (sanitized) user account information.
    </entry>
            </row>
            <row>
              <entry>
                <literal>/etc/shadow</literal>
              </entry>
              <entry>
                <literal>-rw-r-----</literal>
              </entry>
              <entry>
                <literal>root</literal>
              </entry>
              <entry>
                <literal>shadow</literal>
              </entry>
              <entry>
    The secure user account information.
    </entry>
            </row>
            <row>
              <entry>
                <literal>/etc/group</literal>
              </entry>
              <entry>
                <literal>-rw-r--r--</literal>
              </entry>
              <entry>
                <literal>root</literal>
              </entry>
              <entry>
                <literal>root</literal>
              </entry>
              <entry>
    The group information.
    </entry>
            </row>
          </tbody>
        </tgroup>
      </table>
      <simpara>"<literal>/etc/passwd</literal>" contains:</simpara>
      <screen>...
user1:x:1000:1000:User1 Name,,,:/home/user1:/bin/bash
user2:x:1001:1001:User2 Name,,,:/home/user2:/bin/bash
...</screen>
      <simpara>As explained in <literal>passwd</literal>(5), each "<literal>:</literal>" separated entry of this file means:</simpara>
      <itemizedlist>
        <listitem>
          <simpara>
login name
</simpara>
        </listitem>
        <listitem>
          <simpara>
password specification entry
</simpara>
        </listitem>
        <listitem>
          <simpara>
numerical user ID
</simpara>
        </listitem>
        <listitem>
          <simpara>
numerical group ID
</simpara>
        </listitem>
        <listitem>
          <simpara>
user name or comment field
</simpara>
        </listitem>
        <listitem>
          <simpara>
user home directory
</simpara>
        </listitem>
        <listitem>
          <simpara>
optional user command interpreter
</simpara>
        </listitem>
      </itemizedlist>
      <simpara>The second entry of "<literal>/etc/passwd</literal>" was used for the encrypted password entry.  After the introduction of "<literal>/etc/shadow</literal>", this entry is used for the password specification entry.</simpara>
      <table id="thesecondentrycontentofetcpasswd" pgwide="0" frame="topbot" rowsep="1" colsep="1">
        <title>The second entry content of "<literal>/etc/passwd</literal>".</title>
        <tgroup cols="2">
          <colspec colwidth="30%*" align="left"/>
          <colspec colwidth="70%*" align="left"/>
          <thead>
            <row>
              <entry>
    content
    </entry>
              <entry>
    meaning
    </entry>
            </row>
          </thead>
          <tbody>
            <row>
              <entry>
    (empty)
    </entry>
              <entry>
    passwordless account
    </entry>
            </row>
            <row>
              <entry>
    x
    </entry>
              <entry>
    the encrypted password is in "<literal>/etc/shadow</literal>"
    </entry>
            </row>
            <row>
              <entry>
    *
    </entry>
              <entry>
    no login for this account
    </entry>
            </row>
            <row>
              <entry>
    !
    </entry>
              <entry>
    no login for this account
    </entry>
            </row>
          </tbody>
        </tgroup>
      </table>
      <simpara>"<literal>/etc/shadow</literal>" contains:</simpara>
      <screen>...
user1:$1$Xop0FYH9$IfxyQwBe9b8tiyIkt2P4F/:13262:0:99999:7:::
user2:$1$vXGZLVbS$ElyErNf/agUDsm1DehJMS/:13261:0:99999:7:::
...</screen>
      <simpara>As explained in <literal>shadow</literal>(5), each "<literal>:</literal>" separated entry of this file means:</simpara>
      <itemizedlist>
        <listitem>
          <simpara>
login name
</simpara>
        </listitem>
        <listitem>
          <simpara>
encrypted password.  The initial "<literal>$1$</literal>" indicates use of the MD5 encryption. The "*" indicates no login.
</simpara>
        </listitem>
        <listitem>
          <simpara>
days since Jan 1, 1970 that password was last changed
</simpara>
        </listitem>
        <listitem>
          <simpara>
days before password may be changed
</simpara>
        </listitem>
        <listitem>
          <simpara>
days after which password must be changed
</simpara>
        </listitem>
        <listitem>
          <simpara>
days before password is to expire that user is warned
</simpara>
        </listitem>
        <listitem>
          <simpara>
…
</simpara>
        </listitem>
      </itemizedlist>
      <simpara>"<literal>/etc/group</literal>" contains:</simpara>
      <screen>...
group1:x:20:user1,user2
...</screen>
      <simpara>As explained in <literal>shadow</literal>(5), each "<literal>:</literal>" separated entry of this file means:</simpara>
      <itemizedlist>
        <listitem>
          <simpara>
group name
</simpara>
        </listitem>
        <listitem>
          <simpara>
encrypted password (not really used)
</simpara>
        </listitem>
        <listitem>
          <simpara>
numerical group ID.
</simpara>
        </listitem>
        <listitem>
          <simpara>
"," separated list of user names.
</simpara>
        </listitem>
      </itemizedlist>
      <simpara>"<literal>/etc/gshadow</literal>" provides the similar function as "<literal>/etc/shadow</literal>" for "<literal>/etc/group</literal>" but is not really used.</simpara>
      <note>
        <simpara>The actual group membership of a user may be dynamically added if "<literal>auth optional pam_group.so</literal>" line is added to "<literal>/etc/pam.d/common-auth</literal>" and set it in "<literal>/etc/security/group.conf</literal>".  See <literal>pam_group</literal>(8).</simpara>
      </note>
      <note>
        <simpara>The <literal>base-passwd</literal> package contains an authoritative list of the user and the group: "<literal>/usr/share/doc/base-passwd/users-and-groups.html</literal>".</simpara>
      </note>
    </section>
    <section id="_manage_account_and_password_information">
      <title>Manage account and password information</title>
      <simpara>Here are few notable commands to manage account information:</simpara>
      <table id="listofcommandstocountinformation" pgwide="0" frame="topbot" rowsep="1" colsep="1">
        <title>List of commands to manage account information.</title>
        <tgroup cols="2">
          <colspec colwidth="30%*" align="left"/>
          <colspec colwidth="70%*" align="left"/>
          <thead>
            <row>
              <entry>
    command
    </entry>
              <entry>
    function
    </entry>
            </row>
          </thead>
          <tbody>
            <row>
              <entry>
                <literal>getent passwd &lt;user_name&gt;</literal>
              </entry>
              <entry>
    browse account information of "<literal>&lt;user_name&gt;</literal>"
    </entry>
            </row>
            <row>
              <entry>
                <literal>getent shadow &lt;user_name&gt;</literal>
              </entry>
              <entry>
    browse shadowed account information of "<literal>&lt;user_name&gt;</literal>"
    </entry>
            </row>
            <row>
              <entry>
                <literal>getent group &lt;group_name&gt;</literal>
              </entry>
              <entry>
    browse group information of "<literal>&lt;group_name&gt;</literal>"
    </entry>
            </row>
            <row>
              <entry>
                <literal>passwd</literal>
              </entry>
              <entry>
    manage password for the account
    </entry>
            </row>
            <row>
              <entry>
                <literal>passwd -e</literal>
              </entry>
              <entry>
    set one-time password for the account activation
    </entry>
            </row>
            <row>
              <entry>
                <literal>chage</literal>
              </entry>
              <entry>
    manage password aging information
    </entry>
            </row>
          </tbody>
        </tgroup>
      </table>
      <simpara>You may need to have the root privilege for some functions to work. See <literal>crypt</literal>(3) for the password and data encryption.</simpara>
      <note>
        <simpara>On the system set up with PAM and NSS as the Debian <ulink url="&alioth;">alioth</ulink> machine, the content of local "<literal>/etc/passwd</literal>", "<literal>/etc/group</literal>" and "<literal>/etc/shadow</literal>" may not be actively used by the system.  Above commands are valid even under such environment.</simpara>
      </note>
    </section>
    <section id="_good_password">
      <title>Good password</title>
      <simpara>When creating an account during your system installation or with the <literal>passwd</literal>(1) command, you should choose a <ulink url="&goodpassword;">good password</ulink> which consists of 6 to 8 characters including one or more characters from each of the following sets according to <literal>passwd</literal>(1):</simpara>
      <itemizedlist>
        <listitem>
          <simpara>
lower case alphabetics
</simpara>
        </listitem>
        <listitem>
          <simpara>
digits 0 through 9
</simpara>
        </listitem>
        <listitem>
          <simpara>
punctuation marks
</simpara>
        </listitem>
      </itemizedlist>
      <warning>
        <simpara>Do not chose guessable words for the password.</simpara>
      </warning>
    </section>
    <section id="_creating_encrypted_password">
      <title>Creating encrypted password</title>
      <simpara>There are independent tools to generate encrypted password with salt:</simpara>
      <table id="listoftoolstogeneratepassword" pgwide="0" frame="topbot" rowsep="1" colsep="1">
        <title>List of tools to generate password.</title>
        <tgroup cols="5">
          <colspec colwidth="10%*" align="left"/>
          <colspec colwidth="10%*" align="left"/>
          <colspec colwidth="10%*" align="left"/>
          <colspec colwidth="10%*" align="left"/>
          <colspec colwidth="60%*" align="left"/>
          <thead>
            <row>
              <entry>
    package
    </entry>
              <entry>
    popcon
    </entry>
              <entry>
    size
    </entry>
              <entry>
    command
    </entry>
              <entry>
    function
    </entry>
            </row>
          </thead>
          <tbody>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/whois">
                <literal>whois</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/whois">&pop-whois;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/w/whois.html">&size-whois;</ulink></entry>
              <entry>
                <literal>mkpasswd</literal>
              </entry>
              <entry>
    over-featured front end to the <literal>crypt</literal>(3) library
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/openssl">
                <literal>openssl</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/openssl">&pop-openssl;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/o/openssl.html">&size-openssl;</ulink></entry>
              <entry>
                <literal>openssl passwd</literal>
              </entry>
              <entry>
    compute password hashes (OpenSSL). <literal>passwd</literal>(1ssl)
    </entry>
            </row>
          </tbody>
        </tgroup>
      </table>
    </section>
    <section id="_pam_and_nss">
      <title>PAM and NSS</title>
      <simpara>Modern <ulink url="&unixlike;">Unix-like</ulink> systems such as the Debian system provide <ulink url="&pampluggableauthnticationmodules;">PAM (Pluggable Authentication Modules)</ulink> and <ulink url="&nssnameserviceswitch;">NSS (Name Service Switch)</ulink> mechanism to the local system administrator to configure his system.  The role of these can be summarizes as:</simpara>
      <itemizedlist>
        <listitem>
          <simpara>
PAM offers a flexible authentication mechanism used by the application software thus involves password data exchange.
</simpara>
        </listitem>
        <listitem>
          <simpara>
NSS offers a flexible name service mechanism which is frequently used by the <ulink url="&cstandardlibrary;">C standard library</ulink> to obtain the user and group name for programs such as <literal>ls</literal>(1) and <literal>id</literal>(1).
</simpara>
        </listitem>
      </itemizedlist>
      <simpara>These PAM and NSS systems need to be configured consistently.</simpara>
      <simpara>The notable packages of PAM and NSS systems are:</simpara>
      <table id="listofnotablepamandnsssystems" pgwide="0" frame="topbot" rowsep="1" colsep="1">
        <title>List of notable PAM and NSS systems.</title>
        <tgroup cols="4">
          <colspec colwidth="20%*" align="left"/>
          <colspec colwidth="20%*" align="left"/>
          <colspec colwidth="20%*" align="left"/>
          <colspec colwidth="40%*" align="left"/>
          <thead>
            <row>
              <entry>
    package
    </entry>
              <entry>
    popcon
    </entry>
              <entry>
    size
    </entry>
              <entry>
    description
    </entry>
            </row>
          </thead>
          <tbody>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/libpam-modules">
                <literal>libpam-modules</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/libpam-modules">&pop-libpammodules;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/libp/libpam-modules.html">&size-libpammodules;</ulink></entry>
              <entry>
    Pluggable Authentication Modules (basic service)
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/libpam-ldap">
                <literal>libpam-ldap</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/libpam-ldap">&pop-libpamldap;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/libp/libpam-ldap.html">&size-libpamldap;</ulink></entry>
              <entry>
    Pluggable Authentication Module allowing LDAP interfaces
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/libpam-cracklib">
                <literal>libpam-cracklib</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/libpam-cracklib">&pop-libpamcracklib;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/libp/libpam-cracklib.html">&size-libpamcracklib;</ulink></entry>
              <entry>
    Pluggable Authentication Module to enable cracklib support
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/libpam-doc">
                <literal>libpam-doc</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/libpam-doc">&pop-libpamdoc;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/libp/libpam-doc.html">&size-libpamdoc;</ulink></entry>
              <entry>
    Pluggable Authentication Modules (documentation in html and text)
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/libc6">
                <literal>libc6</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/libc6">&pop-libcg;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/libc/libc6.html">&size-libcg;</ulink></entry>
              <entry>
    GNU C Library: Shared libraries which also provides "Name Service Switch" service
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/glibc-doc">
                <literal>glibc-doc</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/glibc-doc">&pop-glibcdoc;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/g/glibc-doc.html">&size-glibcdoc;</ulink></entry>
              <entry>
    GNU C Library: Manpages
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/glibc-doc-reference">
                <literal>glibc-doc-reference</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/glibc-doc-reference">&pop-glibcdocreference;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/g/glibc-doc-reference.html">&size-glibcdocreference;</ulink></entry>
              <entry>
    GNU C Library: Reference manual in info, pdf and html format (non-free)
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/libnss-mdns">
                <literal>libnss-mdns</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/libnss-mdns">&pop-libnssmdns;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/libn/libnss-mdns.html">&size-libnssmdns;</ulink></entry>
              <entry>
    NSS module for Multicast DNS name resolution
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/libnss-ldap">
                <literal>libnss-ldap</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/libnss-ldap">&pop-libnssldap;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/libn/libnss-ldap.html">&size-libnssldap;</ulink></entry>
              <entry>
    NSS module for using LDAP as a naming service
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/libnss-ldapd">
                <literal>libnss-ldapd</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/libnss-ldapd">&pop-libnssldapd;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/libn/libnss-ldapd.html">&size-libnssldapd;</ulink></entry>
              <entry>
    NSS module for using LDAP as a naming service (new folk of <literal>libnss-ldap</literal>)
    </entry>
            </row>
          </tbody>
        </tgroup>
      </table>
      <itemizedlist>
        <listitem>
          <simpara>
"The Linux-PAM System Administrators' Guide" in <literal>libpam-doc</literal> is essential for learning PAM configuration.
</simpara>
        </listitem>
        <listitem>
          <simpara>
"System Databases and Name Service Switch" section in <literal>glibc-doc-reference</literal> is essential for learning NSS configuration.
</simpara>
        </listitem>
      </itemizedlist>
      <note>
        <simpara>You can see more extensive and current list by "<literal>aptitude search 'libpam-|libnss-'</literal>" command.  The acronym NSS may also mean "Network Security Service" which is different from "Name Service Switch".</simpara>
      </note>
      <note>
        <simpara>PAM is the most basic way to initialize environment variables for each program with the system wide default value.</simpara>
      </note>
      <section id="_configuration_files_accessed_by_the_pam_and_nss">
        <title>Configuration files accessed by the PAM and NSS</title>
        <simpara>Here are few notable configuration files accessed by the PAM:</simpara>
        <table id="listofconfigurataccessedbythepam" pgwide="0" frame="topbot" rowsep="1" colsep="1">
          <title>List of configuration files accessed by the PAM.</title>
          <tgroup cols="2">
            <colspec colwidth="30%*" align="left"/>
            <colspec colwidth="70%*" align="left"/>
            <thead>
              <row>
                <entry>
    configuration file
    </entry>
                <entry>
    function
    </entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry>
                  <literal>/etc/pam.d/&lt;program_name&gt;</literal>
                </entry>
                <entry>
    set up PAM configuration for the "<literal>&lt;program_name&gt;</literal>" program. See <literal>pam</literal>(7) and <literal>pam.d</literal>(5).
    </entry>
              </row>
              <row>
                <entry>
                  <literal>/etc/nsswitch.conf</literal>
                </entry>
                <entry>
    set up NSS configuration with the entry for each service. See <literal>nsswitch.conf</literal>(5).
    </entry>
              </row>
              <row>
                <entry>
                  <literal>/etc/nologin</literal>
                </entry>
                <entry>
    limit the user login by the <literal>pam_nologin</literal>(8) module.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>/etc/securetty</literal>
                </entry>
                <entry>
    limit the tty for the root access by the <literal>pam_securetty</literal>(8) module.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>/etc/security/access.conf</literal>
                </entry>
                <entry>
    set access limit by the <literal>pam_access</literal>(8) module.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>/etc/security/group.conf</literal>
                </entry>
                <entry>
    set group based restraint by the <literal>pam_group</literal>(8) module.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>/etc/security/pam_env.conf</literal>
                </entry>
                <entry>
    set environment variables by the <literal>pam_env</literal>(8) module.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>/etc/environment</literal>
                </entry>
                <entry>
    set additional environment variables by the <literal>pam_env</literal>(8) module with the "<literal>readenv=1</literal>" argument.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>/etc/default/locale</literal>
                </entry>
                <entry>
    set locale by <literal>pam_env</literal>(8) module with the "<literal>readenv=1 envfile=/etc/default/locale</literal>" argument. (Debian)
    </entry>
              </row>
              <row>
                <entry>
                  <literal>/etc/security/limits.conf</literal>
                </entry>
                <entry>
    set resource restraint (ulimit, core, …) by the <literal>pam_linits</literal>(8) module.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>/etc/security/time.conf</literal>
                </entry>
                <entry>
    set time restraint by the <literal>pam_time</literal>(8) module.
    </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
        <simpara>The limitation of the password selection is implemented by the PAM modules, <literal>pam_unix</literal>(8) and <literal>pam_cracklib</literal>(8). They can be configured by their arguments.</simpara>
        <tip>
          <simpara>PAM modules use suffix "<literal>.so</literal>" for their filenames.</simpara>
        </tip>
      </section>
      <section id="_the_modern_centralized_system_management">
        <title>The modern centralized system management</title>
        <simpara>The modern centralized system management can be deployed using the centralized <ulink url="&lightweightdireccessprotocolldap;">Lightweight Directory Access Protocol (LDAP)</ulink> server to administer many Unix-like and non-Unix-like systems on the network.  The open source implementation of the Lightweight Directory Access Protocol is <ulink url="&openldapsoftware;">OpenLDAP Software</ulink>.</simpara>
        <simpara>The LDAP server provides the account information through the use of PAM and NSS with <literal>libpam-ldap</literal> and <literal>libnss-ldap</literal> packages for the Debian system. Several actions are required to enable this (I have not used this setup and the following is purely secondary information.  Please read this in this context.):</simpara>
        <itemizedlist>
          <listitem>
            <simpara>
You set up a centralized LDAP server by running program such as stand-alone LDAP daemon, <literal>slapd</literal>(8).
</simpara>
          </listitem>
          <listitem>
            <simpara>
You change the PAM configuration files in the "<literal>/etc/pam.d/</literal>" directory to use "<literal>pam_ldap.so</literal>" instead of the default "<literal>pam_unix.so</literal>".
</simpara>
          </listitem>
          <listitem>
            <simpara>
You change the NSS configuration in the "<literal>/etc/nsswitch.conf</literal>" file to use "<literal>ldap</literal>" instead of the default ("<literal>compat</literal>" or "<literal>file</literal>").
</simpara>
          </listitem>
          <listitem>
            <simpara>
Debian uses "<literal>/etc/pam_ldap.conf</literal>" as the configuration file for <literal>libpam-ldap</literal> and "<literal>/etc/pam_ldap.secret</literal>" as the file to store the password of the root.
</simpara>
          </listitem>
          <listitem>
            <simpara>
Debian uses "<literal>/etc/libnss-ldap.conf</literal>" as the configuration file for <literal>libnss-ldap</literal>.
</simpara>
          </listitem>
          <listitem>
            <simpara>
You must make <literal>libpam-ldap</literal> to use <ulink url="&sslortls;">SSL (or TLS)</ulink> connection for the security of password.
</simpara>
          </listitem>
          <listitem>
            <simpara>
You may make <literal>libnss-ldap</literal> to use <ulink url="&sslortls;">SSL (or TLS)</ulink> connection to ensure integrity of data at the cost of the LDAP network overhead.
</simpara>
          </listitem>
          <listitem>
            <simpara>
You should run <literal>nscd</literal>(8) locally to cache any LDAP search results in order to reduce the LDAP network traffic.
</simpara>
          </listitem>
        </itemizedlist>
        <simpara>See documentations in <literal>pam_ldap.conf</literal>(5) and "<literal>/usr/share/doc/libpam-doc/html/</literal>" offered by the <literal>libpam-doc</literal> package and "<literal>info libc 'Name Service Switch'</literal>" offered by the <literal>glibc-doc</literal> package.</simpara>
        <simpara>Similarly, you can set up alternative centralized systems with:</simpara>
        <itemizedlist>
          <listitem>
            <simpara><ulink url="&nisoriginallycalledyp;">NIS (originally called YP)</ulink> or <ulink url="&nisplus;">NIS+</ulink> with older Unix-like systems.
</simpara>
          </listitem>
          <listitem>
            <simpara>
Winbind with Windows NT and <ulink url="&samba;">SAMBA</ulink>.
</simpara>
          </listitem>
        </itemizedlist>
      </section>
      <section id="_why_gnu_su_does_not_support_the_wheel_group">
        <title>"Why GNU su does not support the wheel group"</title>
        <simpara>This is the famous phrase at the bottom of the old "<literal>info su</literal>" page by Richard M. Stallman.  Not to worry: the current <literal>su</literal> command in Debian uses PAM, so that one can restrict the ability to use <literal>su</literal> to the <literal>root</literal> group by enabling the line with "<literal>pam_wheel.so</literal>" in "<literal>/etc/pam.d/su</literal>".</simpara>
      </section>
      <section id="_stricter_password_rule">
        <title>Stricter password rule</title>
        <simpara>Installing the <literal>libpam-cracklib</literal> package will enable you to force stricter password rule, for example, by having active lines in "<literal>/etc/pam.d/common-password</literal>" as:</simpara>
        <simpara>For <literal>lenny</literal>:</simpara>
        <screen>password required pam_cracklib.so retry=3 minlen=9 difok=3
password required pam_unix.so use_authtok nullok md5</screen>
        <simpara>For <literal>squeeze</literal>:</simpara>
        <screen>password required pam_cracklib.so retry=3 minlen=9 difok=3
password [success=1 default=ignore] pam_unix.so use_authtok nullok md5
password requisite pam_deny.so
password required pam_permit.so</screen>
      </section>
    </section>
    <section id="_other_access_controls">
      <title>Other access controls</title>
      <note>
        <simpara>See <xref linkend="_alt_sysrq"/> for restricting the kernel <ulink url="&secureattentionkeysak;">secure attention key (SAK)</ulink> feature.</simpara>
      </note>
      <section id="_sudo">
        <title>sudo</title>
        <simpara><literal>sudo</literal>(8) is a program designed to allow a sysadmin to give limited root privileges to users and log root activity. <literal>sudo</literal> requires only an ordinary user's password.  Install <literal>sudo</literal> package and activate it by setting options in "<literal>/etc/sudoers</literal>".  See configuration example at "<literal>/usr/share/doc/sudo/examples/sudoers</literal>".</simpara>
        <simpara>My usage of <literal>sudo</literal> for the single user system (see <xref linkend="_sudo_configuration"/>) is aimed to protect myself from my own stupidity. Personally, I consider using <literal>sudo</literal> a better alternative to using the system from the root account all the time.   For example, following will change the owner of "<literal>&lt;some_file&gt;</literal>" to "<literal>&lt;my_name&gt;</literal>":</simpara>
        <screen>$ sudo chown &lt;my_name&gt; &lt;some_file&gt;</screen>
        <simpara>Of course if you know the root password (as self-installed Debian users do), any command can be run under root from any user's account using "<literal>su -c</literal>".</simpara>
      </section>
      <section id="_selinux">
        <title>SELinux</title>
        <simpara><ulink url="&securityenhancedlinuxselinux;">Security-Enhanced Linux (SELinux)</ulink> is a framework to tighten privilege model tighter than the ordinary Unix-like security model with the <ulink url="&mandatoryaccesscontrolmac;">mandatory access control (MAC)</ulink> policies.  The root power may be restricted under some conditions.</simpara>
      </section>
      <section id="_restricting_access_to_some_server_services">
        <title>Restricting access to some server services</title>
        <simpara>The Internet <emphasis>super-server</emphasis>, <literal>inetd</literal>(8), is started at boot time by "<literal>/etc/rc2.d/S20inetd</literal>" (for RUNLEVEL=2), which is a symlink to "<literal>/etc/init.d/inetd</literal>".  Essentially, <literal>inetd</literal> allows one running daemon to invoke several others, reducing load on the system.</simpara>
        <simpara>Whenever a request for service arrives, its protocol and service are identified by looking them up in the databases in "<literal>/etc/protocols</literal>" and "<literal>/etc/services</literal>".  <literal>inetd</literal> then looks up a normal Internet service in "<literal>/etc/inetd.conf</literal>", or a <ulink url="&sunrpc;">Sun RPC</ulink> based service in "<literal>/etc/rpc.conf</literal>".</simpara>
        <simpara>For system security, make sure to disable unused services in "<literal>/etc/inetd.conf</literal>".   <ulink url="&sunrpc;">Sun RPC</ulink> services need to be active for NFS and other RPC based programs.</simpara>
        <simpara>Sometimes, <literal>inetd</literal> does not start the intended server directly but starts the <ulink url="&tcpwrapper;">TCP wrapper</ulink> program, <literal>tcpd</literal>(8), with the intended server name as its argument in "<literal>/etc/inetd.conf</literal>".  In this case, <literal>tcpd</literal> runs the appropriate server program after logging the request and doing some additional checks using "<literal>/etc/hosts.deny</literal>" and "<literal>/etc/hosts.allow</literal>".</simpara>
        <simpara>If you have problems with remote access in a recent Debian system, comment out "<literal>ALL: PARANOID</literal>" in "<literal>/etc/hosts.deny</literal>" if it exists.</simpara>
        <simpara>For details, see <literal>inetd</literal>(8), <literal>inetd.conf</literal>(5), <literal>protocols</literal>(5), <literal>services</literal>(5), <literal>tcpd</literal>(8), <literal>hosts_access</literal>(5), and <literal>hosts_options</literal>(5).</simpara>
        <simpara>For more information on <ulink url="&sunrpc;">Sun RPC</ulink>, see <literal>rpcinfo</literal>(8), <literal>portmap</literal>(8), and "<literal>/usr/share/doc/portmap/portmapper.txt.gz</literal>".</simpara>
        <simpara>There are also non-PAM based access control available for <literal>atd</literal>(8) and <literal>cron</literal>(8).</simpara>
      </section>
    </section>
    <section id="_security_of_authentication">
      <title>Security of authentication</title>
      <simpara>The information here may not be sufficient for your security needs but it should be a good start.</simpara>
      <section id="_secure_password_over_the_internet">
        <title>Secure password over the Internet</title>
        <simpara>Many popular transportation layer services communicate messages including password authentication in the plain text. It is very bad idea to transmit password in the plain text over the wild Internet where it can be intercepted.  You can run these services over "<ulink url="&transportlayersecurity;">Transport Layer Security</ulink>" (TLS) or its predecessor, "Secure Sockets Layer" (SSL) to secure entire communication including password by the encryption.</simpara>
        <table id="listofinsecureanservicesandports" pgwide="0" frame="topbot" rowsep="1" colsep="1">
          <title>List of insecure and secure services and ports.</title>
          <tgroup cols="4">
            <colspec colwidth="25%*" align="left"/>
            <colspec colwidth="25%*" align="left"/>
            <colspec colwidth="25%*" align="left"/>
            <colspec colwidth="25%*" align="left"/>
            <thead>
              <row>
                <entry>
    insecure service name
    </entry>
                <entry>
    port
    </entry>
                <entry>
    secure service name
    </entry>
                <entry>
    port
    </entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry>
    www (http)
    </entry>
                <entry>
    80
    </entry>
                <entry>
    https
    </entry>
                <entry>
    443
    </entry>
              </row>
              <row>
                <entry>
    smtp (mail)
    </entry>
                <entry>
    25
    </entry>
                <entry>
    ssmtp (smtps)
    </entry>
                <entry>
    465
    </entry>
              </row>
              <row>
                <entry>
    ftp-data
    </entry>
                <entry>
    20
    </entry>
                <entry>
    ftps-data
    </entry>
                <entry>
    989
    </entry>
              </row>
              <row>
                <entry>
    ftp
    </entry>
                <entry>
    21
    </entry>
                <entry>
    ftps
    </entry>
                <entry>
    990
    </entry>
              </row>
              <row>
                <entry>
    telnet
    </entry>
                <entry>
    23
    </entry>
                <entry>
    telnets
    </entry>
                <entry>
    992
    </entry>
              </row>
              <row>
                <entry>
    imap2
    </entry>
                <entry>
    143
    </entry>
                <entry>
    imaps
    </entry>
                <entry>
    993
    </entry>
              </row>
              <row>
                <entry>
    pop3
    </entry>
                <entry>
    110
    </entry>
                <entry>
    pop3s
    </entry>
                <entry>
    995
    </entry>
              </row>
              <row>
                <entry>
    ldap
    </entry>
                <entry>
    389
    </entry>
                <entry>
    ldaps
    </entry>
                <entry>
    636
    </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
        <simpara>The encryption costs CPU time.  As a CPU friendly alternative, you can keep communication in plain text while securing just password with the secure authentication protocol such as "Authenticated Post Office Protocol" (APOP) for POP and "Challenge-Response Authentication Mechanism MD5" (CRAM-MD5) for SMTP and IMAP.  (For sending mail messages over the Internet to your mail server from your mail client, it is recently popular to use new message submission port 587 instead of traditional SMTP port 25 to avoid port 25 blocking by the network provider while authenticating yourself with CRAM-MD5.)</simpara>
      </section>
      <section id="_secure_shell">
        <title>Secure Shell</title>
        <simpara>The <ulink url="&secureshellssh;">Secure Shell (SSH)</ulink> program provides secure encrypted communications between two untrusted hosts over an insecure network with the secure authentication. It consists of the <ulink url="&openssh;">OpenSSH</ulink> client, <literal>ssh</literal>(1), and the <ulink url="&openssh;">OpenSSH</ulink> daemon, <literal>sshd</literal>(8).  This SSH can be used to tunnel the insecure protocol communication such as POP and X securely over the Internet with the port forwarding feature.</simpara>
        <simpara>The client tries to authenticate itself using host-based authentication, public key authentication, challenge-response authentication, or password authentication.  The use of public key authentication enables the remote password-less login. See <xref linkend="_the_remote_access_server_and_utility_ssh"/>.</simpara>
      </section>
      <section id="_extra_security_measures_for_the_internet">
        <title>Extra security measures for the Internet</title>
        <simpara>Even when you run secure services such as <ulink url="&secureshellssh;">Secure Shell (SSH)</ulink> and <ulink url="&pointtopointtunnlingprotocolpptp;">Point-to-point tunneling protocol (PPTP)</ulink> servers, there are still chances for the break-ins using brute force password guessing attack etc. from the Internet.  Use of the firewall policy (see <xref linkend="_netfilter"/>) together with the following secure tools may improve the security situation.</simpara>
        <table id="listoftoolstoprosecuritymeasures" pgwide="0" frame="topbot" rowsep="1" colsep="1">
          <title>List of tools to provide extra security measures.</title>
          <tgroup cols="4">
            <colspec colwidth="20%*" align="left"/>
            <colspec colwidth="20%*" align="left"/>
            <colspec colwidth="20%*" align="left"/>
            <colspec colwidth="40%*" align="left"/>
            <thead>
              <row>
                <entry>
    package
    </entry>
                <entry>
    popcon
    </entry>
                <entry>
    size
    </entry>
                <entry>
    description
    </entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/knockd">
                  <literal>knockd</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/knockd">&pop-knockd;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/k/knockd.html">&size-knockd;</ulink></entry>
                <entry>
    small port-knock daemon <literal>knocked</literal>(1) and client <literal>konck</literal>(1)
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/denyhosts">
                  <literal>denyhosts</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/denyhosts">&pop-denyhosts;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/d/denyhosts.html">&size-denyhosts;</ulink></entry>
                <entry>
    an utility to help sysadmins thwart ssh hackers
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/fail2ban">
                  <literal>fail2ban</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/fail2ban">&pop-failcban;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/f/fail2ban.html">&size-failcban;</ulink></entry>
                <entry>
    bans IPs that cause multiple authentication errors
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/libpam-shield">
                  <literal>libpam-shield</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/libpam-shield">&pop-libpamshield;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/libp/libpam-shield.html">&size-libpamshield;</ulink></entry>
                <entry>
    locks out remote attackers trying password guessing
    </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
      </section>
      <section id="_securing_the_root_password">
        <title>Securing the root password</title>
        <simpara>To prevent people to access your machine with root privilege, you need to:</simpara>
        <itemizedlist>
          <listitem>
            <simpara>
prevent physical access to the hard disk.
</simpara>
          </listitem>
          <listitem>
            <simpara>
lock BIOS and prevent booting from the removable media.
</simpara>
          </listitem>
          <listitem>
            <simpara>
set password for GRUB interactive session.
</simpara>
          </listitem>
          <listitem>
            <simpara>
lock GRUB menu from editing.
</simpara>
          </listitem>
        </itemizedlist>
        <simpara>With physical access to hard disk, resetting the password is relatively easy;</simpara>
        <itemizedlist>
          <listitem>
            <simpara>
move the hard disk to a PC with CD bootable BIOS.
</simpara>
          </listitem>
          <listitem>
            <simpara>
boot system with a rescue media (Debian boot disk, Knopix CD, GRUB CD, …).
</simpara>
          </listitem>
          <listitem>
            <simpara>
mount root partition with read-write access.
</simpara>
          </listitem>
          <listitem>
            <simpara>
edit "<literal>/etc/passwd</literal>" in the root partition and make the second entry for the <literal>root</literal> account empty.
</simpara>
          </listitem>
        </itemizedlist>
        <simpara>If you have the edit access to the GRUB menu entry (see <xref linkend="_stage_2_the_boot_loader"/>) for <literal>grub-rescue-pc</literal> at the boot time, it is even easier:</simpara>
        <itemizedlist>
          <listitem>
            <simpara>
boot system with the kernel parameter changed to something like "<literal>root=/dev/hda6 rw init=/bin/sh</literal>".
</simpara>
          </listitem>
          <listitem>
            <simpara>
edit "<literal>/etc/passwd</literal>" and make the second entry for the <literal>root</literal> account empty.
</simpara>
          </listitem>
          <listitem>
            <simpara>
reboot system.
</simpara>
          </listitem>
        </itemizedlist>
        <simpara>The root shell of the system is now accessible without password.</simpara>
        <note>
          <simpara>Once you have root shell access, you can compromise password for all user accounts using brute force password cracking tools such as <literal>john</literal> and <literal>crack</literal> packages (see <xref linkend="_system_security_and_integrity_check"/>).</simpara>
        </note>
        <simpara>The only reasonable software solution to avoid all these concerns is to use software encrypted root partition (or "<literal>/etc</literal>" partition) using <ulink url="&dmcrypt;">dm-crypt</ulink> and initramfs (see <xref linkend="_data_encryption_tips"/>).  You always need password to boot the system, though.</simpara>
      </section>
    </section>
  </chapter>
  <chapter id="_network_setup">
    <title>Network setup</title>
    <tip>
      <simpara>For general guide to the GNU/Linux networking, read the <ulink url="&linuxnetworkadministratorsguide;">Linux Network Administrators Guide</ulink>.</simpara>
    </tip>
    <simpara>The traditional <ulink url="&tcpipnetwork;">TCP/IP network</ulink> setup on Debian system uses <literal>ifupdown</literal> package as a high level tool.  There are 2 typical cases:</simpara>
    <itemizedlist>
      <listitem>
        <simpara>
For <emphasis role="strong">dynamic IP</emphasis> system such as mobile PCs, you should setup TCP/IP network <emphasis role="strong">with</emphasis> the <literal>resolvconf</literal> package and enable you to switch your network configuration easily (see <xref linkend="_the_network_interface_served_by_the_dhcp"/>).
</simpara>
      </listitem>
      <listitem>
        <simpara>
For <emphasis role="strong">static IP</emphasis> system such as servers, you should setup TCP/IP network <emphasis role="strong">without</emphasis> the <literal>resolvconf</literal> package and keep your system simple (see <xref linkend="_the_network_interface_with_the_static_ip"/>).
</simpara>
      </listitem>
    </itemizedlist>
    <simpara>We will describe these traditional cases in detail here.</simpara>
    <simpara>We will also touch on some alternative high level tools such as <literal>network-manager</literal> and <literal>wicd</literal> which ease configuration of wireless networks (see <xref linkend="_automatic_network_configuration"/>).</simpara>
    <section id="_the_basic_network_infrastructure">
      <title>The basic network infrastructure</title>
      <simpara>Let's review the basic network infrastructure on the modern Debian system.</simpara>
      <section id="_the_domain_name">
        <title>The domain name</title>
        <simpara>The naming for the domain name is a tricky one for the normal PC workstation users.  The PC workstation may be mobile one hopping around the network or located behind the NAT firewall inaccessible from the Internet. For such case, you may not want the domain name to be a valid domain name to avoid name collision.</simpara>
        <simpara>According to <ulink url="&rfccgag;">rfc2606</ulink>, "<literal>invalid</literal>" seems to be a choice for the <ulink url="&topleveldomaintld;">top level domain (TLD)</ulink> to construct domain names that are sure to be invalid from the Internet.</simpara>
        <simpara>The <ulink url="&mdns;">mDNS</ulink> network discovery protocol (<ulink url="&applebonjourapplerendezvous;">Apple Bonjour / Apple Rendezvous</ulink>, Avahi on Debian) uses <ulink url="&local;">"local"</ulink> as the <ulink url="&pseudotopleveldomain;">pseudo-top-level domain</ulink>.  <ulink url="&microsoftalsoseelocalareanetwork;">Microsoft also seems to promote "local" for the TLD of local area network</ulink>.</simpara>
        <simpara>Other popular choices for the invalid TLD seem to be "<literal>localdomain</literal>", "<literal>lan</literal>", "<literal>localnet</literal>", or "<literal>home</literal>" according to my incoming mail analysis.</simpara>
      </section>
      <section id="_the_hostname_resolution">
        <title>The hostname resolution</title>
        <simpara>The hostname resolution is currently supported by the <ulink url="&nssnameserviceswitch;">NSS (Name Service Switch)</ulink> mechanism too.  The flow of this resolution is:</simpara>
        <orderedlist>
          <listitem>
            <simpara>
The "<literal>/etc/nsswitch.conf</literal>" file with stanza like "<literal>hosts: files dns</literal>" dictates the hostname resolution order. (This replaces the old functionality of the "<literal>order</literal>" stanza in "<literal>/etc/host.conf</literal>".)
</simpara>
          </listitem>
          <listitem>
            <simpara>
The <literal>files</literal> method is invoked first.  If the hostname is found in the "<literal>/etc/hosts</literal>" file, it returns all valid addresses for it and exits. (The "<literal>/etc/host.conf</literal>" file contains "<literal>multi on</literal>".)
</simpara>
          </listitem>
          <listitem>
            <simpara>
The <literal>dns</literal> method is invoked.  If the hostname is found by the query to the <ulink url="&internetdomainnamesystemdns;">Internet Domain Name System (DNS)</ulink> identified by the "<literal>/etc/resolv.conf</literal>" file, it returns all valid addresses for it and exits.
</simpara>
          </listitem>
        </orderedlist>
        <simpara>The "<literal>/etc/hosts</literal>" file <ulink url="&associatesipaddrseswithhostnames;">associates IP addresses with hostnames</ulink>:</simpara>
        <screen>127.0.0.1 localhost
127.0.1.1 &lt;host_name&gt;.&lt;domain_name&gt; &lt;host_name&gt;

# The following lines are desirable for IPv6 capable hosts
::1     ip6-localhost ip6-loopback
fe00::0 ip6-localnet
ff00::0 ip6-mcastprefix
ff02::1 ip6-allnodes
ff02::2 ip6-allrouters
ff02::3 ip6-allhosts</screen>
        <simpara>Here the &lt;host_name&gt; in this matches the own hostname defined in the "<literal>/etc/hostname</literal>".  The &lt;domain_name&gt; in this is the <ulink url="&fullyqualifieddomainnamefqdn;">fully qualified domain name (FQDN)</ulink> of this host.</simpara>
        <tip>
          <simpara>For the mobile PC without real FQDN, you may pick a TLD such as bogus "<literal>invalid</literal>" or mDNS "<literal>local</literal>" as the TLD part of &lt;domain_name&gt; in this configuration.</simpara>
        </tip>
        <simpara>The "<literal>/etc/resolv.conf</literal>" is a static file if the <literal>resolvconf</literal> package is not installed.  If installed, it is a symbolic link.  Either way, it contains information that initialize the resolver routines. If the DNS is found at IP="<literal>192.168.11.1</literal>", it contains:</simpara>
        <screen>nameserver 192.168.11.1</screen>
        <simpara>The <literal>resolvconf</literal> package makes this "<literal>/etc/resolv.conf</literal>" into a symbolic link and manages its contents by the hook scripts automatically.</simpara>
        <simpara>The hostname resolution via Multicast DNS (using <ulink url="&zeroconf;">Zeroconf</ulink>, aka <ulink url="&applebonjourapplerendezvous;">Apple Bonjour / Apple Rendezvous</ulink>) which effectively allows name resolution by common Unix/Linux programs in the ad-hoc mDNS domain "<literal>local</literal>", can be provided by installing the <literal>libnss-mdns</literal> package.  The "<literal>/etc/nsswitch.conf</literal>" file should have stanza like "<literal>hosts: files mdns4_minimal [NOTFOUND=return] dns mdns4</literal>" to enable this functionality.</simpara>
      </section>
      <section id="_the_network_interface_name">
        <title>The network interface name</title>
        <simpara>The network interface name, e.g. <literal>eth0</literal>, is assigned to each hardware in the Linux kernel through the user space configuration mechanism, <literal>udev</literal> (see <xref linkend="_the_udev_system"/>), as it is found.  The network interface name is referred as <emphasis role="strong">physical interface</emphasis> in <literal>ifup</literal>(8) and <literal>interfaces</literal>(5).</simpara>
        <simpara>In order to ensure each network interface to be named persistently for each reboot using <ulink url="&macaddress;">MAC address</ulink> etc., there is a record file "<literal>/etc/udev/rules.d/70-persistent-net.rules</literal>".  This file is automatically generated by the "<literal>/lib/udev/write_net_rules</literal>" program, probably run by the "<literal>persistent-net-generator.rules</literal>" rules file. You can modify it to change naming rule.</simpara>
        <caution>
          <simpara>When editing the "<literal>/etc/udev/rules.d/70-persistent-net.rules</literal>" rules file, you must keep each rule on a single line and the <ulink url="&macaddress;">MAC address</ulink> in lowercase. For example, if you find "Firewire device" and "PCI device" in this file, you probably want to name "PCI device" as <literal>eth0</literal> and configure it as the primary network interface.</simpara>
        </caution>
      </section>
      <section id="_the_network_address_range_for_the_lan">
        <title>The network address range for the LAN</title>
        <simpara>Let us be reminded of the IPv4 32 bit address ranges in each class reserved for use on the <ulink url="&localareanetworkslans;">local area networks (LANs)</ulink> by <ulink url="&rfcbjbi;">rfc1918</ulink>.  These addresses are guaranteed not to conflict with any addresses on the Internet proper.</simpara>
        <table id="listofnetworkaddressranges" pgwide="0" frame="topbot" rowsep="1" colsep="1">
          <title>List of network address ranges.</title>
          <tgroup cols="5">
            <colspec colwidth="10%*" align="left"/>
            <colspec colwidth="10%*" align="left"/>
            <colspec colwidth="10%*" align="left"/>
            <colspec colwidth="10%*" align="left"/>
            <colspec colwidth="60%*" align="left"/>
            <thead>
              <row>
                <entry>
    Class
    </entry>
                <entry>
    network addresses
    </entry>
                <entry>
    net mask
    </entry>
                <entry>
    net mask /bits
    </entry>
                <entry>
    # of subnets
    </entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry>
    A
    </entry>
                <entry>
    10.x.x.x
    </entry>
                <entry>
    255.0.0.0
    </entry>
                <entry>
    /8
    </entry>
                <entry>
    1
    </entry>
              </row>
              <row>
                <entry>
    B
    </entry>
                <entry>
    172.16.x.x — 172.31.x.x
    </entry>
                <entry>
    255.255.0.0
    </entry>
                <entry>
    /16
    </entry>
                <entry>
    16
    </entry>
              </row>
              <row>
                <entry>
    C
    </entry>
                <entry>
    192.168.0.x — 192.168.255.x
    </entry>
                <entry>
    255.255.255.0
    </entry>
                <entry>
    /24
    </entry>
                <entry>
    256
    </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
        <note>
          <simpara>If one of these addresses is assigned to a host, then that host must not access the Internet directly but must access it through a gateway that acts as a proxy for individual services or else does <ulink url="&networkaddresstranslationnat;">Network Address Translation(NAT)</ulink>.  The broadband router usually performs NAT for the consumer LAN environment.</simpara>
        </note>
      </section>
      <section id="_the_network_configuration_infrastructure">
        <title>The network configuration infrastructure</title>
        <simpara>There are 2 types of low level networking programs for Linux networking system (see <xref linkend="_iproute2_commands"/>).</simpara>
        <itemizedlist>
          <listitem>
            <simpara>
Old <ulink url="&nettools;">net-tools</ulink> programs (<literal>ifconfig</literal>(8), …) are from the Linux NET-3 networking system. Most of these are obsolete now.
</simpara>
          </listitem>
          <listitem>
            <simpara>
New <ulink url="&linuxiproutec;">Linux iproute2</ulink> programs (<literal>ip</literal>(8), …) are the current Linux networking system.
</simpara>
          </listitem>
        </itemizedlist>
        <simpara>Although these low level networking programs are powerful, they are cumbersome to use.  So high level network configuration systems have been created.</simpara>
        <simpara>The <literal>ifupdown</literal> package is the de facto standard for such high level network configuration system on Debian.  It enables you to bring up network simply by doing , e.g., "<literal>ifup eth0</literal>".  Its configuration file is the "<literal>/etc/network/interfaces</literal>" file and its typical contents are:</simpara>
        <screen>auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp</screen>
        <simpara>The <literal>resolvconf</literal> package was created to supplement <literal>ifupdown</literal> system to support smooth reconfiguration of network address resolution by automating rewrite of resolver configuration file "<literal>/etc/resolv.conf</literal>".  Now, most Debian network configuration packages are modified to use <literal>resolvconf</literal> package (see "<literal>/usr/share/doc/resolvconf/README.Debian</literal>").</simpara>
        <simpara>Helper scripts to the <literal>ifupdown</literal> package such as <literal>ifplugd</literal>, <literal>guessnet</literal>, <literal>ifscheme</literal>, etc. are created to automate dynamic configuration of network environment such as one for mobile PC on wired LAN.  These are relatively difficult to use but play well with existing <literal>ifupdown</literal> system.</simpara>
        <simpara>Alternative high level network configuration systems, independent of <literal>ifupdown</literal> system, such as <literal>network-manager</literal>, <literal>wicd</literal>, etc. are created to ease configuration of network environment even for mobile PC on wireless network.  Since these are relatively new system and their integration to Debian system is in progress, you may still need to disable the corresponding network interface configuration manually in "<literal>/etc/network/interfaces</literal>" to avoid conflicts between these and <literal>ifupdown</literal> (see <xref linkend="_automatic_network_configuration"/>).</simpara>
        <table id="listofnetworkconfigurationtools" pgwide="0" frame="topbot" rowsep="1" colsep="1">
          <title>List of network configuration tools.</title>
          <tgroup cols="5">
            <colspec colwidth="10%*" align="left"/>
            <colspec colwidth="10%*" align="left"/>
            <colspec colwidth="10%*" align="left"/>
            <colspec colwidth="10%*" align="left"/>
            <colspec colwidth="60%*" align="left"/>
            <thead>
              <row>
                <entry>
    packages
    </entry>
                <entry>
    popcon
    </entry>
                <entry>
    size
    </entry>
                <entry>
    type
    </entry>
                <entry>
    function
    </entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/ifupdown">
                  <literal>ifupdown</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/ifupdown">&pop-ifupdown;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/i/ifupdown.html">&size-ifupdown;</ulink></entry>
                <entry>
    config::<ulink url="&ifupdown;">ifupdown</ulink>
    </entry>
                <entry>
    Standardized tool to bring up and down the network (Debian specific)
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/ifplugd">
                  <literal>ifplugd</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/ifplugd">&pop-ifplugd;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/i/ifplugd.html">&size-ifplugd;</ulink></entry>
                <entry>
    , ,
    </entry>
                <entry>
    Manage the wired network automatically
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/ifupdown-extra">
                  <literal>ifupdown-extra</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/ifupdown-extra">&pop-ifupdownextra;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/i/ifupdown-extra.html">&size-ifupdownextra;</ulink></entry>
                <entry>
    , ,
    </entry>
                <entry>
    Network testing script to enhance "<literal>ifupdown</literal>" package
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/ifmetric">
                  <literal>ifmetric</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/ifmetric">&pop-ifmetric;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/i/ifmetric.html">&size-ifmetric;</ulink></entry>
                <entry>
    , ,
    </entry>
                <entry>
    Set routing metrics for a network interface.
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/guessnet">
                  <literal>guessnet</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/guessnet">&pop-guessnet;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/g/guessnet.html">&size-guessnet;</ulink></entry>
                <entry>
    , ,
    </entry>
                <entry>
    Mapping script to enhance "<literal>ifupdown</literal>" package via "<literal>/etc/network/interfaces</literal>" file
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/ifscheme">
                  <literal>ifscheme</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/ifscheme">&pop-ifscheme;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/i/ifscheme.html">&size-ifscheme;</ulink></entry>
                <entry>
    , ,
    </entry>
                <entry>
    Mapping scripts to enhance "<literal>ifupdown</literal>" package
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/ifupdown-scripts-zg2">
                  <literal>ifupdown-scripts-zg2</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/ifupdown-scripts-zg2">&pop-ifupdownscriptszgc;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/i/ifupdown-scripts-zg2.html">&size-ifupdownscriptszgc;</ulink></entry>
                <entry>
    , ,
    </entry>
                <entry>
    Zugschlus' interface scripts for ifupdown's manual method
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/network-manager">
                  <literal>network-manager</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/network-manager">&pop-networkmanager;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/n/network-manager.html">&size-networkmanager;</ulink></entry>
                <entry>
    config::<ulink url="&networkmanager;">NetworkManager</ulink>
    </entry>
                <entry>
    NetworkManager (daemon): Manage the network automatically
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/network-manager-gnome">
                  <literal>network-manager-gnome</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/network-manager-gnome">&pop-networkmanagergnome;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/n/network-manager-gnome.html">&size-networkmanagergnome;</ulink></entry>
                <entry>
    , ,
    </entry>
                <entry>
    NetworkManager (GNOME frontend)
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/network-manager-kde">
                  <literal>network-manager-kde</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/network-manager-kde">&pop-networkmanagerkde;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/n/network-manager-kde.html">&size-networkmanagerkde;</ulink></entry>
                <entry>
    , ,
    </entry>
                <entry>
    NetworkManager (KDE frontend)
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/wicd">
                  <literal>wicd</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/wicd">&pop-wicd;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/w/wicd.html">&size-wicd;</ulink></entry>
                <entry>
    config::<ulink url="&wicd;">wicd</ulink>
    </entry>
                <entry>
    Wired and wireless network manager
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/iptables">
                  <literal>iptables</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/iptables">&pop-iptables;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/i/iptables.html">&size-iptables;</ulink></entry>
                <entry>
    config::<ulink url="&netfilter;">Netfilter</ulink>
    </entry>
                <entry>
    Administration tools for packet filtering and NAT
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/iproute">
                  <literal>iproute</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/iproute">&pop-iproute;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/i/iproute.html">&size-iproute;</ulink></entry>
                <entry>
    config::<ulink url="&iproutec;">iproute2</ulink>
    </entry>
                <entry>
    IPv6 and other advanced network configuration: <literal>ip</literal>(8), <literal>tc</literal>(8), etc.
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/ifrename">
                  <literal>ifrename</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/ifrename">&pop-ifrename;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/i/ifrename.html">&size-ifrename;</ulink></entry>
                <entry>
    , ,
    </entry>
                <entry>
    Rename network interfaces based on various static criteria: <literal>ifrename</literal>(8)
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/ethtool">
                  <literal>ethtool</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/ethtool">&pop-ethtool;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/e/ethtool.html">&size-ethtool;</ulink></entry>
                <entry>
    , ,
    </entry>
                <entry>
    Display or change Ethernet device settings
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/iputils-ping">
                  <literal>iputils-ping</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/iputils-ping">&pop-iputilsping;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/i/iputils-ping.html">&size-iputilsping;</ulink></entry>
                <entry>
    test::<ulink url="&iproutec;">iproute2</ulink>
    </entry>
                <entry>
    Tools to test network reachability of a remote host by <ulink url="&hostname;">hostname</ulink> or <ulink url="&ipaddress;">IP address</ulink>
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/iputils-arping">
                  <literal>iputils-arping</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/iputils-arping">&pop-iputilsarping;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/i/iputils-arping.html">&size-iputilsarping;</ulink></entry>
                <entry>
    , ,
    </entry>
                <entry>
    Tools to test network reachability of a remote host specified by the <ulink url="&arp;">ARP</ulink> address
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/iputils-tracepath">
                  <literal>iputils-tracepath</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/iputils-tracepath">&pop-iputilstracepath;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/i/iputils-tracepath.html">&size-iputilstracepath;</ulink></entry>
                <entry>
    , ,
    </entry>
                <entry>
    Tools to trace the network path to a remote host
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/net-tools">
                  <literal>net-tools</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/net-tools">&pop-nettools;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/n/net-tools.html">&size-nettools;</ulink></entry>
                <entry>
    config::<ulink url="&nettools;">net-tools</ulink>
    </entry>
                <entry>
    The NET-3 networking toolkit (IPv4 network configuration):  <literal>ifconfig</literal>(8) etc.
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/inetutils-ping">
                  <literal>inetutils-ping</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/inetutils-ping">&pop-inetutilsping;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/i/inetutils-ping.html">&size-inetutilsping;</ulink></entry>
                <entry>
    test::<ulink url="&nettools;">net-tools</ulink>
    </entry>
                <entry>
    Tools to test network reachability of a remote host by <ulink url="&hostname;">hostname</ulink> or <ulink url="&ipaddress;">IP address</ulink> (legacy, GNU)
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/arping">
                  <literal>arping</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/arping">&pop-arping;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/a/arping.html">&size-arping;</ulink></entry>
                <entry>
    , ,
    </entry>
                <entry>
    Tools to test network reachability of a remote host specified by the <ulink url="&arp;">ARP</ulink> address (legacy)
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/traceroute">
                  <literal>traceroute</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/traceroute">&pop-traceroute;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/t/traceroute.html">&size-traceroute;</ulink></entry>
                <entry>
    , ,
    </entry>
                <entry>
    Tools to trace the network path to a remote host (legacy, console)
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/dhcp3-client">
                  <literal>dhcp3-client</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/dhcp3-client">&pop-dhcpdclient;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/d/dhcp3-client.html">&size-dhcpdclient;</ulink></entry>
                <entry>
    config::low-level
    </entry>
                <entry>
    DHCP client
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/wpasupplicant">
                  <literal>wpasupplicant</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/wpasupplicant">&pop-wpasupplicant;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/w/wpasupplicant.html">&size-wpasupplicant;</ulink></entry>
                <entry>
    , ,
    </entry>
                <entry>
    Client support for WPA and WPA2 (IEEE 802.11i)
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/wireless-tools">
                  <literal>wireless-tools</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/wireless-tools">&pop-wirelesstools;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/w/wireless-tools.html">&size-wirelesstools;</ulink></entry>
                <entry>
    , ,
    </entry>
                <entry>
    Tools for manipulating Linux Wireless Extensions
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/ppp">
                  <literal>ppp</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/ppp">&pop-ppp;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/p/ppp.html">&size-ppp;</ulink></entry>
                <entry>
    , ,
    </entry>
                <entry>
    PPP/PPPoE connection with <literal>chat</literal>
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/pppoeconf">
                  <literal>pppoeconf</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/pppoeconf">&pop-pppoeconf;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/p/pppoeconf.html">&size-pppoeconf;</ulink></entry>
                <entry>
    config::helper
    </entry>
                <entry>
    Configuration helper for PPPoE connection
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/pppconfig">
                  <literal>pppconfig</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/pppconfig">&pop-pppconfig;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/p/pppconfig.html">&size-pppconfig;</ulink></entry>
                <entry>
    , ,
    </entry>
                <entry>
    Configuration helper for PPP connection with <literal>chat</literal>
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/wvdial">
                  <literal>wvdial</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/wvdial">&pop-wvdial;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/w/wvdial.html">&size-wvdial;</ulink></entry>
                <entry>
    , ,
    </entry>
                <entry>
    Configuration helper for PPP connection with <literal>wvdial</literal> and <literal>ppp</literal>
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/mtr-tiny">
                  <literal>mtr-tiny</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/mtr-tiny">&pop-mtrtiny;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/m/mtr-tiny.html">&size-mtrtiny;</ulink></entry>
                <entry>
    test::low-level
    </entry>
                <entry>
    Tools to trace the network path to a remote host (curses)
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/mtr">
                  <literal>mtr</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/mtr">&pop-mtr;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/m/mtr.html">&size-mtr;</ulink></entry>
                <entry>
    , ,
    </entry>
                <entry>
    Tools to trace the network path to a remote host (curses and GTK+)
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/gnome-nettool">
                  <literal>gnome-nettool</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/gnome-nettool">&pop-gnomenettool;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/g/gnome-nettool.html">&size-gnomenettool;</ulink></entry>
                <entry>
    , ,
    </entry>
                <entry>
    Tools for common network information operations (GNOME)
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/nmap">
                  <literal>nmap</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/nmap">&pop-nmap;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/n/nmap.html">&size-nmap;</ulink></entry>
                <entry>
    , ,
    </entry>
                <entry>
    Network mapper / port scanner (<ulink url="&nmap;">Nmap</ulink>, console)
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/zenmap">
                  <literal>zenmap</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/zenmap">&pop-zenmap;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/z/zenmap.html">&size-zenmap;</ulink></entry>
                <entry>
    , ,
    </entry>
                <entry>
    Network mapper / port scanner (GTK+)
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/knmap">
                  <literal>knmap</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/knmap">&pop-knmap;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/k/knmap.html">&size-knmap;</ulink></entry>
                <entry>
    , ,
    </entry>
                <entry>
    Network mapper / port scanner (KDE)
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/tcpdump">
                  <literal>tcpdump</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/tcpdump">&pop-tcpdump;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/t/tcpdump.html">&size-tcpdump;</ulink></entry>
                <entry>
    , ,
    </entry>
                <entry>
    Network traffic analyzer (<ulink url="&tcpdump;">Tcpdump</ulink>, console)
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/wireshark">
                  <literal>wireshark</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/wireshark">&pop-wireshark;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/w/wireshark.html">&size-wireshark;</ulink></entry>
                <entry>
    , ,
    </entry>
                <entry>
    Network traffic analyzer (<ulink url="&wireshark;">Wireshark</ulink>, GTK+)
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/tshark">
                  <literal>tshark</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/tshark">&pop-tshark;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/t/tshark.html">&size-tshark;</ulink></entry>
                <entry>
    , ,
    </entry>
                <entry>
    Network traffic analyzer (console)
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/nagios3">
                  <literal>nagios3</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/nagios3">&pop-nagiosd;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/n/nagios3.html">&size-nagiosd;</ulink></entry>
                <entry>
    , ,
    </entry>
                <entry>
    Monitoring and management system for hosts, services and networks (<ulink url="&nagios;">Nagios</ulink>)
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/tcptrace">
                  <literal>tcptrace</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/tcptrace">&pop-tcptrace;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/t/tcptrace.html">&size-tcptrace;</ulink></entry>
                <entry>
    , ,
    </entry>
                <entry>
    Tool to produce a summarization of the connections from <literal>tcpdump</literal> output
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/snort">
                  <literal>snort</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/snort">&pop-snort;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/s/snort.html">&size-snort;</ulink></entry>
                <entry>
    , ,
    </entry>
                <entry>
    Flexible network intrusion detection system (<ulink url="&snort;">Snort</ulink>)
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/ntop">
                  <literal>ntop</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/ntop">&pop-ntop;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/n/ntop.html">&size-ntop;</ulink></entry>
                <entry>
    , ,
    </entry>
                <entry>
    Display network usage in web browser
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/dnsutils">
                  <literal>dnsutils</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/dnsutils">&pop-dnsutils;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/d/dnsutils.html">&size-dnsutils;</ulink></entry>
                <entry>
    , ,
    </entry>
                <entry>
    Network clients provided with <ulink url="&bind;">BIND</ulink>: <literal>nslookup</literal>(8), <literal>nsupdate</literal>(8), <literal>dig</literal>(8)
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/dlint">
                  <literal>dlint</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/dlint">&pop-dlint;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/d/dlint.html">&size-dlint;</ulink></entry>
                <entry>
    , ,
    </entry>
                <entry>
    Checks <ulink url="&dns;">DNS</ulink> zone information using nameserver lookups
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/dnstracer">
                  <literal>dnstracer</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/dnstracer">&pop-dnstracer;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/d/dnstracer.html">&size-dnstracer;</ulink></entry>
                <entry>
    , ,
    </entry>
                <entry>
    Tool to trace a chain of <ulink url="&dns;">DNS</ulink> servers to the source
    </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
      </section>
      <section id="_the_network_device_support">
        <title>The network device support</title>
        <simpara>Although most hardware devices are supported by the Debian system, there are some network devices which require <ulink url="&dsfg;">DSFG</ulink> non-free external hardware drivers to support them.  Please see <xref linkend="_non_free_hardware_drivers"/>.</simpara>
      </section>
    </section>
    <section id="_the_network_connection_method">
      <title>The network connection method</title>
      <caution>
        <simpara>The connection test method described in this section are meant for testing purposes.  It is not meant to be used directly for the daily network connection.  You are advised to use them via the <literal>ifupdown</literal> package (see <xref linkend="_the_basic_network_configuration_with_ifupdown"/>).</simpara>
      </caution>
      <simpara>The typical network connection method and connection path for a PC can be summarized as:</simpara>
      <table id="listofnetworkcondconnectionpaths" pgwide="0" frame="topbot" rowsep="1" colsep="1">
        <title>List of network connection methods and connection paths.</title>
        <tgroup cols="3">
          <colspec colwidth="30%*" align="left"/>
          <colspec colwidth="30%*" align="left"/>
          <colspec colwidth="40%*" align="left"/>
          <thead>
            <row>
              <entry>
    PC
    </entry>
              <entry>
    connection method
    </entry>
              <entry>
    connection path
    </entry>
            </row>
          </thead>
          <tbody>
            <row>
              <entry>
    Serial port (<literal>ppp0</literal>)
    </entry>
              <entry>
    PPP
    </entry>
              <entry>
    ⇔ <ulink url="&modem;">modem</ulink> ⇔ POTS ⇔ dial-up access point ⇔ ISP
    </entry>
            </row>
            <row>
              <entry>
    Ethernet port (<literal>eth0</literal>)
    </entry>
              <entry>
    PPPoE/DHCP/Static
    </entry>
              <entry>
    ⇔ BB-modem ⇔ BB service ⇔ BB access point ⇔ ISP
    </entry>
            </row>
            <row>
              <entry>
    Ethernet port (<literal>eth0</literal>)
    </entry>
              <entry>
    DHCP/Static
    </entry>
              <entry>
    ⇔ LAN ⇔ BB-router with <ulink url="&networkaddresstranslationnat;">network address translation (NAT)</ulink> (⇔ BB-modem …)
    </entry>
            </row>
          </tbody>
        </tgroup>
      </table>
      <simpara>Here is the summary of configuration script for each connection method:</simpara>
      <table id="listofnetworkcononconfigurations" pgwide="0" frame="topbot" rowsep="1" colsep="1">
        <title>List of network connection configurations.</title>
        <tgroup cols="3">
          <colspec colwidth="30%*" align="left"/>
          <colspec colwidth="30%*" align="left"/>
          <colspec colwidth="40%*" align="left"/>
          <thead>
            <row>
              <entry>
    connection method
    </entry>
              <entry>
    configuration
    </entry>
              <entry>
    backend package(s)
    </entry>
            </row>
          </thead>
          <tbody>
            <row>
              <entry>
    PPP
    </entry>
              <entry><literal>pppconfig</literal> to create deterministic chat
    </entry>
              <entry><literal>pppconfig</literal>, <literal>ppp</literal></entry>
            </row>
            <row>
              <entry>
    PPP (alternative)
    </entry>
              <entry><literal>wvdialconf</literal> to create heuristic chat
    </entry>
              <entry><literal>ppp</literal>, <literal>wvdial</literal></entry>
            </row>
            <row>
              <entry>
    PPPoE
    </entry>
              <entry><literal>pppoeconf</literal> to create deterministic chat
    </entry>
              <entry><literal>pppoeconf</literal>, <literal>ppp</literal></entry>
            </row>
            <row>
              <entry>
    DHCP
    </entry>
              <entry>
    described in "<literal>/etc/dhcp3/dhclient.conf</literal>"
    </entry>
              <entry>
                <literal>dhcp3-client</literal>
              </entry>
            </row>
            <row>
              <entry>
    static IP (IPv4)
    </entry>
              <entry>
    described in "<literal>/etc/network/interfaces</literal>"
    </entry>
              <entry>
                <literal>net-tools</literal>
              </entry>
            </row>
            <row>
              <entry>
    static IP (IPv6)
    </entry>
              <entry>
    described in "<literal>/etc/network/interfaces</literal>"
    </entry>
              <entry>
                <literal>iproute</literal>
              </entry>
            </row>
          </tbody>
        </tgroup>
      </table>
      <simpara>The network connection acronyms mean:</simpara>
      <table id="listofnetworkconnectionacronyms" pgwide="0" frame="topbot" rowsep="1" colsep="1">
        <title>List of network connection acronyms.</title>
        <tgroup cols="2">
          <colspec colwidth="30%*" align="left"/>
          <colspec colwidth="70%*" align="left"/>
          <thead>
            <row>
              <entry>
    acronym
    </entry>
              <entry>
    meaning
    </entry>
            </row>
          </thead>
          <tbody>
            <row>
              <entry>
                <ulink url="&pots;">POTS</ulink>
              </entry>
              <entry>
    The plain old telephone service
    </entry>
            </row>
            <row>
              <entry>
    BB
    </entry>
              <entry>
    The <ulink url="&broadband;">broadband</ulink>
    </entry>
            </row>
            <row>
              <entry>
    BB-service
    </entry>
              <entry>
    E.g., the digital subscriber line (DSL), the cable TV, or the fiber to the premises (FTTP).
    </entry>
            </row>
            <row>
              <entry>
    BB-modem
    </entry>
              <entry>
    E.g., <ulink url="&thedslmodem;">the DSL modem</ulink>, <ulink url="&thecablemodem;">the cable modem</ulink>, or <ulink url="&theopticalnetworkterminalont;">the optical network terminal (ONT)</ulink>.
    </entry>
            </row>
            <row>
              <entry>
                <ulink url="&lan;">LAN</ulink>
              </entry>
              <entry>
    The local area network
    </entry>
            </row>
            <row>
              <entry>
                <ulink url="&wan;">WAN</ulink>
              </entry>
              <entry>
    The wide area network
    </entry>
            </row>
            <row>
              <entry>
                <ulink url="&dhcp;">DHCP</ulink>
              </entry>
              <entry>
    The dynamic host configuration protocol
    </entry>
            </row>
            <row>
              <entry>
                <ulink url="&ppp;">PPP</ulink>
              </entry>
              <entry>
    The point-to-point protocol
    </entry>
            </row>
            <row>
              <entry>
                <ulink url="&pppoe;">PPPoE</ulink>
              </entry>
              <entry>
    The point-to-point protocol over Ethernet
    </entry>
            </row>
            <row>
              <entry>
                <ulink url="&isp;">ISP</ulink>
              </entry>
              <entry>
    The Internet service provider
    </entry>
            </row>
          </tbody>
        </tgroup>
      </table>
      <note>
        <simpara>The WAN connection services via cable TV are generally served by DHCP or PPPoE.  The ones by ADSL and FTTP are generally served by PPPoE.  You have to consult your ISP for exact configuration requirements of the WAN connection.</simpara>
      </note>
      <note>
        <simpara>When BB-router is used to create home LAN environment, PCs on LAN are connected to the WAN via BB-router with <ulink url="&networkaddresstranslationnat;">network address translation (NAT)</ulink>.  For such case, PC's network interfaces on the LAN are served by static IP or DHCP from the BB-router.  BB-router must be configured to connect the WAN following the instruction by your ISP.</simpara>
      </note>
      <section id="_the_dhcp_connection_with_the_ethernet">
        <title>The DHCP connection with the Ethernet</title>
        <simpara>The typical modern home and small business network, i.e. LAN, are connected to the WAN(Internet) using some consumer grade broadband router.  The LAN behind this router is usually served by the <ulink url="&dynamichostconfitionprotocoldhcp;">dynamic host configuration protocol (DHCP)</ulink> server running on the router.</simpara>
        <simpara>Just install the <literal>dhcp3-client</literal> package for the Ethernet served by the <ulink url="&dynamichostconfitionprotocoldhcp;">dynamic host configuration protocol (DHCP)</ulink>.</simpara>
      </section>
      <section id="_the_static_ip_connection_with_the_ethernet">
        <title>The static IP connection with the Ethernet</title>
        <simpara>No special action is needed for the Ethernet served by the static IP.</simpara>
      </section>
      <section id="_the_ppp_connection_with_pppconfig">
        <title>The PPP connection with pppconfig</title>
        <simpara>The configuration script <literal>pppconfig</literal> will configure the <ulink url="&ppp;">PPP</ulink> connection interactively just by selecting:</simpara>
        <itemizedlist>
          <listitem>
            <simpara>
the telephone number,
</simpara>
          </listitem>
          <listitem>
            <simpara>
the ISP user name,
</simpara>
          </listitem>
          <listitem>
            <simpara>
the ISP password,
</simpara>
          </listitem>
          <listitem>
            <simpara>
the port speed,
</simpara>
          </listitem>
          <listitem>
            <simpara>
the modem communication port, and
</simpara>
          </listitem>
          <listitem>
            <simpara>
the authentication method.
</simpara>
          </listitem>
        </itemizedlist>
        <simpara>The configuration files are:</simpara>
        <table id="listofconfigurationwithpppconfig" pgwide="0" frame="topbot" rowsep="1" colsep="1">
          <title>List of configuration files for the <ulink url="&ppp;">PPP</ulink> connection with pppconfig.</title>
          <tgroup cols="2">
            <colspec colwidth="30%*" align="left"/>
            <colspec colwidth="70%*" align="left"/>
            <thead>
              <row>
                <entry>
    file
    </entry>
                <entry>
    function
    </entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry>
                  <literal>/etc/ppp/peers/&lt;isp_name&gt;</literal>
                </entry>
                <entry>
    The <literal>pppconfig</literal> generated configuration file for <literal>pppd</literal> specific to &lt;isp_name&gt;
    </entry>
              </row>
              <row>
                <entry>
                  <literal>/etc/chatscripts/&lt;isp_name&gt;</literal>
                </entry>
                <entry>
    The <literal>pppconfig</literal> generated configuration file for <literal>chat</literal> specific to &lt;isp_name&gt;
    </entry>
              </row>
              <row>
                <entry>
                  <literal>/etc/ppp/options</literal>
                </entry>
                <entry>
    The general execution parameter for <literal>pppd</literal>
    </entry>
              </row>
              <row>
                <entry>
                  <literal>/etc/ppp/pap-secret</literal>
                </entry>
                <entry>
    Authentication data for the <ulink url="&pap;">PAP</ulink> (security risk)
    </entry>
              </row>
              <row>
                <entry>
                  <literal>/etc/ppp/chap-secret</literal>
                </entry>
                <entry>
    Authentication data for the <ulink url="&chap;">CHAP</ulink> (more secure)
    </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
        <caution>
          <simpara>The "&lt;isp_name&gt;" value of "<literal>provider</literal>" is assumed if <literal>pon</literal> and <literal>poff</literal> commands are invoked without arguments.</simpara>
        </caution>
        <simpara>You can test configuration using low level network configuration tools:</simpara>
        <screen>$ sudo pon &lt;isp_name&gt;
...
$ sudo poff &lt;isp_name&gt;</screen>
        <simpara>See "<literal>/usr/share/doc/ppp/README.Debian.gz</literal>" for more information.</simpara>
      </section>
      <section id="_the_alternative_ppp_connection_with_wvdialconf">
        <title>The alternative PPP connection with wvdialconf</title>
        <simpara>A different approach to using <literal>pppd</literal>(8) is to run it from <literal>wvdial</literal>(1) which comes in the <literal>wvdial</literal> package.  Instead of <literal>pppd</literal> running <literal>chat</literal>(8) to dial in and negotiate the connection, <literal>wvdial</literal> does the dialing and initial negotiating and then starts <literal>pppd</literal> to do the rest.</simpara>
        <simpara>The configuration script <literal>wvdialconf</literal> will configure the PPP connection interactively just by selecting:</simpara>
        <itemizedlist>
          <listitem>
            <simpara>
the telephone number,
</simpara>
          </listitem>
          <listitem>
            <simpara>
the ISP user name, and
</simpara>
          </listitem>
          <listitem>
            <simpara>
the ISP password.
</simpara>
          </listitem>
        </itemizedlist>
        <simpara><literal>wvdial</literal> succeeds in making the connection in most cases and maintains authentication data list automatically.</simpara>
        <simpara>The configuration files are:</simpara>
        <table id="listofconfiguratonwithwvdialconf" pgwide="0" frame="topbot" rowsep="1" colsep="1">
          <title>List of configuration files for the PPP connection with wvdialconf.</title>
          <tgroup cols="2">
            <colspec colwidth="30%*" align="left"/>
            <colspec colwidth="70%*" align="left"/>
            <thead>
              <row>
                <entry>
    file
    </entry>
                <entry>
    function
    </entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry>
                  <literal>/etc/ppp/peers/wvdial</literal>
                </entry>
                <entry>
    The <literal>wvdialconf</literal> generated configuration file for <literal>pppd</literal> specific to <literal>wvdial</literal>
    </entry>
              </row>
              <row>
                <entry>
                  <literal>/etc/wvdial.conf</literal>
                </entry>
                <entry>
    The <literal>wvdialconf</literal> generated configuration file
    </entry>
              </row>
              <row>
                <entry>
                  <literal>/etc/ppp/options</literal>
                </entry>
                <entry>
    The general execution parameter for <literal>pppd</literal>
    </entry>
              </row>
              <row>
                <entry>
                  <literal>/etc/ppp/pap-secret</literal>
                </entry>
                <entry>
    Authentication data for the <ulink url="&pap;">PAP</ulink> (security risk)
    </entry>
              </row>
              <row>
                <entry>
                  <literal>/etc/ppp/chap-secret</literal>
                </entry>
                <entry>
    Authentication data for the <ulink url="&chap;">CHAP</ulink> (more secure)
    </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
        <simpara>You can test configuration using low level network configuration tools:</simpara>
        <screen>$ sudo wvdial
...
$ sudo killall wvdial</screen>
        <simpara>See <literal>wvdial</literal>(1) and <literal>wvdial.conf</literal>(5) for more information.</simpara>
      </section>
      <section id="_the_pppoe_connection_with_pppoeconf">
        <title>The PPPoE connection with pppoeconf</title>
        <simpara>When your ISP serves you with PPPoE connection and you decide to connect your PC directly to the WAN, the network of your PC must be configured with the PPPoE. The PPPoE stand for PPP over Ethernet. The configuration script <literal>pppoeconf</literal> will configure the PPPoE connection interactively.</simpara>
        <simpara>The configuration files are:</simpara>
        <table id="listofconfigurationwithpppoeconf" pgwide="0" frame="topbot" rowsep="1" colsep="1">
          <title>List of configuration files for the PPPoE connection with pppoeconf.</title>
          <tgroup cols="2">
            <colspec colwidth="30%*" align="left"/>
            <colspec colwidth="70%*" align="left"/>
            <thead>
              <row>
                <entry>
    file
    </entry>
                <entry>
    function
    </entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry>
                  <literal>/etc/ppp/peers/dsl-provider</literal>
                </entry>
                <entry>
    The <literal>pppoeconf</literal> generated configuration file for <literal>pppd</literal> specific to <literal>pppoe</literal>
    </entry>
              </row>
              <row>
                <entry>
                  <literal>/etc/ppp/options</literal>
                </entry>
                <entry>
    The general execution parameter for <literal>pppd</literal>
    </entry>
              </row>
              <row>
                <entry>
                  <literal>/etc/ppp/pap-secret</literal>
                </entry>
                <entry>
    Authentication data for the <ulink url="&pap;">PAP</ulink> (security risk)
    </entry>
              </row>
              <row>
                <entry>
                  <literal>/etc/ppp/chap-secret</literal>
                </entry>
                <entry>
    Authentication data for the <ulink url="&chap;">CHAP</ulink> (more secure)
    </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
        <simpara>You can test configuration using low level network configuration tools:</simpara>
        <screen>$ sudo /sbin/ifconfig eth0 up
$ sudo pon dsl-provider
...
$ sudo poff dsl-provider
$ sudo /sbin/ifconfig eth0 down</screen>
        <simpara>See "<literal>/usr/share/doc/pppoeconf/README.Debian</literal>" for more information.</simpara>
      </section>
    </section>
    <section id="_the_basic_network_configuration_with_ifupdown">
      <title>The basic network configuration with ifupdown</title>
      <simpara>The <literal>ifupdown</literal> package provides the standardized framework for the high level network configuration in the Debian system. In this section, we learn the basic network configuration with <literal>ifupdown</literal> with simplified introduction and many typical examples.</simpara>
      <section id="_the_command_syntax_simplified">
        <title>The command syntax simplified</title>
        <simpara>The <literal>ifupdown</literal> package contains 2 commands: <literal>ifup</literal>(8) and <literal>ifdown</literal>(8).  They offer high level network configuration dictated by the configuration file "/etc/network/interfaces".</simpara>
        <table id="listofbasicnetwoandswithifupdown" pgwide="0" frame="topbot" rowsep="1" colsep="1">
          <title>List of basic network configuration commands with ifupdown.</title>
          <tgroup cols="2">
            <colspec colwidth="30%*" align="left"/>
            <colspec colwidth="70%*" align="left"/>
            <thead>
              <row>
                <entry>
    command
    </entry>
                <entry>
    action
    </entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry>
                  <literal>ifup eth0</literal>
                </entry>
                <entry>
    To bring up a network interface <literal>eth0</literal> with the configuration <literal>eth0</literal> if "<literal>iface eth0</literal>" stanza exists.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>ifdown eth0</literal>
                </entry>
                <entry>
    To bring down a network interface <literal>eth0</literal> with the configuration <literal>eth0</literal> if "<literal>iface eth0</literal>" stanza exists.
    </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
        <warning>
          <simpara>Do not use low level configuration tools such as <literal>ifconfig</literal>(8) and <literal>ip</literal>(8) commands to configure an interface in <emphasis role="strong">up</emphasis> state.</simpara>
        </warning>
        <note>
          <simpara>There is no command <literal>ifupdown</literal>.</simpara>
        </note>
      </section>
      <section id="_the_basic_syntax_of_etc_network_interfaces">
        <title>The basic syntax of "/etc/network/interfaces"</title>
        <simpara>The key syntax of "<literal>/etc/network/interfaces</literal>" as explained in <literal>interfaces</literal>(5) can be summarized as:</simpara>
        <table id="list-of-stanzas-in-eni" pgwide="0" frame="topbot" rowsep="1" colsep="1">
          <title>List of stanzas in "<literal>/etc/network/interfaces</literal>"</title>
          <tgroup cols="2">
            <colspec colwidth="30%*" align="left"/>
            <colspec colwidth="70%*" align="left"/>
            <thead>
              <row>
                <entry>
    stanza
    </entry>
                <entry>
    meaning
    </entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry>
    "<literal>auto &lt;interface_name&gt;</literal>"
    </entry>
                <entry>
    To start interface  &lt;interface_name&gt; upon start of the system.
    </entry>
              </row>
              <row>
                <entry>
    "<literal>allow-auto &lt;interface_name&gt;</literal>"
    </entry>
                <entry>
    , ,
    </entry>
              </row>
              <row>
                <entry>
    "<literal>allow-hotplug &lt;interface_name&gt;</literal>"
    </entry>
                <entry>
    To start interface &lt;interface_name&gt; when the kernel detects a hotplug event from the interface.
    </entry>
              </row>
              <row>
                <entry>
    Lines started with "<literal>iface &lt;config_name&gt; …</literal>"
    </entry>
                <entry>
    To define the network configuration &lt;config_name&gt;.
    </entry>
              </row>
              <row>
                <entry>
    Lines started with "<literal>mapping &lt;interface_name_glob&gt; </literal>"
    </entry>
                <entry>
    To define mapping value of &lt;config_name&gt; for the matching &lt;interface_name&gt;.
    </entry>
              </row>
              <row>
                <entry>
    A line starting with a hash "<literal>#</literal>"
    </entry>
                <entry>
    To be ignored as comments. (end-of-line comments are <emphasis role="strong">not</emphasis> supported)
    </entry>
              </row>
              <row>
                <entry>
    A line ending with a backslash "<literal>\</literal>"
    </entry>
                <entry>
    To extend the configuration to the next line.
    </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
        <simpara>Lines started with <emphasis role="strong"><literal>iface</literal></emphasis> stanza has the following syntax:</simpara>
        <screen>iface &lt;config_name&gt; &lt;address_family&gt; &lt;method_name&gt;
 &lt;option1&gt; &lt;value1&gt;
 &lt;option2&gt; &lt;value2&gt;
 ...</screen>
        <simpara>For the basic configuration, the <emphasis role="strong"><literal>mapping</literal></emphasis> stanza is not used and you use the network interface name as the network configuration name (See <xref linkend="_the_mapping_stanza"/>).</simpara>
        <warning>
          <simpara>Do not define duplicates of the "<literal>iface</literal>" stanza for a network interface in "<literal>/etc/network/interfaces</literal>".</simpara>
        </warning>
      </section>
      <section id="_the_loopback_network_interface">
        <title>The loopback network interface</title>
        <simpara>The following configuration entry in the "<literal>/etc/network/interfaces</literal>" file brings up the loopback network interface <literal>lo</literal> upon booting the system (via <emphasis role="strong"><literal>auto</literal></emphasis> stanza).</simpara>
        <screen>auto lo
iface lo inet loopback</screen>
        <simpara>This one always exists in the "<literal>/etc/network/interfaces</literal>" file.</simpara>
      </section>
      <section id="_the_network_interface_served_by_the_dhcp">
        <title>The network interface served by the DHCP</title>
        <simpara>After prepairing the system by <xref linkend="_the_dhcp_connection_with_the_ethernet"/>, the network interface served by the DHCP is configured by creating the configuration entry in the "<literal>/etc/network/interfaces</literal>" file as:</simpara>
        <screen>allow-hotplug eth0
iface eth0 inet dhcp
 hostname "mymachine"</screen>
        <simpara>When the Linux kernel detects the physical interface <literal>eth0</literal>, the <emphasis role="strong"><literal>allow-hotplug</literal></emphasis> stanza will cause <literal>ifup</literal> to bring up the interface and the <emphasis role="strong"><literal>iface</literal></emphasis> stanza will cause <literal>ifup</literal> to use DHCP to configure the interface.</simpara>
      </section>
      <section id="_the_network_interface_with_the_static_ip">
        <title>The network interface with the static IP</title>
        <simpara>The network interface served by the static IP is configured by creating the configuration entry in the "<literal>/etc/network/interfaces</literal>" file as, e.g.,:</simpara>
        <screen>allow-hotplug eth0
iface eth0 inet static
 address 192.168.11.100
 netmask 255.255.255.0
 broadcast 192.168.11.255
 gateway 192.168.11.1
 dns-domain lan
 dns-nameservers 192.168.11.1</screen>
        <simpara>When the Linux kernel detects the physical interface <literal>eth0</literal>, the <emphasis role="strong"><literal>allow-hotplug</literal></emphasis> stanza will cause <literal>ifup</literal> to bring up the interface and the <emphasis role="strong"><literal>iface</literal></emphasis> stanza will cause <literal>ifup</literal> to use the static IP to configure the interface.</simpara>
        <simpara>Here, I assumed:</simpara>
        <itemizedlist>
          <listitem>
            <simpara>
IP address range of the LAN network: <literal>192.168.11.0</literal> - <literal>192.168.11.255</literal>
</simpara>
          </listitem>
          <listitem>
            <simpara>
IP address of the gateway: <literal>192.168.11.1</literal>
</simpara>
          </listitem>
          <listitem>
            <simpara>
IP address of the PC: <literal>192.168.11.100</literal>
</simpara>
          </listitem>
          <listitem>
            <simpara>
The <literal>resolvconf</literal> package is installed.
</simpara>
          </listitem>
          <listitem>
            <simpara>
The domain name as "<literal>lan</literal>".
</simpara>
          </listitem>
          <listitem>
            <simpara>
IP address of the DNS server: <literal>192.168.11.1</literal>
</simpara>
          </listitem>
        </itemizedlist>
        <simpara>When the <literal>resolvconf</literal> package is not installed, DNS related configuration needs to be done manually by editing the "<literal>/etc/resolv.conf</literal>" as:</simpara>
        <screen>nameserver 192.168.11.1
domain lan</screen>
        <caution>
          <simpara>The IP addresses used in the above example are not meant to be copied literally.  You have to adjust IP numbers to your actual network configuration.</simpara>
        </caution>
      </section>
      <section id="_the_basics_of_wireless_lan_interface">
        <title>The basics of wireless LAN interface</title>
        <simpara>The <ulink url="&wirelesslanwlanforshort;">wireless LAN (WLAN for short)</ulink> provides the fast wireless connectivity through the spread-spectrum communication of unlicensed radio bands based on the set of standards called <ulink url="&ieeeiacbb;">IEEE 802.11</ulink>.</simpara>
        <simpara>The WLAN interfaces are almost like normal Ethernet interfaces but require some network ID and encryption key data to be provided when they are initialized.  Their high level network tools are exactly the same as that of Ethernet interfaces except interface names are a bit different like <literal>eth1</literal>, <literal>wlan0</literal>, <literal>ath0</literal>, <literal>wifi0</literal>, … depending on the kernel drivers used.</simpara>
        <tip>
          <simpara>The <literal>wmaster0</literal> device is the master device which is an internal device used only by <ulink url="&softmac;">SoftMAC</ulink> with new <ulink url="&maciacbbapioflinux;">mac80211 API of Linux</ulink>.</simpara>
        </tip>
        <simpara>Here are some keywords to remember for the WLAN:</simpara>
        <table id="listofacronymsforwlan" pgwide="0" frame="topbot" rowsep="1" colsep="1">
          <title>List of acronyms for WLAN.</title>
          <tgroup cols="3">
            <colspec colwidth="30%*" align="left"/>
            <colspec colwidth="30%*" align="left"/>
            <colspec colwidth="40%*" align="left"/>
            <thead>
              <row>
                <entry>
    acronym
    </entry>
                <entry>
    full word
    </entry>
                <entry>
    meaning
    </entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry>
    NWID
    </entry>
                <entry>
    Network ID
    </entry>
                <entry>
    The 16 bit network ID used by pre-802.11 <ulink url="&wavelan;">WaveLAN</ulink> network. Very much deprecated.
    </entry>
              </row>
              <row>
                <entry>
    (E)SSID
    </entry>
                <entry>
    (Extended) <ulink url="&servicesetidentifier;">Service Set Identifier</ulink>
    </entry>
                <entry>
    The network name of the <ulink url="&wirelessaccesspointsaps;">Wireless Access Points (APs)</ulink> interconnected to form an integrated <ulink url="&iacbbwirelesslan;">802.11 wireless LAN</ulink>.  Domain ID.
    </entry>
              </row>
              <row>
                <entry>
    WEP, (WEP2)
    </entry>
                <entry>
                  <ulink url="&wiredequivalentprivacy;">Wired Equivalent Privacy</ulink>
                </entry>
                <entry>
    The 1st generation 64-bit (128-bit) wireless encryption standard with 40-bit key. Deprecated.
    </entry>
              </row>
              <row>
                <entry>
    WPA
    </entry>
                <entry>
                  <ulink url="&wifiprotectedaccess;">Wi-Fi Protected Access</ulink>
                </entry>
                <entry>
    The 2nd generation wireless encryption standard (most of 802.11i), compatible with WEP.
    </entry>
              </row>
              <row>
                <entry>
    WPA2
    </entry>
                <entry>
                  <ulink url="&wifiprotectedaccessc;">Wi-Fi Protected Access 2</ulink>
                </entry>
                <entry>
    The 3rd generation wireless encryption standard (full 802.11i), non-compatible with WEP.
    </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
        <simpara>The actual choice of protocol is usually limited by the wireless router you deploy.</simpara>
      </section>
      <section id="_the_wireless_lan_interface_with_wpa_wpa2">
        <title>The wireless LAN interface with WPA/WPA2</title>
        <simpara>You need to install the <literal>wpasupplicant</literal> package to support the WLAN with the new WPA/WPA2.</simpara>
        <simpara>In case of the <ulink url="&dhcp;">DHCP</ulink> served IP on WLAN connection, the "<literal>/etc/network/interfaces</literal>" file entry should be:</simpara>
        <screen>allow-hotplug ath0
iface ath0 inet dhcp
 wpa-ssid homezone
 # hexadecimal psk is encoded from a plaintext passphrase
 wpa-psk 000102030405060708090a0b0c0d0e0f101112131415161718191a1b1c1d1e1f</screen>
        <simpara>See more on "<literal>/usr/share/doc/wpasupplicant/README.modes.gz</literal>".</simpara>
      </section>
      <section id="_the_wireless_lan_interface_with_wep">
        <title>The wireless LAN interface with WEP</title>
        <simpara>You need to install the <literal>wireless-tools</literal> package to support the WLAN with the old WEP.  (Your consumer grade router may still be using this insecure infrastructure but this is better than nothing.)</simpara>
        <caution>
          <simpara>Please note that your network traffic on WLAN with WEP may be sniffed by others.</simpara>
        </caution>
        <simpara>In case of the <ulink url="&dhcp;">DHCP</ulink> served IP on WLAN connection, the "<literal>/etc/network/interfaces</literal>" file entry should be:</simpara>
        <screen>allow-hotplug eth0
iface eth0 inet dhcp
 wireless-essid Home
 wireless-key1 0123-4567-89ab-cdef
 wireless-key2 12345678
 wireless-key3 s:password
 wireless-defaultkey 2
 wireless-keymode open</screen>
        <simpara>See more on "<literal>/usr/share/doc/wireless-tools/README.Debian</literal>".</simpara>
      </section>
      <section id="_the_ppp_connection">
        <title>The PPP connection</title>
        <simpara>You need to configure the PPP connection first as described before (see <xref linkend="_the_ppp_connection_with_pppconfig"/>).  Then, add the "<literal>/etc/network/interfaces</literal>" file entry for the primary PPP device <literal>ppp0</literal> as:</simpara>
        <screen>iface ppp0 inet ppp
 provider &lt;isp_name&gt;</screen>
      </section>
      <section id="_the_alternative_ppp_connection">
        <title>The alternative PPP connection</title>
        <simpara>You need to configure the alternative PPP connection with <literal>wvdial</literal> first as described before (see <xref linkend="_the_alternative_ppp_connection_with_wvdialconf"/>).  Then, add the "<literal>/etc/network/interfaces</literal>" file entry for the primary PPP device <literal>ppp0</literal> as:</simpara>
        <screen>iface ppp0 inet wvdial</screen>
      </section>
      <section id="_the_pppoe_connection">
        <title>The PPPoE connection</title>
        <simpara>For PC connected directly to the WAN served by the PPPoE, you need to configure system with the PPPoE connection as described before (see <xref linkend="_the_pppoe_connection_with_pppoeconf"/>).  Then, add the "<literal>/etc/network/interfaces</literal>" file entry for the primary PPPoE device <literal>eth0</literal> as:</simpara>
        <screen>allow-hotplug eth0
iface eth0 inet manual
 pre-up /sbin/ifconfig eth0 up
 up ifup ppp0=dsl
 down ifdown ppp0=dsl
 post-down /sbin/ifconfig eth0 down
# The following is used internally only
iface dsl inet ppp
 provider dsl-provider</screen>
      </section>
      <section id="_the_network_configuration_state_of_ifupdown">
        <title>The network configuration state of ifupdown</title>
        <simpara>The "<literal>/etc/network/run/ifstate</literal>" file stores the <emphasis role="strong">intended</emphasis> network configuration states for all the currently active network interfaces managed by the <literal>ifupdown</literal> package are listed. Unfortunately, even if the <literal>ifupdown</literal> system fails to bring up the interface as intended, the "<literal>/etc/network/run/ifstate</literal>" file lists it active.</simpara>
        <simpara>Unless the output of the <literal>ifconfig</literal>(8) command for an interface does not have a line like following example, it can not be used as a part of <ulink url="&ipvenetwork;">IPV4 network</ulink>:</simpara>
        <screen>  inet addr:192.168.11.2  Bcast:192.168.11.255  Mask:255.255.255.0</screen>
        <note>
          <simpara>For the Ethernet device connected to the PPPoE, the output of the <literal>ifconfig</literal>(8) command lacks a line which looks like above example.</simpara>
        </note>
      </section>
      <section id="_the_basic_network_reconfiguration">
        <title>The basic network reconfiguration</title>
        <simpara>When you try to reconfigure the interface, e.g. <literal>eth0</literal>, you must disable it first with the "<emphasis role="strong"><literal>sudo ifdown eth0</literal></emphasis>" command.  This will remove the entry of <literal>eth0</literal> from the "<literal>/etc/network/run/ifstate</literal>" file. (This may result in some error message if <literal>eth0</literal> is not active or it is configured improperly previously.  So far, it seems to be safe to do this for the simple single user work station at any time.)</simpara>
        <simpara>You are now free to rewrite the "<literal>/etc/network/interfaces</literal>" contents as needed to reconfigure the network interface, <literal>eth0</literal>.</simpara>
        <simpara>Then, you can reactivate <literal>eth0</literal> with the "<emphasis role="strong"><literal>sudo ifup eth0</literal></emphasis>" command.</simpara>
        <tip>
          <simpara>You can (re)initialize the network interface simply by "<emphasis role="strong"><literal>sudo ifdown eth0;sudo ifup eth0</literal></emphasis>".</simpara>
        </tip>
      </section>
      <section id="_the_ifupdown_extra_package">
        <title>The ifupdown-extra package</title>
        <simpara>The <literal>ifupdown-extra</literal> package provides the easy network connection test for use with the <literal>ifupdown</literal> package by:</simpara>
        <itemizedlist>
          <listitem>
            <simpara>
the <literal>network-test</literal>(1) command from the shell, and
</simpara>
          </listitem>
          <listitem>
            <simpara>
the automatic scripts run for each <literal>ifup</literal> command execution.
</simpara>
          </listitem>
        </itemizedlist>
        <simpara>The <literal>network-test</literal> command frees you from the execution of cumbersome low level commands to analyze the network problem.</simpara>
        <simpara>The automatic scripts are installed in "<literal>/etc/network/*/</literal>" and:</simpara>
        <itemizedlist>
          <listitem>
            <simpara>
check the network cable connection,
</simpara>
          </listitem>
          <listitem>
            <simpara>
check duplicate use of IP address,
</simpara>
          </listitem>
          <listitem>
            <simpara>
setup system's static routes based on the "<literal>/etc/network/routes</literal>" definition,
</simpara>
          </listitem>
          <listitem>
            <simpara>
check if network gateway is reachable, and
</simpara>
          </listitem>
          <listitem>
            <simpara>
record results in the "<literal>/var/log/syslog</literal>" file.
</simpara>
          </listitem>
        </itemizedlist>
        <simpara>This syslog record is quite useful for administration of the network problem on the remote system.</simpara>
        <tip>
          <simpara>The automatic behavior of the <literal>ifupdown-extra</literal> package is configurable with the "<literal>/etc/default/network-test</literal>". Some of these automatic checks slow down the system bootup a little bit since it takes some time to listen for <ulink url="&arp;">ARP</ulink> replies.</simpara>
        </tip>
      </section>
    </section>
    <section id="_the_advanced_network_configuration_with_ifupdown">
      <title>The advanced network configuration with ifupdown</title>
      <simpara>The functionality of the <literal>ifupdown</literal> package can be improved beyond what was described in <xref linkend="_the_basic_network_configuration_with_ifupdown"/> with the advanced knowledge.</simpara>
      <simpara>The functionalities described here are completely optional.  I, being lazy and minimalist, rarely bother to use these.</simpara>
      <caution>
        <simpara>If you could not set up network connection by information in <xref linkend="_the_basic_network_configuration_with_ifupdown"/>, you will make situation worse by using information below.</simpara>
      </caution>
      <section id="_the_ifplugd_package">
        <title>The ifplugd package</title>
        <simpara>The <literal>ifplugd</literal> package is older automatic network configuration tool which can manage only Ethernet connections. This solves unplugged/replugged Ethernet cable issues for mobile PC etc..   If you have <ulink url="&networkmanager;">NetworkManager</ulink> or <ulink url="&wicd;">Wicd</ulink> (see <xref linkend="_automatic_network_configuration"/>) installled, you do not need this package.</simpara>
        <simpara>This package runs <ulink url="&daemon;">daemon</ulink> and replaces <emphasis role="strong">auto</emphasis> or <emphasis role="strong">allow-hotplug</emphasis> functionalities (see <xref linkend="list-of-stanzas-in-eni"/>) and starts interfaces upon their connection to the network.</simpara>
        <simpara>Here is how to use the <literal>ifplugd</literal> package for the internal Ethernet port, e.g. <literal>eth0</literal>:</simpara>
        <itemizedlist>
          <listitem>
            <simpara>
Remove stanza in "<literal>/etc/network/interfaces</literal>": "<literal>auto eth0</literal>" or "<literal>allow-hotplug eth0</literal>",
</simpara>
          </listitem>
          <listitem>
            <simpara>
Keep stanza in "<literal>/etc/network/interfaces</literal>": "<literal>iface eth0 inet …</literal>" and "<literal>mapping …</literal>",
</simpara>
          </listitem>
          <listitem>
            <simpara>
Install the <literal>ifplugd</literal> package,
</simpara>
          </listitem>
          <listitem>
            <simpara>
Run "<literal>sudo dpkg-reconfigure ifplugd</literal>", and
</simpara>
          </listitem>
          <listitem>
            <simpara>
Put <literal>eth0</literal> as the "static interfaces to be watched by ifplugd".
</simpara>
          </listitem>
        </itemizedlist>
        <simpara>Now, the network reconfiguration works as you desire:</simpara>
        <itemizedlist>
          <listitem>
            <simpara>
Upon power-on or upon hardware discovery, the interface is not brought up by itself.
</simpara>
            <itemizedlist>
              <listitem>
                <simpara>
Quick boot process without the long DHCP timeout.
</simpara>
              </listitem>
              <listitem>
                <simpara>
No funny activated interface without proper IPv4 address (see <xref linkend="_the_network_configuration_state_of_ifupdown"/>).
</simpara>
              </listitem>
            </itemizedlist>
          </listitem>
          <listitem>
            <simpara>
Upon finding the Ethernet cable, the interface is brought up.
</simpara>
          </listitem>
          <listitem>
            <simpara>
Upon some time after unplugging the Ethernet cable, the interface is brought down automatically.
</simpara>
          </listitem>
          <listitem>
            <simpara>
Upon plugging in another Ethernet cable, the interface will be brought up under the new network environment.
</simpara>
          </listitem>
        </itemizedlist>
        <tip>
          <simpara>The arguments for the <literal>ifplugd</literal>(8) command can set its behaviors such as the delay for reconfiguring interfaces.</simpara>
        </tip>
      </section>
      <section id="_the_ifmetric_package">
        <title>The ifmetric package</title>
        <simpara>The <literal>ifmeric</literal> package enables us to manipulate metrics of routes a posteriori even for DHCP.</simpara>
        <simpara>The following will set the <literal>eth0</literal> interface to be preferred over the <literal>wlan0</literal> interface:</simpara>
        <itemizedlist>
          <listitem>
            <simpara>
Install the <literal>ifmetric</literal> package, and
</simpara>
          </listitem>
          <listitem>
            <simpara>
Add an option line with "<literal>metric 0</literal>" just below the "<literal>iface eth0 inet dhcp</literal>" line.
</simpara>
          </listitem>
          <listitem>
            <simpara>
Add an option line with "<literal>metric 1</literal>" just below the "<literal>iface wlan0 inet dhcp</literal>" line.
</simpara>
          </listitem>
        </itemizedlist>
        <simpara>The metric 0 means the highest priority route and is the default one.  The larger metric value means lower priority routes. The IP address of the active interface with the lowest metric value becomes the originating one. See <literal>ifmetric</literal>(8).</simpara>
      </section>
      <section id="_the_virtual_interface">
        <title>The virtual interface</title>
        <simpara>A single physical Ethernet interface can be configured as multiple virtual interfaces with different IP addresses.  Usually the purpose is to connect an interface to several IP subnetworks.  For example, IP address based virtual web hosting by a single network interface is one such application.</simpara>
        <simpara>For example, let's suppose that</simpara>
        <itemizedlist>
          <listitem>
            <simpara>
a single Ethernet interface on your host is connected to a Ethernet hub (not to the broadband router),
</simpara>
          </listitem>
          <listitem>
            <simpara>
the Ethernet hub is connected to both the Internet and LAN network,
</simpara>
          </listitem>
          <listitem>
            <simpara>
the LAN network uses subnet <literal>192.168.0.x/24</literal>,
</simpara>
          </listitem>
          <listitem>
            <simpara>
your host uses DHCP served IP address with the physical interface <literal>eth0</literal> for the Internet, and
</simpara>
          </listitem>
          <listitem>
            <simpara>
your host uses <literal>192.168.0.1</literal> with the virtual interface <literal>eth0:0</literal> for the LAN,
</simpara>
          </listitem>
        </itemizedlist>
        <simpara>then following stanzas in "<literal>/etc/network/interfaces</literal>" will configure your network:</simpara>
        <screen>iface eth0 inet dhcp
 metric 0
iface eth0:0 inet static
 address 192.168.0.1
 netmask 255.255.255.0
 network 192.168.0.0
 broadcast 192.168.0.255
 metric 1</screen>
        <caution>
          <simpara>Although this configuration example with <ulink url="&networkaddresstranslationnat;">network address translation (NAT)</ulink> using <ulink url="&netfilteriptables;">netfilter/iptables</ulink> (see <xref linkend="_netfilter"/>) can provide cheap router for the LAN with only single interface, there is no real firewall capability with such set up.  You should use 2 physical interfaces with NAT to secure the local network from Internet.</simpara>
        </caution>
      </section>
      <section id="_the_advanced_command_syntax">
        <title>The advanced command syntax</title>
        <simpara>The <literal>ifupdown</literal> package offers advanced network configuration using the  <emphasis role="strong">network configuration</emphasis> name and the <emphasis role="strong">network interface</emphasis> name.  I use slightly different terminology from one used in <literal>ifup</literal>(8) and <literal>interfaces</literal>(5).</simpara>
        <table id="listofterminologornetworkdevices" pgwide="0" frame="topbot" rowsep="1" colsep="1">
          <title>List of terminology for network devices.</title>
          <tgroup cols="4">
            <colspec colwidth="20%*" align="left"/>
            <colspec colwidth="20%*" align="left"/>
            <colspec colwidth="20%*" align="left"/>
            <colspec colwidth="40%*" align="left"/>
            <thead>
              <row>
                <entry>
    manpage terminology
    </entry>
                <entry>
    my terminology
    </entry>
                <entry>
    examples in the following text
    </entry>
                <entry>
    explanation
    </entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry><emphasis role="strong">physical interface</emphasis> name
    </entry>
                <entry><emphasis role="strong">network interface</emphasis> name
    </entry>
                <entry><literal>lo</literal>, <literal>eth0</literal>, <literal>&lt;interface_name&gt;</literal></entry>
                <entry>
    A name given by the Linux kernel (using <literal>udev</literal> mechanism).
    </entry>
              </row>
              <row>
                <entry><emphasis role="strong">logical interface</emphasis> name
    </entry>
                <entry><emphasis role="strong">network configuration</emphasis> name
    </entry>
                <entry><literal>config1</literal>, <literal>config2</literal>, <literal>&lt;config_name&gt;</literal></entry>
                <entry>
    A name token following <emphasis role="strong"><literal>iface</literal></emphasis> in the "<literal>/etc/network/interfaces</literal>".
    </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
        <simpara>Basic network configuration commands in <xref linkend="_the_command_syntax_simplified"/> require the <emphasis role="strong">network configuration</emphasis> name token of the <emphasis role="strong"><literal>iface</literal></emphasis> stanza to match the <emphasis role="strong">network interface</emphasis> name in the "<literal>/etc/network/interfaces</literal>".</simpara>
        <simpara>Advanced network configuration commands enables separation of the <emphasis role="strong">network configuration</emphasis> name and the <emphasis role="strong">network interface</emphasis> name in the "<literal>/etc/network/interfaces</literal>":</simpara>
        <table id="listofadvancedneandswithifupdown" pgwide="0" frame="topbot" rowsep="1" colsep="1">
          <title>List of advanced network configuration commands with ifupdown.</title>
          <tgroup cols="2">
            <colspec colwidth="30%*" align="left"/>
            <colspec colwidth="70%*" align="left"/>
            <thead>
              <row>
                <entry>
    command
    </entry>
                <entry>
    action
    </entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry>
                  <literal>ifup eth0=config1</literal>
                </entry>
                <entry>
    To bring up a network interface <literal>eth0</literal> with the configuration <literal>config1</literal>.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>ifdown eth0=config1</literal>
                </entry>
                <entry>
    To bring down a network interface <literal>eth0</literal> with the configuration <literal>config1</literal>.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>ifup eth0</literal>
                </entry>
                <entry>
    To bring up a network interface <literal>eth0</literal> with the configuration selected by <emphasis role="strong"><literal>mapping</literal></emphasis> stanza.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>ifdown eth0</literal>
                </entry>
                <entry>
    To bring down a network interface <literal>eth0</literal> with the configuration selected by <emphasis role="strong"><literal>mapping</literal></emphasis> stanza.
    </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
      </section>
      <section id="_the_mapping_stanza">
        <title>The mapping stanza</title>
        <simpara>We skipped explaining the <emphasis role="strong"><literal>mapping</literal></emphasis> stanza in the "<literal>/etc/network/interfaces</literal>" in <xref linkend="_the_basic_syntax_of_etc_network_interfaces"/> to avoid complication.  This stanza has the following syntax:</simpara>
        <screen>mapping &lt;interface_name_glob&gt;
 script &lt;script_name&gt;
 map &lt;script_input1&gt;
 map &lt;script_input2&gt;
 map ...</screen>
        <simpara>This provides advanced feature to the "<literal>/etc/network/interfaces</literal>" file by automating the choice of the configuration with the mapping script specified by <literal>&lt;script_name&gt;</literal>.</simpara>
        <simpara>When the "<literal>&lt;interface_name_glob&gt;</literal>" matches "<literal>eth0</literal>", the execution of</simpara>
        <screen>$ sudo ifup eth0</screen>
        <simpara>will produce the execution of:</simpara>
        <screen>$ sudo ifup eth0=$(echo -e '&lt;script_input1&gt; \n &lt;script_input2&gt; \n ...' | &lt;script_name&gt; eth0)</screen>
        <simpara>to configure <literal>eth0</literal> automatically. Here, lines with "<literal>map</literal>" are optional and can be repeated.</simpara>
        <note>
          <simpara>The glob for <emphasis role="strong"><literal>mapping</literal></emphasis> stanza works like shell filename glob (see <xref linkend="_shell_glob"/>).</simpara>
        </note>
      </section>
      <section id="_the_manually_switchable_network_configuration">
        <title>The manually switchable network configuration</title>
        <simpara>Here is how to switch manually among several network configurations without rewriting the "<literal>/etc/network/interfaces</literal>" file as in <xref linkend="_the_basic_network_reconfiguration"/> .</simpara>
        <simpara>For all the network configuration you need to access, you create a single "<literal>/etc/network/interfaces</literal>" file, e.g,:</simpara>
        <screen>auto lo
iface lo inet loopback

iface config1 inet dhcp
 hostname "mymachine"

iface config2 inet static
 address 192.168.11.100
 netmask 255.255.255.0
 broadcast 192.168.11.255
 gateway 192.168.11.1
 dns-domain lan
 dns-nameservers 192.168.11.1

iface pppoe inet manual
 pre-up /sbin/ifconfig eth0 up
 up ifup ppp0=dsl
 down ifdown ppp0=dsl
 post-down /sbin/ifconfig eth0 down

# The following is used internally only
iface dsl inet ppp
 provider dsl-provider

iface pots inet ppp
 provider provider</screen>
        <simpara>Please note the <emphasis role="strong">network configuration name</emphasis> which is the token after <emphasis role="strong"><literal>iface</literal></emphasis> does not use the token for the <emphasis role="strong">network interface name</emphasis>.  Also, there are no <emphasis role="strong"><literal>auto</literal></emphasis> stanza nor <emphasis role="strong"><literal>allow-hotplug</literal></emphasis> stanza to start the network interface <literal>eth0</literal> automatically upon events.</simpara>
        <simpara>Now you are ready to switch the network configuration.</simpara>
        <simpara>Let's move your PC to a LAN served by the DHCP.  You bring up the <emphasis role="strong">network interface</emphasis> (the physical interface) <literal>eth0</literal> by assigning  the <emphasis role="strong">network configuration</emphasis> name (the logical interface name) <literal>config1</literal> to it:</simpara>
        <screen>$ sudo ifup eth0=config1
Password:
...</screen>
        <simpara>The interface <literal>eth0</literal> is up, configured by DHCP and connected to LAN.</simpara>
        <screen>$ sudo ifdown eth0=config1
...</screen>
        <simpara>The interface <literal>eth0</literal> is down and disconnected from LAN.</simpara>
        <simpara>Let's move your PC to a LAN served by the static IP.  You bring up the <emphasis role="strong">network interface</emphasis> <literal>eth0</literal> by assigning the <emphasis role="strong">network configuration</emphasis> name <literal>config2</literal> to it:</simpara>
        <screen>$ sudo ifup eth0=config2
...</screen>
        <simpara>The interface <literal>eth0</literal> is up, configured with static IP and connected to LAN. The additional parameters given as <literal>dns-*</literal> configures "<literal>/etc/resolv.conf</literal>" contents.  This "<literal>/etc/resolv.conf</literal>" is better manged if the <literal>resolvconf</literal> package is installed.</simpara>
        <screen>$ sudo ifdown eth0=config2
...</screen>
        <simpara>The interface <literal>eth0</literal> is down and disconnected from LAN, again.</simpara>
        <simpara>Let's move your PC to a port on BB-modem connected to the PPPoE served service.  You bring up the <emphasis role="strong">network interface</emphasis> <literal>eth0</literal> by assigning the <emphasis role="strong">network configuration</emphasis> name <literal>pppoe</literal> to it:</simpara>
        <screen>$ sudo ifup eth0=pppoe
...</screen>
        <simpara>The interface <literal>eth0</literal> is up, configured with PPPoE connection directly to the ISP.</simpara>
        <screen>$ sudo ifdown eth0=pppoe
...</screen>
        <simpara>The interface <literal>eth0</literal> is down and disconnected, again.</simpara>
        <simpara>Let's move your PC to a location without LAN or BB-modem but with POTS and modem.  You bring up the <emphasis role="strong">network interface</emphasis> <literal>ppp0</literal> by assigning the <emphasis role="strong">network configuration</emphasis> name <literal>pots</literal> to it:</simpara>
        <screen>$ sudo ifup ppp0=pots
...</screen>
        <simpara>The interface <literal>ppp0</literal> is up and connected to the Internet with PPP.</simpara>
        <screen>$ sudo ifdown ppp0=pots
...</screen>
        <simpara>The interface <literal>ppp0</literal> is down and disconnected from the Internet.</simpara>
        <simpara>You should check the "<literal>/etc/network/run/ifstate</literal>" file for the current network configuration state of the <literal>ifupdown</literal> system.</simpara>
        <warning>
          <simpara>You may need to adjust numbers at the end of <literal>eth*</literal>, <literal>ppp*</literal>, etc. if you have multiple network interfaces.</simpara>
        </warning>
      </section>
      <section id="_scripting_with_the_ifupdown_system">
        <title>Scripting with the ifupdown system</title>
        <simpara>The <literal>ifupdown</literal> system automatically runs scripts installed in "<literal>/etc/network/*/</literal>" while exporting environment variables to scripts:</simpara>
        <table id="listofenvironmenheifupdownsystem" pgwide="0" frame="topbot" rowsep="1" colsep="1">
          <title>List of environment variables passed by the ifupdown system</title>
          <tgroup cols="2">
            <colspec colwidth="30%*" align="left"/>
            <colspec colwidth="70%*" align="left"/>
            <thead>
              <row>
                <entry>
    environment variable
    </entry>
                <entry>
    value passed
    </entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry>
    "<literal>$IFACE</literal>"
    </entry>
                <entry>
    physical name (interface name) of the interface being processed.
    </entry>
              </row>
              <row>
                <entry>
    "<literal>$LOGICAL</literal>"
    </entry>
                <entry>
    logical name (configuration name) of the interface being processed.
    </entry>
              </row>
              <row>
                <entry>
    "<literal>$ADDRFAM</literal>"
    </entry>
                <entry>
    &lt;address_family&gt; of the interface.
    </entry>
              </row>
              <row>
                <entry>
    "<literal>$METHOD</literal>"
    </entry>
                <entry>
    &lt;method_name&gt; of the interface. (e.g., "static")
    </entry>
              </row>
              <row>
                <entry>
    "<literal>$MODE</literal>"
    </entry>
                <entry>
    "start" if run from <literal>ifup</literal>, "stop" if run from <literal>ifdown</literal>.
    </entry>
              </row>
              <row>
                <entry>
    "<literal>$PHASE</literal>"
    </entry>
                <entry>
    as per "<literal>$MODE</literal>", but with finer granularity, distinguishing the <literal>pre-up</literal>, <literal>post-up</literal>, <literal>pre-down</literal> and <literal>post-down</literal> phases.
    </entry>
              </row>
              <row>
                <entry>
    "<literal>$VERBOSITY</literal>"
    </entry>
                <entry>
    indicates whether "<literal>--verbose</literal>" was used; set to 1 if so, 0 if not.
    </entry>
              </row>
              <row>
                <entry>
    "<literal>$PATH</literal>"
    </entry>
                <entry>
    the command search path: "<literal>/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin</literal>"
    </entry>
              </row>
              <row>
                <entry>
    "<literal>$IF_&lt;OPTION&gt;</literal>"
    </entry>
                <entry>
    the value for the corresponding option under the <emphasis role="strong"><literal>iface</literal></emphasis> stanza.
    </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
        <simpara>Here, each environment variable, "<literal>$IF_&lt;OPTION&gt;</literal>", is created from the name for the corresponding option such as &lt;option1&gt; and &lt;option2&gt; by prepending "<literal>$IF_</literal>", converting the case to the upper case, replacing hyphens to underscores, and discarding non-alphanumeric characters.</simpara>
        <tip>
          <simpara>See <xref linkend="_the_basic_syntax_of_etc_network_interfaces"/> for &lt;address_family&gt;, &lt;method_name&gt;, &lt;option1&gt; and &lt;option2&gt;.</simpara>
        </tip>
        <simpara>The <literal>ifupdown-extra</literal> package (see <xref linkend="_the_ifupdown_extra_package"/>) uses these environment variables to extend the functionality of the <literal>ifupdown</literal> package.  The <literal>ifmetric</literal> package (see <xref linkend="_the_ifmetric_package"/>) installs the "<literal>/etc/network/if-up.d/ifmetric</literal>" script which sets the metric via the "<literal>$IF_METRIC</literal>" variable.  The <literal>guessnet</literal> package (see <xref linkend="_mapping_with_guessnet"/>), which provides simple and powerful framework for the auto-selection of the network configuration via the mapping mechanism, also uses these.</simpara>
        <note>
          <simpara>For more specific examples of custom network configuration scripts using these environment variables, you should check example scripts in "<literal>/usr/share/doc/ifupdown/examples/*</literal>" and scripts used in <literal>ifscheme</literal> and <literal>ifupdown-scripts-zg2</literal> packages.  These additional scripts have some overlaps of functinalities with basic <literal>ifupdown-extra</literal> and <literal>guessnet</literal> packages.  If you install these additional scripts, you should customize these scripts to avoid interferences.</simpara>
        </note>
      </section>
      <section id="_mapping_with_guessnet">
        <title>Mapping with guessnet</title>
        <simpara>Instead of manually choosing configuration as described in <xref linkend="_the_manually_switchable_network_configuration"/>, you can use the mapping mechanism described in <xref linkend="_the_mapping_stanza"/> to select network configuration automatically with custom scripts.</simpara>
        <simpara>The <literal>guessnet-ifupdown</literal>(8) command provided by the <literal>guessnet</literal> package is designed to be used as a mapping script and provides powerful framework to enhance the <literal>ifupdown</literal> system.</simpara>
        <itemizedlist>
          <listitem>
            <simpara>
you list test condition as the value for <emphasis role="strong"><literal>guessnet</literal></emphasis> options for each network configuration under <emphasis role="strong"><literal>iface</literal></emphasis> stanza.
</simpara>
          </listitem>
          <listitem>
            <simpara>
mapping will chose the <emphasis role="strong"><literal>iface</literal></emphasis> with first non-ERROR result as the network configuration.
</simpara>
          </listitem>
        </itemizedlist>
        <simpara>This dual usage of the "<literal>/etc/network/interfaces</literal>" file by the mapping script, <literal>guessnet-ifupdown</literal>, and the original network configuration infrastructure, <literal>ifupdown</literal>, does not cause negative impacts since <emphasis role="strong"><literal>guessnet</literal></emphasis> options only export extra environment variables to scripts run by the <literal>ifupdown</literal> system.  See details in <literal>guessnet-ifupdown</literal>(8).</simpara>
        <note>
          <simpara>When multiple <emphasis role="strong"><literal>guessnet</literal></emphasis> option lines are required in "<literal>/etc/network/interfaces</literal>", use option lines started with <emphasis role="strong"><literal>guessnet1</literal></emphasis>, <emphasis role="strong"><literal>guessnet2</literal></emphasis>, and so on, since the <literal>ifupdown</literal> package does not allow starting strings of option lines to be repeated.</simpara>
        </note>
      </section>
    </section>
    <section id="_the_network_configuration_for_desktop">
      <title>The network configuration for desktop</title>
      <section id="_gui_network_configuration_tools">
        <title>GUI network configuration tools</title>
        <simpara>The capability of default GUI network configuration tools for each desktop environments such as GNOME tends to be limited to basic configurations such as static IP or DHCP.  They actually overwrite contents of "<literal>/etc/network/interfaces</literal>" file behind you. Please check how they change "<literal>/etc/network/interfaces</literal>" file by yourself.</simpara>
        <caution>
          <simpara>They may not understand complicated advanced configuration done manually in "<literal>/etc/network/interfaces</literal>" file.</simpara>
        </caution>
      </section>
      <section id="_automatic_network_configuration">
        <title>Automatic network configuration</title>
        <simpara>There are independent automatic network configuration tools, such as <ulink url="&networkmanagernm;">NetworkManager (NM)</ulink> (<literal>network-manager</literal> and associated packages) and <ulink url="&wicd;">Wicd</ulink> (<literal>wicd</literal> package) which manage network connection via <ulink url="&daemon;">daemon</ulink> independen of the <literal>ifupdown</literal> package. They allow easy management of wireless connections.  These come with its own nice GUI user interfaces.</simpara>
        <warning>
          <simpara>Do not use these automatic network configuration tools for servers.  These are aimed primarily for mobile desktop users on laptops.</simpara>
        </warning>
        <warning>
          <simpara>These automatic network configuration tools are moving targets and documentation here is likely to be incorrect for <literal>squeeze</literal>.  So be warned.</simpara>
        </warning>
        <caution>
          <simpara>These automatic network configuration tools may not be compatible with esoteric configurations of <literal>ifupdown</literal> in "<literal>/etc/network/interfaces</literal>" such as ones in <xref linkend="_the_basic_network_configuration_with_ifupdown"/> and <xref linkend="_the_advanced_network_configuration_with_ifupdown"/>.  Having even "<literal>hostname</literal>" stanza for DHCP controlled interface as described in <xref linkend="_the_network_interface_served_by_the_dhcp"/> caused NM to ignore such interface in <literal>lenny</literal>. Check <ulink url="&btsofnetworkmanager;">BTS of network-manager</ulink> and <ulink url="&btsofwicd;">BTS of wicd</ulink> for current issues and limitations.</simpara>
        </caution>
        <simpara>The configuration of NM is described in "<literal>/usr/share/doc/network-manager/README.Debian</literal>".  Essentially:</simpara>
        <orderedlist>
          <listitem>
            <simpara>
Make desktop user, e.g. <literal>foo</literal>, belong to group "<literal>netdev</literal>" by:
</simpara>
            <screen>$ sudo adduser foo netdev</screen>
          </listitem>
          <listitem>
            <simpara>
Keep configuration of "<literal>/etc/network/interfaces</literal>" as simple as:
</simpara>
            <screen>auto lo
iface lo inet loopback

auto eth0
iface eth0 inet dhcp</screen>
          </listitem>
          <listitem>
            <simpara>
Restart NM by:
</simpara>
            <screen>$ sudo /etc/init.d/network-manager restart</screen>
          </listitem>
        </orderedlist>
        <note>
          <simpara>Only interfaces which are <emphasis role="strong">not</emphasis> listed in "<literal>/etc/network/interfaces</literal>" or which have been configured with "<literal>auto …</literal>" or "<literal>allow-hotplug …</literal>" and "<literal>iface … inet dhcp</literal>" (with no other options) are managed by NM to avoid conflict with <literal>ifupdown</literal>.</simpara>
        </note>
        <simpara>The configuration of <ulink url="&wicd;">Wicd</ulink> is described in "<literal>/usr/share/doc/wicd/README.Debian</literal>".  Essentially:</simpara>
        <orderedlist>
          <listitem>
            <simpara>
Make configuration in "<literal>/etc/network/interfaces</literal>" only as:
</simpara>
            <screen>auto lo
iface lo inet loopback</screen>
          </listitem>
          <listitem>
            <simpara>
Restart Wicd.
</simpara>
            <screen>$ sudo /etc/init.d/wicd restart</screen>
          </listitem>
        </orderedlist>
      </section>
    </section>
    <section id="_the_low_level_network_configuration">
      <title>The low level network configuration</title>
      <section id="_iproute2_commands">
        <title>Iproute2 commands</title>
        <simpara><ulink url="&iproutec;">Iproute2</ulink> commands offer complete low-level network configuration capabilities. Here is a translation table from obsolete <ulink url="&nettools;">net-tools</ulink> commands to new <ulink url="&iproutec;">iproute2</ulink> etc. commands.</simpara>
        <table id="translationtableiprouteccommands" pgwide="0" frame="topbot" rowsep="1" colsep="1">
          <title>Translation table from obsolete <literal>net-tools</literal> commands to new <literal>iproute2</literal> commands.</title>
          <tgroup cols="3">
            <colspec colwidth="30%*" align="left"/>
            <colspec colwidth="30%*" align="left"/>
            <colspec colwidth="40%*" align="left"/>
            <thead>
              <row>
                <entry>
    obsolete net-tools
    </entry>
                <entry>
    new iproute2 etc.
    </entry>
                <entry>
    manipulation
    </entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry><literal>ifconfig</literal>(8)
    </entry>
                <entry>
                  <literal>ip addr</literal>
                </entry>
                <entry>
    protocol (IP or IPv6) address on a device.
    </entry>
              </row>
              <row>
                <entry><literal>route</literal>(8)
    </entry>
                <entry>
                  <literal>ip route</literal>
                </entry>
                <entry>
    routing table entry.
    </entry>
              </row>
              <row>
                <entry><literal>arp</literal>(8)
    </entry>
                <entry>
                  <literal>ip neigh</literal>
                </entry>
                <entry>
    ARP or NDISC cache entry.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>ipmaddr</literal>
                </entry>
                <entry>
                  <literal>ip maddr</literal>
                </entry>
                <entry>
    multicast address.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>iptunnel</literal>
                </entry>
                <entry>
                  <literal>ip tunnel</literal>
                </entry>
                <entry>
    tunnel over IP.
    </entry>
              </row>
              <row>
                <entry><literal>nameif</literal>(8)
    </entry>
                <entry><literal>ifrename</literal>(8)
    </entry>
                <entry>
    name network interfaces based on MAC addresses.
    </entry>
              </row>
              <row>
                <entry><literal>mii-tool</literal>(8)
    </entry>
                <entry><literal>ethtool</literal>(8)
    </entry>
                <entry>
    Ethernet device settings.
    </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
        <simpara>See <literal>ip</literal>(8) and <ulink url="&iproutecutilitysuitehowto;">IPROUTE2 Utility Suite Howto</ulink>.</simpara>
      </section>
      <section id="_safe_low_level_network_operations">
        <title>Safe low level network operations</title>
        <simpara>You may use low level network commands as follows safely since they do not change network configuration:</simpara>
        <table id="listoflowlevelnetworkcommands" pgwide="0" frame="topbot" rowsep="1" colsep="1">
          <title>List of low level network commands.</title>
          <tgroup cols="2">
            <colspec colwidth="30%*" align="left"/>
            <colspec colwidth="70%*" align="left"/>
            <thead>
              <row>
                <entry>
    command
    </entry>
                <entry>
    description
    </entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry>
                  <literal>ifconfig</literal>
                </entry>
                <entry>
    displays the link and address status of active interfaces
    </entry>
              </row>
              <row>
                <entry>
                  <literal>ip addr show</literal>
                </entry>
                <entry>
    displays the link and address status of active interfaces
    </entry>
              </row>
              <row>
                <entry>
                  <literal>route -n</literal>
                </entry>
                <entry>
    displays all the routing table in numerical addresses
    </entry>
              </row>
              <row>
                <entry>
                  <literal>ip route show</literal>
                </entry>
                <entry>
    displays all the routing table in numerical addresses
    </entry>
              </row>
              <row>
                <entry>
                  <literal>arp</literal>
                </entry>
                <entry>
    displays the current content of the <ulink url="&arp;">ARP</ulink> cache tables
    </entry>
              </row>
              <row>
                <entry>
                  <literal>ip neigh</literal>
                </entry>
                <entry>
    displays the current content of the <ulink url="&arp;">ARP</ulink> cache tables
    </entry>
              </row>
              <row>
                <entry>
                  <literal>plog</literal>
                </entry>
                <entry>
    display ppp daemon log
    </entry>
              </row>
              <row>
                <entry>
                  <literal>ping yahoo.com</literal>
                </entry>
                <entry>
    check Internet connection to "<literal>yahoo.com</literal>"
    </entry>
              </row>
              <row>
                <entry>
                  <literal>whois yahoo.com</literal>
                </entry>
                <entry>
    check who registered "<literal>yahoo.com</literal>" in the domains database
    </entry>
              </row>
              <row>
                <entry>
                  <literal>traceroute yahoo.com</literal>
                </entry>
                <entry>
    trace Internet connection to "<literal>yahoo.com</literal>"
    </entry>
              </row>
              <row>
                <entry>
                  <literal>tracepath yahoo.com</literal>
                </entry>
                <entry>
    trace Internet connection to "<literal>yahoo.com</literal>"
    </entry>
              </row>
              <row>
                <entry>
                  <literal>mtr yahoo.com</literal>
                </entry>
                <entry>
    trace Internet connection to "<literal>yahoo.com</literal>" (repeatedly)
    </entry>
              </row>
              <row>
                <entry>
                  <literal>dig [@dns-server.com] example.com [{a|mx|any}]</literal>
                </entry>
                <entry>
    check <ulink url="&dns;">DNS</ulink> records of "<literal>example.com</literal>" by "<literal>dns-server.com</literal>" for a "<literal>a</literal>", "<literal>mx</literal>", or "<literal>any</literal>" record
    </entry>
              </row>
              <row>
                <entry>
                  <literal>iptables -L -n</literal>
                </entry>
                <entry>
    check packet filter
    </entry>
              </row>
              <row>
                <entry>
                  <literal>netstat -a</literal>
                </entry>
                <entry>
    find all open ports
    </entry>
              </row>
              <row>
                <entry>
                  <literal>netstat -l --inet</literal>
                </entry>
                <entry>
    find listening ports
    </entry>
              </row>
              <row>
                <entry>
                  <literal>netstat -ln --tcp</literal>
                </entry>
                <entry>
    find listening TCP ports (numeric)
    </entry>
              </row>
              <row>
                <entry>
                  <literal>dlint example.com</literal>
                </entry>
                <entry>
    check DNS zone information of "<literal>examle.org</literal>"
    </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
        <tip>
          <simpara>Some of these low level network configuration tools reside in "<literal>/sbin/</literal>".  You may need to issue full command path such as "<literal>/sbin/ifconfig</literal>" or add "<literal>/sbin</literal>" to the "<literal>$PATH</literal>" list in your "<literal>~/.bashrc</literal>".</simpara>
        </tip>
      </section>
    </section>
    <section id="_network_optimization">
      <title>Network optimization</title>
      <simpara>Generic network optimization is beyond the scope of this documentation.  I will touch only subjects pertinent to the consumer grade connection.</simpara>
      <table id="listofnetworkoptimizationtools" pgwide="0" frame="topbot" rowsep="1" colsep="1">
        <title>List of network optimization tools.</title>
        <tgroup cols="4">
          <colspec colwidth="20%*" align="left"/>
          <colspec colwidth="20%*" align="left"/>
          <colspec colwidth="20%*" align="left"/>
          <colspec colwidth="40%*" align="left"/>
          <thead>
            <row>
              <entry>
    packages
    </entry>
              <entry>
    popcon
    </entry>
              <entry>
    size
    </entry>
              <entry>
    description
    </entry>
            </row>
          </thead>
          <tbody>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/iftop">
                <literal>iftop</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/iftop">&pop-iftop;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/i/iftop.html">&size-iftop;</ulink></entry>
              <entry>
    displays bandwidth usage information on an network interface
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/iperf">
                <literal>iperf</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/iperf">&pop-iperf;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/i/iperf.html">&size-iperf;</ulink></entry>
              <entry>
    Internet Protocol bandwidth measuring tool
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/apt-spy">
                <literal>apt-spy</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/apt-spy">&pop-aptspy;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/a/apt-spy.html">&size-aptspy;</ulink></entry>
              <entry>
    writes a "<literal>/etc/apt/sources.list</literal>" file based on bandwidth tests
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/ifstat">
                <literal>ifstat</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/ifstat">&pop-ifstat;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/i/ifstat.html">&size-ifstat;</ulink></entry>
              <entry>
    InterFace STATistics Monitoring
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/bmon">
                <literal>bmon</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/bmon">&pop-bmon;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/b/bmon.html">&size-bmon;</ulink></entry>
              <entry>
    portable bandwidth monitor and rate estimator
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/ethstatus">
                <literal>ethstatus</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/ethstatus">&pop-ethstatus;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/e/ethstatus.html">&size-ethstatus;</ulink></entry>
              <entry>
    script that quickly measures network device throughput
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/bing">
                <literal>bing</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/bing">&pop-bing;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/b/bing.html">&size-bing;</ulink></entry>
              <entry>
    Empirical stochastic bandwidth tester
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/bwm-ng">
                <literal>bwm-ng</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/bwm-ng">&pop-bwmng;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/b/bwm-ng.html">&size-bwmng;</ulink></entry>
              <entry>
    small and simple console-based bandwidth monitor
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/ethstats">
                <literal>ethstats</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/ethstats">&pop-ethstats;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/e/ethstats.html">&size-ethstats;</ulink></entry>
              <entry>
    console-based Ethernet statistics monitor
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/ipfm">
                <literal>ipfm</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/ipfm">&pop-ipfm;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/i/ipfm.html">&size-ipfm;</ulink></entry>
              <entry>
    a bandwidth analysis tool
    </entry>
            </row>
          </tbody>
        </tgroup>
      </table>
      <section id="_finding_optimal_mtu">
        <title>Finding optimal MTU</title>
        <simpara>The <ulink url="&maximumtransmissionunitmtu;">Maximum Transmission Unit (MTU)</ulink> value can be determined experimentally with <literal>ping</literal>(8) with "<literal>-M do</literal>" option which sends ICMP packets with data size starting from 1500 (with offset of 28 bytes for the IP+ICMP header) and finding the largest size without IP fragmentation. For example:</simpara>
        <screen>$ ping -c 1 -s $((1500-28)) -M do www.debian.org
PING www.debian.org (194.109.137.218) 1472(1500) bytes of data.
From 192.168.11.2 icmp_seq=1 Frag needed and DF set (mtu = 1454)

--- www.debian.org ping statistics ---
0 packets transmitted, 0 received, +1 errors</screen>
        <itemizedlist>
          <listitem>
            <simpara>
… try 1454 instead of 1500
</simpara>
          </listitem>
          <listitem>
            <simpara>
The <literal>ping</literal>(8) command succeed
</simpara>
          </listitem>
        </itemizedlist>
        <simpara>This process is <ulink url="&pathmtupmtudiscovery;">Path MTU (PMTU) discovery</ulink> (<ulink url="&rfcbbjb;">RFC1191</ulink>) and the <literal>tracepath</literal>(8) command can automate this.</simpara>
        <tip>
          <simpara>The above example with PMTU value of 1454 is for my previous FTTP provider which used <ulink url="&asynchronoustransfermode;">Asynchronous Transfer Mode</ulink> (ATM) as its backbone network and served its clients with the <ulink url="&pppoe;">PPPoE</ulink>.  The actual PMTU value depends on your environment, e.g., 1500 for the my new FTTP provider.</simpara>
        </tip>
        <table id="basicguidelinesoeoptimalmtuvalue" pgwide="0" frame="topbot" rowsep="1" colsep="1">
          <title>Basic guide lines of the optimal MTU value</title>
          <tgroup cols="3">
            <colspec colwidth="30%*" align="left"/>
            <colspec colwidth="30%*" align="left"/>
            <colspec colwidth="40%*" align="left"/>
            <thead>
              <row>
                <entry>
    network environment
    </entry>
                <entry>
    MTU
    </entry>
                <entry>
    rationale
    </entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry>
    Dial-up link (IP: PPP)
    </entry>
                <entry>
    576
    </entry>
                <entry>
    standard
    </entry>
              </row>
              <row>
                <entry>
    Ethernet link (IP: DHCP or fixed)
    </entry>
                <entry>
    1500
    </entry>
                <entry>
    standard and default
    </entry>
              </row>
              <row>
                <entry>
    Ethernet link (IP: PPPoE)
    </entry>
                <entry>
    1492 (=1500-8)
    </entry>
                <entry>
    2 bytes for PPP header and 6 bytes for PPPoE header
    </entry>
              </row>
              <row>
                <entry>
    Ethernet link (ISP's backbone: ATM, IP: DHCP or fixed)
    </entry>
                <entry>
    1462 (=48*31-18-8)
    </entry>
                <entry>
    author's speculation: 18 for Ethernet header, 8 for SAR trailer.
    </entry>
              </row>
              <row>
                <entry>
    Ethernet link (ISP's backbone: ATM, IP: PPPoE)
    </entry>
                <entry>
    1454 (=48*31-8-18-8)
    </entry>
                <entry>
    see "<ulink url="&optimalmtuconfigeadslconnections;">Optimal MTU configuration for PPPoE ADSL Connections</ulink>" for rationale.
    </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
        <simpara>In addtion to these basic guide lines, you should know:</simpara>
        <itemizedlist>
          <listitem>
            <simpara>
Any use of tunneling methods (<ulink url="&vpn;">VPN</ulink> etc.) may reduce optimal MTU further by their overheads.
</simpara>
          </listitem>
          <listitem>
            <simpara>
The MTU value should not exceed the experimentally determined PMTU value.
</simpara>
          </listitem>
          <listitem>
            <simpara>
The bigger MTU value is generally better when other limitations are met.
</simpara>
          </listitem>
        </itemizedlist>
      </section>
      <section id="_setting_mtu">
        <title>Setting MTU</title>
        <simpara>Here are examples for setting the MTU value from its default 1500 to 1454.</simpara>
        <simpara>For the DHCP (see <xref linkend="_the_network_interface_served_by_the_dhcp"/>), you can replace pertinent <emphasis role="strong"><literal>iface</literal></emphasis> stanza lines in the "<literal>/etc/network/interfaces</literal>" with, e.g.,:</simpara>
        <screen>iface eth0 inet dhcp
 hostname "mymachine"
 pre-up /sbin/ifconfig $IFACE mtu 1454</screen>
        <simpara>For the static IP (see <xref linkend="_the_network_interface_with_the_static_ip"/>), you can replace pertinent <emphasis>'</emphasis><literal>iface</literal><emphasis>'</emphasis> stanza lines in the "<literal>/etc/network/interfaces</literal>" with, e.g.,:</simpara>
        <screen>iface eth0 inet static
 address 192.168.11.100
 netmask 255.255.255.0
 broadcast 192.168.11.255
 gateway 192.168.11.1
 mtu 1454
 dns-domain lan
 dns-nameservers 192.168.11.1</screen>
        <simpara>For the direct PPPoE (see <xref linkend="_the_pppoe_connection_with_pppoeconf"/>), you can replace pertinent "<literal>mtu</literal>" line in the "<literal>/etc/ppp/peers/dsl-provider</literal>" with:</simpara>
        <screen>mtu 1454</screen>
        <simpara>The <ulink url="&maximumsegmentsize;">maximum segment size</ulink> (MSS) is used as an alternative measure of packet size.  The relationship between MSS and MTU are:</simpara>
        <itemizedlist>
          <listitem>
            <simpara>
MSS = MTU - 40 for IPv4
</simpara>
          </listitem>
          <listitem>
            <simpara>
MSS = MTU - 60 for IPv6
</simpara>
          </listitem>
        </itemizedlist>
        <note>
          <simpara>The <literal>iptables</literal>(8) (see <xref linkend="_netfilter"/>) based optimization can clamp packet size by the MSS and is useful for the router.</simpara>
        </note>
      </section>
      <section id="_wan_tcp_optimization">
        <title>WAN TCP optimization</title>
        <simpara>The TCP throughput can be maximized by adjusting TCP buffer size parameters as described in "<ulink url="&tcptuningguide;">TCP Tuning Guide</ulink>" and "<ulink url="&tcptuning;">TCP tuning</ulink>"  for the modern high-bandwidth and high-latency WAN.  So far, the current Debian default settings serve well even for my LAN connected by the fast 1G bps FTTP service.</simpara>
      </section>
    </section>
    <section id="_netfilter">
      <title>Netfilter</title>
      <simpara><ulink url="&netfilter;">Netfilter</ulink> provides infrastructure for <ulink url="&statefulfirewall;">stateful firewall</ulink> and <ulink url="&networkaddresstranslationnat;">network address translation (NAT)</ulink> with <ulink url="&linuxkernel;">Linux kernel</ulink> modules (see <xref linkend="_the_kernel_module_initialization"/>).</simpara>
      <table id="listoffirewalltools" pgwide="0" frame="topbot" rowsep="1" colsep="1">
        <title>List of firewall tools.</title>
        <tgroup cols="4">
          <colspec colwidth="20%*" align="left"/>
          <colspec colwidth="20%*" align="left"/>
          <colspec colwidth="20%*" align="left"/>
          <colspec colwidth="40%*" align="left"/>
          <thead>
            <row>
              <entry>
    packages
    </entry>
              <entry>
    popcon
    </entry>
              <entry>
    size
    </entry>
              <entry>
    description
    </entry>
            </row>
          </thead>
          <tbody>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/iptables">
                <literal>iptables</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/iptables">&pop-iptables;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/i/iptables.html">&size-iptables;</ulink></entry>
              <entry>
    administration tools for <ulink url="&netfilter;">netfilter</ulink>
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/iptstate">
                <literal>iptstate</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/iptstate">&pop-iptstate;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/i/iptstate.html">&size-iptstate;</ulink></entry>
              <entry>
    Tool to continuously monitor <ulink url="&netfilter;">netfilter</ulink> state. (similar to <literal>top</literal>(1))
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/shorewall-perl">
                <literal>shorewall-perl</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/shorewall-perl">&pop-shorewallperl;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/s/shorewall-perl.html">&size-shorewallperl;</ulink></entry>
              <entry><ulink url="&shorelinefirewall;">Shoreline Firewall</ulink>, <ulink url="&netfilter;">netfilter</ulink> configuration file generator (Perl-based, recommended for <literal>lenny</literal>)
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/shorewall-shell">
                <literal>shorewall-shell</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/shorewall-shell">&pop-shorewallshell;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/s/shorewall-shell.html">&size-shorewallshell;</ulink></entry>
              <entry><ulink url="&shorelinefirewall;">Shoreline Firewall</ulink>, <ulink url="&netfilter;">netfilter</ulink> configuration file generator (shell-based, alternative for <literal>lenny</literal>)
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/ipmasq">
                <literal>ipmasq</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/ipmasq">&pop-ipmasq;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/i/ipmasq.html">&size-ipmasq;</ulink></entry>
              <entry>
    Simple set of init script to configure <ulink url="&netfilter;">netfilter</ulink> (old)
    </entry>
            </row>
          </tbody>
        </tgroup>
      </table>
      <simpara>Main user space program of <ulink url="&netfilter;">netfilter</ulink> is <literal>iptables</literal>(8).  You can manually configure <ulink url="&netfilter;">netfilter</ulink> interactively from shell, save its state with <literal>iptables-save</literal>(8), and restore it via init script with <literal>iptables-restore</literal>(8) upon system reboot.</simpara>
      <simpara>Configuration helper scripts such as <ulink url="&shorewall;">shorewall</ulink> ease this process.</simpara>
      <simpara>See documentation at <ulink url="&httpwwwnetfilterorgdocumentation;">http://www.netfilter.org/documentation/</ulink> (or in "<literal>/usr/share/doc/iptables/html/</literal>"):</simpara>
      <itemizedlist>
        <listitem>
          <simpara>
            <ulink url="&linuxnetworkingconceptshowto;">Linux Networking-concepts HOWTO</ulink>
          </simpara>
        </listitem>
        <listitem>
          <simpara>
            <ulink url="&linuxcepacketfilteringhowto;">Linux 2.4 Packet Filtering HOWTO</ulink>
          </simpara>
        </listitem>
        <listitem>
          <simpara>
            <ulink url="&linuxcenathowto;">Linux 2.4 NAT HOWTO</ulink>
          </simpara>
        </listitem>
      </itemizedlist>
      <tip>
        <simpara>Although these were written for Linux <emphasis role="strong">2.4</emphasis>, both <literal>iptables</literal>(8) command and netfilter kernel function apply for current Linux <emphasis role="strong">2.6</emphasis>.</simpara>
      </tip>
    </section>
  </chapter>
  <chapter id="_network_applications">
    <title>Network applications</title>
    <simpara>After establishing network connectivity (see <xref linkend="_network_setup"/>), you can run verious network applications.</simpara>
    <section id="_web_browsers">
      <title>Web browsers</title>
      <simpara>There are many <ulink url="&webbrowser;">web browser</ulink> packages to access remote contents with <ulink url="&hypertexttransferprotocol;">Hypertext Transfer Protocol</ulink> (HTTP).</simpara>
      <table id="listofwebbrowsers" pgwide="0" frame="topbot" rowsep="1" colsep="1">
        <title>List of web browsers.</title>
        <tgroup cols="4">
          <colspec colwidth="20%*" align="left"/>
          <colspec colwidth="20%*" align="left"/>
          <colspec colwidth="20%*" align="left"/>
          <colspec colwidth="40%*" align="left"/>
          <thead>
            <row>
              <entry>
    package
    </entry>
              <entry>
    popcon
    </entry>
              <entry>
    size
    </entry>
              <entry>
    description
    </entry>
            </row>
          </thead>
          <tbody>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/iceweasel">
                <literal>iceweasel</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/iceweasel">&pop-iceweasel;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/i/iceweasel.html">&size-iceweasel;</ulink></entry>
              <entry>
    Web browser (X) (<ulink url="&unbranded;">unbranded</ulink> <ulink url="&mozillafirefox;">Mozilla Firefox</ulink>, )
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/iceape-browser">
                <literal>iceape-browser</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/iceape-browser">&pop-iceapebrowser;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/i/iceape-browser.html">&size-iceapebrowser;</ulink></entry>
              <entry>
    Web browser (X) (<ulink url="&unbranded;">unbranded</ulink> <ulink url="&mozilla;">Mozilla</ulink> browser, removed due to security concerns <ulink url="&bugfaffgf;">bug#505565</ulink>)
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/epiphany-browser">
                <literal>epiphany-browser</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/epiphany-browser">&pop-epiphanybrowser;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/e/epiphany-browser.html">&size-epiphanybrowser;</ulink></entry>
              <entry>
    Web browser (X) (<ulink url="&gnome;">GNOME</ulink> <ulink url="&hig;">HIG</ulink> compliant browser, <ulink url="&epiphany;">Epiphany</ulink>)
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/galeon">
                <literal>galeon</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/galeon">&pop-galeon;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/g/galeon.html">&size-galeon;</ulink></entry>
              <entry>
    Web browser (X) (<ulink url="&gnome;">GNOME</ulink> browser, <ulink url="&galeon;">Galeon</ulink> was superseded by <ulink url="&epiphany;">Epiphany</ulink>)
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/konqueror">
                <literal>konqueror</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/konqueror">&pop-konqueror;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/k/konqueror.html">&size-konqueror;</ulink></entry>
              <entry>
    Web browser (X) (<ulink url="&kde;">KDE</ulink> browser, <ulink url="&konqueror;">Konqueror</ulink>)
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/w3m">
                <literal>w3m</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/w3m">&pop-wdm;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/w/w3m.html">&size-wdm;</ulink></entry>
              <entry>
    Web browser (text) (<ulink url="&wdm;">w3m</ulink>)
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/lynx">
                <literal>lynx</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/lynx">&pop-lynx;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/l/lynx.html">&size-lynx;</ulink></entry>
              <entry>
    , ,
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/elinks">
                <literal>elinks</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/elinks">&pop-elinks;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/e/elinks.html">&size-elinks;</ulink></entry>
              <entry>
    , ,
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/links">
                <literal>links</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/links">&pop-links;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/l/links.html">&size-links;</ulink></entry>
              <entry>
    , ,
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/links2">
                <literal>links2</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/links2">&pop-linksc;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/l/links2.html">&size-linksc;</ulink></entry>
              <entry>
    , ,
    </entry>
            </row>
          </tbody>
        </tgroup>
      </table>
      <section id="_browser_configuration">
        <title>Browser configuration</title>
        <simpara>You may be able to use following special URL strings for some browsers to confirm their settings.</simpara>
        <itemizedlist>
          <listitem>
            <simpara>
"<literal>about:</literal>"
</simpara>
          </listitem>
          <listitem>
            <simpara>
"<literal>about:config</literal>"
</simpara>
          </listitem>
          <listitem>
            <simpara>
"<literal>about:plugins</literal>"
</simpara>
          </listitem>
        </itemizedlist>
        <simpara>Debian offers many free browser plugin packages in the main component which can handle not only <ulink url="&javasoftwareplatform;">Java (software platform)</ulink> and <ulink url="&flash;">Flash</ulink> but also <ulink url="&mpeg;">MPEG</ulink>, <ulink url="&mpegc;">MPEG2</ulink>, <ulink url="&mpege;">MPEG4</ulink>, <ulink url="&divx;">DivX</ulink>, <ulink url="&windowsmediavideowmv;">Windows Media Video (.wmv)</ulink>, <ulink url="&quicktimemov;">QuickTime (.mov)</ulink>, <ulink url="&mpdmpd;">MP3 (.mp3)</ulink>, <ulink url="&oggvorbis;">Ogg/Vorbis</ulink> files, DVDs, VCDs, etc.  Debian also offers helper programs to install non-free browser plugin packages as contrib or non-free components.</simpara>
        <table id="listofbrowserpluginpackages" pgwide="0" frame="topbot" rowsep="1" colsep="1">
          <title>List of browser plugin packages.</title>
          <tgroup cols="5">
            <colspec colwidth="10%*" align="left"/>
            <colspec colwidth="10%*" align="left"/>
            <colspec colwidth="10%*" align="left"/>
            <colspec colwidth="10%*" align="left"/>
            <colspec colwidth="60%*" align="left"/>
            <thead>
              <row>
                <entry>
    package
    </entry>
                <entry>
    popcon
    </entry>
                <entry>
    size
    </entry>
                <entry>
    component
    </entry>
                <entry>
    description
    </entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/icedtea-gcjwebplugin">
                  <literal>icedtea-gcjwebplugin</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/icedtea-gcjwebplugin">&pop-icedteagcjwebplugin;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/i/icedtea-gcjwebplugin.html">&size-icedteagcjwebplugin;</ulink></entry>
                <entry>
    main
    </entry>
                <entry>
    Java plugin using Hotspot JIT
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/sun-java6-plugin">
                  <literal>sun-java6-plugin</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/sun-java6-plugin">&pop-sunjavagplugin;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/s/sun-java6-plugin.html">&size-sunjavagplugin;</ulink></entry>
                <entry>
    non-free
    </entry>
                <entry>
    Java plugin for Sun's Java SE 6 (i386 only)
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/swfdec-mozilla">
                  <literal>swfdec-mozilla</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/swfdec-mozilla">&pop-swfdecmozilla;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/s/swfdec-mozilla.html">&size-swfdecmozilla;</ulink></entry>
                <entry>
    main
    </entry>
                <entry>
    Flash plugin based on libswfdec
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/mozilla-plugin-gnash">
                  <literal>mozilla-plugin-gnash</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/mozilla-plugin-gnash">&pop-mozillaplugingnash;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/m/mozilla-plugin-gnash.html">&size-mozillaplugingnash;</ulink></entry>
                <entry>
    main
    </entry>
                <entry>
    Flash plugin based on Gnash
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/flashplugin-nonfree">
                  <literal>flashplugin-nonfree</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/flashplugin-nonfree">&pop-flashpluginnonfree;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/f/flashplugin-nonfree.html">&size-flashpluginnonfree;</ulink></entry>
                <entry>
    contrib
    </entry>
                <entry>
    Flash plugin helper to install Adobe Flash Player (i386, amd64 only)
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/mozilla-bonobo">
                  <literal>mozilla-bonobo</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/mozilla-bonobo">&pop-mozillabonobo;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/m/mozilla-bonobo.html">&size-mozillabonobo;</ulink></entry>
                <entry>
    main
    </entry>
                <entry>
    Mozilla plugin support for GNOME Bonobo components
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/mozilla-plugin-vlc">
                  <literal>mozilla-plugin-vlc</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/mozilla-plugin-vlc">&pop-mozillapluginvlc;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/m/mozilla-plugin-vlc.html">&size-mozillapluginvlc;</ulink></entry>
                <entry>
    main
    </entry>
                <entry>
    Multimedia plugin based on <ulink url="&vlcmediaplayer;">VLC media player</ulink>
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/totem-mozilla">
                  <literal>totem-mozilla</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/totem-mozilla">&pop-totemmozilla;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/t/totem-mozilla.html">&size-totemmozilla;</ulink></entry>
                <entry>
    main
    </entry>
                <entry>
    Multimedia plugin based on <ulink url="&gnomestotemmediaplayer;">GNOME's Totem media player</ulink>
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/gecko-mediaplayer">
                  <literal>gecko-mediaplayer</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/gecko-mediaplayer">&pop-geckomediaplayer;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/g/gecko-mediaplayer.html">&size-geckomediaplayer;</ulink></entry>
                <entry>
    main
    </entry>
                <entry>
    Multimedia plugin based on (GNOME) <ulink url="&mplayer;">MPlayer</ulink>
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/nspluginwrapper">
                  <literal>nspluginwrapper</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/nspluginwrapper">&pop-nspluginwrapper;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/n/nspluginwrapper.html">&size-nspluginwrapper;</ulink></entry>
                <entry>
    contrib
    </entry>
                <entry>
    A wrapper to run i386 Netscape plugins on amd64 architecture
    </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
        <tip>
          <simpara>Although use of above Debian packages are much easier, browser plugins can be still manually enabled by installing "*.so" into plugin directories (e.g., "<literal>/usr/lib/iceweasel/plugins/</literal>") and restarting browsers.</simpara>
        </tip>
        <simpara>Some web sites refuse to be connected based on the user-agent string of your browser.  You can work around this situation by <ulink url="&spoofingtheuseragentstring;">spoofing the user-agent string</ulink>.  For exaple, you can do this by adding following line into user configuration files such as "<literal>~/.gnome2/epiphany/mozilla/epiphany/user.js</literal>" or "<literal>~/.mozilla/firefox/*.default/user.js</literal>":</simpara>
        <screen>user_pref{"general.useragent.override","Mozilla/4.0 (compatible; MSIE 7.0; Windows NT 6.0)"};</screen>
        <simpara>Alternatively, you can add and reset this variable by typing "<literal>about:config</literal>" into URL and right clicking its display contents.</simpara>
        <caution>
          <simpara>Spoofed user-agent string may cause <ulink url="&badsideeffectswithjava;">bad side effects with Java</ulink>.</simpara>
        </caution>
      </section>
    </section>
    <section id="_the_mail_system">
      <title>The mail system</title>
      <caution>
        <simpara>If you are to set up the mail server to exchange mail directly with the Internet, you should be better than reading this elementary document.</simpara>
      </caution>
      <section id="_modern_mail_service_basics">
        <title>Modern mail service basics</title>
        <simpara>In order to contain spam (unwanted and unsolicited e-mail) problems, many ISPs which provide consumer grade Internet connection are implementing counter measures:</simpara>
        <itemizedlist>
          <listitem>
            <simpara>
The smarthost service for their customers to send message uses the message submission port (587) specified in <ulink url="&rfceeaj;">rfc4409</ulink> with the password (<ulink url="&smtpauth;">SMTP AUTH</ulink> service) specified in <ulink url="&rfcejfe;">rfc4954</ulink>.
</simpara>
          </listitem>
          <listitem>
            <simpara>
The <ulink url="&smtp;">SMTP</ulink> port (25) connection from their internal network hosts (except ISP's own outgoing mail server) to the Internet are blocked.
</simpara>
          </listitem>
          <listitem>
            <simpara>
The <ulink url="&smtp;">SMTP</ulink> port (25) connection to the ISP's incoming mail server from some suspicious external network hosts are blocked.  (The connection from hosts on the dynamic IP address range used by the dial-up and other consumer grade Internet connections are the first ones to be blocked.)
</simpara>
          </listitem>
        </itemizedlist>
        <simpara>When configuring your mail system or resolving mail delivery problems, you must consider these new limitations.</simpara>
        <simpara>In light of these hostile Internet situation and limitations, some independent Internet mail ISPs such as Yahoo.com and Gmail.com offer the secure mail service which can be connected from anywhere on the Internet using <ulink url="&transportlayerseesocketslayerssl;">Transport Layer Security (TLS) and its predecessor, Secure Sockets Layer (SSL)</ulink> :</simpara>
        <itemizedlist>
          <listitem>
            <simpara>
The smarthost service for their customers to send message uses the SMTP/SSL port (465) or the message submission port (587) with the password (SMTP AUTH service).
</simpara>
          </listitem>
          <listitem>
            <simpara>
The incoming mail is accessible at the TLS/POP3 port (995) with <ulink url="&popd;">POP3</ulink>.
</simpara>
          </listitem>
        </itemizedlist>
        <caution>
          <simpara>It is not realistic to run SMTP server on consumer grade network to send mail directly to the remote host reliably.  They are very likely to be rejected.  You must use some smarthost services offered by your connection ISP or independent mail ISPs.  For the simplicity, I will assume that the smarthost is located at "<literal>smtp.hostname.dom</literal>", requires <ulink url="&smtpauth;">SMTP AUTH</ulink>, and uses the message submission port (587) in the following text.</simpara>
        </caution>
      </section>
      <section id="_basic_mail_software_choice">
        <title>Basic mail software choice</title>
        <table id="listofpopularmaiemforworkstation" pgwide="0" frame="topbot" rowsep="1" colsep="1">
          <title>List of popular mail system for workstation.</title>
          <tgroup cols="4">
            <colspec colwidth="20%*" align="left"/>
            <colspec colwidth="20%*" align="left"/>
            <colspec colwidth="20%*" align="left"/>
            <colspec colwidth="40%*" align="left"/>
            <thead>
              <row>
                <entry>
    package
    </entry>
                <entry>
    popcon
    </entry>
                <entry>
    size
    </entry>
                <entry>
    function
    </entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/exim4-daemon-light">
                  <literal>exim4-daemon-light</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/exim4-daemon-light">&pop-eximedaemonlight;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/e/exim4-daemon-light.html">&size-eximedaemonlight;</ulink></entry>
                <entry>
    Exim4 mail transport agent (MTA: Debian default)
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/exim4-base">
                  <literal>exim4-base</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/exim4-base">&pop-eximebase;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/e/exim4-base.html">&size-eximebase;</ulink></entry>
                <entry>
    Exim4 documentation (text) and common files
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/exim4-doc-html">
                  <literal>exim4-doc-html</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/exim4-doc-html">&pop-eximedochtml;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/e/exim4-doc-html.html">&size-eximedochtml;</ulink></entry>
                <entry>
    Exim4 documentation (html)
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/exim4-doc-info">
                  <literal>exim4-doc-info</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/exim4-doc-info">&pop-eximedocinfo;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/e/exim4-doc-info.html">&size-eximedocinfo;</ulink></entry>
                <entry>
    Exim4 documentation (info)
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/postfix">
                  <literal>postfix</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/postfix">&pop-postfix;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/p/postfix.html">&size-postfix;</ulink></entry>
                <entry>
    Postfix mail transport agent (MTA: alternative)
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/postfix-doc">
                  <literal>postfix-doc</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/postfix-doc">&pop-postfixdoc;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/p/postfix-doc.html">&size-postfixdoc;</ulink></entry>
                <entry>
    Postfix documentation (html+text)
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/sasl2-bin">
                  <literal>sasl2-bin</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/sasl2-bin">&pop-saslcbin;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/s/sasl2-bin.html">&size-saslcbin;</ulink></entry>
                <entry>
    Cyrus SASL API implementation (supplement postfix for SMTP-AUTH)
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/cyrus-sasl2-doc">
                  <literal>cyrus-sasl2-doc</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/cyrus-sasl2-doc">&pop-cyrussaslcdoc;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/c/cyrus-sasl2-doc.html">&size-cyrussaslcdoc;</ulink></entry>
                <entry>
    Cyrus SASL - documentation
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/fetchmail">
                  <literal>fetchmail</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/fetchmail">&pop-fetchmail;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/f/fetchmail.html">&size-fetchmail;</ulink></entry>
                <entry>
    Remote mail retrieval and forwarding utility
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/procmail">
                  <literal>procmail</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/procmail">&pop-procmail;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/p/procmail.html">&size-procmail;</ulink></entry>
                <entry>
    Mail filter utility
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/mutt">
                  <literal>mutt</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/mutt">&pop-mutt;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/m/mutt.html">&size-mutt;</ulink></entry>
                <entry>
    Mail user agent (MUA) to read/write the mail usually used with <literal>vim</literal>
    </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
        <simpara>The choice between <literal>exim4-*</literal> and <literal>postfix</literal> packages is really up to you.</simpara>
        <simpara>Although the popcon vote count of exim4 looks several times popular than that of postfix, this does not mean postfix is not popular with Debian developers.  The Debian server system uses both exim4 and postfix.  The <ulink url="&mailheaderanalysis;">mail header analysis</ulink> of mailing list postings from prominent Debian developers also indicate both of these MTAs are as popular.</simpara>
        <simpara>The <literal>exim4-*</literal> packages are known to have very small memory consumption and very flexible for its configuration.  The <literal>postfix</literal> package is known to be compact, fast, simple, and secure.  Both come with ample documentation and are as good in quality and license.</simpara>
      </section>
      <section id="_the_mail_configuration_strategy_for_workstation">
        <title>The mail configuration strategy for workstation</title>
        <simpara>The most simple mail configuration is that the mail is sent to the ISP's smarthost and received from ISP's POP3 server by the MUA itself. This type of configuration is popular with full featured GUI based mail user agent (MUA) such as <literal>icedove</literal>(1), <literal>evolution</literal>(1), etc.. If you need to filter mail by their types, you use MUA's filtering function. For this case, the local mail transport agent (MTA) need to do local delivery only.</simpara>
        <simpara>The alternative mail configuration is that the mail is sent via local MTA to the ISP's smarthost and received from ISP's POP3 by <literal>fetchmail</literal>(1) to the local mailbox.  If you need to filter mail by their types, you use <literal>procmail</literal>(1) to filter mail into separate mailboxes.  This type of configuration is popular with simple console based MUA such as <literal>mutt</literal>(1), <literal>gnus</literal>(1), etc., although this is possible with any MUAs. For this case, the local MTA need to do both smarthost delivery and local delivery.</simpara>
        <section id="_the_configuration_of_exim4">
          <title>The configuration of exim4</title>
          <simpara>For Internet via smarthost, you (re)configure <literal>exim4-*</literal> packages as follows:</simpara>
          <screen>$ sudo /etc/init.d/exim4 stop
$ sudo dpkg-reconfigure exim4-conf</screen>
          <itemizedlist>
            <listitem>
              <simpara>
Chose "mail sent by smarthost; received via SMTP or fetchmail".
</simpara>
            </listitem>
            <listitem>
              <simpara>
Set "IP address or host name of the outgoing smarthost:" to "smtp.hostname.dom:587".
</simpara>
            </listitem>
            <listitem>
              <simpara>
Reply to "Keep number of DNS-queries minimal (Dial-on-Demand)?" as:
</simpara>
              <itemizedlist>
                <listitem>
                  <simpara>
"No" if the system is connected to Internet while booting, or
</simpara>
                </listitem>
                <listitem>
                  <simpara>
"Yes" if the system is <emphasis role="strong">not</emphasis> connected to Internet while booting.
</simpara>
                </listitem>
              </itemizedlist>
            </listitem>
          </itemizedlist>
          <screen>$ sudo vim /etc/exim4/passwd.client</screen>
          <itemizedlist>
            <listitem>
              <simpara>
Create password entries for the smarthost.
</simpara>
            </listitem>
          </itemizedlist>
          <screen>$ cat /etc/exim4/passwd.client
^smtp.*\.hostname\.dom:username@hostname.dom:password
$ sudo /etc/init.d/exim4 start</screen>
          <simpara>The host name in "<literal>/etc/exim4/passwd.client</literal>" should not be the alias.  You check the real host name with:</simpara>
          <screen>$ host smtp.hostname.dom
smtp.hostname.dom is an alias for smtp99.hostname.dom.
smtp99.hostname.dom has address 123.234.123.89</screen>
          <simpara>I use regex in "<literal>/etc/exim4/passwd.client</literal>" to work around the alias issue so even if the ISP moves host pointed by the alias, SMTP AUTH will likely be working.</simpara>
          <caution>
            <simpara>You must execute <literal>update-exim4.conf</literal>(8) after manually updating <literal>exim4</literal> configuration files in "<literal>/etc/exim4/</literal>".</simpara>
          </caution>
          <caution>
            <simpara>Starting <literal>exim4</literal> will take long time if "No" (default value) was chosen for the debconf query of "Keep number of DNS-queries minimal (Dial-on-Demand)?" and the system is <emphasis role="strong">not</emphasis> connected to Internet while booting.</simpara>
          </caution>
          <note>
            <simpara>Please read the official guide at: "<literal>/usr/share/doc/exim4-base/README.Debian.gz</literal>" and <literal>update-exim4.conf</literal>(8).</simpara>
          </note>
          <tip>
            <simpara>Local customization file "<literal>/etc/exim4/exim4.conf.localmacros</literal>" may be created to set MACROs.  For example, <ulink url="&yahoo;">Yahoo</ulink>'s mail service is said to require "<literal>MAIN_TLS_ENABLE = true</literal>" and "<literal>AUTH_CLIENT_ALLOW_NOTLS_PASSWORDS = yes</literal>" in it.</simpara>
          </tip>
        </section>
        <section id="_the_configuration_of_postfix_with_sasl">
          <title>The configuration of postfix with SASL</title>
          <simpara>For Internet via smarthost, you should first read <ulink url="&postfixdocumentation;">postfix documentation</ulink> and key manual pages:</simpara>
          <table id="listofimportantpstfixmanualpages" pgwide="0" frame="topbot" rowsep="1" colsep="1">
            <title>List of important postfix manual pages</title>
            <tgroup cols="2">
              <colspec colwidth="30%*" align="left"/>
              <colspec colwidth="70%*" align="left"/>
              <thead>
                <row>
                  <entry>
    command
    </entry>
                  <entry>
    function
    </entry>
                </row>
              </thead>
              <tbody>
                <row>
                  <entry><literal>postfix</literal>(1)
    </entry>
                  <entry>
    Postfix control program
    </entry>
                </row>
                <row>
                  <entry><literal>postconf</literal>(1)
    </entry>
                  <entry>
    Postfix configuration utility
    </entry>
                </row>
                <row>
                  <entry><literal>postconf</literal>(5)
    </entry>
                  <entry>
    Postfix configuration parameters
    </entry>
                </row>
                <row>
                  <entry><literal>postmap</literal>(1)
    </entry>
                  <entry>
    Postfix lookup table maintenance
    </entry>
                </row>
                <row>
                  <entry><literal>postalias</literal>(1)
    </entry>
                  <entry>
    Postfix alias database maintenance
    </entry>
                </row>
              </tbody>
            </tgroup>
          </table>
          <simpara>You (re)configure <literal>postfix</literal> and <literal>sasl2-bin</literal> packages as follows:</simpara>
          <screen>$ sudo /etc/init.d/postfix stop
$ sudo dpkg-reconfigure postfix</screen>
          <itemizedlist>
            <listitem>
              <simpara>
Chose "Internet with smarthost"
</simpara>
            </listitem>
            <listitem>
              <simpara>
Set "SMTP relay host (blank for none):" to "<literal>[smtp.hostname.dom]:587</literal>"
</simpara>
            </listitem>
          </itemizedlist>
          <screen>$ sudo postconf -e 'smtp_sender_dependent_authentication = yes'
$ sudo postconf -e 'smtp_sasl_auth_enable = yes'
$ sudo postconf -e 'smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd'
$ sudo postconf -e 'smtp_sasl_type = cyrus'
$ sudo vim /etc/postfix/sasl_passwd</screen>
          <itemizedlist>
            <listitem>
              <simpara>
Create password entries for the smarthost.
</simpara>
            </listitem>
          </itemizedlist>
          <screen>$ cat /etc/postfix/sasl_passwd
[smtp.hostname.dom]:587     username:password
$ sudo postmap hush:/etc/postfix/sasl_passwd
$ sudo /etc/init.d/postfix start</screen>
          <simpara>Here the use of "<literal>[</literal>" and "<literal>]</literal>" in the dpkg-reconfigure dialogue and "<literal>/etc/postfix/sasl_passwd</literal>" ensures not to check MX record but directly use exact hostname specified.  Read more for "Enabling SASL authentication in the Postfix SMTP client" in "<literal>usr/share/doc/postfix/html/SASL_README.html</literal>".</simpara>
        </section>
        <section id="_the_mail_address_configuration">
          <title>The mail address configuration</title>
          <simpara>There are a few <ulink url="&mailaddressconfieryanduseragents;">mail address configuration files for mail transport, delivery and user agents</ulink>.</simpara>
          <table id="listofmailaddresnfigurationfiles" pgwide="0" frame="topbot" rowsep="1" colsep="1">
            <title>List of mail address related configuration files.</title>
            <tgroup cols="3">
              <colspec colwidth="30%*" align="left"/>
              <colspec colwidth="30%*" align="left"/>
              <colspec colwidth="40%*" align="left"/>
              <thead>
                <row>
                  <entry>
    file
    </entry>
                  <entry>
    function
    </entry>
                  <entry>
    application
    </entry>
                </row>
              </thead>
              <tbody>
                <row>
                  <entry>
                    <literal>/etc/mailname</literal>
                  </entry>
                  <entry>
    default host name for (outgoing) mail
    </entry>
                  <entry>
    Debian specific, <literal>mailname</literal>(5)
    </entry>
                </row>
                <row>
                  <entry>
                    <literal>/etc/email-addresses</literal>
                  </entry>
                  <entry>
    host name spoofing for outgoing mail
    </entry>
                  <entry><literal>exim</literal>(8) specific, <literal>exim4-config_files</literal>(5)
    </entry>
                </row>
                <row>
                  <entry>
                    <literal>/etc/postfix/generic</literal>
                  </entry>
                  <entry>
    host name spoofing for outgoing mail
    </entry>
                  <entry><literal>postfix</literal>(1) specific, activated after <literal>postmap</literal>(1) command execution.
    </entry>
                </row>
                <row>
                  <entry>
                    <literal>/etc/aliases</literal>
                  </entry>
                  <entry>
    account name alias for incoming mail
    </entry>
                  <entry>
    general, activated after <literal>newaliases</literal>(1) command execution.
    </entry>
                </row>
              </tbody>
            </tgroup>
          </table>
          <simpara>The <emphasis role="strong">mailname</emphasis> in the "<literal>/etc/mailname</literal>" file is usually a fully qualified domain name (FQDN) that resolves to one of the host's IP addresses.  The mobile workstation which does not have a hostname with resolvable IP address, set this <emphasis role="strong">mailname</emphasis> to the value of "<literal>hostname -f</literal>". (This is safe choice and works for both <literal>exim4-*</literal> and <literal>postfix</literal>.)</simpara>
          <tip>
            <simpara>The contents of "<literal>/etc/mailname</literal>" is used by many non-MTA programs for their default behavior. For <literal>mutt</literal>, set "<literal>hostname</literal>" and "<literal>from</literal>" variables in <literal>~/muttrc</literal> file to override the <emphasis role="strong">mailname</emphasis> value.  For programs in the <literal>devscripts</literal> package, such as <literal>bts</literal>(1) and <literal>dch</literal>(1), export environment variables "<literal>$DEBFULLNAME</literal>" and "<literal>$DEBEMAIL</literal>" to override it.</simpara>
          </tip>
          <simpara>When setting the <emphasis role="strong">mailname</emphasis> to "<literal>hostname -f</literal>", the spoofing of the source mail address via MTA can be realized by:</simpara>
          <itemizedlist>
            <listitem>
              <simpara>
"<literal>/etc/email-addresses</literal>" file for <literal>exim4</literal>(8) as explained in the <literal>exim4-config_files</literal>(5), and
</simpara>
            </listitem>
            <listitem>
              <simpara>
"<literal>/etc/postfix/generic</literal>" file for <literal>postfix</literal>(1) as explained in the <literal>generic</literal>(5).
</simpara>
            </listitem>
          </itemizedlist>
          <simpara>For <literal>postfix</literal>, the following extra steps are needed:</simpara>
          <screen># postmap hash:/etc/postfix/generic
# postconf -e 'smtp_generic_maps = hash:/etc/postfix/generic'
# postfix reload</screen>
          <simpara>You check filters using:</simpara>
          <itemizedlist>
            <listitem>
              <simpara><literal>exim</literal>(8) with <literal>-brw, -bf, -bF, -bV, …</literal> options.
</simpara>
            </listitem>
            <listitem>
              <simpara><literal>postmap</literal>(1) with <literal>-q</literal> option.
</simpara>
            </listitem>
          </itemizedlist>
          <tip>
            <simpara>Exim comes with several utility programs such as <literal>exiqgrep</literal>(8) and <literal>exipick</literal>(8).  See "<literal>dpkg -L exim4-base|grep man8/</literal>" for available commands.</simpara>
          </tip>
        </section>
      </section>
      <section id="_tips_for_managing_the_mail">
        <title>Tips for managing the mail</title>
        <section id="_basic_mta_operations">
          <title>Basic MTA operations</title>
          <simpara>There are several basic MTA operations.  Some may be performed via <literal>sendmail</literal>(1) compatibility interface.</simpara>
          <table id="listofbasicmtaoperation" pgwide="0" frame="topbot" rowsep="1" colsep="1">
            <title>List of basic MTA operation.</title>
            <tgroup cols="3">
              <colspec colwidth="30%*" align="left"/>
              <colspec colwidth="30%*" align="left"/>
              <colspec colwidth="40%*" align="left"/>
              <thead>
                <row>
                  <entry>
    exim command
    </entry>
                  <entry>
    postfix command
    </entry>
                  <entry>
    description
    </entry>
                </row>
              </thead>
              <tbody>
                <row>
                  <entry>
                    <literal>sendmail</literal>
                  </entry>
                  <entry>
                    <literal>sendmail</literal>
                  </entry>
                  <entry>
    Read mail from standard input and arrange for delivery. (<literal>-bm</literal>)
    </entry>
                </row>
                <row>
                  <entry>
                    <literal>mailq</literal>
                  </entry>
                  <entry>
                    <literal>mailq</literal>
                  </entry>
                  <entry>
    List the mail queue with status and queue ID. (<literal>-bp</literal>)
    </entry>
                </row>
                <row>
                  <entry>
                    <literal>newaliases</literal>
                  </entry>
                  <entry>
                    <literal>newaliases</literal>
                  </entry>
                  <entry>
    Initialize alias database. (<literal>-I</literal>)
    </entry>
                </row>
                <row>
                  <entry>
                    <literal>exim4 -q</literal>
                  </entry>
                  <entry>
                    <literal>postqueue -f</literal>
                  </entry>
                  <entry>
    flush waiting mail (<literal>-q</literal>)
    </entry>
                </row>
                <row>
                  <entry>
                    <literal>exim4 -qf</literal>
                  </entry>
                  <entry>
                    <literal>postsuper -r ALL deferred; postqueue -f</literal>
                  </entry>
                  <entry>
    flush all mail
    </entry>
                </row>
                <row>
                  <entry>
                    <literal>exim4 -qff</literal>
                  </entry>
                  <entry>
                    <literal>postsuper -r ALL; postqueue -f</literal>
                  </entry>
                  <entry>
    flush even frozen mail
    </entry>
                </row>
                <row>
                  <entry>
                    <literal>exim4 -Mg queue_id</literal>
                  </entry>
                  <entry>
                    <literal>postsuper -h queue_id</literal>
                  </entry>
                  <entry>
    freeze one message by its queue ID
    </entry>
                </row>
                <row>
                  <entry>
                    <literal>exim4 -Mrm queue_id</literal>
                  </entry>
                  <entry>
                    <literal>postsuper -d queue_id</literal>
                  </entry>
                  <entry>
    remove one message by its queue ID
    </entry>
                </row>
                <row>
                  <entry>
    ---
    </entry>
                  <entry>
                    <literal>postsuper -d ALL</literal>
                  </entry>
                  <entry>
    remove all messages
    </entry>
                </row>
              </tbody>
            </tgroup>
          </table>
          <simpara>For the script in "<literal>/etc/ppp/ip-up.d/*</literal>", "flush all mail" may be good idea.</simpara>
        </section>
        <section id="_basic_mua_8212_mutt">
          <title>Basic MUA  — Mutt</title>
          <simpara>Use <literal>mutt</literal> as the mail user agent (MUA) in combination with <literal>vim</literal>. Customize with "<literal>~/.muttrc</literal>"; for example:</simpara>
          <screen># use visual mode and "gq" to reformat quotes
set editor="vim -c 'set tw=72 et ft=mail'"
#
# header weeding taken from the manual (Sven's Draconian header weeding)
#
ignore *
unignore from: date subject to cc
unignore user-agent x-mailer
hdr_order from subject to cc date user-agent x-mailer
set hostname=spoof.example.org
set from="First Last &lt;username@example.org&gt;"
....</screen>
          <simpara>Add the following to "<literal>/etc/mailcap</literal>" or "<literal>~/.mailcap</literal>" to display HTML mail and MS Word attachments inline:</simpara>
          <screen>text/html; lynx -force_html %s; needsterminal;
application/msword; /usr/bin/antiword '%s'; copiousoutput; description="Microsoft Word Text"; nametemplate=%s.doc</screen>
        </section>
        <section id="_redeliver_mbox_contents">
          <title>Redeliver mbox contents</title>
          <simpara>You need to manually deliver mails to the sorted mailboxes in your home directory from "<literal>/var/mail/&lt;username&gt;</literal>" if your home directory became full and <literal>procmail</literal>(1) failed.  After making disk space in the home directory, run:</simpara>
          <screen># /etc/init.d/${MAILDAEMON} stop
# formail -s procmail &lt;/var/mail/&lt;username&gt;
# /etc/init.d/${MAILDAEMON} start</screen>
        </section>
      </section>
      <section id="_choices_of_software_for_the_mail">
        <title>Choices of software for the mail</title>
        <simpara>For mail system programs, there are many alternatives developed with different priority.  Here is the overview.</simpara>
        <section id="_mta">
          <title>MTA</title>
          <simpara>There are many choices for MTA (mail transfer agent).</simpara>
          <table id="listofmta" pgwide="0" frame="topbot" rowsep="1" colsep="1">
            <title>List of MTA.</title>
            <tgroup cols="4">
              <colspec colwidth="20%*" align="left"/>
              <colspec colwidth="20%*" align="left"/>
              <colspec colwidth="20%*" align="left"/>
              <colspec colwidth="40%*" align="left"/>
              <thead>
                <row>
                  <entry>
    package
    </entry>
                  <entry>
    popcon
    </entry>
                  <entry>
    size
    </entry>
                  <entry>
    capability
    </entry>
                </row>
              </thead>
              <tbody>
                <row>
                  <entry><ulink url="http://packages.debian.org/sid/exim4-daemon-light">
                    <literal>exim4-daemon-light</literal>
                  </ulink></entry>
                  <entry><ulink url="http://bugs.debian.org/exim4-daemon-light">&pop-eximedaemonlight;</ulink></entry>
                  <entry><ulink url="http://packages.qa.debian.org/e/exim4-daemon-light.html">&size-eximedaemonlight;</ulink></entry>
                  <entry>
    full
    </entry>
                </row>
                <row>
                  <entry><ulink url="http://packages.debian.org/sid/postfix">
                    <literal>postfix</literal>
                  </ulink></entry>
                  <entry><ulink url="http://bugs.debian.org/postfix">&pop-postfix;</ulink></entry>
                  <entry><ulink url="http://packages.qa.debian.org/p/postfix.html">&size-postfix;</ulink></entry>
                  <entry>
    full (security)
    </entry>
                </row>
                <row>
                  <entry><ulink url="http://packages.debian.org/sid/exim4-daemon-heavy">
                    <literal>exim4-daemon-heavy</literal>
                  </ulink></entry>
                  <entry><ulink url="http://bugs.debian.org/exim4-daemon-heavy">&pop-eximedaemonheavy;</ulink></entry>
                  <entry><ulink url="http://packages.qa.debian.org/e/exim4-daemon-heavy.html">&size-eximedaemonheavy;</ulink></entry>
                  <entry>
    full (flexible)
    </entry>
                </row>
                <row>
                  <entry><ulink url="http://packages.debian.org/sid/sendmail-bin">
                    <literal>sendmail-bin</literal>
                  </ulink></entry>
                  <entry><ulink url="http://bugs.debian.org/sendmail-bin">&pop-sendmailbin;</ulink></entry>
                  <entry><ulink url="http://packages.qa.debian.org/s/sendmail-bin.html">&size-sendmailbin;</ulink></entry>
                  <entry>
    full (only if you are already familiar)
    </entry>
                </row>
                <row>
                  <entry><ulink url="http://packages.debian.org/sid/nullmailer">
                    <literal>nullmailer</literal>
                  </ulink></entry>
                  <entry><ulink url="http://bugs.debian.org/nullmailer">&pop-nullmailer;</ulink></entry>
                  <entry><ulink url="http://packages.qa.debian.org/n/nullmailer.html">&size-nullmailer;</ulink></entry>
                  <entry>
    strip down, no local mail
    </entry>
                </row>
                <row>
                  <entry><ulink url="http://packages.debian.org/sid/ssmtp">
                    <literal>ssmtp</literal>
                  </ulink></entry>
                  <entry><ulink url="http://bugs.debian.org/ssmtp">&pop-ssmtp;</ulink></entry>
                  <entry><ulink url="http://packages.qa.debian.org/s/ssmtp.html">&size-ssmtp;</ulink></entry>
                  <entry>
    strip down, no local mail
    </entry>
                </row>
                <row>
                  <entry><ulink url="http://packages.debian.org/sid/nbsmtp">
                    <literal>nbsmtp</literal>
                  </ulink></entry>
                  <entry><ulink url="http://bugs.debian.org/nbsmtp">&pop-nbsmtp;</ulink></entry>
                  <entry><ulink url="http://packages.qa.debian.org/n/nbsmtp.html">&size-nbsmtp;</ulink></entry>
                  <entry>
    ?
    </entry>
                </row>
                <row>
                  <entry><ulink url="http://packages.debian.org/sid/courier-mta">
                    <literal>courier-mta</literal>
                  </ulink></entry>
                  <entry><ulink url="http://bugs.debian.org/courier-mta">&pop-couriermta;</ulink></entry>
                  <entry><ulink url="http://packages.qa.debian.org/c/courier-mta.html">&size-couriermta;</ulink></entry>
                  <entry>
    very full (web interface etc.)
    </entry>
                </row>
                <row>
                  <entry><ulink url="http://packages.debian.org/sid/xmail">
                    <literal>xmail</literal>
                  </ulink></entry>
                  <entry><ulink url="http://bugs.debian.org/xmail">&pop-xmail;</ulink></entry>
                  <entry><ulink url="http://packages.qa.debian.org/x/xmail.html">&size-xmail;</ulink></entry>
                  <entry>
    light
    </entry>
                </row>
                <row>
                  <entry><ulink url="http://packages.debian.org/sid/masqmail">
                    <literal>masqmail</literal>
                  </ulink></entry>
                  <entry><ulink url="http://bugs.debian.org/masqmail">&pop-masqmail;</ulink></entry>
                  <entry><ulink url="http://packages.qa.debian.org/m/masqmail.html">&size-masqmail;</ulink></entry>
                  <entry>
    light
    </entry>
                </row>
                <row>
                  <entry><ulink url="http://packages.debian.org/sid/esmtp">
                    <literal>esmtp</literal>
                  </ulink></entry>
                  <entry><ulink url="http://bugs.debian.org/esmtp">&pop-esmtp;</ulink></entry>
                  <entry><ulink url="http://packages.qa.debian.org/e/esmtp.html">&size-esmtp;</ulink></entry>
                  <entry>
    light
    </entry>
                </row>
                <row>
                  <entry><ulink url="http://packages.debian.org/sid/esmtp-run">
                    <literal>esmtp-run</literal>
                  </ulink></entry>
                  <entry><ulink url="http://bugs.debian.org/esmtp-run">&pop-esmtprun;</ulink></entry>
                  <entry><ulink url="http://packages.qa.debian.org/e/esmtp-run.html">&size-esmtprun;</ulink></entry>
                  <entry>
    light (sendmail compatibility extension to <literal>esmtp</literal>)
    </entry>
                </row>
                <row>
                  <entry><ulink url="http://packages.debian.org/sid/msmtp">
                    <literal>msmtp</literal>
                  </ulink></entry>
                  <entry><ulink url="http://bugs.debian.org/msmtp">&pop-msmtp;</ulink></entry>
                  <entry><ulink url="http://packages.qa.debian.org/m/msmtp.html">&size-msmtp;</ulink></entry>
                  <entry>
    light
    </entry>
                </row>
                <row>
                  <entry><ulink url="http://packages.debian.org/sid/msmtp-mta">
                    <literal>msmtp-mta</literal>
                  </ulink></entry>
                  <entry><ulink url="http://bugs.debian.org/msmtp-mta">&pop-msmtpmta;</ulink></entry>
                  <entry><ulink url="http://packages.qa.debian.org/m/msmtp-mta.html">&size-msmtpmta;</ulink></entry>
                  <entry>
    light (sendmail compatibility extension to <literal>msmtp</literal>)
    </entry>
                </row>
              </tbody>
            </tgroup>
          </table>
        </section>
        <section id="_mua">
          <title>MUA</title>
          <simpara>If you subscribe to Debian related mailing list, it may be a good idea to use such MUA as <literal>mutt</literal> and <literal>gnus</literal> which are the de facto standard for the participant and known to behave as expected.</simpara>
          <table id="listofmua" pgwide="0" frame="topbot" rowsep="1" colsep="1">
            <title>List of MUA.</title>
            <tgroup cols="4">
              <colspec colwidth="20%*" align="left"/>
              <colspec colwidth="20%*" align="left"/>
              <colspec colwidth="20%*" align="left"/>
              <colspec colwidth="40%*" align="left"/>
              <thead>
                <row>
                  <entry>
    package
    </entry>
                  <entry>
    popcon
    </entry>
                  <entry>
    size
    </entry>
                  <entry>
    type
    </entry>
                </row>
              </thead>
              <tbody>
                <row>
                  <entry><ulink url="http://packages.debian.org/sid/iceweasel">
                    <literal>iceweasel</literal>
                  </ulink></entry>
                  <entry><ulink url="http://bugs.debian.org/iceweasel">&pop-iceweasel;</ulink></entry>
                  <entry><ulink url="http://packages.qa.debian.org/i/iceweasel.html">&size-iceweasel;</ulink></entry>
                  <entry>
    X GUI (<ulink url="&unbranded;">unbranded</ulink> <ulink url="&mozillafirefox;">Mozilla Firefox</ulink>)
    </entry>
                </row>
                <row>
                  <entry><ulink url="http://packages.debian.org/sid/evolution">
                    <literal>evolution</literal>
                  </ulink></entry>
                  <entry><ulink url="http://bugs.debian.org/evolution">&pop-evolution;</ulink></entry>
                  <entry><ulink url="http://packages.qa.debian.org/e/evolution.html">&size-evolution;</ulink></entry>
                  <entry>
    X GUI (part of a groupware suite)
    </entry>
                </row>
                <row>
                  <entry><ulink url="http://packages.debian.org/sid/icedove">
                    <literal>icedove</literal>
                  </ulink></entry>
                  <entry><ulink url="http://bugs.debian.org/icedove">&pop-icedove;</ulink></entry>
                  <entry><ulink url="http://packages.qa.debian.org/i/icedove.html">&size-icedove;</ulink></entry>
                  <entry>
    X GUI (<ulink url="&unbranded;">unbranded</ulink> <ulink url="&mozillathunderbird;">Mozilla Thunderbird</ulink>)
    </entry>
                </row>
                <row>
                  <entry><ulink url="http://packages.debian.org/sid/mutt">
                    <literal>mutt</literal>
                  </ulink></entry>
                  <entry><ulink url="http://bugs.debian.org/mutt">&pop-mutt;</ulink></entry>
                  <entry><ulink url="http://packages.qa.debian.org/m/mutt.html">&size-mutt;</ulink></entry>
                  <entry>
    character terminal probably with <literal>vim</literal>
    </entry>
                </row>
                <row>
                  <entry><ulink url="http://packages.debian.org/sid/gnus">
                    <literal>gnus</literal>
                  </ulink></entry>
                  <entry><ulink url="http://bugs.debian.org/gnus">&pop-gnus;</ulink></entry>
                  <entry><ulink url="http://packages.qa.debian.org/g/gnus.html">&size-gnus;</ulink></entry>
                  <entry>
    character terminal under <literal>(x)emacs</literal>
    </entry>
                </row>
              </tbody>
            </tgroup>
          </table>
        </section>
        <section id="_the_remote_mail_retrieval_and_forward_utility">
          <title>The remote mail retrieval and forward utility</title>
          <simpara>Although <literal>fetchmail</literal>(1) has been de facto standard for the remote mail retrieval on GNU/Linux, the authour likes <literal>getmail</literal>(1) now.  If you want to reject mail before downloading to save bandwidth, <literal>mailfilter</literal> or <literal>mpop</literal> may be useful.  Whichever mail retriever utilities are used, it is good idea to configure system to deliver retrieved mails to MDA, such as <literal>maildrop</literal>, via pipe.</simpara>
          <table id="listofremotemailforwardutilities" pgwide="0" frame="topbot" rowsep="1" colsep="1">
            <title>List of remote mail retrieval and forward utilities.</title>
            <tgroup cols="4">
              <colspec colwidth="20%*" align="left"/>
              <colspec colwidth="20%*" align="left"/>
              <colspec colwidth="20%*" align="left"/>
              <colspec colwidth="40%*" align="left"/>
              <thead>
                <row>
                  <entry>
    package
    </entry>
                  <entry>
    popcon
    </entry>
                  <entry>
    size
    </entry>
                  <entry>
    capability
    </entry>
                </row>
              </thead>
              <tbody>
                <row>
                  <entry><ulink url="http://packages.debian.org/sid/fetchmail">
                    <literal>fetchmail</literal>
                  </ulink></entry>
                  <entry><ulink url="http://bugs.debian.org/fetchmail">&pop-fetchmail;</ulink></entry>
                  <entry><ulink url="http://packages.qa.debian.org/f/fetchmail.html">&size-fetchmail;</ulink></entry>
                  <entry>
    mail retriever (POP3, APOP, IMAP) (old)
    </entry>
                </row>
                <row>
                  <entry><ulink url="http://packages.debian.org/sid/getmail4">
                    <literal>getmail4</literal>
                  </ulink></entry>
                  <entry><ulink url="http://bugs.debian.org/getmail4">&pop-getmaile;</ulink></entry>
                  <entry><ulink url="http://packages.qa.debian.org/g/getmail4.html">&size-getmaile;</ulink></entry>
                  <entry>
    mail retriever (POP3, IMAP4, and SDPS) (simple, secure, and reliable)
    </entry>
                </row>
                <row>
                  <entry><ulink url="http://packages.debian.org/sid/mailfilter">
                    <literal>mailfilter</literal>
                  </ulink></entry>
                  <entry><ulink url="http://bugs.debian.org/mailfilter">&pop-mailfilter;</ulink></entry>
                  <entry><ulink url="http://packages.qa.debian.org/m/mailfilter.html">&size-mailfilter;</ulink></entry>
                  <entry>
    mail retriever (POP3) with with regex filtering capability
    </entry>
                </row>
                <row>
                  <entry><ulink url="http://packages.debian.org/sid/mpop">
                    <literal>mpop</literal>
                  </ulink></entry>
                  <entry><ulink url="http://bugs.debian.org/mpop">&pop-mpop;</ulink></entry>
                  <entry><ulink url="http://packages.qa.debian.org/m/mpop.html">&size-mpop;</ulink></entry>
                  <entry>
    mail retriever (POP3) and MDA with filtering capability
    </entry>
                </row>
              </tbody>
            </tgroup>
          </table>
          <simpara><literal>getmail</literal>(1) configuration is described in <ulink url="&getmaildocumentation;">getmail documentation</ulink>. Here is my set up to access multiple POP3 accounts as user:</simpara>
          <itemizedlist>
            <listitem>
              <simpara>
Create "<literal>/usr/local/bin/getmails</literal>" as:
</simpara>
            </listitem>
          </itemizedlist>
          <screen>#!/bin/sh
set -e
rcfiles="/usr/bin/getmail"
for file in $HOME/.getmail/config/* ; do
  rcfiles="$rcfiles --rcfile $file"
done
exec $rcfiles $@</screen>
          <itemizedlist>
            <listitem>
              <simpara>
Execute as follows:
</simpara>
            </listitem>
          </itemizedlist>
          <screen>$ sudo chmod 755 /usr/local/bin/getmails
$ mkdir -m 0700 $HOME/.getmail
$ mkdir -m 0700 $HOME/.getmail/config
$ mkdir -m 0700 $HOME/.getmail/log</screen>
          <itemizedlist>
            <listitem>
              <simpara>
Create configuration files "<literal>$HOME/.getmail/config/pop3_name</literal>" for each POP3 acconts as:
</simpara>
            </listitem>
          </itemizedlist>
          <screen>[retriever]
type = SimplePOP3SSLRetriever
server = pop.example.com
username =  pop3_name@example.com
password = secret

[destination]
type = MDA_external
path = /usr/bin/maildrop
unixfrom = True
'Spam'
[options]
verbose = 0
delete = True
delivered_to = False
message_log = ~/.getmail/log/pop3_name.log</screen>
          <itemizedlist>
            <listitem>
              <simpara>
Execute as follows:
</simpara>
            </listitem>
          </itemizedlist>
          <screen>$ chmod 0600 $HOME/.getmail/config/*</screen>
          <itemizedlist>
            <listitem>
              <simpara>
schedule "<literal>/usr/local/bin/getmails</literal>" to run every 15 minutes with <literal>cron</literal>(8) by executing "<literal>sudo crontab -e -u &lt;user_name&gt;</literal>" and adding following entry:
</simpara>
            </listitem>
          </itemizedlist>
          <screen>5,20,35,50 * * * * /usr/local/bin/getmails --quiet</screen>
          <tip>
            <simpara>Problems of POP3 access may not come from <literal>getmail</literal>. Some popular free POP3 services may be violating the POP3 protocol and their SPAM filter may not be perfect.  For example, they may delete messages just after receiving RETR command before receiving DELE command and may quarantined messages into Spam mailbox.  You should minimize damages by configuring them to archive accessed messages and not to delete them. See also <ulink url="&somemailwasnotdownloaded;">"Some mail was not downloaded"</ulink>.</simpara>
          </tip>
        </section>
        <section id="_mda_with_filter">
          <title>MDA with filter</title>
          <simpara>Most MTA programs, such as <literal>postfix</literal> and <literal>exim4</literal>, function as MDA (mail delivery agent). There are specialized MDA with filtering capabilities.</simpara>
          <simpara>Although <literal>procmail</literal>(1) has been de facto standard for MDA with filter on GNU/Linux, authour likes <literal>maildrop</literal>(1) now.  Whichever filtering utilities are used, it is good idea to configure system to deliver filtered mails to a <ulink url="&qmailstylemaildir;">qmail-style Maildir</ulink>.</simpara>
          <table id="listofmdawithfilter" pgwide="0" frame="topbot" rowsep="1" colsep="1">
            <title>List of MDA with filter.</title>
            <tgroup cols="4">
              <colspec colwidth="20%*" align="left"/>
              <colspec colwidth="20%*" align="left"/>
              <colspec colwidth="20%*" align="left"/>
              <colspec colwidth="40%*" align="left"/>
              <thead>
                <row>
                  <entry>
    package
    </entry>
                  <entry>
    popcon
    </entry>
                  <entry>
    size
    </entry>
                  <entry>
    description
    </entry>
                </row>
              </thead>
              <tbody>
                <row>
                  <entry><ulink url="http://packages.debian.org/sid/procmail">
                    <literal>procmail</literal>
                  </ulink></entry>
                  <entry><ulink url="http://bugs.debian.org/procmail">&pop-procmail;</ulink></entry>
                  <entry><ulink url="http://packages.qa.debian.org/p/procmail.html">&size-procmail;</ulink></entry>
                  <entry>
    MDA with filter (old)
    </entry>
                </row>
                <row>
                  <entry><ulink url="http://packages.debian.org/sid/mailagent">
                    <literal>mailagent</literal>
                  </ulink></entry>
                  <entry><ulink url="http://bugs.debian.org/mailagent">&pop-mailagent;</ulink></entry>
                  <entry><ulink url="http://packages.qa.debian.org/m/mailagent.html">&size-mailagent;</ulink></entry>
                  <entry>
    MDA with perl filter
    </entry>
                </row>
                <row>
                  <entry><ulink url="http://packages.debian.org/sid/maildrop">
                    <literal>maildrop</literal>
                  </ulink></entry>
                  <entry><ulink url="http://bugs.debian.org/maildrop">&pop-maildrop;</ulink></entry>
                  <entry><ulink url="http://packages.qa.debian.org/m/maildrop.html">&size-maildrop;</ulink></entry>
                  <entry>
    MDA with structured filtering language
    </entry>
                </row>
              </tbody>
            </tgroup>
          </table>
          <simpara><literal>maildrop</literal>(1) configuration is described in <ulink url="&maildropfilterdocumentation;">maildropfilter documentation</ulink>.  Here is a configuration example for "<literal>$HOME/.mailfilter</literal>":</simpara>
          <screen>logfile $HOME/.maildroplog
# clearly bad looking mails: drop them into X-trash and exit
if (    /^X-Advertisement/ ||\
        /^Subject:.*BUSINESS PROPOSAL/ ||\
        /^Subject:.*URGENT.*ASISSTANCE/ ||\
        /^Subject: *I NEED YOUR ASSISTANCE/ )
    to "$HOME/Maildir/X-trash/"

# Delivering mailinglist messages
if (    /^Precedence:.*list/ ||\
        /^Precedence:.*bulk/ ||\
        /^List-/ ||\
        /^X-Distribution:.*bulk/ )
{
    if (    /^Resent-Sender.*debian-user-request@lists.debian.org/)
        to "$HOME/Maildir/debian-user/"
    if (    /^Resent-Sender.*debian-devel-request@lists.debian.org/)
        to "$HOME/Maildir/debian-devel/"
    if (    /^Resent-Sender.*debian-announce-request@lists.debian.org/)
        to "$HOME/Maildir/debian-announce/"
    to "$HOME/Maildir/mailing-list/"
}
to "$HOME/Maildir/Inbox/"
exit</screen>
          <warning>
            <simpara>Unlike <literal>procmail</literal>, <literal>maildrop</literal> does not create missing maildir directories automatically.  You must create them manually using <literal>maildirmake</literal>(1) in advance.</simpara>
          </warning>
          <simpara>Equivalent configurartion can be done with <literal>procmail</literal>(1) with "<literal>$HOME/.procmailrc</literal>" as:</simpara>
          <screen>MAILDIR=$HOME/Maildir
DEFAULT=$MAILDIR/Inbox/
LOGFILE=$MAILDIR/Maillog
# clearly bad looking mails: drop them into X-trash and exit
:0
* 1^0 ^X-Advertisement
* 1^0 ^Subject:.*BUSINESS PROPOSAL
* 1^0 ^Subject:.*URGENT.*ASISSTANCE
* 1^0 ^Subject: *I NEED YOUR ASSISTANCE
X-trash/

# Delivering mailinglist messages
:0
* 1^0 ^Precedence:.*list
* 1^0 ^Precedence:.*bulk
* 1^0 ^List-
* 1^0 ^X-Distribution:.*bulk
{
:0
* 1^0 ^Return-path:.*debian-devel-admin@debian.or.jp
jp-debian-devel/

:0
* ^Resent-Sender.*debian-user-request@lists.debian.org
debian-user/

:0
* ^Resent-Sender.*debian-devel-request@lists.debian.org
debian-devel/

:0
* ^Resent-Sender.*debian-announce-request@lists.debian.org
debian-announce

:0
mailing-list/
}

:0
Inbox/</screen>
        </section>
        <section id="_pop3_imap4_server">
          <title>POP3/IMAP4 server</title>
          <simpara>If you are to run a private server on LAN, you may consider to run <ulink url="&popd;">POP3</ulink> / <ulink url="&imape;">IMAP4</ulink> server for delivering mail to LAN clients.</simpara>
          <table id="listofpopdimapeservers" pgwide="0" frame="topbot" rowsep="1" colsep="1">
            <title>List of POP3/IMAP4 servers.</title>
            <tgroup cols="5">
              <colspec colwidth="10%*" align="left"/>
              <colspec colwidth="10%*" align="left"/>
              <colspec colwidth="10%*" align="left"/>
              <colspec colwidth="10%*" align="left"/>
              <colspec colwidth="60%*" align="left"/>
              <thead>
                <row>
                  <entry>
    package
    </entry>
                  <entry>
    popcon
    </entry>
                  <entry>
    size
    </entry>
                  <entry>
    type
    </entry>
                  <entry>
    description
    </entry>
                </row>
              </thead>
              <tbody>
                <row>
                  <entry><ulink url="http://packages.debian.org/sid/qpopper">
                    <literal>qpopper</literal>
                  </ulink></entry>
                  <entry><ulink url="http://bugs.debian.org/qpopper">&pop-qpopper;</ulink></entry>
                  <entry><ulink url="http://packages.qa.debian.org/q/qpopper.html">&size-qpopper;</ulink></entry>
                  <entry>
    POP3
    </entry>
                  <entry>
    Qualcomm enhanced version
    </entry>
                </row>
                <row>
                  <entry><ulink url="http://packages.debian.org/sid/courier-pop">
                    <literal>courier-pop</literal>
                  </ulink></entry>
                  <entry><ulink url="http://bugs.debian.org/courier-pop">&pop-courierpop;</ulink></entry>
                  <entry><ulink url="http://packages.qa.debian.org/c/courier-pop.html">&size-courierpop;</ulink></entry>
                  <entry>
    POP3
    </entry>
                  <entry>
    support only the maildir format
    </entry>
                </row>
                <row>
                  <entry><ulink url="http://packages.debian.org/sid/ipopd">
                    <literal>ipopd</literal>
                  </ulink></entry>
                  <entry><ulink url="http://bugs.debian.org/ipopd">&pop-ipopd;</ulink></entry>
                  <entry><ulink url="http://packages.qa.debian.org/i/ipopd.html">&size-ipopd;</ulink></entry>
                  <entry>
    POP3
    </entry>
                  <entry>
    formerly part of the University of Washington IMAP package
    </entry>
                </row>
                <row>
                  <entry><ulink url="http://packages.debian.org/sid/cyrus-pop3d-2.2">
                    <literal>cyrus-pop3d-2.2</literal>
                  </ulink></entry>
                  <entry><ulink url="http://bugs.debian.org/cyrus-pop3d-2.2">&pop-cyruspopddcc;</ulink></entry>
                  <entry><ulink url="http://packages.qa.debian.org/c/cyrus-pop3d-2.2.html">&size-cyruspopddcc;</ulink></entry>
                  <entry>
    POP3
    </entry>
                  <entry>
    part of the Cyrus IMAPd suite
    </entry>
                </row>
                <row>
                  <entry><ulink url="http://packages.debian.org/sid/xmail">
                    <literal>xmail</literal>
                  </ulink></entry>
                  <entry><ulink url="http://bugs.debian.org/xmail">&pop-xmail;</ulink></entry>
                  <entry><ulink url="http://packages.qa.debian.org/x/xmail.html">&size-xmail;</ulink></entry>
                  <entry>
    POP3
    </entry>
                  <entry>
    ESMTP/POP3 mail server
    </entry>
                </row>
                <row>
                  <entry><ulink url="http://packages.debian.org/sid/courier-imap">
                    <literal>courier-imap</literal>
                  </ulink></entry>
                  <entry><ulink url="http://bugs.debian.org/courier-imap">&pop-courierimap;</ulink></entry>
                  <entry><ulink url="http://packages.qa.debian.org/c/courier-imap.html">&size-courierimap;</ulink></entry>
                  <entry>
    IMAP
    </entry>
                  <entry>
    This provides access to email stored in Maildirs
    </entry>
                </row>
                <row>
                  <entry><ulink url="http://packages.debian.org/sid/uw-imapd">
                    <literal>uw-imapd</literal>
                  </ulink></entry>
                  <entry><ulink url="http://bugs.debian.org/uw-imapd">&pop-uwimapd;</ulink></entry>
                  <entry><ulink url="http://packages.qa.debian.org/u/uw-imapd.html">&size-uwimapd;</ulink></entry>
                  <entry>
    IMAP
    </entry>
                  <entry>
    the University of Washington IMAP
    </entry>
                </row>
                <row>
                  <entry><ulink url="http://packages.debian.org/sid/cyrus-imapd-2.2">
                    <literal>cyrus-imapd-2.2</literal>
                  </ulink></entry>
                  <entry><ulink url="http://bugs.debian.org/cyrus-imapd-2.2">&pop-cyrusimapdcc;</ulink></entry>
                  <entry><ulink url="http://packages.qa.debian.org/c/cyrus-imapd-2.2.html">&size-cyrusimapdcc;</ulink></entry>
                  <entry>
    IMAP
    </entry>
                  <entry>
    part of the Cyrus IMAPd suite
    </entry>
                </row>
              </tbody>
            </tgroup>
          </table>
        </section>
      </section>
    </section>
    <section id="_the_print_server_and_utility">
      <title>The print server and utility</title>
      <simpara>In the old Unix-like system, the BSD <ulink url="&lineprinterdaemon;">Line printer daemon</ulink> was the standard.  Since the standard print out format of the free software is PostScript on the Unix like system, some filter system was used along with <ulink url="&ghostscript;">Ghostscript</ulink> to enable printing to the non-PostScript printer.</simpara>
      <simpara>Recently, <ulink url="&commonunixprintingsystem;">Common UNIX Printing System</ulink> (CUPS) is the new de facto standard.  The CUPS uses <ulink url="&internetprintingprotocol;">Internet Printing Protocol</ulink> (IPP). The IPP is now supported by other OSs such as Windows XP and Mac OS X and has became new cross-platform de facto standard for remote printing with bi-directional communication capability.</simpara>
      <simpara>The standard printable data format for the application on the Debian system is the <ulink url="&postscriptps;">PostScript (PS)</ulink> which is a page description language.  The data in PS format is fed into the Ghostscript PostScript interpreter to produce the printable data specific to the printer.  See <xref linkend="_ghostscript"/>.</simpara>
      <simpara>Thanks to the file format dependent auto-conversion feature of the CUPS system, simply feeding any data to the <literal>lpr</literal> command should generate the expected print output. (In CUPS, <literal>lpr</literal> can be enabled by installing the <literal>cups-bsd</literal> package.)</simpara>
      <simpara>The Debian system has few notable packages for the print servers and utilities:</simpara>
      <table id="listofprintserversandutilities" pgwide="0" frame="topbot" rowsep="1" colsep="1">
        <title>List of print servers and utilities.</title>
        <tgroup cols="5">
          <colspec colwidth="10%*" align="left"/>
          <colspec colwidth="10%*" align="left"/>
          <colspec colwidth="10%*" align="left"/>
          <colspec colwidth="10%*" align="left"/>
          <colspec colwidth="60%*" align="left"/>
          <thead>
            <row>
              <entry>
    package
    </entry>
              <entry>
    popcon
    </entry>
              <entry>
    size
    </entry>
              <entry>
    port
    </entry>
              <entry>
    function
    </entry>
            </row>
          </thead>
          <tbody>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/lpr">
                <literal>lpr</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/lpr">&pop-lpr;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/l/lpr.html">&size-lpr;</ulink></entry>
              <entry>
    printer (515)
    </entry>
              <entry>
    BSD lpr/lpd (<ulink url="&lineprinterdaemon;">Line printer daemon</ulink>)
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/lprng">
                <literal>lprng</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/lprng">&pop-lprng;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/l/lprng.html">&size-lprng;</ulink></entry>
              <entry>
    , ,
    </entry>
              <entry>
    , , (Enhanced)
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/cups">
                <literal>cups</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/cups">&pop-cups;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/c/cups.html">&size-cups;</ulink></entry>
              <entry>
    IPP (631)
    </entry>
              <entry>
    Internet Printing CUPS server
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/cups-client">
                <literal>cups-client</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/cups-client">&pop-cupsclient;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/c/cups-client.html">&size-cupsclient;</ulink></entry>
              <entry>
    , ,
    </entry>
              <entry><ulink url="&systemvprintercommands;">System V printer commands</ulink> for CUPS: <literal>lp</literal>(1), <literal>lpstat</literal>(1), <literal>lpoptions</literal>(1), <literal>cancel</literal>(1), <literal>lpmove</literal>(8), <literal>lpinfo</literal>(8), <literal>lpadmin</literal>(8), …
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/cups-bsd">
                <literal>cups-bsd</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/cups-bsd">&pop-cupsbsd;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/c/cups-bsd.html">&size-cupsbsd;</ulink></entry>
              <entry>
    , ,
    </entry>
              <entry><ulink url="&bsdprintercommands;">BSD printer commands</ulink> for CUPS: <literal>lpr</literal>(1), <literal>lpq</literal>(1), <literal>lprm</literal>(1), <literal>lpc</literal>(8)
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/cups-driver-gutenprint">
                <literal>cups-driver-gutenprint</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/cups-driver-gutenprint">&pop-cupsdrivergutenprint;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/c/cups-driver-gutenprint.html">&size-cupsdrivergutenprint;</ulink></entry>
              <entry>
    Not applicable
    </entry>
              <entry>
    printer drivers for CUPS
    </entry>
            </row>
          </tbody>
        </tgroup>
      </table>
      <tip>
        <simpara>You can configure CUPS system by pointing your web browser to "<ulink url="&httplocalhostgdb;">http://localhost:631/</ulink>" .</simpara>
      </tip>
    </section>
    <section id="_the_remote_access_server_and_utility_ssh">
      <title>The remote access server and utility (SSH)</title>
      <simpara>The <ulink url="&secureshell;">Secure SHell</ulink> (SSH) is the <emphasis role="strong">secure</emphasis> way to connect over the Internet.  A free version of SSH called <ulink url="&openssh;">OpenSSH</ulink> is available as the <literal>ssh</literal> package in Debian.</simpara>
      <table id="listofremoteaccerverandutilities" pgwide="0" frame="topbot" rowsep="1" colsep="1">
        <title>List of remote access server and utilities.</title>
        <tgroup cols="5">
          <colspec colwidth="10%*" align="left"/>
          <colspec colwidth="10%*" align="left"/>
          <colspec colwidth="10%*" align="left"/>
          <colspec colwidth="10%*" align="left"/>
          <colspec colwidth="60%*" align="left"/>
          <thead>
            <row>
              <entry>
    package
    </entry>
              <entry>
    popcon
    </entry>
              <entry>
    size
    </entry>
              <entry>
    tool
    </entry>
              <entry>
    comment
    </entry>
            </row>
          </thead>
          <tbody>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/openssh-client">
                <literal>openssh-client</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/openssh-client">&pop-opensshclient;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/o/openssh-client.html">&size-opensshclient;</ulink></entry>
              <entry>
    ssh
    </entry>
              <entry>
    Secure shell client
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/openssh-server">
                <literal>openssh-server</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/openssh-server">&pop-opensshserver;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/o/openssh-server.html">&size-opensshserver;</ulink></entry>
              <entry>
    sshd
    </entry>
              <entry>
    Secure shell server
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/ssh-askpass-fullscreen">
                <literal>ssh-askpass-fullscreen</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/ssh-askpass-fullscreen">&pop-sshaskpassfullscreen;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/s/ssh-askpass-fullscreen.html">&size-sshaskpassfullscreen;</ulink></entry>
              <entry>
    ssh-askpass-fullscreen
    </entry>
              <entry>
    asks user for a pass phrase for ssh-add (GNOME2)
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/ssh-askpass">
                <literal>ssh-askpass</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/ssh-askpass">&pop-sshaskpass;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/s/ssh-askpass.html">&size-sshaskpass;</ulink></entry>
              <entry>
    ssh-askpass
    </entry>
              <entry>
    asks user for a pass phrase for ssh-add (plain X)
    </entry>
            </row>
          </tbody>
        </tgroup>
      </table>
      <caution>
        <simpara>See <xref linkend="_extra_security_measures_for_the_internet"/> if your SSH is accessible from Internet.</simpara>
      </caution>
      <tip>
        <simpara>Please use the <literal>screen</literal>(1) program to enable remote shell process to survive the interrupted connection (see <xref linkend="_the_screen_program"/>).</simpara>
      </tip>
      <section id="_basics_of_ssh">
        <title>Basics of SSH</title>
        <simpara><literal>/etc/ssh/sshd_not_to_be_run</literal> must not be present if one wishes to run the OpenSSH server.</simpara>
        <simpara>SSH has two authentication protocols:</simpara>
        <table id="listofsshauthenttocolsandmethods" pgwide="0" frame="topbot" rowsep="1" colsep="1">
          <title>List of SSH authentication protocols and methods.</title>
          <tgroup cols="3">
            <colspec colwidth="30%*" align="left"/>
            <colspec colwidth="30%*" align="left"/>
            <colspec colwidth="40%*" align="left"/>
            <thead>
              <row>
                <entry>
    SSH protocol
    </entry>
                <entry>
    SSH method
    </entry>
                <entry>
    description
    </entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry>
    SSH-1
    </entry>
                <entry>
    RSAAuthentication
    </entry>
                <entry>
    RSA identity key based user authentication
    </entry>
              </row>
              <row>
                <entry>
    , ,
    </entry>
                <entry>
    RhostsAuthentication
    </entry>
                <entry><literal>.rhosts</literal> based host authentication (insecure, disabled)
    </entry>
              </row>
              <row>
                <entry>
    , ,
    </entry>
                <entry>
    RhostsRSAAuthentication
    </entry>
                <entry><literal>.rhosts</literal> authentication combined with RSA host key (disabled)
    </entry>
              </row>
              <row>
                <entry>
    , ,
    </entry>
                <entry>
    ChallengeResponseAuthentication
    </entry>
                <entry>
    RSA challenge-response authentication
    </entry>
              </row>
              <row>
                <entry>
    , ,
    </entry>
                <entry>
    PasswordAuthentication
    </entry>
                <entry>
    password based authentication
    </entry>
              </row>
              <row>
                <entry>
    SSH-2
    </entry>
                <entry>
    PubkeyAuthentication
    </entry>
                <entry>
    public key based user authentication
    </entry>
              </row>
              <row>
                <entry>
    , ,
    </entry>
                <entry>
    HostbasedAuthentication
    </entry>
                <entry>
    "<literal>~/.rhosts</literal>" or "<literal>/etc/hosts.equiv</literal>" authentication combined with public key client host authentication (disabled)
    </entry>
              </row>
              <row>
                <entry>
    , ,
    </entry>
                <entry>
    ChallengeResponseAuthentication
    </entry>
                <entry>
    challenge-response authentication
    </entry>
              </row>
              <row>
                <entry>
    , ,
    </entry>
                <entry>
    PasswordAuthentication
    </entry>
                <entry>
    password based authentication
    </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
        <simpara>Be careful about these differences if you are using a non-Debian system.</simpara>
        <simpara>See "<literal>/usr/share/doc/ssh/README.Debian.gz</literal>", <literal>ssh</literal>(1), <literal>sshd</literal>(8), <literal>ssh-agent</literal>(1), and <literal>ssh-keygen</literal>(1) for details.</simpara>
        <simpara>Following are the key configuration files:</simpara>
        <table id="listofsshconfigurationfiles" pgwide="0" frame="topbot" rowsep="1" colsep="1">
          <title>List of SSH configuration files.</title>
          <tgroup cols="2">
            <colspec colwidth="30%*" align="left"/>
            <colspec colwidth="70%*" align="left"/>
            <thead>
              <row>
                <entry>
    configuration file
    </entry>
                <entry>
    function
    </entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry>
                  <literal>/etc/ssh/ssh_config</literal>
                </entry>
                <entry>
    SSH client defaults.  See <literal>ssh_config</literal>(5).
    </entry>
              </row>
              <row>
                <entry>
                  <literal>/etc/ssh/sshd_config</literal>
                </entry>
                <entry>
    SSH server defaults.  See <literal>sshd_config</literal>(5).
    </entry>
              </row>
              <row>
                <entry>
                  <literal>~/.ssh/authorized_keys</literal>
                </entry>
                <entry>
    the lists of the default public SSH keys that clients use to connect to this account on this host.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>~/.ssh/identity</literal>
                </entry>
                <entry>
    secret SSH-1 RSA key of the user.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>~/.ssh/id_rsa</literal>
                </entry>
                <entry>
    secret SSH-2 RSA key of the user.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>~/.ssh/id_dsa</literal>
                </entry>
                <entry>
    secret SSH-2 DSA key of the user.
    </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
        <tip>
          <simpara>See <literal>ssh-keygen</literal>(1), <literal>ssh-add</literal>(1) and <literal>ssh-agent</literal>(1) for how to use public and secret SSH keys.</simpara>
        </tip>
        <simpara>The following will start an <literal>ssh</literal>(1) connection from a client.</simpara>
        <table id="listofsshclientstartupexamples" pgwide="0" frame="topbot" rowsep="1" colsep="1">
          <title>List of SSH client startup examples.</title>
          <tgroup cols="2">
            <colspec colwidth="30%*" align="left"/>
            <colspec colwidth="70%*" align="left"/>
            <thead>
              <row>
                <entry>
    command
    </entry>
                <entry>
    description
    </entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry>
                  <literal>ssh username@hostname.domain.ext</literal>
                </entry>
                <entry>
    connect with default mode
    </entry>
              </row>
              <row>
                <entry>
                  <literal>ssh -v username@hostname.domain.ext</literal>
                </entry>
                <entry>
    connect with default mode with debugging messages
    </entry>
              </row>
              <row>
                <entry>
                  <literal>ssh -1 username@hostname.domain.ext</literal>
                </entry>
                <entry>
    force to connect with SSH version 1
    </entry>
              </row>
              <row>
                <entry>
                  <literal>ssh -1 -o RSAAuthentication=no -l username hostname.domain.ext</literal>
                </entry>
                <entry>
    force to use password with SSH version 1
    </entry>
              </row>
              <row>
                <entry>
                  <literal>ssh -o PreferredAuthentications=password -l username hostname.domain.ext</literal>
                </entry>
                <entry>
    force to use password with SSH version 2
    </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
        <simpara>If you use the same user name on the local and the remote host, you can eliminate typing "<literal>username@</literal>".  Even if you use different user name on the local and the remote host, you can eliminate it using "<literal>~/.ssh/config</literal>".  For <ulink url="&debianaliothservice;">Debian Alioth service</ulink> with account name "<literal>foo-guest</literal>", you set "<literal>~/.ssh/config</literal>" to contain:</simpara>
        <screen>Host alioth.debian.org svn.debian.org git.debian.org
    User foo-guest</screen>
        <simpara>For the user, <literal>ssh</literal>(1) functions as a smarter and more secure <literal>telnet</literal>(1).  Unlike <literal>telnet</literal> command, <literal>ssh</literal> command does not bomb on the <literal>telnet</literal> escape character (initial default CTRL-]).</simpara>
      </section>
      <section id="_port_forwarding_for_smtp_pop3_tunneling">
        <title>Port forwarding for SMTP/POP3 tunneling</title>
        <simpara>To establish a pipe to connect to port 25 of remote-server from port 4025 of localhost, and to port 110 of remote-server from port 4110 of localhost through <literal>ssh</literal>, execute on the local machine:</simpara>
        <screen># ssh -q -L 4025:remote-server:25 4110:remote-server:110 username@remote-server</screen>
        <simpara>This is a secure way to make connections to SMTP/POP3 servers over the Internet.  Set the "<literal>AllowTcpForwarding</literal>" entry to "<literal>yes</literal>" in "<literal>/etc/ssh/sshd_config</literal>" of the remote host.</simpara>
      </section>
      <section id="_connecting_with_fewer_passwords_8212_rsa">
        <title>Connecting with fewer passwords — RSA</title>
        <simpara>One can avoid having to remember a password for each remote system by using "<literal>RSAAuthentication</literal>" (SSH-1 protocol) or PubkeyAuthentication (SSH-2 protocol).</simpara>
        <simpara>On the remote system, set the respective entries, "<literal>RSAAuthentication yes</literal>" or "<literal>PubkeyAuthentication yes</literal>", in "<literal>/etc/ssh/sshd_config</literal>".</simpara>
        <simpara>Then generate authentication keys locally and install the public key on the remote system:</simpara>
        <itemizedlist>
          <listitem>
            <simpara>
"<literal>RSAAuthentication</literal>": RSA1 key for SSH-1 (deprecated because superseded.)
</simpara>
          </listitem>
        </itemizedlist>
        <screen>$ ssh-keygen
$ cat .ssh/identity.pub | ssh user1@remote "cat - &gt;&gt;.ssh/authorized_keys"</screen>
        <itemizedlist>
          <listitem>
            <simpara>
PubkeyAuthentication: RSA key for SSH-2
</simpara>
          </listitem>
        </itemizedlist>
        <screen>$ ssh-keygen -t rsa
$ cat .ssh/id_rsa.pub | ssh user1@remote "cat - &gt;&gt;.ssh/authorized_keys"</screen>
        <itemizedlist>
          <listitem>
            <simpara>
PubkeyAuthentication: DSA key for SSH-2 (deprecated because key is smaller and slow.  Also see <ulink url="&dsabfhbb;">DSA-1571-1</ulink>.)
</simpara>
          </listitem>
        </itemizedlist>
        <screen>$ ssh-keygen -t dsa
$ cat .ssh/id_dsa.pub | ssh user1@remote "cat - &gt;&gt;.ssh/authorized_keys"</screen>
        <note>
          <simpara>There are no more reasons to work around RSA patent using DSA since it has been expired.  DSA stands for <ulink url="&digitalsignaturealgorithm;">Digital Signature Algorithm</ulink> and slow.</simpara>
        </note>
        <simpara>One can change the pass phrase later with "<literal>ssh-keygen -p</literal>".  Make sure to verify settings by testing the connection.  In case of any problem, use "<literal>ssh -v</literal>".</simpara>
        <simpara>You can add options to the entries in "<literal>~/.ssh/authorized_keys</literal>" to limit hosts and to run specific commands.  See <literal>sshd</literal>(8) for details.</simpara>
        <simpara>Note that SSH-2 has "<literal>HostbasedAuthentication</literal>".  For this to work, you must adjust the settings of "<literal>HostbasedAuthentication</literal>" to "<literal>yes</literal>" in both "<literal>/etc/ssh/sshd_config</literal>" on the server machine and "<literal>/etc/ssh/ssh_config</literal>" or "<literal>~/.ssh/config</literal>" on the client machine.</simpara>
      </section>
      <section id="_dealing_with_alien_ssh_clients">
        <title>Dealing with alien SSH clients</title>
        <simpara>There are a few free <ulink url="&ssh;">SSH</ulink> clients available for other platforms.</simpara>
        <table id="listoffreesshcliorotherplatforms" pgwide="0" frame="topbot" rowsep="1" colsep="1">
          <title>List of free SSH clients for other platforms.</title>
          <tgroup cols="2">
            <colspec colwidth="30%*" align="left"/>
            <colspec colwidth="70%*" align="left"/>
            <thead>
              <row>
                <entry>
    environment
    </entry>
                <entry>
    free SSH program
    </entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry>
    Windows
    </entry>
                <entry>
    puTTY (<ulink url="&httpwwwchiarkgreguksgtathamputty;">http://www.chiark.greenend.org.uk/~sgtatham/putty/</ulink>) (GPL)
    </entry>
              </row>
              <row>
                <entry>
    Windows (cygwin)
    </entry>
                <entry>
    SSH in cygwin (<ulink url="&httpwwwcygwincom;">http://www.cygwin.com/</ulink>) (GPL)
    </entry>
              </row>
              <row>
                <entry>
    Macintosh Classic
    </entry>
                <entry>
    macSSH (<ulink url="&httpwwwmacsshcom;">http://www.macssh.com/</ulink>) (GPL)
    </entry>
              </row>
              <row>
                <entry>
    Mac OS X
    </entry>
                <entry>
    OpenSSH; use <literal>ssh</literal> in the Terminal application (GPL)
    </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
      </section>
      <section id="_setting_up_ssh_agent">
        <title>Setting up ssh-agent</title>
        <simpara>It is safer to protect your SSH authentication key with a pass phrase.  If it was not set, use "<literal>ssh-keygen -p</literal>" to set it.</simpara>
        <simpara>Place your public key (e.g.  "<literal>~/.ssh/id_rsa.pub</literal>") into "<literal>~/.ssh/authorized_keys</literal>" on a remote host using a password-based connection to the remote host as described above.</simpara>
        <screen>$ ssh-agent bash
$ ssh-add ~/.ssh/id_rsa
Enter passphrase for /home/&lt;username&gt;/.ssh/id_rsa:
Identity added: /home/&lt;username&gt;/.ssh/id_rsa (/home/&lt;username&gt;/.ssh/id_rsa)</screen>
        <itemizedlist>
          <listitem>
            <simpara>
No passphrase needed from here on, e.g.:
</simpara>
          </listitem>
        </itemizedlist>
        <screen>$ scp foo &lt;username&gt;@remote.host:foo</screen>
        <itemizedlist>
          <listitem>
            <simpara>
No password requested.
</simpara>
          </listitem>
          <listitem>
            <simpara>
Press ^D to terminating ssh-agent session.
</simpara>
          </listitem>
        </itemizedlist>
        <simpara>For the X server, the normal Debian startup script executes <literal>ssh-agent</literal> as the parent process.  So you only need to execute <literal>ssh-add</literal> once. For more, read <literal>ssh-agent</literal>(1)and <literal>ssh-add</literal>(1).</simpara>
      </section>
      <section id="_troubleshooting_ssh">
        <title>Troubleshooting SSH</title>
        <simpara>If you have problems, check the permissions of configuration files and run <literal>ssh</literal> with the "<literal>-v</literal>" option.</simpara>
        <simpara>Use the "<literal>-P</literal>" option if you are root and have trouble with a firewall; this avoids the use of server ports 1--1023.</simpara>
        <simpara>If <literal>ssh</literal> connections to a remote site suddenly stop working, it may be the result of tinkering by the sysadmin, most likely a change in "<literal>host_key</literal>" during system maintenance.  After making sure this is the case and nobody is trying to fake the remote host by some clever hack, one can regain a connection by removing the "<literal>host_key</literal>" entry from "<literal>~/.ssh/known_hosts</literal>" on the local machine.</simpara>
      </section>
    </section>
    <section id="_other_network_application_servers">
      <title>Other network application servers</title>
      <table id="listofothernetwoplicationservers" pgwide="0" frame="topbot" rowsep="1" colsep="1">
        <title>List of other network application servers.</title>
        <tgroup cols="5">
          <colspec colwidth="10%*" align="left"/>
          <colspec colwidth="10%*" align="left"/>
          <colspec colwidth="10%*" align="left"/>
          <colspec colwidth="10%*" align="left"/>
          <colspec colwidth="60%*" align="left"/>
          <thead>
            <row>
              <entry>
    package
    </entry>
              <entry>
    popcon
    </entry>
              <entry>
    size
    </entry>
              <entry>
    protocol
    </entry>
              <entry>
    focus
    </entry>
            </row>
          </thead>
          <tbody>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/telnetd">
                <literal>telnetd</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/telnetd">&pop-telnetd;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/t/telnetd.html">&size-telnetd;</ulink></entry>
              <entry>
                <ulink url="&telnet;">TELNET</ulink>
              </entry>
              <entry>
    TELNET server
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/telnetd-ssl">
                <literal>telnetd-ssl</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/telnetd-ssl">&pop-telnetdssl;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/t/telnetd-ssl.html">&size-telnetdssl;</ulink></entry>
              <entry>
    , ,
    </entry>
              <entry>
    , , (SSL support)
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/nfs-kernel-server">
                <literal>nfs-kernel-server</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/nfs-kernel-server">&pop-nfskernelserver;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/n/nfs-kernel-server.html">&size-nfskernelserver;</ulink></entry>
              <entry>
                <ulink url="&nfs;">NFS</ulink>
              </entry>
              <entry>
    Unix file sharing
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/samba">
                <literal>samba</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/samba">&pop-samba;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/s/samba.html">&size-samba;</ulink></entry>
              <entry>
                <ulink url="&smb;">SMB</ulink>
              </entry>
              <entry>
    windows file and printer sharing
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/netatalk">
                <literal>netatalk</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/netatalk">&pop-netatalk;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/n/netatalk.html">&size-netatalk;</ulink></entry>
              <entry>
                <ulink url="&atp;">ATP</ulink>
              </entry>
              <entry>
    apple/mac file and printer sharing (AppleTalk)
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/proftpd-basic">
                <literal>proftpd-basic</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/proftpd-basic">&pop-proftpdbasic;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/p/proftpd-basic.html">&size-proftpdbasic;</ulink></entry>
              <entry>
                <ulink url="&ftp;">FTP</ulink>
              </entry>
              <entry>
    general file download
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/wu-ftpd">
                <literal>wu-ftpd</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/wu-ftpd">&pop-wuftpd;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/w/wu-ftpd.html">&size-wuftpd;</ulink></entry>
              <entry>
    , ,
    </entry>
              <entry>
    , ,
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/apache2-mpm-prefork">
                <literal>apache2-mpm-prefork</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/apache2-mpm-prefork">&pop-apachecmpmprefork;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/a/apache2-mpm-prefork.html">&size-apachecmpmprefork;</ulink></entry>
              <entry>
                <ulink url="&http;">HTTP</ulink>
              </entry>
              <entry>
    general web server
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/apache2-mpm-worker">
                <literal>apache2-mpm-worker</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/apache2-mpm-worker">&pop-apachecmpmworker;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/a/apache2-mpm-worker.html">&size-apachecmpmworker;</ulink></entry>
              <entry>
    , ,
    </entry>
              <entry>
    , ,
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/squid">
                <literal>squid</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/squid">&pop-squid;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/s/squid.html">&size-squid;</ulink></entry>
              <entry>
    , ,
    </entry>
              <entry>
    general web <ulink url="&proxyserver;">proxy server</ulink>
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/squid3">
                <literal>squid3</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/squid3">&pop-squidd;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/s/squid3.html">&size-squidd;</ulink></entry>
              <entry>
    , ,
    </entry>
              <entry>
    , ,
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/slpd">
                <literal>slpd</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/slpd">&pop-slpd;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/s/slpd.html">&size-slpd;</ulink></entry>
              <entry>
                <ulink url="&slp;">SLP</ulink>
              </entry>
              <entry><ulink url="&openslp;">OpenSLP</ulink> Server as <ulink url="&ldap;">LDAP</ulink> server
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/bind9">
                <literal>bind9</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/bind9">&pop-bindj;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/b/bind9.html">&size-bindj;</ulink></entry>
              <entry>
                <ulink url="&dns;">DNS</ulink>
              </entry>
              <entry>
    IP address for other hosts
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/dhcp3-server">
                <literal>dhcp3-server</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/dhcp3-server">&pop-dhcpdserver;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/d/dhcp3-server.html">&size-dhcpdserver;</ulink></entry>
              <entry>
                <ulink url="&dhcp;">DHCP</ulink>
              </entry>
              <entry>
    IP address of client itself
    </entry>
            </row>
          </tbody>
        </tgroup>
      </table>
      <simpara>Common Internet File System Protocol (CIFS) is the same protocol as Server Message Block (SMB).</simpara>
      <tip>
        <simpara>Use of proxy server such as <literal>squid</literal> is much more efficient for saving bandwidth than use of local mirror server with the full Debian archive contents.</simpara>
      </tip>
    </section>
    <section id="_other_network_application_clients">
      <title>Other network application clients</title>
      <table id="listofnetworkapplicationclients" pgwide="0" frame="topbot" rowsep="1" colsep="1">
        <title>List of network application clients.</title>
        <tgroup cols="5">
          <colspec colwidth="10%*" align="left"/>
          <colspec colwidth="10%*" align="left"/>
          <colspec colwidth="10%*" align="left"/>
          <colspec colwidth="10%*" align="left"/>
          <colspec colwidth="60%*" align="left"/>
          <thead>
            <row>
              <entry>
    package
    </entry>
              <entry>
    popcon
    </entry>
              <entry>
    size
    </entry>
              <entry>
    protocol
    </entry>
              <entry>
    focus
    </entry>
            </row>
          </thead>
          <tbody>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/netcat">
                <literal>netcat</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/netcat">&pop-netcat;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/n/netcat.html">&size-netcat;</ulink></entry>
              <entry>
                <ulink url="&tcpip;">TCP/IP</ulink>
              </entry>
              <entry>
    TCP/IP swiss army knife
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/stunnel4">
                <literal>stunnel4</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/stunnel4">&pop-stunnele;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/s/stunnel4.html">&size-stunnele;</ulink></entry>
              <entry>
                <ulink url="&ssl;">SSL</ulink>
              </entry>
              <entry>
    Universal SSL Wrapper
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/telnet">
                <literal>telnet</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/telnet">&pop-telnet;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/t/telnet.html">&size-telnet;</ulink></entry>
              <entry>
                <ulink url="&telnet;">TELNET</ulink>
              </entry>
              <entry>
    TELNET client
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/telnet-ssl">
                <literal>telnet-ssl</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/telnet-ssl">&pop-telnetssl;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/t/telnet-ssl.html">&size-telnetssl;</ulink></entry>
              <entry>
    , ,
    </entry>
              <entry>
    , , (SSL support)
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/nfs-common">
                <literal>nfs-common</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/nfs-common">&pop-nfscommon;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/n/nfs-common.html">&size-nfscommon;</ulink></entry>
              <entry>
                <ulink url="&nfs;">NFS</ulink>
              </entry>
              <entry>
    Unix file sharing
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/smbclient">
                <literal>smbclient</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/smbclient">&pop-smbclient;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/s/smbclient.html">&size-smbclient;</ulink></entry>
              <entry>
                <ulink url="&smb;">SMB</ulink>
              </entry>
              <entry>
    MS windows file and printer sharing client
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/smbfs">
                <literal>smbfs</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/smbfs">&pop-smbfs;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/s/smbfs.html">&size-smbfs;</ulink></entry>
              <entry>
    , ,
    </entry>
              <entry>
    Mount and umount commands for remote MS windows file
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/ftp">
                <literal>ftp</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/ftp">&pop-ftp;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/f/ftp.html">&size-ftp;</ulink></entry>
              <entry>
                <ulink url="&ftp;">FTP</ulink>
              </entry>
              <entry>
    FTP client
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/lftp">
                <literal>lftp</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/lftp">&pop-lftp;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/l/lftp.html">&size-lftp;</ulink></entry>
              <entry>
    , ,
    </entry>
              <entry>
    , ,
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/ncftp">
                <literal>ncftp</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/ncftp">&pop-ncftp;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/n/ncftp.html">&size-ncftp;</ulink></entry>
              <entry>
    , ,
    </entry>
              <entry>
    Full screen FTP client
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/wget">
                <literal>wget</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/wget">&pop-wget;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/w/wget.html">&size-wget;</ulink></entry>
              <entry><ulink url="&http;">HTTP</ulink> and <ulink url="&ftp;">FTP</ulink>
    </entry>
              <entry>
    Web downloader
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/curl">
                <literal>curl</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/curl">&pop-curl;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/c/curl.html">&size-curl;</ulink></entry>
              <entry>
    , ,
    </entry>
              <entry>
    , ,
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/dog">
                <literal>dog</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/dog">&pop-dog;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/d/dog.html">&size-dog;</ulink></entry>
              <entry>
                <ulink url="&http;">HTTP</ulink>
              </entry>
              <entry>
    Web uploader (<literal>cat</literal> with URL support)
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/bind9-host">
                <literal>bind9-host</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/bind9-host">&pop-bindjhost;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/b/bind9-host.html">&size-bindjhost;</ulink></entry>
              <entry>
                <ulink url="&dns;">DNS</ulink>
              </entry>
              <entry>
    The <literal>host</literal> command from bind9, priority standard
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/dnsutils">
                <literal>dnsutils</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/dnsutils">&pop-dnsutils;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/d/dnsutils.html">&size-dnsutils;</ulink></entry>
              <entry>
    , ,
    </entry>
              <entry>
    The <literal>dig</literal> command from bind, priority standard
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/host">
                <literal>host</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/host">&pop-host;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/h/host.html">&size-host;</ulink></entry>
              <entry>
    , ,
    </entry>
              <entry>
    The <literal>host</literal> command from dnsutils, priority extra
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/dhcp3-client">
                <literal>dhcp3-client</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/dhcp3-client">&pop-dhcpdclient;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/d/dhcp3-client.html">&size-dhcpdclient;</ulink></entry>
              <entry>
                <ulink url="&dhcp;">DHCP</ulink>
              </entry>
              <entry>
    Obtain IP address
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/ldap-utils">
                <literal>ldap-utils</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/ldap-utils">&pop-ldaputils;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/l/ldap-utils.html">&size-ldaputils;</ulink></entry>
              <entry>
                <ulink url="&ldap;">LDAP</ulink>
              </entry>
              <entry>
    Obtain data from LDAP server
    </entry>
            </row>
          </tbody>
        </tgroup>
      </table>
    </section>
    <section id="_the_diagnosis_of_the_system_daemons">
      <title>The diagnosis of the system daemons</title>
      <simpara>The <literal>telnet</literal> program enables manual connection and diagnosis of the system daemons.  E.g.:</simpara>
      <screen>$ telnet mail.ispname.net pop3</screen>
      <simpara>The following <ulink url="&rfcs;">RFCs</ulink> provide required knowledge to text each system daemon.</simpara>
      <table id="listofpopularrfcs" pgwide="0" frame="topbot" rowsep="1" colsep="1">
        <title>List of popular RFCs.</title>
        <tgroup cols="2">
          <colspec colwidth="30%*" align="left"/>
          <colspec colwidth="70%*" align="left"/>
          <thead>
            <row>
              <entry>
    RFC
    </entry>
              <entry>
    description
    </entry>
            </row>
          </thead>
          <tbody>
            <row>
              <entry><ulink url="&rfcbjdj;">rfc1939</ulink> and <ulink url="&rfcceej;">rfc2449</ulink>
    </entry>
              <entry><ulink url="&popd;">POP3</ulink> service
    </entry>
            </row>
            <row>
              <entry>
                <ulink url="&rfcdfab;">rfc3501</ulink>
              </entry>
              <entry><ulink url="&imape;">IMAP4</ulink> service
    </entry>
            </row>
            <row>
              <entry><ulink url="&rfccicb;">rfc2821</ulink> (<ulink url="&rfcicb;">rfc821</ulink>)
    </entry>
              <entry><ulink url="&smtp;">SMTP</ulink> service
    </entry>
            </row>
            <row>
              <entry><ulink url="&rfccicc;">rfc2822</ulink> (<ulink url="&rfcicc;">rfc822</ulink>)
    </entry>
              <entry>
    Mail file format
    </entry>
            </row>
            <row>
              <entry>
                <ulink url="&rfccaef;">rfc2045</ulink>
              </entry>
              <entry>
                <ulink url="&multipurposeinteilextensionsmime;">Multipurpose Internet Mail Extensions (MIME)</ulink>
              </entry>
            </row>
            <row>
              <entry>
                <ulink url="&rfcibj;">rfc819</ulink>
              </entry>
              <entry><ulink url="&dns;">DNS</ulink> service
    </entry>
            </row>
            <row>
              <entry>
                <ulink url="&rfccgbg;">rfc2616</ulink>
              </entry>
              <entry><ulink url="&http;">HTTP</ulink> service
    </entry>
            </row>
            <row>
              <entry>
                <ulink url="&rfccdjg;">rfc2396</ulink>
              </entry>
              <entry><ulink url="&uri;">URI</ulink> definition
    </entry>
            </row>
          </tbody>
        </tgroup>
      </table>
      <simpara>The port usage is described in "<literal>/etc/services</literal>".</simpara>
      <note>
        <simpara>For testing <ulink url="&tls;">TLS</ulink>/SSL services such as <ulink url="&https;">HTTPS</ulink>, you need TLS/SSL enabled <literal>telnet</literal> program.</simpara>
      </note>
    </section>
  </chapter>
  <chapter id="_the_x_window_system">
    <title>The X window system</title>
    <simpara>The <ulink url="&xwindowsystem;">X window system</ulink> on the Debian system is based on the source from <ulink url="&xorg;">X.Org</ulink>. As of January 2009, they are X11R7.1(etch), X11R7.3(lenny) and X11R7.3(sid).</simpara>
    <section id="_key_packages">
      <title>Key packages</title>
      <simpara>There are a few (meta)packages provided to ease installation.</simpara>
      <table id="listofkeymetapackagesforxwindow" pgwide="0" frame="topbot" rowsep="1" colsep="1">
        <title>List of key (meta)packages for X window.</title>
        <tgroup cols="4">
          <colspec colwidth="20%*" align="left"/>
          <colspec colwidth="20%*" align="left"/>
          <colspec colwidth="20%*" align="left"/>
          <colspec colwidth="40%*" align="left"/>
          <thead>
            <row>
              <entry>
    (meta)package
    </entry>
              <entry>
    popcon
    </entry>
              <entry>
    size
    </entry>
              <entry>
    description
    </entry>
            </row>
          </thead>
          <tbody>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/xorg">
                <literal>xorg</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/xorg">&pop-xorg;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/x/xorg.html">&size-xorg;</ulink></entry>
              <entry>
    This metapackage provides the X libraries, an X server, a set of fonts, and a group of basic X clients and utilities.
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/xserver-xorg">
                <literal>xserver-xorg</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/xserver-xorg">&pop-xserverxorg;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/x/xserver-xorg.html">&size-xserverxorg;</ulink></entry>
              <entry>
    This package provides the full suits of the X server and its configuration.
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/xbase-clients">
                <literal>xbase-clients</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/xbase-clients">&pop-xbaseclients;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/x/xbase-clients.html">&size-xbaseclients;</ulink></entry>
              <entry>
    This package provides a miscellaneous assortment of X clients.
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/x11-common">
                <literal>x11-common</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/x11-common">&pop-xbbcommon;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/x/x11-common.html">&size-xbbcommon;</ulink></entry>
              <entry>
    This package contains the filesystem infrastructure for the X window system.
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/xorg-docs">
                <literal>xorg-docs</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/xorg-docs">&pop-xorgdocs;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/x/xorg-docs.html">&size-xorgdocs;</ulink></entry>
              <entry>
    This package contains miscellaneous documentation for the X.Org software suite.
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/xspecs">
                <literal>xspecs</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/xspecs">&pop-xspecs;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/x/xspecs.html">&size-xspecs;</ulink></entry>
              <entry>
    This package contains X protocol, extension, and library technical specifications.
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/menu">
                <literal>menu</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/menu">&pop-menu;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/m/menu.html">&size-menu;</ulink></entry>
              <entry>
    This package generates the Debian menu for all menu-aware applications.
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/gksu">
                <literal>gksu</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/gksu">&pop-gksu;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/g/gksu.html">&size-gksu;</ulink></entry>
              <entry>
    This package provides a Gtk+ frontend to <literal>su</literal>(1) or <literal>sudo</literal>(8).
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/menu-xdg">
                <literal>menu-xdg</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/menu-xdg">&pop-menuxdg;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/m/menu-xdg.html">&size-menuxdg;</ulink></entry>
              <entry>
    This package converts the Debian menu structure to the <ulink url="&freedesktoporg;">freedesktop.org</ulink> xdg menu structure.
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/xdg-utils">
                <literal>xdg-utils</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/xdg-utils">&pop-xdgutils;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/x/xdg-utils.html">&size-xdgutils;</ulink></entry>
              <entry>
    This package provides utilities to integrate desktop environment provided by the <ulink url="&freedesktoporg;">freedesktop.org</ulink>.
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/gnome-desktop-environment">
                <literal>gnome-desktop-environment</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/gnome-desktop-environment">&pop-gnomedesktopenvironment;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/g/gnome-desktop-environment.html">&size-gnomedesktopenvironment;</ulink></entry>
              <entry>
    metapackage for the stadard <ulink url="&gnome;">GNOME</ulink> desktop environment.
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/kde-core">
                <literal>kde-core</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/kde-core">&pop-kdecore;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/k/kde-core.html">&size-kdecore;</ulink></entry>
              <entry>
    metapackage for the core <ulink url="&kde;">KDE</ulink> desktop environment.
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/xfce4">
                <literal>xfce4</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/xfce4">&pop-xfcee;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/x/xfce4.html">&size-xfcee;</ulink></entry>
              <entry>
    metapackage for the <ulink url="&xfce;">Xfce</ulink> lightweight desktop environment.
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/lxde-core">
                <literal>lxde-core</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/lxde-core">&pop-lxdecore;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/l/lxde-core.html">&size-lxdecore;</ulink></entry>
              <entry>
    metapackage for the <ulink url="&lxde;">LXDE</ulink> lightweight desktop environment.
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/fluxbox">
                <literal>fluxbox</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/fluxbox">&pop-fluxbox;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/f/fluxbox.html">&size-fluxbox;</ulink></entry>
              <entry><ulink url="&fluxbox;">Fluxbox</ulink>: package for highly configurable and low resource <ulink url="&xwindowmanager;">X window manager</ulink>.
    </entry>
            </row>
          </tbody>
        </tgroup>
      </table>
      <simpara>For the basics of X, refer to <literal>X</literal>(7), <ulink url="&theldpxwindowuserhowto;">the LDP XWindow-User-HOWTO</ulink>.</simpara>
    </section>
    <section id="_setting_up_desktop_environment">
      <title>Setting up desktop environment</title>
      <simpara>A <ulink url="&desktopenvironment;">desktop environment</ulink> is usually a combination of a <ulink url="&xwindowmanager;">X window manager</ulink>, a file manager, and a suite of compatible utility programs.</simpara>
      <simpara>You can setup a full <ulink url="&desktopenvironment;">desktop environment</ulink> such as <ulink url="&gnome;">GNOME</ulink>, <ulink url="&kde;">KDE</ulink>, <ulink url="&xfce;">Xfce</ulink>, or <ulink url="&lxde;">LXDE</ulink>, from the <literal>aptitude</literal> under the task menu.</simpara>
      <tip>
        <simpara>Task menu may be out of sync with the latest package transition state under Debian <literal>unstable</literal>/<literal>testing</literal> environment. In such situation, you need to deselect some (meta)packages listed under <literal>aptitude</literal>(8) task menu to avoid package conflicts.  When deselecting (meta)packages, you must select certain packages providing their dependencies if you need to keep them.</simpara>
      </tip>
      <simpara>You may alternatively setup a simple environment manually just with a <ulink url="&xwindowmanager;">X window manager</ulink> such as <ulink url="&fluxbox;">Fluxbox</ulink>.</simpara>
      <simpara>See <ulink url="&windowmanagersforx;">Window Managers for X</ulink> for the guide to the X window manager and the desktop environment.</simpara>
      <section id="_debian_menu">
        <title>Debian menu</title>
        <simpara><ulink url="&debianmenusystem;">Debian menu system</ulink> provides a general interface for both text- and X-oriented programs with <literal>update-menus</literal>(1) from the <literal>menu</literal> package.  Each package installs its menu data in the "<literal>/usr/share/menu/</literal>" directory. See "<literal>/usr/share/menu/README</literal>".</simpara>
      </section>
      <section id="_freedesktop_org_menu">
        <title>Freedesktop.org menu</title>
        <simpara>Each package which is compliant to Freedesktop.org's xdg menu system installs its menu data provided by "<literal>*.desktop</literal>" under "<literal>/usr/share/applications/</literal>". Modern desktop environments which are compliant to Freedesktop.org standard use these data to generate their menu using the <literal>xdg-utils</literal> package.  See "<literal>/usr/share/doc/xdg-utils/README</literal>".</simpara>
      </section>
      <section id="_debian_menu_under_gnome_desktop_environment">
        <title>Debian menu under GNOME desktop environment</title>
        <simpara>In order to obtain access to the traditional Debian menu under GNOME desktop environment, you must install the <literal>menu-xdg</literal> package, click "System" → "Preference" → "Main Menu", and check the box for "Debian".</simpara>
        <tip>
          <simpara>You may need to do the similar for other modern desktop environments which are compliant to Freedesktop.org standard.</simpara>
        </tip>
      </section>
    </section>
    <section id="_the_server_client_relationship">
      <title>The server/client relationship</title>
      <simpara>The X window system is activated as a combination of the server and client programs. The meaning for the words <emphasis role="strong">server</emphasis> and <emphasis role="strong">client</emphasis> with respect to the words <emphasis role="strong">local</emphasis> and <emphasis role="strong">remote</emphasis> requires attention here:</simpara>
      <table id="listofserverclientterminology" pgwide="0" frame="topbot" rowsep="1" colsep="1">
        <title>List of server/client terminology.</title>
        <tgroup cols="2">
          <colspec colwidth="30%*" align="left"/>
          <colspec colwidth="70%*" align="left"/>
          <thead>
            <row>
              <entry>
    type
    </entry>
              <entry>
    description
    </entry>
            </row>
          </thead>
          <tbody>
            <row>
              <entry>
                <emphasis role="strong">X server</emphasis>
              </entry>
              <entry>
    a program run on a <emphasis role="strong">local host</emphasis> connected to the user's display and input devices.
    </entry>
            </row>
            <row>
              <entry>
                <emphasis role="strong">X client</emphasis>
              </entry>
              <entry>
    a program run on a <emphasis role="strong">remote host</emphasis> that processes data and talks to the X server.
    </entry>
            </row>
            <row>
              <entry>
                <emphasis role="strong">application server</emphasis>
              </entry>
              <entry>
    a program run on a <emphasis role="strong">remote host</emphasis> that processes data and talks to the clients.
    </entry>
            </row>
            <row>
              <entry>
                <emphasis role="strong">application client</emphasis>
              </entry>
              <entry>
    a program run on a <emphasis role="strong">local host</emphasis> connected to the user's display and input devices.
    </entry>
            </row>
          </tbody>
        </tgroup>
      </table>
    </section>
    <section id="_the_x_server">
      <title>The X server</title>
      <simpara>See <literal>xorg</literal>(1) for X server information.</simpara>
      <section id="_the_re_configuration_of_the_x_server">
        <title>The (re)configuration of the X server</title>
        <note>
          <simpara>X server (post-<literal>lenny</literal>) is rewitten to use more information from standardized OS services such as <ulink url="&hal;">HAL</ulink> and <ulink url="&dbus;">D-bus</ulink>, for its configuration than that from "<literal>/etc/X11/xorg.conf</literal>".  So contents in "<literal>/etc/X11/xorg.conf</literal>" are getting less.  You may need to <ulink url="&workaroundtransiroblemsofxserver;">work around transitional problems of X server</ulink>.</simpara>
        </note>
        <simpara>To (re)configure an X server,</simpara>
        <screen># dpkg-reconfigure --priority=low x11-common
# dpkg-reconfigure --priority=low xserver-xorg</screen>
        <simpara>will generate a new "<literal>/etc/X11/xorg.conf</literal>" file using <literal>dexconf</literal>(1).</simpara>
        <simpara>If you have manually edited this "<literal>/etc/X11/xorg.conf</literal>" file but would like it to be automatically updated again, run the following command:</simpara>
        <screen># sudo dpkg-reconfigure -phigh xserver-xorg</screen>
        <simpara>Please check your X configuration  with respect to the specification of your monitor carefully.  For the large high resolution CRT monitor, it is a good idea to set the refresh rate as high as your monitor can handle (85 Hz is great, 75 Hz is OK) to reduce flicker.  For the LCD monitor, slower standard refresh rate (60Hz) is usually fine due to its slow response.</simpara>
        <note>
          <simpara>Be careful not to use too high refresh rate which may cause fatal hardware failure of your monitor system.</simpara>
        </note>
      </section>
      <section id="_the_connection_methods_to_the_x_server">
        <title>The connection methods to the X server</title>
        <simpara>There are several ways of getting the "X server" (<emphasis role="strong">display</emphasis> side) to accept connections from an "X client" (<emphasis role="strong">application</emphasis> side):</simpara>
        <table id="listofconnectionhodstothexserver" pgwide="0" frame="topbot" rowsep="1" colsep="1">
          <title>List of connection methods to the X server.</title>
          <tgroup cols="7">
            <colspec colwidth="10%*" align="left"/>
            <colspec colwidth="10%*" align="left"/>
            <colspec colwidth="10%*" align="left"/>
            <colspec colwidth="10%*" align="left"/>
            <colspec colwidth="10%*" align="left"/>
            <colspec colwidth="10%*" align="left"/>
            <colspec colwidth="40%*" align="left"/>
            <thead>
              <row>
                <entry>
    method
    </entry>
                <entry>
    package
    </entry>
                <entry>
    popcon
    </entry>
                <entry>
    size
    </entry>
                <entry>
    user
    </entry>
                <entry>
    encryption
    </entry>
                <entry>
    pertinent use
    </entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry><literal>xhost</literal> command
    </entry>
                <entry><ulink url="http://packages.debian.org/sid/xbase-clients">
                  <literal>xbase-clients</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/xbase-clients">&pop-xbaseclients;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/x/xbase-clients.html">&size-xbaseclients;</ulink></entry>
                <entry>
    unchecked
    </entry>
                <entry>
    no
    </entry>
                <entry>
    deprecated
    </entry>
              </row>
              <row>
                <entry><literal>xauth</literal> command
    </entry>
                <entry><ulink url="http://packages.debian.org/sid/xbase-clients">
                  <literal>xbase-clients</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/xbase-clients">&pop-xbaseclients;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/x/xbase-clients.html">&size-xbaseclients;</ulink></entry>
                <entry>
    checked
    </entry>
                <entry>
    no
    </entry>
                <entry>
    for local connection via pipe
    </entry>
              </row>
              <row>
                <entry><literal>ssh -X</literal> command
    </entry>
                <entry><ulink url="http://packages.debian.org/sid/openssh-client">
                  <literal>openssh-client</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/openssh-client">&pop-opensshclient;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/o/openssh-client.html">&size-opensshclient;</ulink></entry>
                <entry>
    checked
    </entry>
                <entry>
    yes
    </entry>
                <entry>
    for remote network connection
    </entry>
              </row>
              <row>
                <entry>
    GNOME display manager
    </entry>
                <entry><ulink url="http://packages.debian.org/sid/gdm">
                  <literal>gdm</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/gdm">&pop-gdm;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/g/gdm.html">&size-gdm;</ulink></entry>
                <entry>
    checked
    </entry>
                <entry>
    no(XDMCP)
    </entry>
                <entry>
    for local connection via pipe
    </entry>
              </row>
              <row>
                <entry>
    KDE display manager
    </entry>
                <entry><ulink url="http://packages.debian.org/sid/kdm">
                  <literal>kdm</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/kdm">&pop-kdm;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/k/kdm.html">&size-kdm;</ulink></entry>
                <entry>
    checked
    </entry>
                <entry>
    no(XDMCP)
    </entry>
                <entry>
    for local connection via pipe
    </entry>
              </row>
              <row>
                <entry>
    X display manager
    </entry>
                <entry><ulink url="http://packages.debian.org/sid/xdm">
                  <literal>xdm</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/xdm">&pop-xdm;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/x/xdm.html">&size-xdm;</ulink></entry>
                <entry>
    checked
    </entry>
                <entry>
    no(XDMCP)
    </entry>
                <entry>
    for local connection via pipe
    </entry>
              </row>
              <row>
                <entry>
    WindowMaker display manager
    </entry>
                <entry><ulink url="http://packages.debian.org/sid/wdm">
                  <literal>wdm</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/wdm">&pop-wdm;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/w/wdm.html">&size-wdm;</ulink></entry>
                <entry>
    checked
    </entry>
                <entry>
    no(XDMCP)
    </entry>
                <entry>
    for local connection via pipe
    </entry>
              </row>
              <row>
                <entry>
    LTSP display manager
    </entry>
                <entry><ulink url="http://packages.debian.org/sid/ldm">
                  <literal>ldm</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/ldm">&pop-ldm;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/l/ldm.html">&size-ldm;</ulink></entry>
                <entry>
    checked
    </entry>
                <entry>
    yes
    </entry>
                <entry>
    for remote SSH network connection (thin client)
    </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
        <warning>
          <simpara>Do not use remote <ulink url="&tcp;">TCP</ulink>/<ulink url="&ip;">IP</ulink> connection over <emphasis role="strong">unsecured</emphasis> network for X connection unless you have very good reason such as use of encryption.  A remote TCP/IP socket connection without encryption is prone to the <emphasis role="strong">eavesdropping attack</emphasis> and is disabled by default on the Debian system.  Use "<literal>ssh -X</literal>".</simpara>
        </warning>
        <warning>
          <simpara>Do not use <ulink url="&xdmcpconnection;">XDMCP connection</ulink> over <emphasis role="strong">unsecured</emphasis> network either.  It sends data via <ulink url="&udp;">UDP</ulink>/<ulink url="&ip;">IP</ulink> without encryption and prone to the <emphasis role="strong">eavesdropping attack</emphasis>.</simpara>
        </warning>
        <tip>
          <simpara>You can <emphasis role="strong">dare</emphasis> to enable remote TCP/IP connection by setting "<literal>DisallowTCP=false</literal>" in "<literal>/etc/gdm/gdm.conf</literal>" and by removing "<literal>-nolisten</literal>" from lines found by "<literal>find /etc/X11 -type f -print0 | xargs -0 grep nolisten</literal>", if you are in the fully <emphasis role="strong">secured</emphasis> environment.</simpara>
        </tip>
        <tip>
          <simpara>LTSP stands for <ulink url="&linuxterminalserverproject;">Linux Terminal Server Project</ulink>.</simpara>
        </tip>
      </section>
    </section>
    <section id="_starting_the_x_window_system">
      <title>Starting the X window system</title>
      <simpara>The X Window system is usually started as an X session which is the combination of an X server and connecting X clients.  For normal desktop system, both of them are executed on the workstation.</simpara>
      <simpara>To start the X Window system,</simpara>
      <itemizedlist>
        <listitem>
          <simpara><literal>startx</literal> command started from the command line, or
</simpara>
        </listitem>
        <listitem>
          <simpara>
one of the <ulink url="&xdisplaymanager;">X display manager</ulink> daemon programs <literal>*dm</literal> started from the end of the start up script in "<literal>/etc/rc?.d/</literal>" directory ("<literal>?</literal>" corresponding to the runlevel)
are used to start the <ulink url="&xsession;">X session</ulink>. (The start up script for the display manager daemons checks the content of the "<literal>/etc/X11/default-display-manager</literal>" file before actually executing themselves.)
</simpara>
        </listitem>
      </itemizedlist>
      <tip>
        <simpara>See <xref linkend="_specific_locale_only_under_x_window"/> for initial environment variables of the X display manager.</simpara>
      </tip>
      <simpara>Essentially, all these programs execute the "<literal>/etc/X11/Xsession</literal>" script.  Then the "<literal>/etc/X11/Xsession</literal>" script performs run-parts like action to execute scripts in the "<literal>/etc/X11/Xsession.d/</literal>" directory. This is essentially an execution of a first program which is found in the following order with the <literal>exec</literal> builtin command:</simpara>
      <orderedlist>
        <listitem>
          <simpara>
The script specified as the argument of "<literal>/etc/X11/Xsession</literal>" by the X display manager, if it is defined.
</simpara>
        </listitem>
        <listitem>
          <simpara>
The "<literal>~/.xsession</literal>" or "<literal>~/.Xsession</literal>" script, if it is defined.
</simpara>
        </listitem>
        <listitem>
          <simpara>
The "<literal>/usr/bin/x-session-manager</literal>" command, if it is defined.
</simpara>
        </listitem>
        <listitem>
          <simpara>
The "<literal>/usr/bin/x-window-manager</literal>" command, if it is defined.
</simpara>
        </listitem>
        <listitem>
          <simpara>
The "<literal>/usr/bin/x-terminal-emulator</literal>" command, if it is defined.
</simpara>
        </listitem>
      </orderedlist>
      <simpara>This process is affected by the content of "<literal>/etc/X11/Xsession.options</literal>".  The exact programs to which these "<literal>/usr/bin/x-*</literal>" commands point, are determined by the Debian alternative system and changed by "<literal>update-alternatives --config x-session-manager</literal>", etc.</simpara>
      <section id="_starting_x_session_with_gdm">
        <title>Starting X session with gdm</title>
        <simpara><literal>gdm</literal>(1) lets you select the session type (or desktop environment: <xref linkend="_setting_up_desktop_environment"/>), and language (or locale: <xref linkend="_the_locale"/>) of the X session from its menu.  It keeps the selected default value in "<literal>~/.dmrc</literal>" as, e.g.:</simpara>
        <screen>[Desktop]
Session=default
Language=ja_JP.UTF-8</screen>
      </section>
      <section id="_customizing_the_x_session_classic_method">
        <title>Customizing the X session (classic method)</title>
        <simpara>On a system where "<literal>/etc/X11/Xsession.options</literal>" contains a line "<literal>allow-user-xsession</literal>" without preceding "<literal>#</literal>" characters, any user who defines "<literal>~/.xsession</literal>" or "<literal>~/.Xsession</literal>" will be able to customize the action of "<literal>/etc/X11/Xsession</literal>" by completely overiding the system code. The last command in the "<literal>~/.xsession</literal>" file should use form of "<literal>exec some-window/session-manager</literal>" to start your favorite X window/session managers.</simpara>
      </section>
      <section id="_customizing_the_x_session_new_method">
        <title>Customizing the X session (new method)</title>
        <simpara>Here are new methods to customize the X session without completely overiding the system code as above.</simpara>
        <itemizedlist>
          <listitem>
            <simpara>
The display manager <literal>gdm</literal> can select a specific session and set it as the argument of "<literal>/etc/X11/Xsession</literal>".
</simpara>
          </listitem>
          <listitem>
            <simpara>
The "<literal>~/.xsessionrc</literal>" file is executed as a part of start up process (desktop independent.)
</simpara>
          </listitem>
          <listitem>
            <simpara>
The "<literal>~/.gnomerc</literal>" file is executed as a part of start up process. (GNOME desktop only)
</simpara>
          </listitem>
          <listitem>
            <simpara>
The GUI program based session management software can use the "<literal>~/.gnome2/session</literal>" file etc..
</simpara>
          </listitem>
        </itemizedlist>
      </section>
      <section id="_connecting_a_remote_x_client_via_ssh">
        <title>Connecting a remote X client via SSH</title>
        <simpara>The use of "<literal>ssh -X</literal>" enables a secure connection from a local X server to a remote application server.</simpara>
        <itemizedlist>
          <listitem>
            <simpara>
Set "<literal>X11Forwarding</literal>" entries to "<literal>yes</literal>" in "<literal>/etc/ssh/sshd_config</literal>" of the remote host, if you want to avoid "<literal>-X</literal>" command-line option.
</simpara>
          </listitem>
          <listitem>
            <simpara>
Start the X server on the local host.
</simpara>
          </listitem>
          <listitem>
            <simpara>
Open an <literal>xterm</literal> in the local host.
</simpara>
          </listitem>
          <listitem>
            <simpara>
Run <literal>ssh</literal>(1) to establish a connection with the remote site.
</simpara>
          </listitem>
        </itemizedlist>
        <screen>localname @ localhost $ ssh -q -X loginname@remotehost.domain
Password:
.....</screen>
        <itemizedlist>
          <listitem>
            <simpara>
Run an X application command, e.g. "<literal>gimp</literal>", on the remote site.
</simpara>
          </listitem>
        </itemizedlist>
        <screen>loginname @ remotehost $ gimp &amp;</screen>
        <simpara>This method allows the display of the remote X client output as if it were locally connected through a local UNIX domain socket.</simpara>
      </section>
      <section id="_secure_x_terminal_via_internet">
        <title>Secure X terminal via Internet</title>
        <simpara>Secure X terminal via Internet, which displays remotely run entire X desktop environment, can easily achieved by using specialized package such as <literal>ldm</literal>. Your local machine becomes a secure thin client to the remote application server connected via SSH.</simpara>
        <simpara>If you want to add similar feature to your normal display manager <literal>gdm</literal>, create executable shell script at "<literal>/usr/local/bin/ssh-session</literal>" as:</simpara>
        <screen>#!/bin/sh -e
# Based on gdm-ssh-session in gdm source (GPL)
ZENITY=$(type -p zenity)
TARGETHOST=$($ZENITY --width=600 \
--title "Host to connect to" --entry \
--text "Enter the name of the host you want to log in to as user@host.dom:")
TARGETSESSION=$($ZENITY --width=600 --height=400 \
--title "Remote session name" --list --radiolist --text "Select one" \
--column " " --column "Session" --column "description" --print-column 2 \
TRUE "/etc/X11/Xsession" "Debian" \
FALSE "/etc/X11/xinit/Xclients" "RH variants" \
FALSE "gnome-session" "GNOME session" \
FALSE "xterm" "Safe choice" \
FALSE "rxvt" "Safe choice" \
FALSE "gnome-terminal" "Safe choice")
echo "Connecting to "$TARGETHOST" with $TARGETSESSION"
/usr/bin/ssh -A -X -T -n "$TARGETHOST" "$TARGETSESSION"
#SSH_ASKPASS=/usr/bin/ssh-askpass /usr/bin/ssh -A -X -T -n "$TARGETHOST" "$TARGETSESSION"</screen>
        <simpara>Then add followings to "<literal>/etc/dm/Sessions/ssh.desktop</literal>":</simpara>
        <screen>[Desktop Entry]
Encoding=UTF-8
Name=SSH
Comment=This session logs you into a remote host using ssh
Exec=/usr/local/bin/ssh-session
Type=Application</screen>
      </section>
    </section>
    <section id="_fonts_in_the_x_window">
      <title>Fonts in the X window</title>
      <simpara>X window on the Debian system support two mechanisms for font management:</simpara>
      <itemizedlist>
        <listitem>
          <simpara>
server side font management: the original core X11 font system and
</simpara>
        </listitem>
        <listitem>
          <simpara>
client side font management: the new <ulink url="&xft;">Xft</ulink> 2 font system.
</simpara>
        </listitem>
      </itemizedlist>
      <simpara>The core X11 font system provides backward compatibility with older applications such as Xterm with bitmap fonts.  It is supported by installing pertinent font packages which trigger <literal>defoma</literal>(1) scripts to generate required files such as "<literal>fonts.dir</literal>".</simpara>
      <simpara>The Xft2 font system is used by all modern applications such as ones from GNOME, KDE, OpenOffice.org, etc..  It supports all fonts listed below (<xref linkend="_basic_fonts"/>, <xref linkend="_additional_fonts"/>, and <xref linkend="_cjk_fonts"/>) with advanced features such as anti-aliasing.  It has no configuration mechanism itself, rather it relies upon the <ulink url="&fontconfiglibrary;">fontconfig library</ulink> to configure and customize fonts as described in <literal>fonts.conf</literal>(5).  Actual rasterization is supported by the FreeType 2 font engine.  These new X clients using Xft2 font system can talk to modern X server via  <ulink url="&thexrenderingextension;">the X Rendering Extension</ulink>.</simpara>
      <table id="tableofpackagestindowfontsystems" pgwide="0" frame="topbot" rowsep="1" colsep="1">
        <title>Table of packages to support X window font systems.</title>
        <tgroup cols="4">
          <colspec colwidth="20%*" align="left"/>
          <colspec colwidth="20%*" align="left"/>
          <colspec colwidth="20%*" align="left"/>
          <colspec colwidth="40%*" align="left"/>
          <thead>
            <row>
              <entry>
    package
    </entry>
              <entry>
    popcon
    </entry>
              <entry>
    size
    </entry>
              <entry>
    description
    </entry>
            </row>
          </thead>
          <tbody>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/xfonts-utils">
                <literal>xfonts-utils</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/xfonts-utils">&pop-xfontsutils;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/x/xfonts-utils.html">&size-xfontsutils;</ulink></entry>
              <entry>
    X Window System font utility programs
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/libxft2">
                <literal>libxft2</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/libxft2">&pop-libxftc;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/libx/libxft2.html">&size-libxftc;</ulink></entry>
              <entry>
    Xft: FreeType-based font drawing library for X
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/libfreetype6">
                <literal>libfreetype6</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/libfreetype6">&pop-libfreetypeg;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/libf/libfreetype6.html">&size-libfreetypeg;</ulink></entry>
              <entry><ulink url="&freetype;">FreeType</ulink> 2 font engine, shared library files
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/fontconfig">
                <literal>fontconfig</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/fontconfig">&pop-fontconfig;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/f/fontconfig.html">&size-fontconfig;</ulink></entry>
              <entry><ulink url="&genericfontconfigurationlibrary;">generic font configuration library</ulink> - support binaries
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/fontconfig-config">
                <literal>fontconfig-config</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/fontconfig-config">&pop-fontconfigconfig;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/f/fontconfig-config.html">&size-fontconfigconfig;</ulink></entry>
              <entry>
    generic font configuration library - configuration
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/defoma">
                <literal>defoma</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/defoma">&pop-defoma;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/d/defoma.html">&size-defoma;</ulink></entry>
              <entry>
    Debian Font Manager — automatic font configuration framework
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/x-ttcidfont-conf">
                <literal>x-ttcidfont-conf</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/x-ttcidfont-conf">&pop-xttcidfontconf;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/x/x-ttcidfont-conf.html">&size-xttcidfontconf;</ulink></entry>
              <entry>
    TrueType configuration for X (for CJK support)
    </entry>
            </row>
          </tbody>
        </tgroup>
      </table>
      <simpara>You can check actual font path for:</simpara>
      <itemizedlist>
        <listitem>
          <simpara>
core X11 font path with "<literal>xset q</literal>"
</simpara>
        </listitem>
        <listitem>
          <simpara>
fontconfig font default: "<literal>fc-match</literal>"
</simpara>
        </listitem>
      </itemizedlist>
      <tip>
        <simpara>"<ulink url="&thepenguinandunicode;">The Penguin and Unicode</ulink>" is a good overview of modern X Window system. Other documentations at <ulink url="&httpunifontorg;">http://unifont.org/</ulink> should provide good information on Unicode fonts, Unicode-enabled software, internationalization, and Unicode usability issues on <ulink url="&freelibreopensourcefloss;">free/libre/open source (FLOSS)</ulink> operating systems.</simpara>
      </tip>
      <tip>
        <simpara>You should rely on <ulink url="&fontconfig;">fontconfig</ulink> infrastructure to configure fonts on the Debian system.  Debian Font Manager (<literal>defoma</literal>(1)) is only useful as font installation such as <ulink url="&xlogicalfontdescriptionxlfd;">X logical font description (XLFD)</ulink> data.</simpara>
      </tip>
      <section id="_basic_fonts">
        <title>Basic fonts</title>
        <simpara>There are 2 major types of <ulink url="&computerfonts;">computer fonts</ulink>:</simpara>
        <itemizedlist>
          <listitem>
            <simpara>
bitmap fonts (good for low resolution rasterization)
</simpara>
          </listitem>
          <listitem>
            <simpara>
outline/stroke fonts (good for high resolution rasterization)
</simpara>
          </listitem>
        </itemizedlist>
        <simpara>While scaling of bitmap fonts causes jugged image, scaling of outline/stroke
fonts produces smooth image.</simpara>
        <simpara>Bitmap fonts on the Debian system are provided by compressed <ulink url="&xbbpcfbitmapfontfiles;">X11 pcf bitmap font files</ulink> having their file extension "<literal>.pcf.gz</literal>".</simpara>
        <simpara>Outline fonts on the Debian system are provided by:</simpara>
        <itemizedlist>
          <listitem>
            <simpara><ulink url="&postscript;">PostScript</ulink> Type 1 font files having their file extension "<literal>.pfb</literal>" (binary font file) and "<literal>.afm</literal>" (font metrics file).
</simpara>
          </listitem>
          <listitem>
            <simpara><ulink url="&truetype;">TrueType</ulink> font files having their file extension "<literal>.ttf</literal>".
</simpara>
          </listitem>
        </itemizedlist>
        <table id="tableofcorresponscripttypebfonts" pgwide="0" frame="topbot" rowsep="1" colsep="1">
          <title>Table of corresponding <ulink url="&postscript;">PostScript</ulink> Type 1 fonts.</title>
          <tgroup cols="7">
            <colspec colwidth="10%*" align="left"/>
            <colspec colwidth="10%*" align="left"/>
            <colspec colwidth="10%*" align="left"/>
            <colspec colwidth="10%*" align="left"/>
            <colspec colwidth="10%*" align="left"/>
            <colspec colwidth="10%*" align="left"/>
            <colspec colwidth="40%*" align="left"/>
            <thead>
              <row>
                <entry>
    font package
    </entry>
                <entry>
    popcon
    </entry>
                <entry>
    size
    </entry>
                <entry>
    sans-serif font
    </entry>
                <entry>
    serif font
    </entry>
                <entry>
    monospace font
    </entry>
                <entry>
    source of font
    </entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry>
    PostScript
    </entry>
                <entry>
    N/A
    </entry>
                <entry>
    N/A
    </entry>
                <entry>
                  <ulink url="&helvetica;">Helvetica</ulink>
                </entry>
                <entry>
                  <ulink url="&times;">Times</ulink>
                </entry>
                <entry>
                  <ulink url="&courier;">Courier</ulink>
                </entry>
                <entry>
    Adobe
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/gsfonts">
    gsfonts
    </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/gsfonts">&pop-gsfonts;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/g/gsfonts.html">&size-gsfonts;</ulink></entry>
                <entry>
    Nimbus Sans L
    </entry>
                <entry>
    Nimbus Roman No9 L
    </entry>
                <entry>
    Nimbus Mono L
    </entry>
                <entry><ulink url="&urw;">URW</ulink> (Adobe compatible size)
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/gsfonts-x11">
    gsfonts-x11
    </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/gsfonts-x11">&pop-gsfontsxbb;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/g/gsfonts-x11.html">&size-gsfontsxbb;</ulink></entry>
                <entry>
    Nimbus Sans L
    </entry>
                <entry>
    Nimbus Roman No9 L
    </entry>
                <entry>
    Nimbus Mono L
    </entry>
                <entry>
    X font support with PostScript Type 1 fonts.
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/t1-cyrillic">
    t1-cyrillic
    </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/t1-cyrillic">&pop-tbcyrillic;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/t/t1-cyrillic.html">&size-tbcyrillic;</ulink></entry>
                <entry>
    Free Helvetian
    </entry>
                <entry>
    Free Times
    </entry>
                <entry>
    Free Courier
    </entry>
                <entry>
    URW extended (Adobe compatible size)
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/lmodern">
    lmodern
    </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/lmodern">&pop-lmodern;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/l/lmodern.html">&size-lmodern;</ulink></entry>
                <entry>
    LMSans*
    </entry>
                <entry>
    LMRoman*
    </entry>
                <entry>
    LMTypewriter*
    </entry>
                <entry>
    scalable PostScript and OpenType fonts based on Computer Modern (from TeX)
    </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
        <table id="tableofcorresponingtruetypefonts" pgwide="0" frame="topbot" rowsep="1" colsep="1">
          <title>Table of corresponding <ulink url="&truetype;">TrueType</ulink> fonts.</title>
          <tgroup cols="7">
            <colspec colwidth="10%*" align="left"/>
            <colspec colwidth="10%*" align="left"/>
            <colspec colwidth="10%*" align="left"/>
            <colspec colwidth="10%*" align="left"/>
            <colspec colwidth="10%*" align="left"/>
            <colspec colwidth="10%*" align="left"/>
            <colspec colwidth="40%*" align="left"/>
            <thead>
              <row>
                <entry>
    font package
    </entry>
                <entry>
    popcon
    </entry>
                <entry>
    size
    </entry>
                <entry>
    sans-serif font
    </entry>
                <entry>
    serif font
    </entry>
                <entry>
    monospace font
    </entry>
                <entry>
    source of font
    </entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/ttf-mscorefonts-installer">
    ttf-mscorefonts-installer
    </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/ttf-mscorefonts-installer">&pop-ttfmscorefontsinstaller;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/t/ttf-mscorefonts-installer.html">&size-ttfmscorefontsinstaller;</ulink></entry>
                <entry>
                  <ulink url="&arial;">Arial</ulink>
                </entry>
                <entry>
                  <ulink url="&timesnewroman;">Times New Roman</ulink>
                </entry>
                <entry>
                  <ulink url="&couriernew;">Courier New</ulink>
                </entry>
                <entry>
    Microsoft (Adobe compatible size) (This installs non-free data)
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/ttf-liberation">
    ttf-liberation
    </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/ttf-liberation">&pop-ttfliberation;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/t/ttf-liberation.html">&size-ttfliberation;</ulink></entry>
                <entry>
    Liberation Sans
    </entry>
                <entry>
    Liberation Serif
    </entry>
                <entry>
    Liberation Mono
    </entry>
                <entry><ulink url="&liberationfontsproject;">Liberation Fonts project</ulink> (Microsoft compatible size)
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/ttf-freefont">
    ttf-freefont
    </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/ttf-freefont">&pop-ttffreefont;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/t/ttf-freefont.html">&size-ttffreefont;</ulink></entry>
                <entry>
    FreeSans
    </entry>
                <entry>
    FreeSerif
    </entry>
                <entry>
    FreeMono
    </entry>
                <entry><ulink url="&gnufreefont;">GNU freefont</ulink> (Microsoft compatible size)
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/ttf-bitstream-vera">
    ttf-bitstream-vera
    </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/ttf-bitstream-vera">&pop-ttfbitstreamvera;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/t/ttf-bitstream-vera.html">&size-ttfbitstreamvera;</ulink></entry>
                <entry>
    Bitstream Vera Sans
    </entry>
                <entry>
    Bitstream Vera Serif
    </entry>
                <entry>
    Bitstream Vera Sans Mono
    </entry>
                <entry>
                  <ulink url="&bitstreaminc;">Bitstream, Inc.</ulink>
                </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/ttf-dejavu">
    ttf-dejavu
    </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/ttf-dejavu">&pop-ttfdejavu;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/t/ttf-dejavu.html">&size-ttfdejavu;</ulink></entry>
                <entry>
    DejaVu Sans
    </entry>
                <entry>
    DejaVu Serif
    </entry>
                <entry>
    DejaVu Sans Mono
    </entry>
                <entry><ulink url="&dejavu;">DejaVu</ulink>, Bitstream with extended character code support
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/ttf-dejavu-core">
    ttf-dejavu-core
    </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/ttf-dejavu-core">&pop-ttfdejavucore;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/t/ttf-dejavu-core.html">&size-ttfdejavucore;</ulink></entry>
                <entry>
    DejaVu Sans
    </entry>
                <entry>
    DejaVu Serif
    </entry>
                <entry>
    DejaVu Sans Mono
    </entry>
                <entry><ulink url="&dejavu;">DejaVu</ulink>, basic font style variants
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/ttf-dejavu-extra">
    ttf-dejavu-extra
    </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/ttf-dejavu-extra">&pop-ttfdejavuextra;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/t/ttf-dejavu-extra.html">&size-ttfdejavuextra;</ulink></entry>
                <entry>
    DejaVu Sans
    </entry>
                <entry>
    DejaVu Serif
    </entry>
                <entry>
    DejaVu Sans Mono
    </entry>
                <entry><ulink url="&dejavu;">DejaVu</ulink>, extra font style variants
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/ttf-unifont">
    ttf-unifont
    </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/ttf-unifont">&pop-ttfunifont;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/t/ttf-unifont.html">&size-ttfunifont;</ulink></entry>
                <entry>
    N/A
    </entry>
                <entry>
    N/A
    </entry>
                <entry>
    unifont
    </entry>
                <entry><ulink url="&gnuunifont;">GNU Unifont</ulink>, with all printable character code in Unicode 5.1 Basic Multilingual Plane (BMP)
    </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
      </section>
      <section id="_additional_fonts">
        <title>Additional fonts</title>
        <simpara><literal>aptitude</literal>(8) will help you find additional fonts easily:</simpara>
        <itemizedlist>
          <listitem>
            <simpara>
by the short package list under "Packages which depend on defoma" under the <literal>defoma</literal> package list,
</simpara>
          </listitem>
          <listitem>
            <simpara>
by the short package list under "Tasks" →  "Localization",
</simpara>
          </listitem>
          <listitem>
            <simpara>
by the filtered flat package list of font data with regex on debtag: "<literal>~Gmade-of::data:font</literal>",
</simpara>
          </listitem>
          <listitem>
            <simpara>
by the filtered flat package list of the BDF (bitmap) font packages with regex on package name: "<literal>~nxfonts-</literal>", or
</simpara>
          </listitem>
          <listitem>
            <simpara>
by the filtered flat package list of the TrueType (outline) font packages with regex on package name: "<literal>~nttf-</literal>".
</simpara>
          </listitem>
        </itemizedlist>
        <simpara>Since <emphasis role="strong">Free</emphasis> fonts are sometimes limited, installing or sharing some commercial TrueType fonts is an option for a Debian users.  In order to make this process easy for the user, some convenience packages have been created:</simpara>
        <itemizedlist>
          <listitem>
            <simpara>
              <literal>ttf-mathematica4.1</literal>
            </simpara>
          </listitem>
          <listitem>
            <simpara><literal>ttf-mscorefonts-installer</literal>
You'll have a really good selection of TrueType fonts at the expense of contaminating your <emphasis role="strong">Free</emphasis> system with non-Free fonts.
</simpara>
          </listitem>
        </itemizedlist>
      </section>
      <section id="_cjk_fonts">
        <title>CJK fonts</title>
        <simpara>Here are some key points focused on CJK issues.</simpara>
        <table id="tableofkeywordsundicatefonttypes" pgwide="0" frame="topbot" rowsep="1" colsep="1">
          <title>Table of key words used in CJK font names to indicate font types.</title>
          <tgroup cols="4">
            <colspec colwidth="20%*" align="left"/>
            <colspec colwidth="20%*" align="left"/>
            <colspec colwidth="20%*" align="left"/>
            <colspec colwidth="40%*" align="left"/>
            <thead>
              <row>
                <entry>
    font type
    </entry>
                <entry>
    Japanese font name
    </entry>
                <entry>
    Chinese font name
    </entry>
                <entry>
    Korean font name
    </entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry>
    sans-serif
    </entry>
                <entry>
    gothic, ゴチック     hei,
    </entry>
                <entry>
    gothic       dodu
    </entry>
                <entry>
    m, gulim, gothic
    </entry>
              </row>
              <row>
                <entry>
    serif
    </entry>
                <entry>
    mincho, 明朝         so
    </entry>
                <entry>
    ng, ming        ba
    </entry>
                <entry>
    tang
    </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
        <simpara>Font name such as "VL PGothic" with "P" is a proportional font which corresponds to the fixed width "VL Gothic" font.</simpara>
        <simpara>For example, Shift_JIS code table comprises 7070 characters.  They can be grouped into:</simpara>
        <itemizedlist>
          <listitem>
            <simpara>
JIS X 0201 single-byte characters (191 characters),
</simpara>
          </listitem>
          <listitem>
            <simpara>
JIS X 0208 double-byte characters (6879 characters).
Double-byte characters occupy double width on console terminals which uses CJK fixed width fonts.  In order to cope with such situation, <ulink url="&hanzibitmapfonthbffile;">Hanzi Bitmap Font (HBF) File</ulink> with file extension "<literal>.hbf</literal>" may be deployed for fonts containing single-byte and double-byte characters.
</simpara>
          </listitem>
        </itemizedlist>
        <simpara>In order to save space for <ulink url="&truetype;">TrueType</ulink> font files, <ulink url="&truetype;">TrueType</ulink> font collection file with file extension "<literal>.ttc</literal>" may be used.</simpara>
        <simpara>I order to cover complicated code space of characters, CID keyed Type 1 <ulink url="&postscript;">PostScript</ulink> font is used with CMap files starting themselves with "<literal>%!PS-Adobe-3.0 Resource-CMap</literal>".  This is rarely used for normal X display but used for PDF rendering etc. (see <xref linkend="_x_utility_applications"/>).</simpara>
        <tip>
          <simpara>The multiple <ulink url="&glyphs;">glyphs</ulink> are expected for some <ulink url="&unicode;">Unicode</ulink> code points due to <ulink url="&hanunification;">Han unification</ulink>.  One of the most annoying ones are  "U+3001 IDEOGRAPHIC COMMA" and "U+3002 IDEOGRAPHIC FULL STOP" whose character positions differ among CJK countries.  Configuring priority of Japanese centric fonts over Chinese ones using "<literal>~/.fonts.conf</literal>" should give peace of minds to Japanese.</simpara>
        </tip>
      </section>
    </section>
    <section id="_x_applications">
      <title>X applications</title>
      <section id="_x_office_applications">
        <title>X office applications</title>
        <simpara>Here is a list of basic office applications (OO is OpenOffice.org):</simpara>
        <table id="listofbasicxofficeapplications" pgwide="0" frame="topbot" rowsep="1" colsep="1">
          <title>List of basic X office applications</title>
          <tgroup cols="5">
            <colspec colwidth="10%*" align="left"/>
            <colspec colwidth="10%*" align="left"/>
            <colspec colwidth="10%*" align="left"/>
            <colspec colwidth="10%*" align="left"/>
            <colspec colwidth="60%*" align="left"/>
            <thead>
              <row>
                <entry>
    package
    </entry>
                <entry>
    popcon
    </entry>
                <entry>
    package size
    </entry>
                <entry>
    type
    </entry>
                <entry>
    description
    </entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/openoffice.org-writer">
                  <literal>openoffice.org-writer</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/openoffice.org-writer">&pop-openofficeorgwriter;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/o/openoffice.org-writer.html">&size-openofficeorgwriter;</ulink></entry>
                <entry>
    OO
    </entry>
                <entry>
    word processor
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/openoffice.org-calc">
                  <literal>openoffice.org-calc</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/openoffice.org-calc">&pop-openofficeorgcalc;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/o/openoffice.org-calc.html">&size-openofficeorgcalc;</ulink></entry>
                <entry>
    OO
    </entry>
                <entry>
    spreadsheet
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/openoffice.org-impress">
                  <literal>openoffice.org-impress</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/openoffice.org-impress">&pop-openofficeorgimpress;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/o/openoffice.org-impress.html">&size-openofficeorgimpress;</ulink></entry>
                <entry>
    OO
    </entry>
                <entry>
    presentation
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/openoffice.org-base">
                  <literal>openoffice.org-base</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/openoffice.org-base">&pop-openofficeorgbase;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/o/openoffice.org-base.html">&size-openofficeorgbase;</ulink></entry>
                <entry>
    OO
    </entry>
                <entry>
    database management
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/openoffice.org-draw">
                  <literal>openoffice.org-draw</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/openoffice.org-draw">&pop-openofficeorgdraw;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/o/openoffice.org-draw.html">&size-openofficeorgdraw;</ulink></entry>
                <entry>
    OO
    </entry>
                <entry>
    vector graphics editor (draw)
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/openoffice.org-math">
                  <literal>openoffice.org-math</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/openoffice.org-math">&pop-openofficeorgmath;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/o/openoffice.org-math.html">&size-openofficeorgmath;</ulink></entry>
                <entry>
    OO
    </entry>
                <entry>
    mathematical equation/formula editor
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/abiword">
                  <literal>abiword</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/abiword">&pop-abiword;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/a/abiword.html">&size-abiword;</ulink></entry>
                <entry>
    GNOME
    </entry>
                <entry>
    word processor
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/gnumeric">
                  <literal>gnumeric</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/gnumeric">&pop-gnumeric;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/g/gnumeric.html">&size-gnumeric;</ulink></entry>
                <entry>
    GNOME
    </entry>
                <entry>
    spreadsheet
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/gimp">
                  <literal>gimp</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/gimp">&pop-gimp;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/g/gimp.html">&size-gimp;</ulink></entry>
                <entry>
    GTK
    </entry>
                <entry>
    bitmap graphics editor (paint)
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/inkscape">
                  <literal>inkscape</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/inkscape">&pop-inkscape;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/i/inkscape.html">&size-inkscape;</ulink></entry>
                <entry>
    GNOME
    </entry>
                <entry>
    vector graphics editor (draw)
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/dia-gnome">
                  <literal>dia-gnome</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/dia-gnome">&pop-diagnome;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/d/dia-gnome.html">&size-diagnome;</ulink></entry>
                <entry>
    GNOME
    </entry>
                <entry>
    flowchart and diagram editor
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/mergeant">
                  <literal>mergeant</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/mergeant">&pop-mergeant;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/m/mergeant.html">&size-mergeant;</ulink></entry>
                <entry>
    GNOME
    </entry>
                <entry>
    database management
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/planner">
                  <literal>planner</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/planner">&pop-planner;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/p/planner.html">&size-planner;</ulink></entry>
                <entry>
    GNOME
    </entry>
                <entry>
    project management
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/kword">
                  <literal>kword</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/kword">&pop-kword;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/k/kword.html">&size-kword;</ulink></entry>
                <entry>
    KDE
    </entry>
                <entry>
    word processor
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/kspread">
                  <literal>kspread</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/kspread">&pop-kspread;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/k/kspread.html">&size-kspread;</ulink></entry>
                <entry>
    KDE
    </entry>
                <entry>
    spreadsheet
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/kpresenter">
                  <literal>kpresenter</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/kpresenter">&pop-kpresenter;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/k/kpresenter.html">&size-kpresenter;</ulink></entry>
                <entry>
    KDE
    </entry>
                <entry>
    presentation
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/kexi">
                  <literal>kexi</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/kexi">&pop-kexi;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/k/kexi.html">&size-kexi;</ulink></entry>
                <entry>
    KDE
    </entry>
                <entry>
    database management
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/kivio">
                  <literal>kivio</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/kivio">&pop-kivio;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/k/kivio.html">&size-kivio;</ulink></entry>
                <entry>
    KDE
    </entry>
                <entry>
    flowchart and diagram editor
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/karbon">
                  <literal>karbon</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/karbon">&pop-karbon;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/k/karbon.html">&size-karbon;</ulink></entry>
                <entry>
    KDE
    </entry>
                <entry>
    vector graphics editor (draw)
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/krita">
                  <literal>krita</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/krita">&pop-krita;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/k/krita.html">&size-krita;</ulink></entry>
                <entry>
    KDE
    </entry>
                <entry>
    bitmap graphics editor (paint)
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/kplato">
                  <literal>kplato</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/kplato">&pop-kplato;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/k/kplato.html">&size-kplato;</ulink></entry>
                <entry>
    KDE
    </entry>
                <entry>
    project management
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/kchart">
                  <literal>kchart</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/kchart">&pop-kchart;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/k/kchart.html">&size-kchart;</ulink></entry>
                <entry>
    KDE
    </entry>
                <entry>
    graph and chart drawing program
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/kformula">
                  <literal>kformula</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/kformula">&pop-kformula;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/k/kformula.html">&size-kformula;</ulink></entry>
                <entry>
    KDE
    </entry>
                <entry>
    mathematical equation/formula editor
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/kugar">
                  <literal>kugar</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/kugar">&pop-kugar;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/k/kugar.html">&size-kugar;</ulink></entry>
                <entry>
    KDE
    </entry>
                <entry>
    business quality report generator
    </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
      </section>
      <section id="_x_utility_applications">
        <title>X utility applications</title>
        <simpara>Here is a list of basic utility applications which caught my eyes:</simpara>
        <table id="listofbasicxutilityapplications" pgwide="0" frame="topbot" rowsep="1" colsep="1">
          <title>List of basic X utility applications</title>
          <tgroup cols="5">
            <colspec colwidth="10%*" align="left"/>
            <colspec colwidth="10%*" align="left"/>
            <colspec colwidth="10%*" align="left"/>
            <colspec colwidth="10%*" align="left"/>
            <colspec colwidth="60%*" align="left"/>
            <thead>
              <row>
                <entry>
    package
    </entry>
                <entry>
    popcon
    </entry>
                <entry>
    package size
    </entry>
                <entry>
    type
    </entry>
                <entry>
    description
    </entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/evince">
                  <literal>evince</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/evince">&pop-evince;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/e/evince.html">&size-evince;</ulink></entry>
                <entry>
    GNOME
    </entry>
                <entry>
    document(pdf) viewer
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/kpdf">
                  <literal>kpdf</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/kpdf">&pop-kpdf;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/k/kpdf.html">&size-kpdf;</ulink></entry>
                <entry>
    KDE3
    </entry>
                <entry>
    document(pdf) viewer
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/okular">
                  <literal>okular</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/okular">&pop-okular;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/o/okular.html">&size-okular;</ulink></entry>
                <entry>
    KDE4
    </entry>
                <entry>
    document(pdf) viewer
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/evolution">
                  <literal>evolution</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/evolution">&pop-evolution;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/e/evolution.html">&size-evolution;</ulink></entry>
                <entry>
    GNOME
    </entry>
                <entry>
    Personal information Management (groupware and email)
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/kontact">
                  <literal>kontact</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/kontact">&pop-kontact;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/k/kontact.html">&size-kontact;</ulink></entry>
                <entry>
    KDE
    </entry>
                <entry>
    Personal information Management (groupware and email)
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/scribus">
                  <literal>scribus</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/scribus">&pop-scribus;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/s/scribus.html">&size-scribus;</ulink></entry>
                <entry>
    KDE
    </entry>
                <entry>
    desktop page layout editor
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/glabels">
                  <literal>glabels</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/glabels">&pop-glabels;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/g/glabels.html">&size-glabels;</ulink></entry>
                <entry>
    GNOME
    </entry>
                <entry>
    label editor
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/kbarcode">
                  <literal>kbarcode</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/kbarcode">&pop-kbarcode;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/k/kbarcode.html">&size-kbarcode;</ulink></entry>
                <entry>
    KDE
    </entry>
                <entry>
    barcode and label printing application
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/gnucash">
                  <literal>gnucash</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/gnucash">&pop-gnucash;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/g/gnucash.html">&size-gnucash;</ulink></entry>
                <entry>
    GNOME
    </entry>
                <entry>
    personal accounting
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/homebank">
                  <literal>homebank</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/homebank">&pop-homebank;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/h/homebank.html">&size-homebank;</ulink></entry>
                <entry>
    GTK
    </entry>
                <entry>
    personal accounting
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/kmymoney2">
                  <literal>kmymoney2</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/kmymoney2">&pop-kmymoneyc;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/k/kmymoney2.html">&size-kmymoneyc;</ulink></entry>
                <entry>
    KDE
    </entry>
                <entry>
    personal accounting
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/xsane">
                  <literal>xsane</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/xsane">&pop-xsane;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/x/xsane.html">&size-xsane;</ulink></entry>
                <entry>
    GTK
    </entry>
                <entry>
    scanner frontend
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/kooka">
                  <literal>kooka</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/kooka">&pop-kooka;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/k/kooka.html">&size-kooka;</ulink></entry>
                <entry>
    KDE
    </entry>
                <entry>
    scanner frontend
    </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
        <caution>
          <simpara>The <literal>poppler-data</literal> package (non-free, see <xref linkend="_ghostscript"/>) needs to be installed for <literal>evince</literal> and <literal>okular</literal> to display CJK PDF documents using Cmap data (<xref linkend="_cjk_fonts"/>).</simpara>
        </caution>
        <note>
          <simpara>Installing softwares such as <literal>scribus</literal> (KDE) on GNOME desktop environment are quite acceptable since corresponding functionality is not available under GNOME desktop environment.  But installing too many packages with duplicated functionalities will clutter your menu.</simpara>
        </note>
      </section>
    </section>
    <section id="_the_x_trivia">
      <title>The X trivia</title>
      <section id="_keymaps_and_pointer_button_mappings_in_x">
        <title>Keymaps and pointer button mappings in X</title>
        <simpara><literal>xmodmap</literal>(1) is a utility for modifying keymaps and pointer button mappings in the X window system.
To get the <emphasis role="strong">keycode</emphasis>, run <literal>xev</literal>(1) in the X and press keys.  To get the meaning of <emphasis role="strong">keysym</emphasis>, look into the MACRO definition in "<literal>/usr/include/X11/keysymdef.h</literal>" file.  All "<literal>#define</literal>" statements in this file are named as "<literal>XK_</literal>" prepended to <emphasis role="strong">keysym</emphasis> names.</simpara>
      </section>
      <section id="_classic_x_clients">
        <title>Classic X clients</title>
        <simpara>Most traditional X client programs, such as <literal>xterm</literal>(1), can be started with a set of standard command line options to specify geometry, font, and display.</simpara>
        <simpara>They also use the X resource database to configure their appearance.  The system-wide defaults of X resources are stored in "<literal>/etc/X11/Xresources/*</literal>" and application defaults of them are stored in "<literal>/etc/X11/app-defaults/*</literal>".  Use these settings as the starting points.</simpara>
        <simpara>The file "<literal>~/.Xresources</literal>" is used to store user resource specifications.  This file is automatically merged into the default X resources upon login.  To make changes to these settings and make them effective immediately, merge them into the database using the command:</simpara>
        <screen>$ xrdb -merge ~/.Xresources</screen>
        <simpara>See <literal>x</literal>(7) and <literal>xrdb</literal>(1).</simpara>
      </section>
      <section id="_the_x_terminal_emulator_8212_xterm">
        <title>The X terminal emulator — xterm</title>
        <simpara>Learn everything about <literal>xterm</literal>(1) at <ulink url="&httpdickeyhiscomtermxtermfaqhtml;">http://dickey.his.com/xterm/xterm.faq.html</ulink>.</simpara>
      </section>
      <section id="_running_x_clients_as_root">
        <title>Running X clients as root</title>
        <warning>
          <simpara>Never start the X display/session manager under the root account by typing in <literal>root</literal> to the prompt of the display manager such as <literal>gdm</literal> because it is considered unsafe (insecure), even when you plan to perform administrative activities.  The entire X architecture is considered insecure if run as root.  You must always use the lowest privilege level possible, like a regular user account.</simpara>
        </warning>
        <simpara>The easiest way to run a particular X client, e.g. "<literal>foo</literal>" as root is to use <literal>sudo</literal>(8):</simpara>
        <screen>$ sudo foo &amp;</screen>
        <simpara>or</simpara>
        <screen>$ sudo -s
# foo &amp;</screen>
        <simpara>or</simpara>
        <screen>$ gksu foo &amp;</screen>
        <simpara>or</simpara>
        <screen>$ ssh -X root@localhost
# foo &amp;</screen>
        <caution>
          <simpara>Use of <literal>ssh</literal>(1) just for this purpose as above is waste of resource.</simpara>
        </caution>
        <simpara>Please note, in order for the X client to connect to the X server,</simpara>
        <itemizedlist>
          <listitem>
            <simpara>
values of the old user's "<literal>$XAUTHORITY</literal>" and "<literal>$DISPLAY</literal>" environment variables must be copied to the new user's ones, and
</simpara>
          </listitem>
          <listitem>
            <simpara>
the file pointed by value of the "<literal>$XAUTHORITY</literal>" environment variable must be readable by the new user.
</simpara>
          </listitem>
        </itemizedlist>
        <simpara>The <literal>gksu</literal> package (popcon: &pop-gksu;) is a specialized GTK+ GUI package for gaining the root privileges.  It can be configured to use <literal>su</literal>(1) or <literal>sudo</literal>(8) as its backend depending on the "<literal>/apps/gksu/sudo-mode</literal>" gconf key.  You can edit gconf key using <literal>gconf-editor</literal>(1) (menu: "Applications" → "System Tools" → "Configuration Editor").</simpara>
      </section>
    </section>
  </chapter>
  <chapter id="_i18n_and_l10n">
    <title>I18N and L10N</title>
    <simpara>Multilingualization (M17N) for an application software is done in 2 steps:</simpara>
    <itemizedlist>
      <listitem>
        <simpara>
Internationalization (I18N): To make a software potentially handle multiple locales.
</simpara>
      </listitem>
      <listitem>
        <simpara>
Localization (L10N): To make a software handle an specific locale.
</simpara>
      </listitem>
    </itemizedlist>
    <tip>
      <simpara>There are 17, 18, or 10 letters between "m" and "n", "i" and "n", or "l" and "n".</simpara>
    </tip>
    <simpara>The modern software such as GNOME and KDE are multilingualized.  They are internationalized by making them handle <ulink url="&utfi;">UTF-8</ulink> data and localized by providing their translated messages through the <literal>gettext</literal>(1) infrastructure.  Translated messages may be provided as separate localization packages.  They can be selected simply by setting pertinent environment variables to the appropriate locale.</simpara>
    <simpara>The simplest representation of the text data is <emphasis role="strong">ASCII</emphasis> which is sufficient for English and uses less than 127 characters (representable with 7 bits).  In order to support much more characters for the international support, many character encoding systems have been invented.  The modern and sensible encoding system is <emphasis role="strong">UTF-8</emphasis> which can handle practically all the characters known to the human (see <xref linkend="_basics_of_encoding"/>).</simpara>
    <simpara>See <ulink url="&introductiontoibin;">Introduction to i18n</ulink> for details.</simpara>
    <simpara>The international hardware support is enabled with localized hardware configuration data.</simpara>
    <section id="_the_keyboard_input">
      <title>The keyboard input</title>
      <simpara>The Debian system can be configured to work with many international keyboard arrangements:</simpara>
      <table id="listofkeyboardreigurationmethods" pgwide="0" frame="topbot" rowsep="1" colsep="1">
        <title>List of keyboard reconfiguration methods.</title>
        <tgroup cols="2">
          <colspec colwidth="30%*" align="left"/>
          <colspec colwidth="70%*" align="left"/>
          <thead>
            <row>
              <entry>
    environment
    </entry>
              <entry>
    command
    </entry>
            </row>
          </thead>
          <tbody>
            <row>
              <entry>
    Linux console
    </entry>
              <entry>
                <literal>dpkg-reconfigure --priority=low console-data</literal>
              </entry>
            </row>
            <row>
              <entry>
    X Window
    </entry>
              <entry>
                <literal>dpkg-reconfigure --priority=low xserver-xorg</literal>
              </entry>
            </row>
          </tbody>
        </tgroup>
      </table>
      <simpara>This will support keyboard input for accented characters of many European languages with its dead-key function. For Asian languages, you need more complicated input method support such as SCIM discussed next.</simpara>
      <section id="_the_input_method_support_with_scim">
        <title>The input method support with SCIM</title>
        <simpara>Setup of multilingual input for the Debian system is simplified by using the SCIM family of packages with the <literal>im-switch</literal> package. The list of SCIM packages are:</simpara>
        <table id="listofinputmethosupportswithscim" pgwide="0" frame="topbot" rowsep="1" colsep="1">
          <title>List of input method supports with scim.</title>
          <tgroup cols="4">
            <colspec colwidth="20%*" align="left"/>
            <colspec colwidth="20%*" align="left"/>
            <colspec colwidth="20%*" align="left"/>
            <colspec colwidth="40%*" align="left"/>
            <thead>
              <row>
                <entry>
    package
    </entry>
                <entry>
    popcon
    </entry>
                <entry>
    size
    </entry>
                <entry>
    suported locale
    </entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/scim-anthy">
    scim-anthy
    </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/scim-anthy">&pop-scimanthy;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/s/scim-anthy.html">&size-scimanthy;</ulink></entry>
                <entry>
    Japanese
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/scim-canna">
    scim-canna
    </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/scim-canna">&pop-scimcanna;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/s/scim-canna.html">&size-scimcanna;</ulink></entry>
                <entry>
    , ,
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/scim-skk">
    scim-skk
    </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/scim-skk">&pop-scimskk;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/s/scim-skk.html">&size-scimskk;</ulink></entry>
                <entry>
    , ,
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/scim-prime">
    scim-prime
    </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/scim-prime">&pop-scimprime;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/s/scim-prime.html">&size-scimprime;</ulink></entry>
                <entry>
    , ,
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/scim-tables-ja">
    scim-tables-ja
    </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/scim-tables-ja">&pop-scimtablesja;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/s/scim-tables-ja.html">&size-scimtablesja;</ulink></entry>
                <entry>
    , , (not very useful)
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/scim-tables-zh">
    scim-tables-zh
    </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/scim-tables-zh">&pop-scimtableszh;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/s/scim-tables-zh.html">&size-scimtableszh;</ulink></entry>
                <entry>
    Chinese (for zh_*)
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/scim-pinyin">
    scim-pinyin
    </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/scim-pinyin">&pop-scimpinyin;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/s/scim-pinyin.html">&size-scimpinyin;</ulink></entry>
                <entry>
    , , (for zh_CN)
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/scim-chewing">
    scim-chewing
    </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/scim-chewing">&pop-scimchewing;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/s/scim-chewing.html">&size-scimchewing;</ulink></entry>
                <entry>
    , , (for zh_TW)
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/scim-hangul">
    scim-hangul
    </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/scim-hangul">&pop-scimhangul;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/s/scim-hangul.html">&size-scimhangul;</ulink></entry>
                <entry>
    Korean
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/scim-tables-ko">
    scim-tables-ko
    </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/scim-tables-ko">&pop-scimtablesko;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/s/scim-tables-ko.html">&size-scimtablesko;</ulink></entry>
                <entry>
    , ,
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/scim-thai">
    scim-thai
    </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/scim-thai">&pop-scimthai;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/s/scim-thai.html">&size-scimthai;</ulink></entry>
                <entry>
    Thai
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/scim-m17n">
    scim-m17n
    </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/scim-m17n">&pop-scimmbhn;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/s/scim-m17n.html">&size-scimmbhn;</ulink></entry>
                <entry>
    Multilingual: Indic, Arabic and others
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/scim-tables-additional">
    scim-tables-additional
    </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/scim-tables-additional">&pop-scimtablesadditional;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/s/scim-tables-additional.html">&size-scimtablesadditional;</ulink></entry>
                <entry>
    , ,
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/scim-uim">
    scim-uim
    </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/scim-uim">&pop-scimuim;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/s/scim-uim.html">&size-scimuim;</ulink></entry>
                <entry>
    , ,
    </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
        <simpara>The kinput2 method and other locale dependent Asian classic input methods still exist but are not recommended for the modern UTF-8 X environment.  The uim tool chain is an alternative approach for the international input method for the modern UTF-8 X environment which is also capable for non-X environment.</simpara>
      </section>
      <section id="_an_example_for_japanese">
        <title>An example for Japanese</title>
        <simpara>I find the Japanese input method started under English environment ("<literal>en_US.UTF-8</literal>") very useful.  Here is how I did it with SCIM.</simpara>
        <itemizedlist>
          <listitem>
            <simpara>
Install the Japanese input tool package <literal>scim-anthy</literal> with its recommended packages such as <literal>im-switch</literal>.
</simpara>
          </listitem>
          <listitem>
            <simpara>
Execute "<literal>im-switch -c</literal>" from user's shell and select "scim".
</simpara>
          </listitem>
          <listitem>
            <simpara>
Relogin to user's account.
</simpara>
          </listitem>
          <listitem>
            <simpara>
Verify setting by "<literal>im-switch -l</literal>".
</simpara>
          </listitem>
          <listitem>
            <simpara>
Setup input method and mode by right clicking GUI toolbar. (You can reduce menu choice of input method)
</simpara>
          </listitem>
          <listitem>
            <simpara>
Start SCIM input method by CTRL-SPACE
</simpara>
          </listitem>
        </itemizedlist>
        <note>
          <simpara>In order to start SCIM under the non-CJK and non-en_US locale, you need to add list of those locales in UTF-8 to the "<literal>~/.scim/global</literal>" or "<literal>/etc/scim/global</literal>" file as:</simpara>
        </note>
        <screen>/SupportedUnicodeLocales = en_US.UTF-8,en_GB.UTF_8,fr_FR.UTF-8</screen>
        <simpara>Please note:</simpara>
        <itemizedlist>
          <listitem>
            <simpara><literal>im-switch</literal>(8) behaves differently if command is executed from root or not.
</simpara>
          </listitem>
          <listitem>
            <simpara>
Input method started by <literal>im-switch</literal> depends on the locale.
</simpara>
          </listitem>
          <listitem>
            <simpara>
Use of new immodule mechanism (by setting "<literal>$GTK_IM_MODULE</literal>") may cause instability during the library transition in <literal>unstable</literal>.
</simpara>
          </listitem>
        </itemizedlist>
        <simpara>For the detail of setup, see "<literal>/usr/share/doc/im-switch/README.Debian.gz</literal>", "<literal>/usr/share/doc/scim/README.Debian.gz</literal>" or "<literal>/usr/share/doc/uim/README.Debian.gz</literal>".  Here key points are described.</simpara>
      </section>
      <section id="_disabling_the_input_method">
        <title>Disabling the input method</title>
        <simpara>If you wish to input without going through XIM, set "<literal>$XMODIFIERS</literal>" value to "none" while starting a program. This may be the case if you use Japanese input infrastructure <literal>egg</literal> on <literal>emacs</literal>(1). From shell, execute as:</simpara>
        <screen>$ XMODIFIERS=none emacs</screen>
        <simpara>In order to adjust the command executed by the Debian menu, place customized configuration in "<literal>/etc/menu/</literal>" following method described in "<literal>/usr/share/doc/menu/html</literal>".</simpara>
      </section>
    </section>
    <section id="_the_display_output">
      <title>The display output</title>
      <simpara>Linux console can only display limited characters.  (You need to use special terminal program such as <literal>jfbterm</literal>(1) to display non-European languages on the non-X console.)</simpara>
      <simpara>X Window can display any characters in the UTF-8 as long as required font data exists. (The encoding of the original font data is taken care by the X Window system and transparent to the user.)</simpara>
    </section>
    <section id="_the_locale">
      <title>The locale</title>
      <simpara>The following will focus on the locale for applications run under X Window environment started from <literal>gdm</literal>(1).</simpara>
      <section id="_basics_of_encoding">
        <title>Basics of encoding</title>
        <simpara>The environment variable "<literal>LANG=xx_YY.ZZZZ</literal>" sets the locale to language code "<literal>xx</literal>", country code "<literal>yy</literal>", and encoding "<literal>ZZZZ</literal>" (see <xref linkend="_lang_variable"/>).</simpara>
        <simpara>Current Debian system normally sets the locale as "<literal>LANG=xx_YY.UTF-8</literal>".  This uses the <ulink url="&utfi;">UTF-8</ulink> encoding with the <ulink url="&unicode;">Unicode</ulink> character set. This <ulink url="&utfi;">UTF-8</ulink> encoding system is a multibyte code system and uses code points smartly. The <ulink url="&ascii;">ASCII</ulink> data, which consist only with 7-bit range codes, are always valid UTF-8 data consisting only with 1 byte per character.</simpara>
        <simpara>Previous Debian system used to set the locale as "<literal>LANG=C</literal>" or "<literal>LANG=xx_YY</literal>" (without "<literal>.UTF-8</literal>").</simpara>
        <itemizedlist>
          <listitem>
            <simpara>
The <ulink url="&ascii;">ASCII</ulink> character set is used for "<literal>LANG=C</literal>" or "<literal>LANG=POSIX</literal>".
</simpara>
          </listitem>
          <listitem>
            <simpara>
The traditional encoding system in Unix is used for "<literal>LANG=xx_YY</literal>".
</simpara>
          </listitem>
        </itemizedlist>
        <simpara>Actual traditional encoding system used for "<literal>LANG=xx_YY</literal>" can be identified by checking "<literal>/usr/share/i18n/SUPPORTED</literal>".  For example, "<literal>en_US</literal>" uses "<literal>ISO-8859-1</literal>" encoding and "<literal>fr_FR@euro</literal>" uses "<literal>ISO-8859-15</literal>" encoding.</simpara>
        <tip>
          <simpara>For meaning of encoding values, see <xref linkend="list-of-encoding-values"/>.</simpara>
        </tip>
      </section>
      <section id="_rationale_for_utf_8_locale">
        <title>Rationale for UTF-8 locale</title>
        <simpara>The <ulink url="&utfi;">UTF-8</ulink> encoding is the modern and sensible text encoding system for I18N and enables to represent <ulink url="&unicode;">Unicode</ulink> characters, i.e., practically all characters known to human. <emphasis role="strong">UTF</emphasis> stands for Unicode Transformation Format (UTF) schemes.</simpara>
        <simpara>I recommend to use <ulink url="&utfi;">UTF-8</ulink> locale for your desktop, e.g.,  "<literal>LANG=en_US.UTF-8</literal>".  The first part of the locale determines messages presented by applications.  For example, <literal>gedit</literal>(1) (text editor for the GNOME Desktop) under "<literal>LANG=fr_FR.UTF-8</literal>" locale can display and edit Chinese character text data while presenting menus in French, as long as required fonts and input methods are installed.</simpara>
        <simpara>I also recommend to set the locale only using the "<literal>$LANG</literal>" environment variable. I do not see much benefit of setting a complicated combination of "<literal>LC_*</literal>" variables (see <literal>locale</literal>(1)) under UTF-8 locale.</simpara>
        <simpara>Even plain English text may contain non-ASCII characters, e.g. left and right quotation marks are not available in ASCII:</simpara>
        <screen>“double quoted text”
‘single quoted text’</screen>
        <simpara>When <ulink url="&ascii;">ASCII</ulink> plain text data is converted to <ulink url="&utfi;">UTF-8</ulink> one, it has exactly the same content and size as the original ASCII one.  So you loose nothing by deploying UTF-8 locale.</simpara>
        <simpara>Some programs consume more memory after supporting I18N.  This is because they are coded to use <ulink url="&utfdcucse;">UTF-32(UCS4)</ulink> internally to support Unicode for speed optimization and consume 4 bytes per each ASCII character data independent of locale selected.  Again, you loose nothing by deploying UTF-8 locale.</simpara>
        <simpara>The vendor specific old non-UTF-8 encoding systems tend to have minor but annoying differences on some characters such as graphic ones for many countries.  The deployment of the UTF-8 system by the modern OSs practically solved these conflicting encoding issues.</simpara>
      </section>
      <section id="_the_reconfiguration_of_the_locale">
        <title>The reconfiguration of the locale</title>
        <simpara>In order for the system to access a particular locale, the locale data must be compiled from the locale database. (The Debian system does <emphasis role="strong">not</emphasis> come with all available locales pre-compiled unless you installed the <literal>locales-all</literal> package.) The full list of supported locales available for compiling are listed in "<literal>/usr/share/i18n/SUPPORTED</literal>". This lists all the proper locale names.  The following will list all the available UTF-8 locales already compiled to the binary form:</simpara>
        <screen>$ locale -a</screen>
        <simpara>The following command execution will reconfigure the <literal>locale</literal> package:</simpara>
        <itemizedlist>
          <listitem>
            <simpara>
to update the list of available locales,
</simpara>
          </listitem>
          <listitem>
            <simpara>
to compile them into the binary form, and
</simpara>
          </listitem>
          <listitem>
            <simpara>
to set the system wide default locale value in the "<literal>/etc/defaults/locale</literal>" for use by PAM (see <xref linkend="_pam_and_nss"/>).
</simpara>
          </listitem>
        </itemizedlist>
        <screen># dpkg-reconfigure locales</screen>
        <simpara>The list of available locale should include "<literal>en_US.UTF-8</literal>" and all the interesting languages with "<literal>UTF-8</literal>".</simpara>
        <simpara>The recommended default locale is "<literal>en_US.UTF-8</literal>" for US English.  For other languages, please make sure to chose locale with "<literal>UTF-8</literal>".  Any one of these settings can handle any international characters.</simpara>
        <note>
          <simpara>Although setting locale to "<literal>C</literal>" will use US English message, it handles only ASCII characters.</simpara>
        </note>
      </section>
      <section id="_configuring_system_with_lang">
        <title>Configuring system with "$LANG"</title>
        <simpara>The environment variable "<literal>$LANG</literal>" is:</simpara>
        <itemizedlist>
          <listitem>
            <simpara>
set initially by some display manager such as <literal>gdm</literal>(1) for all X programs,
</simpara>
          </listitem>
          <listitem>
            <simpara>
changed by the X session startup code via "<literal>~/.xsessionrc</literal>" for all X programs (<literal>lenny</literal> feature),
</simpara>
          </listitem>
          <listitem>
            <simpara>
set initially by the PAM mechanism of <literal>login</literal>(1) for the local Linux console programs,
</simpara>
          </listitem>
          <listitem>
            <simpara>
set initially by the PAM mechanism of <literal>ssh</literal>(1) for the remote console programs, or
</simpara>
          </listitem>
          <listitem>
            <simpara>
changed by the shell startup code, e.g. "<literal>~/.bashrc</literal>", for all console programs.
</simpara>
          </listitem>
        </itemizedlist>
        <tip>
          <simpara>It is good idea to install system wide default locale as "<literal>en_US.UTF-8</literal>" for maximum compatibility.</simpara>
        </tip>
      </section>
      <section id="_specific_locale_only_under_x_window">
        <title>Specific locale only under X Window</title>
        <simpara>You can chose specific locale only under X Window irrespective of your system wide default locale.  This should provide your best desktop experience with stability.</simpara>
        <simpara>This way, you can always access functioning character terminal with readable messages even when X Window system is not working.  This becomes essential for languages which use non-roman characters such as Chinese, Japanese, and Korean.</simpara>
        <simpara>For <literal>gdm</literal>(1), you can select different locale for the X session from its menu independent of the system default locale value in the "<literal>/etc/defaults/locale</literal>".</simpara>
        <simpara>You can set the locale of the X session manager and the value for the default locale permanently using PAM customization (see <xref linkend="_pam_and_nss"/>) as follows.  (There may be another way available as the improvement of X session manager package but please read following as the generic and basic method of setting the locale.)</simpara>
        <simpara>First, change the following line defining language environment variable in its PAM configuration file, such as "<literal>/etc/pam.d/gdm</literal>":</simpara>
        <screen>auth    required        pam_env.so read_env=1 envfile=/etc/default/locale</screen>
        <simpara>into</simpara>
        <screen>auth    required        pam_env.so read_env=1 envfile=/etc/default/locale-x</screen>
        <simpara>Then create a "<literal>/etc/defaults/locale-gdm</literal>" file with "<literal>-rw-r--r-- 1 root root</literal>" permission containing, eg. for Japanese message:</simpara>
        <screen>LANG="ja_JP.UTF-8"</screen>
        <simpara>and keep the default "<literal>/etc/defaults/locale</literal>" file for other programs being:</simpara>
        <screen>LANG="en_US.UTF-8"</screen>
        <simpara>This is the most generic technique to customize locale.</simpara>
        <simpara>Alternatively for this case, you may simply change locale using the "<literal>~/.xsessionrc</literal>" file.</simpara>
      </section>
      <section id="_filename_encoding">
        <title>Filename encoding</title>
        <simpara>For cross platform data exchanges (see <xref linkend="_removable_mass_storage_device"/>), you may need to mount some file system with particular encodings.  For example, <literal>mount</literal>(8) for <ulink url="&vfatfilesystem;">vfat filesystem</ulink> assumes <ulink url="&cpedh;">CP437</ulink> if used without option.  You need to provide
explicit mount option to use <ulink url="&utfi;">UTF-8</ulink> or <ulink url="&cpjdc;">CP932</ulink> for filenames.</simpara>
        <note>
          <simpara>When auto-mounting a hot-pluggable USB memory stick under modern desktop environment such as GNOME, you may provide such mount option by right clicking the icon on the desktop, click "Drive" tab, click to expand "Setting", and entering "utf8" to "Mount options:".  The next time this memory stick is mounted, mount with UTF-8 is enabled.</simpara>
        </note>
        <note>
          <simpara>If you are upgrading system or moving disk drives from older non-UTF-8 system, file names with non-ASCII characters may be encoded in the historic and deprecated encodings such as <ulink url="&isoiifjb;">ISO-8859-1</ulink> or <ulink url="&eucjp;">eucJP</ulink>.  Please seek help of text conversion tools to convert them to <ulink url="&utfi;">UTF-8</ulink>. See <xref linkend="_text_data_conversion_tools"/>.</simpara>
        </note>
        <simpara><ulink url="&samba;">Samba</ulink> uses Unicode for newer clients (Windows NT, 200x, XP) but uses <ulink url="&cpifa;">CP850</ulink> as default for older clients (DOS and Windows 9x/Me clients).  This default for older clients can be changed using "<literal>dos charset</literal>" in the "<literal>/etc/samba/smb.conf</literal>" file, e.g., to <ulink url="&cpjdc;">CP932</ulink> for Japanese.</simpara>
      </section>
      <section id="_localized_messages_and_translated_documentation">
        <title>Localized messages and translated documentation</title>
        <simpara>Translations exist for many of the text messages and documents that are displayed in the Debian system, such as error messages, standard program output, menus, and manual pages.  <ulink url="&gnugettextbcommandtoolchain;">GNU gettext(1) command tool chain</ulink> is used as the backend tool for most translation activities.</simpara>
        <simpara><literal>aptitude</literal>(8) lists under "Tasks" → "Localization" provide extensive list of useful binary packages which add localized messages to applications and provide translated documentation.</simpara>
        <simpara>For example, you can obtain the localized message for manpage by installing the <literal>manpages-&lt;LANG&gt;</literal> package. To read the Italian-language manpage for &lt;programname&gt;, execute</simpara>
        <screen>LANG=it_IT.UTF-8 man &lt;programname&gt;</screen>
        <simpara>to read it from "<literal>/usr/share/man/it/</literal>".</simpara>
      </section>
      <section id="_effects_of_the_locale">
        <title>Effects of the locale</title>
        <simpara>The sort order of characters with <literal>sort</literal>(1) is affected by the language choice of the locale. Spanish and English locale sort differently.</simpara>
        <simpara>The date format of <literal>ls</literal>(1) is affected by the locale.  The date format of "<literal>LANG=C ls -l</literal>" and "<literal>LANG=en_US.UTF-8</literal>" are different (see <xref linkend="_customized_display_of_time_and_date"/>).</simpara>
        <simpara>Number punctuation are different for locales.  For example, in English locale, one thousand one point one is displayed as "<literal>1,000.1</literal>" while in German locale, it is displayed as "<literal>1.000,1</literal>".  You see this difference in spreadsheet program.</simpara>
      </section>
    </section>
  </chapter>
  <chapter id="_system_tips">
    <title>System tips</title>
    <simpara>Here, I will describe basic tips to configure and manage systems, mostly from the console.</simpara>
    <section id="_the_screen_program">
      <title>The screen program</title>
      <simpara><literal>screen</literal>(1) is a very useful tool for people to access remote sites via unreliable or intermittent connections since it support interrupted network connections.</simpara>
      <table id="listofprogramstotworkconnections" pgwide="0" frame="topbot" rowsep="1" colsep="1">
        <title>List of programs to support interrupted network connections.</title>
        <tgroup cols="4">
          <colspec colwidth="20%*" align="left"/>
          <colspec colwidth="20%*" align="left"/>
          <colspec colwidth="20%*" align="left"/>
          <colspec colwidth="40%*" align="left"/>
          <thead>
            <row>
              <entry>
    package
    </entry>
              <entry>
    popcon
    </entry>
              <entry>
    size
    </entry>
              <entry>
    description
    </entry>
            </row>
          </thead>
          <tbody>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/screen">
                <literal>screen</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/screen">&pop-screen;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/s/screen.html">&size-screen;</ulink></entry>
              <entry>
    terminal multiplexer with VT100/ANSI terminal emulation
    </entry>
            </row>
          </tbody>
        </tgroup>
      </table>
      <section id="_the_use_scenario_for_screen_1">
        <title>The use scenario for screen(1)</title>
        <simpara><literal>screen</literal>(1) not only allows one terminal window to work with multiple processes, but also allows <emphasis role="strong">remote shell process to survive interrupted connections</emphasis>.  Here is a typical use scenario of <literal>screen</literal>(1).</simpara>
        <orderedlist>
          <listitem>
            <simpara>
You login to a remote machine.
</simpara>
          </listitem>
          <listitem>
            <simpara>
You start <literal>screen</literal> on a single console.
</simpara>
          </listitem>
          <listitem>
            <simpara>
You execute multiple programs in <literal>screen</literal> windows created with <literal>^A c</literal> ("Control-A" followed by "c").
</simpara>
          </listitem>
          <listitem>
            <simpara>
You switch among the multiple <literal>screen</literal> windows by <literal>^A n</literal> ("Control-A" followed by "n").
</simpara>
          </listitem>
          <listitem>
            <simpara>
Suddenly you need to leave your terminal, but you don't want to lose your active work by keeping the connection.
</simpara>
          </listitem>
          <listitem>
            <simpara>
You <emphasis role="strong">detach</emphasis> the <literal>screen</literal> session by any methods such as:
</simpara>
            <itemizedlist>
              <listitem>
                <simpara>
brutally unplugging your network connection,
</simpara>
              </listitem>
              <listitem>
                <simpara>
typing <literal>^A d</literal> ("Control-A" followed by "d") and manually logging out from the remote connection, or
</simpara>
              </listitem>
              <listitem>
                <simpara>
typing <literal>^A DD</literal> ("Control-A" followed by "DD") to have <literal>screen</literal> detach and log you out.
</simpara>
              </listitem>
            </itemizedlist>
          </listitem>
          <listitem>
            <simpara>
You log in again to the same remote machine (even from a different terminal).
</simpara>
          </listitem>
          <listitem>
            <simpara>
You start <literal>screen</literal> as "<literal>screen -r</literal>".
</simpara>
          </listitem>
          <listitem>
            <simpara><literal>screen</literal> will magically <emphasis role="strong">reattach</emphasis> all previous <literal>screen</literal> windows with all actively running programs.
</simpara>
          </listitem>
        </orderedlist>
        <tip>
          <simpara>You can save connection fees for metered network connections such as dial-up and packet ones, because you can leave a process active while disconnected, and then re-attach it later when you connect again.</simpara>
        </tip>
      </section>
      <section id="_key_bindings_for_the_screen_command">
        <title>Key bindings for the screen command</title>
        <simpara>In a <literal>screen</literal> session, all keyboard inputs are sent to your current window except for the command keystroke, by default <literal>^A</literal> ("Control-A").  All <literal>screen</literal> commands are entered by typing <literal>^A</literal> plus a single key [plus any parameters].  Here are important ones to remember:</simpara>
        <table id="listofkeybindingsforscreen" pgwide="0" frame="topbot" rowsep="1" colsep="1">
          <title>List of key bindings for screen.</title>
          <tgroup cols="2">
            <colspec colwidth="30%*" align="left"/>
            <colspec colwidth="70%*" align="left"/>
            <thead>
              <row>
                <entry>
    key binding
    </entry>
                <entry>
    meaning
    </entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry>
                  <literal>^A ?</literal>
                </entry>
                <entry>
    show a help screen (display key bindings)
    </entry>
              </row>
              <row>
                <entry>
                  <literal>^A c</literal>
                </entry>
                <entry>
    create a new window and switch to it
    </entry>
              </row>
              <row>
                <entry>
                  <literal>^A n</literal>
                </entry>
                <entry>
    go to next window
    </entry>
              </row>
              <row>
                <entry>
                  <literal>^A p</literal>
                </entry>
                <entry>
    go to previous window
    </entry>
              </row>
              <row>
                <entry>
                  <literal>^A 0</literal>
                </entry>
                <entry>
    go to window number 0
    </entry>
              </row>
              <row>
                <entry>
                  <literal>^A 1</literal>
                </entry>
                <entry>
    go to window number 1
    </entry>
              </row>
              <row>
                <entry>
                  <literal>^A w</literal>
                </entry>
                <entry>
    show a list of windows
    </entry>
              </row>
              <row>
                <entry>
                  <literal>^A a</literal>
                </entry>
                <entry>
    send a Ctrl-A to current window as keyboard input
    </entry>
              </row>
              <row>
                <entry>
                  <literal>^A h</literal>
                </entry>
                <entry>
    write a hardcopy of current window to file
    </entry>
              </row>
              <row>
                <entry>
                  <literal>^A H</literal>
                </entry>
                <entry>
    begin/end logging current window to file
    </entry>
              </row>
              <row>
                <entry>
                  <literal>^A ^X</literal>
                </entry>
                <entry>
    lock the terminal (password protected)
    </entry>
              </row>
              <row>
                <entry>
                  <literal>^A d</literal>
                </entry>
                <entry>
    detach screen session from the terminal
    </entry>
              </row>
              <row>
                <entry>
                  <literal>^A DD</literal>
                </entry>
                <entry>
    detach screen session and log out
    </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
        <simpara>See <literal>screen</literal>(1) for details.</simpara>
      </section>
    </section>
    <section id="_data_recording_and_presentation">
      <title>Data recording and presentation</title>
      <section id="_the_log_daemon">
        <title>The log daemon</title>
        <simpara>Many programs record their activities under the "<literal>/var/log/</literal>" directory.</simpara>
        <itemizedlist>
          <listitem>
            <simpara>
The kernel log daemon: <literal>klogd</literal>(8)
</simpara>
          </listitem>
          <listitem>
            <simpara>
The system log daemon: <literal>syslogd</literal>(8)
</simpara>
          </listitem>
        </itemizedlist>
        <simpara>See <xref linkend="_the_system_message"/> and <xref linkend="_the_kernel_message"/>.</simpara>
      </section>
      <section id="_log_analyzer">
        <title>Log analyzer</title>
        <simpara>Here are notable log analyzers ("<literal>~Gsecurity::log-analyzer</literal>" in <literal>aptitude</literal>(8)).</simpara>
        <table id="listofsystemloganalyzers" pgwide="0" frame="topbot" rowsep="1" colsep="1">
          <title>List of system log analyzers.</title>
          <tgroup cols="4">
            <colspec colwidth="20%*" align="left"/>
            <colspec colwidth="20%*" align="left"/>
            <colspec colwidth="20%*" align="left"/>
            <colspec colwidth="40%*" align="left"/>
            <thead>
              <row>
                <entry>
    package
    </entry>
                <entry>
    popcon
    </entry>
                <entry>
    size
    </entry>
                <entry>
    description
    </entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/logwatch">
                  <literal>logwatch</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/logwatch">&pop-logwatch;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/l/logwatch.html">&size-logwatch;</ulink></entry>
                <entry>
    log analyser with nice output written in Perl
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/fail2ban">
                  <literal>fail2ban</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/fail2ban">&pop-failcban;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/f/fail2ban.html">&size-failcban;</ulink></entry>
                <entry>
    bans IPs that cause multiple authentication errors
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/analog">
                  <literal>analog</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/analog">&pop-analog;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/a/analog.html">&size-analog;</ulink></entry>
                <entry>
    web server log analyzer
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/awstats">
                  <literal>awstats</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/awstats">&pop-awstats;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/a/awstats.html">&size-awstats;</ulink></entry>
                <entry>
    powerful and featureful web server log analyzer
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/sarg">
                  <literal>sarg</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/sarg">&pop-sarg;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/s/sarg.html">&size-sarg;</ulink></entry>
                <entry>
    squid analysis report generator
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/pflogsumm">
                  <literal>pflogsumm</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/pflogsumm">&pop-pflogsumm;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/p/pflogsumm.html">&size-pflogsumm;</ulink></entry>
                <entry>
    Postfix log entry summarizer
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/syslog-summary">
                  <literal>syslog-summary</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/syslog-summary">&pop-syslogsummary;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/s/syslog-summary.html">&size-syslogsummary;</ulink></entry>
                <entry>
    summarize the contents of a syslog log file
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/lire">
                  <literal>lire</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/lire">&pop-lire;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/l/lire.html">&size-lire;</ulink></entry>
                <entry>
    full-featured log analyzer and report generator
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/fwlogwatch">
                  <literal>fwlogwatch</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/fwlogwatch">&pop-fwlogwatch;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/f/fwlogwatch.html">&size-fwlogwatch;</ulink></entry>
                <entry>
    Firewall log analyzer
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/squidview">
                  <literal>squidview</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/squidview">&pop-squidview;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/s/squidview.html">&size-squidview;</ulink></entry>
                <entry>
    monitors and analyses squid access.log files
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/visitors">
                  <literal>visitors</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/visitors">&pop-visitors;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/v/visitors.html">&size-visitors;</ulink></entry>
                <entry>
    fast web server log analyzer
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/swatch">
                  <literal>swatch</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/swatch">&pop-swatch;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/s/swatch.html">&size-swatch;</ulink></entry>
                <entry>
    Log file viewer with regexp matching, highlighting, &amp; hooks
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/crm114">
                  <literal>crm114</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/crm114">&pop-crmbbe;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/c/crm114.html">&size-crmbbe;</ulink></entry>
                <entry>
    The Controllable Regex Mutilator and Spam Filter (CRM114)
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/icmpinfo">
                  <literal>icmpinfo</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/icmpinfo">&pop-icmpinfo;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/i/icmpinfo.html">&size-icmpinfo;</ulink></entry>
                <entry>
    Interpret ICMP messages
    </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
        <note>
          <simpara><ulink url="&crmbbe;">CRM114</ulink> provides language infrastructure to write <emphasis role="strong">fuzzy</emphasis> filters with the <ulink url="&treregexlibrary;">TRE regex library</ulink>.  Its popular use is spam mail filter but it can be used as log analyzer.</simpara>
        </note>
      </section>
      <section id="_recording_the_shell_activities_cleanly">
        <title>Recording the shell activities cleanly</title>
        <simpara>The simple use of <literal>script</literal>(1) (see <xref linkend="_recording_the_shell_activities"/>) to record shell activity produces a file with control characters.  This can be avoided by using <literal>col</literal>(1):</simpara>
        <screen>$ script
Script started, file is typescript</screen>
        <itemizedlist>
          <listitem>
            <simpara>
do whatever …
</simpara>
          </listitem>
          <listitem>
            <simpara>
Press <literal>Ctrl-D</literal> to exit <literal>script</literal>
</simpara>
          </listitem>
        </itemizedlist>
        <screen>$ col -bx &lt;typescript &gt;cleanedfile
$ vim cleanedfile</screen>
        <simpara>If you don't have <literal>script</literal> (for example, during the boot process in the initramfs), you can use following instead:</simpara>
        <screen>$ sh -i 2&gt;&amp;1 | tee typescript</screen>
        <tip>
          <simpara>Some <literal>x-terminal-emulator</literal> such as <literal>gnome-terminal</literal> can record.  You may wish to extend line buffer for scrollback.</simpara>
        </tip>
        <tip>
          <simpara>You may use <literal>screen</literal>(1) with "<literal>^A H</literal>" (see <xref linkend="_key_bindings_for_the_screen_command"/>) to perform recording of console.</simpara>
        </tip>
        <tip>
          <simpara>You may use <literal>emacs</literal>(1) with "<literal>M-x shell</literal>", "<literal>M-x eshell</literal>", or "<literal>M-x term</literal>" to perform recording of console.  You may later use "<literal>C-x C-w</literal>" to write the buffer to a file.</simpara>
        </tip>
      </section>
      <section id="_customized_display_of_text_data">
        <title>Customized display of text data</title>
        <simpara>Although pager tools such as <literal>more</literal>(1) and <literal>less</literal>(1) (see <xref linkend="_the_pager"/>) and custom tools for highlighting and formatting <xref linkend="_highlighting_and_formatting_plain_text_data"/> can display text data nicely, general purpose editors (see <xref linkend="_the_text_editor"/>) are most versatile and customizable.</simpara>
        <tip>
          <simpara>For <literal>vim</literal>(1) and its pager mode alias <literal>view</literal>(1), "<literal>:set hls</literal>" will enable highlighted search.</simpara>
        </tip>
      </section>
      <section id="_customized_display_of_time_and_date">
        <title>Customized display of time and date</title>
        <simpara>The default display format of time and date by the "<literal>ls -l</literal>" command depends on the <emphasis role="strong">locale</emphasis> (see value <xref linkend="_timestamps"/>).  The "<literal>$LANG</literal>" variable is referred first and it can be overridden by the "<literal>$LC_TIME</literal>" variable.</simpara>
        <simpara>The actual default display format for each locale depends on the version of  the standard C library (the <literal>libc6</literal> package) used.  I.e., different releases of Debian had different defaults.</simpara>
        <simpara>If you really wish to customize this display format of time and date beyond the <emphasis role="strong">locale</emphasis>, you should set the <emphasis role="strong">time style value</emphasis> by the "<literal>--time-style</literal>" argument or by the "<literal>$TIME_STYLE</literal>" value (see <literal>ls</literal>(1), <literal>date</literal>(1), "<literal>info coreutils 'ls invocation'</literal>").</simpara>
        <table id="displayexamplesolcommandforlenny" pgwide="0" frame="topbot" rowsep="1" colsep="1">
          <title>Display examples of time and date for the "<literal>ls -l</literal>" command for <literal>lenny</literal>.</title>
          <tgroup cols="3">
            <colspec colwidth="30%*" align="left"/>
            <colspec colwidth="30%*" align="left"/>
            <colspec colwidth="40%*" align="left"/>
            <thead>
              <row>
                <entry>
    time style value
    </entry>
                <entry>
    locale
    </entry>
                <entry>
    display of time and date
    </entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry>
                  <literal>iso</literal>
                </entry>
                <entry>
                  <emphasis>any</emphasis>
                </entry>
                <entry>
                  <literal>01-19 00:15</literal>
                </entry>
              </row>
              <row>
                <entry>
                  <literal>long-iso</literal>
                </entry>
                <entry>
                  <emphasis>any</emphasis>
                </entry>
                <entry>
                  <literal>2009-01-19 00:15</literal>
                </entry>
              </row>
              <row>
                <entry>
                  <literal>full-iso</literal>
                </entry>
                <entry>
                  <emphasis>any</emphasis>
                </entry>
                <entry>
                  <literal>2009-01-19 00:15:16.000000000 +0900</literal>
                </entry>
              </row>
              <row>
                <entry>
                  <literal>locale</literal>
                </entry>
                <entry>
                  <literal>C</literal>
                </entry>
                <entry>
                  <literal>Jan 19 00:15</literal>
                </entry>
              </row>
              <row>
                <entry>
                  <literal>locale</literal>
                </entry>
                <entry>
                  <literal>en_US.UTF-8</literal>
                </entry>
                <entry>
                  <literal>2009-01-19 00:15</literal>
                </entry>
              </row>
              <row>
                <entry>
                  <literal>locale</literal>
                </entry>
                <entry>
                  <literal>es_ES.UTF-8</literal>
                </entry>
                <entry>
                  <literal>ene 19 00:15</literal>
                </entry>
              </row>
              <row>
                <entry>
                  <literal>+%d.%m.%y %H:%M</literal>
                </entry>
                <entry>
                  <emphasis>any</emphasis>
                </entry>
                <entry>
                  <literal>19.01.09 00:15</literal>
                </entry>
              </row>
              <row>
                <entry>
                  <literal>+%d.%b.%y %H:%M</literal>
                </entry>
                <entry><literal>C</literal> or <literal>en_US.UTF-8</literal>
    </entry>
                <entry>
                  <literal>19.Jan.09 00:15</literal>
                </entry>
              </row>
              <row>
                <entry>
                  <literal>+%d.%b.%y %H:%M</literal>
                </entry>
                <entry>
                  <literal>es_ES.UTF-8</literal>
                </entry>
                <entry>
                  <literal>19.ene.09 00:15</literal>
                </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
        <tip>
          <simpara>You can eliminate typing long option on commandline using command alias, e.g. "<literal>alias ls='ls --time-style=+%d.%m.%y\ %H:%M'</literal>" (see <xref linkend="_command_alias"/>).</simpara>
        </tip>
        <tip>
          <simpara><ulink url="&isoigab;">ISO 8601</ulink> is followed for these iso-formats.</simpara>
        </tip>
      </section>
      <section id="_colorized_shell_echo">
        <title>Colorized shell echo</title>
        <simpara>Shell echo to most modern terminals can be colorized using <ulink url="&ansiescapecode;">ANSI escape code</ulink> (see "<literal>/usr/share/doc/xterm/ctlseqs.txt.gz</literal>").  E.g.:</simpara>
        <screen>$ RED=$(printf "\x1b[31m")
$ NORMAL=$(printf "\x1b[0m")
$ REVERSE=$(printf "\x1b[7m")
$ echo "${RED}RED-TEXT${NORMAL} ${REVERSE}REVERSE-TEXT${NORMAL}"</screen>
      </section>
      <section id="_colorized_commands">
        <title>Colorized commands</title>
        <simpara>Colorized commands are handy for inspecting their output in the interactive environment.  I include following in my "<literal>~/.bashrc</literal>".</simpara>
        <screen>if [ "$TERM" != "dumb" ]; then
    eval "`dircolors -b`"
    alias ls='ls --color=always'
    alias ll='ls --color=always -l'
    alias la='ls --color=always -A'
    alias less='less -R'
    alias ls='ls --color=always'
    alias grep='grep --color=always'
    alias egrep='egrep --color=always'
    alias fgrep='fgrep --color=always'
    alias zgrep='zgrep --color=always'
else
    alias ll='ls -l'
    alias la='ls -A'
fi</screen>
        <simpara>The use of alias limits color effects to the interactive command usage.  It has advantage over exporting environment variable "<literal>export GREP_OPTIONS='--color=auto'</literal>" since color can be seen under pager programs such as <literal>less</literal>(1).  If you wish to surpress color when piping to other programs, use "<literal>--color=auto</literal>" instead in the above example for "<literal>~/.bashrc</literal>".</simpara>
        <tip>
          <simpara>You can turn off these colorizing aliases in the interactive environment by invoking shell with "<literal>TERM=dumb bash</literal>".</simpara>
        </tip>
      </section>
      <section id="_recording_the_graphic_image_of_an_x_application">
        <title>Recording the graphic image of an X application</title>
        <simpara>There are few ways to record the graphic image of an X application, including an <literal>xterm</literal> display.</simpara>
        <table id="listofgraphicimaanipulationtools" pgwide="0" frame="topbot" rowsep="1" colsep="1">
          <title>List of graphic image manipulation tools.</title>
          <tgroup cols="4">
            <colspec colwidth="20%*" align="left"/>
            <colspec colwidth="20%*" align="left"/>
            <colspec colwidth="20%*" align="left"/>
            <colspec colwidth="40%*" align="left"/>
            <thead>
              <row>
                <entry>
    package
    </entry>
                <entry>
    popcon
    </entry>
                <entry>
    size
    </entry>
                <entry>
    command
    </entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/xbase-clients">
                  <literal>xbase-clients</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/xbase-clients">&pop-xbaseclients;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/x/xbase-clients.html">&size-xbaseclients;</ulink></entry>
                <entry><literal>xwd</literal>(1)
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/gimp">
                  <literal>gimp</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/gimp">&pop-gimp;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/g/gimp.html">&size-gimp;</ulink></entry>
                <entry>
    GUI menu
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/imagemagick">
                  <literal>imagemagick</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/imagemagick">&pop-imagemagick;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/i/imagemagick.html">&size-imagemagick;</ulink></entry>
                <entry><literal>import</literal>(1)
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/scrot">
                  <literal>scrot</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/scrot">&pop-scrot;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/s/scrot.html">&size-scrot;</ulink></entry>
                <entry><literal>scrot</literal>(1)
    </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
      </section>
      <section id="_recording_changes_in_configuration_files">
        <title>Recording changes in configuration files</title>
        <simpara>There are specialized tools to record changes in configuration files with help of DVCS system.</simpara>
        <table id="listofpackagestotionhistoryinvcs" pgwide="0" frame="topbot" rowsep="1" colsep="1">
          <title>List of packages to record configuration history in VCS.</title>
          <tgroup cols="4">
            <colspec colwidth="20%*" align="left"/>
            <colspec colwidth="20%*" align="left"/>
            <colspec colwidth="20%*" align="left"/>
            <colspec colwidth="40%*" align="left"/>
            <thead>
              <row>
                <entry>
    package
    </entry>
                <entry>
    popcon
    </entry>
                <entry>
    size
    </entry>
                <entry>
    description
    </entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/etckeeper">
                  <literal>etckeeper</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/etckeeper">&pop-etckeeper;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/e/etckeeper.html">&size-etckeeper;</ulink></entry>
                <entry>
    store configuration files and its metadata with <ulink url="&git;">Git</ulink> (default), <ulink url="&mercurial;">Mercurial</ulink>, or <ulink url="&bazaar;">Bazaar</ulink>. (new)
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/changetrack">
                  <literal>changetrack</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/changetrack">&pop-changetrack;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/c/changetrack.html">&size-changetrack;</ulink></entry>
                <entry>
    store configuration files with <ulink url="&rcs;">RCS</ulink>. (old)
    </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
        <simpara>I recommend to use the <literal>etckeeper</literal> package with <literal>git</literal>(1) which put entire "<literal>/etc</literal>" under VCS control.  Its installation guide and tutorial are found in "<literal>/usr/share/doc/etckeeper/README.gz</literal>".</simpara>
        <simpara>Essentially, running "<literal>sudo etckeeper init</literal>" initializes the git repository for "<literal>/etc</literal>" just like the process explained in <xref linkend="_git_for_recording_configuration_history"/>) but with special hook scripts for more thorough setups.</simpara>
        <simpara>As you change your configuration, you can use <literal>git</literal>(1) normally to record them.  It will automatically record changes nicely every time you run package management commands, too.</simpara>
        <tip>
          <simpara>You can browse the change history of "<literal>/etc</literal>" by executing "<literal>sudo GIT_DIR=/etc/.git gitk</literal>" with clear view for new installed packages, removed packages, and version changes of packages.</simpara>
        </tip>
      </section>
    </section>
    <section id="_data_storage_tips">
      <title>Data storage tips</title>
      <simpara>Booting your system with Linux <ulink url="&livecds;">live CDs</ulink> or <ulink url="&debianinstallercds;">debian-installer CDs</ulink> in rescue mode make it easy for you to reconfigure data storage on your boot device.  See also <xref linkend="_the_binary_data"/>.</simpara>
      <section id="_partition_configuration">
        <title>Partition configuration</title>
        <simpara>For partition configuration, although <literal>fdisk</literal>(8) has been considered standard, <literal>parted</literal>(8) deserves some attention.  "Disk partitioning data", "partition table", "partition map", and "disk label" are all synonyms.</simpara>
        <simpara>Most PCs use the classic <ulink url="&masterbootrecordmbr;">Master Boot Record (MBR)</ulink> scheme to hold <ulink url="&diskpartitioning;">disk partitioning</ulink> data in the first sector, i.e., <ulink url="&lba;">LBA</ulink> sector 0 (512 bytes).</simpara>
        <note>
          <simpara>Some new PCs with <ulink url="&extensiblefirmwareinterfaceefi;">Extensible Firmware Interface (EFI)</ulink>, including Intel-based Macs, use <ulink url="&guidpartitiontablegpt;">GUID Partition Table (GPT)</ulink> scheme to hold <ulink url="&diskpartitioning;">disk partitioning</ulink> data not in the first sector.</simpara>
        </note>
        <simpara>Although <literal>fdisk</literal>(8) has been standard for the disk partitioning tool, <literal>parted</literal>(8) is replacing it.</simpara>
        <table id="listofdiskpartitnagementpackages" pgwide="0" frame="topbot" rowsep="1" colsep="1">
          <title>List of disk partition management packages</title>
          <tgroup cols="5">
            <colspec colwidth="10%*" align="left"/>
            <colspec colwidth="10%*" align="left"/>
            <colspec colwidth="10%*" align="left"/>
            <colspec colwidth="10%*" align="left"/>
            <colspec colwidth="60%*" align="left"/>
            <thead>
              <row>
                <entry>
    package
    </entry>
                <entry>
    pocon
    </entry>
                <entry>
    size
    </entry>
                <entry>
                  <ulink url="&gpt;">GPT</ulink>
                </entry>
                <entry>
    description
    </entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/util-linux">
                  <literal>util-linux</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/util-linux">&pop-utillinux;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/u/util-linux.html">&size-utillinux;</ulink></entry>
                <entry>
    Not supported
    </entry>
                <entry>
    Miscellaneous system utilities including <literal>fdisk</literal>(8) and <literal>cfdisk</literal>(8)
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/parted">
                  <literal>parted</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/parted">&pop-parted;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/p/parted.html">&size-parted;</ulink></entry>
                <entry>
    Supported
    </entry>
                <entry>
    The GNU Parted disk partition resizing program
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/gparted">
                  <literal>gparted</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/gparted">&pop-gparted;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/g/gparted.html">&size-gparted;</ulink></entry>
                <entry>
    Supported
    </entry>
                <entry>
    GNOME partition editor based on <literal>libparted</literal>
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/qtparted">
                  <literal>qtparted</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/qtparted">&pop-qtparted;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/q/qtparted.html">&size-qtparted;</ulink></entry>
                <entry>
    Supported
    </entry>
                <entry>
    KDE partition editor based on <literal>libparted</literal>
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/gptsync">
                  <literal>gptsync</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/gptsync">&pop-gptsync;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/g/gptsync.html">&size-gptsync;</ulink></entry>
                <entry>
    Supported
    </entry>
                <entry>
    Synchronize classic MBR partition table with the GPT one
    </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
        <caution>
          <simpara>Although <literal>parted</literal>(8) claims to create and to resize filesystem too, it is safer to do such things using best maintained specialized tools such as <literal>mkfs</literal>(8) (<literal>mkfs.msdos</literal>(8), <literal>mkfs.ext2</literal>(8), <literal>mkfs.ext3</literal>(8), …) and <literal>resize2fs</literal>(8).</simpara>
        </caution>
        <note>
          <simpara>In order to switch between GPT and MBR, you need to erase first few blocks of disk contents directly (see <xref linkend="_clear_file_contents"/>) and use "<literal>parted /dev/sdx mklabel gpt</literal>" or "<literal>parted /dev/sdx mklabel msdos</literal>" to set it.  Please note "<literal>msdos</literal>" is use here for <ulink url="&mbr;">MBR</ulink>.</simpara>
        </note>
      </section>
      <section id="_accessing_partition_using_uuid">
        <title>Accessing partition using UUID</title>
        <simpara>Although reconfiguration of your partition may yield different names for partitions, you can access them consistently. This is also helpful if you have multiple disks and your BIOS doesn't give them consistent device names.</simpara>
        <itemizedlist>
          <listitem>
            <simpara><literal>mount</literal>(8) with "<literal>-U</literal>" options can mount a block device using <ulink url="&uuid;">UUID</ulink>, instead of using its file name such as "<literal>/dev/sda3</literal>".
</simpara>
          </listitem>
          <listitem>
            <simpara>
"<literal>/etc/fstab</literal>" (see <literal>fstab</literal>(5)) can use <ulink url="&uuid;">UUID</ulink>.
</simpara>
          </listitem>
          <listitem>
            <simpara>
Boot loaders (<xref linkend="_stage_2_the_boot_loader"/>) may use <ulink url="&uuid;">UUID</ulink> too.
</simpara>
          </listitem>
        </itemizedlist>
        <tip>
          <simpara>You can probe <ulink url="&uuid;">UUID</ulink> of a block special device with <literal>vol_id</literal>(8).</simpara>
        </tip>
      </section>
      <section id="_filesystem_configuration">
        <title>Filesystem configuration</title>
        <simpara>For <ulink url="&extd;">ext3</ulink> filesystem, the <literal>e2fsprogs</literal> package provides:</simpara>
        <itemizedlist>
          <listitem>
            <simpara><literal>mkfs.ext3</literal>(8) to create new <ulink url="&extd;">ext3</ulink> filesystem,
</simpara>
          </listitem>
          <listitem>
            <simpara><literal>fsck.ext3</literal>(8) to check and to repair existing <ulink url="&extd;">ext3</ulink> filesystem, and
</simpara>
          </listitem>
          <listitem>
            <simpara><literal>tune2fs</literal>(8) to configure superblock of <ulink url="&extd;">ext3</ulink> filesystem.
</simpara>
          </listitem>
        </itemizedlist>
        <simpara>The <literal>mkfs</literal>(8) and <literal>fsck</literal>(8) commans are provided by the <literal>e2fsprogs</literal> package as front-ends to various filesystem dependent programs (<literal>mkfs.fstype</literal> and <literal>fsck.fstype</literal>). For <ulink url="&extd;">ext3</ulink> filesystem, they are <literal>mkfs.ext3</literal>(8) and <literal>fsck.ext3</literal>(8) (they are hardlinked to <literal>mke2fs</literal>(8) and <literal>e2fsck</literal>(8)).</simpara>
        <simpara>Similar commands are available for each filesystem supported by Linux.</simpara>
        <table id="listoffilesystemnagementpackages" pgwide="0" frame="topbot" rowsep="1" colsep="1">
          <title>List of filesystem management packages</title>
          <tgroup cols="4">
            <colspec colwidth="20%*" align="left"/>
            <colspec colwidth="20%*" align="left"/>
            <colspec colwidth="20%*" align="left"/>
            <colspec colwidth="40%*" align="left"/>
            <thead>
              <row>
                <entry>
    package
    </entry>
                <entry>
    popcon
    </entry>
                <entry>
    size
    </entry>
                <entry>
    description
    </entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/e2fsprogs">
                  <literal>e2fsprogs</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/e2fsprogs">&pop-ecfsprogs;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/e/e2fsprogs.html">&size-ecfsprogs;</ulink></entry>
                <entry>
    Utilities for the <ulink url="&extc;">ext2</ulink>/<ulink url="&extd;">ext3</ulink>/<ulink url="&exte;">ext4</ulink> filesystems.
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/reiserfsprogs">
                  <literal>reiserfsprogs</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/reiserfsprogs">&pop-reiserfsprogs;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/r/reiserfsprogs.html">&size-reiserfsprogs;</ulink></entry>
                <entry>
    Utilities for the <ulink url="&reiserfs;">Reiserfs</ulink> filesystem.
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/dosfstools">
                  <literal>dosfstools</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/dosfstools">&pop-dosfstools;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/d/dosfstools.html">&size-dosfstools;</ulink></entry>
                <entry>
    Utilities for the <ulink url="&fat;">FAT</ulink> filesystem. (Microsoft: MS-DOS, Windows)
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/xfsprogs">
                  <literal>xfsprogs</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/xfsprogs">&pop-xfsprogs;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/x/xfsprogs.html">&size-xfsprogs;</ulink></entry>
                <entry>
    Utilities for the <ulink url="&xfs;">XFS</ulink> filesystem. (SGI: IRIX)
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/ntfsprogs">
                  <literal>ntfsprogs</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/ntfsprogs">&pop-ntfsprogs;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/n/ntfsprogs.html">&size-ntfsprogs;</ulink></entry>
                <entry>
    Utilities for the <ulink url="&ntfs;">NTFS</ulink> filesystem. (Microsoft: Windows NT, …)
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/jfsutils">
                  <literal>jfsutils</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/jfsutils">&pop-jfsutils;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/j/jfsutils.html">&size-jfsutils;</ulink></entry>
                <entry>
    Utilities for the <ulink url="&jfs;">JFS</ulink> filesystem. (IBM: AIX, OS/2)
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/reiser4progs">
                  <literal>reiser4progs</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/reiser4progs">&pop-reisereprogs;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/r/reiser4progs.html">&size-reisereprogs;</ulink></entry>
                <entry>
    Utilities for the <ulink url="&reisere;">Reiser4</ulink> filesystem.
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/hfsprogs">
                  <literal>hfsprogs</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/hfsprogs">&pop-hfsprogs;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/h/hfsprogs.html">&size-hfsprogs;</ulink></entry>
                <entry>
    Utilities for <ulink url="&hfs;">HFS</ulink> and <ulink url="&hfsplus;">HFS Plus</ulink> filesystem. (Apple: Mac OS)
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/btrfs-tools">
                  <literal>btrfs-tools</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/btrfs-tools">&pop-btrfstools;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/b/btrfs-tools.html">&size-btrfstools;</ulink></entry>
                <entry>
    Utilities for the <ulink url="&btrfs;">btrfs</ulink> filesystem.
    </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
        <tip>
          <simpara><ulink url="&extd;">Ext3</ulink> filesystem is the default filesystem for the Linux system and strongly recommended to use it unless you have some specific reasons not to.  After Linux kernel 2.6.28 (Debian <literal>squeeze</literal>), <ulink url="&exte;">ext4</ulink> filesystem will be available and expected to be the default filesystem for the Linux system.  <ulink url="&btrfs;">btrfs</ulink> filesystem is expected to be the next default filesystem after <ulink url="&exte;">ext4</ulink> filesystem for the Linux system.</simpara>
        </tip>
        <warning>
          <simpara>You might face some limtations with ext4 since it is new.  For example, you must have Linux kernel 2.6.30 or later if you wish to resizean ext4 partition.</simpara>
        </warning>
        <tip>
          <simpara>Some tools allow access to filesystem without Linux kernel support (see <xref linkend="_manipulating_files_without_mounting_disk"/>).</simpara>
        </tip>
      </section>
      <section id="_filesystem_creation_and_integrity_check">
        <title>Filesystem creation and integrity check</title>
        <simpara>The <literal>mkfs</literal>(8) command creates the filesystem on a Linux system. The <literal>fsck</literal>(8) command provides the filesystem integrity check and repair on a Linux system.</simpara>
        <caution>
          <simpara>It is generally not safe to run <literal>fsck</literal> on <emphasis role="strong">mounted filesystems</emphasis>.</simpara>
        </caution>
        <tip>
          <simpara>Check files in "<literal>/var/log/fsck/</literal>" for the result of the <literal>fsck</literal>(8) command run from the boot script.</simpara>
        </tip>
        <tip>
          <simpara>Use "<literal>shutdown -F -r now</literal>" to force to run the <literal>fsck</literal>(8) command safely on all filesystems including root file system on reboot. See the <literal>shutdown</literal>(8) manpage for more.</simpara>
        </tip>
      </section>
      <section id="_optimization_of_filesystem_by_mount_options">
        <title>Optimization of filesystem by mount options</title>
        <simpara>Performance and characteristics of a filesystem can be optimized by mount options used on it (see <literal>fstab</literal>(5) and <literal>mount</literal>(8)).  For example:</simpara>
        <itemizedlist>
          <listitem>
            <simpara>
"<literal>defaults</literal>" option implies default options: "<literal>rw,suid,dev,exec,auto,nouser,async</literal>". (general)
</simpara>
          </listitem>
          <listitem>
            <simpara>
"<literal>noatime</literal>" or "<literal>relatime</literal>" option is very effective for speeding up the read access. (general)
</simpara>
          </listitem>
          <listitem>
            <simpara>
"<literal>user</literal>" option allows an ordinary user to mount the file system. This option implies "<literal>noexec,nosuid,nodev</literal>" option combination. (general, used for CD and floppy)
</simpara>
          </listitem>
          <listitem>
            <simpara>
"<literal>noexec,nodev,nosuid</literal>" option combination is used to enhance security. (general)
</simpara>
          </listitem>
          <listitem>
            <simpara>
"<literal>noauto</literal>" option limits mounting by explicit operation only. (general)
</simpara>
          </listitem>
          <listitem>
            <simpara>
"<literal>data=journal</literal>" option for ext3fs can enhance data integrity against power failure with some loss of write speed.
</simpara>
          </listitem>
        </itemizedlist>
        <tip>
          <simpara>You need to provide kernel boot parameter "<literal>rootflags=data=journal</literal>" to deploy "<literal>data=journal</literal>" option for the root file system formatted with ext3fs.</simpara>
        </tip>
      </section>
      <section id="_optimization_of_filesystem_via_superblock">
        <title>Optimization of filesystem via superblock</title>
        <simpara>Characteristics of a filesystem can be optimized via its superblock using the <literal>tune2fs</literal>(8) command.  For example on "<literal>/dev/hda1</literal>":</simpara>
        <itemizedlist>
          <listitem>
            <simpara>
Execution of "<literal>sudo tune2fs -l /dev/hda1</literal>" will display the contents of its filesystem superblock.
</simpara>
          </listitem>
          <listitem>
            <simpara>
Execution of "<literal>sudo tune2fs -c 50 /dev/hda1</literal>" will change frequency of filesystem checks (<literal>fsck</literal> execution during boot-up) to every 50 boots.
</simpara>
          </listitem>
          <listitem>
            <simpara>
Execution of "<literal>sudo tune2fs -j /dev/hda1</literal>" will add journaling capability to the filesystem, i.e. filesystem conversion from <ulink url="&extc;">ext2</ulink> to <ulink url="&extd;">ext3</ulink>.  (Do this on the unmounted filesystem.)
</simpara>
          </listitem>
          <listitem>
            <simpara>
Execution of "<literal>sudo tune2fs -O extents,uninit_bg,dir_index /dev/hda1 &amp;&amp; fsck -pf /dev/hda1</literal>" will convert it from <ulink url="&extd;">ext3</ulink> to <ulink url="&exte;">ext4</ulink>.  (Do this on the unmounted filesystem.)
</simpara>
          </listitem>
        </itemizedlist>
        <warning>
          <simpara>Filesystem conversion for the boot device to the <ulink url="&exte;">ext4</ulink> filesystem should be avoided until <ulink url="&grubbootloadersutefilesystemwell;">GRUB boot loader supports the ext4 filesystem well</ulink> and installed Linux Kernel version is newer than 2.6.28.</simpara>
        </warning>
        <tip>
          <simpara>Despite its name, <literal>tune2fs</literal>(8) works not only on the <ulink url="&extc;">ext2</ulink> filesystem but also on the <ulink url="&extd;">ext3</ulink> and <ulink url="&exte;">ext4</ulink> filesystems.</simpara>
        </tip>
      </section>
      <section id="_optimization_of_harddisk">
        <title>Optimization of harddisk</title>
        <warning>
          <simpara>Please check your hardware and read manpage of <literal>hdparam</literal>(8) before playing with harddisk configuration because this may be quite dangerous for the data integrity.</simpara>
        </warning>
        <simpara>You can test disk access speed of a harddisk, e.g. "<literal>/dev/hda</literal>", by "<literal>hdparm -tT /dev/hda</literal>". For some harddisk connected with (E)IDE, you can speed it up with "<literal>hdparm -q -c3 -d1 -u1 -m16 /dev/hda</literal>" by enabling the "(E)IDE 32-bit I/O support", enabling the "using_dma flag", setting "interrupt-unmask flag", and setting the "multiple 16 sector I/O" (dangerous!).</simpara>
        <simpara>You can test write cache feature of a harddisk, e.g. "<literal>/dev/sda</literal>", by "<literal>hdparm -W /dev/sda</literal>". You can disable its write cache feature with "<literal>hdparm -W 0 /dev/sda</literal>".</simpara>
        <simpara>You may be able to read badly pressed CDROMs on modern high head CD-ROM drive by slowing it down with "<literal>setcd -x 2</literal>.</simpara>
      </section>
      <section id="_using_smart_to_predict_harddisk_failure">
        <title>Using SMART to predict harddisk failure</title>
        <simpara>You can monitor and log your harddisk which is compliant to <ulink url="&smart;">SMART</ulink> with the <literal>smartd</literal>(8) daemon.</simpara>
        <orderedlist>
          <listitem>
            <simpara>
Enable <ulink url="&smart;">SMART</ulink> feature in <ulink url="&bios;">BIOS</ulink>.
</simpara>
          </listitem>
          <listitem>
            <simpara>
Install the <literal>smartmontools</literal> package.
</simpara>
          </listitem>
          <listitem>
            <simpara>
Identify your harddisk drives by listing them with <literal>df</literal>(1).
</simpara>
            <itemizedlist>
              <listitem>
                <simpara>
Let's assume a harddisk drive to be monitored as "<literal>/dev/hda</literal>".
</simpara>
              </listitem>
            </itemizedlist>
          </listitem>
          <listitem>
            <simpara>
Check the output of "<literal>smartctl -a /dev/hda</literal>" to see if <ulink url="&smart;">SMART</ulink> feature is actually enabled.
</simpara>
            <itemizedlist>
              <listitem>
                <simpara>
If not, enable it by "<literal>smartctl -s on -a /dev/hda</literal>".
</simpara>
              </listitem>
            </itemizedlist>
          </listitem>
          <listitem>
            <simpara>
Enable <literal>smartd</literal>(8) daemon to run by:
</simpara>
            <itemizedlist>
              <listitem>
                <simpara>
uncomment "<literal>start_smartd=yes</literal>" in the "<literal>/etc/default/smartmontools</literal>" file.
</simpara>
              </listitem>
              <listitem>
                <simpara>
restart the <literal>smartd</literal>(8) daemon by "<literal>sudo /etc/init.d/smartmontools restart</literal>".
</simpara>
              </listitem>
            </itemizedlist>
          </listitem>
        </orderedlist>
        <tip>
          <simpara>The <literal>smartd</literal>(8) daemon can be customized with the <literal>/etc/smartd.conf</literal> file including how to be notified of warnings.</simpara>
        </tip>
      </section>
      <section id="_expand_usable_storage_space_via_lvm">
        <title>Expand usable storage space via LVM</title>
        <simpara>For partitions created on <ulink url="&logicalvolumemanagerlinux;">Logical Volume Manager (Linux)</ulink> at install time, they can be resized easily by concatenating extents onto them or truncating extents from them over multiple storage devices without major system reconfiguration.</simpara>
        <caution>
          <simpara>Deployment of the current LVM system may degrade guarantee against filesystem corruption offered by journaled file systems such as ext3fs unless their system performance is sacrificed by disabling write cache of harddisk.</simpara>
        </caution>
      </section>
      <section id="_expand_usable_storage_space_by_mounting_another_partition">
        <title>Expand usable storage space by mounting another partition</title>
        <simpara>If you have an empty partition (e.g., "<literal>/dev/sdx</literal>"), you can format it with <literal>mkfs.ext3</literal>(1) and <literal>mount</literal>(8) it to a directory where you need more space. (You need to copy original data contents.)</simpara>
        <screen>$ sudo mv work-dir old-dir
$ sudo mkfs.ext3 /dev/sdx
$ sudo mount -t ext3 /dev/sdx work-dir
$ sudo cp -a old-dir/* work-dir
$ sudo rm -rf old-dir</screen>
      </section>
      <section id="_expand_usable_storage_space_using_symlink">
        <title>Expand usable storage space using symlink</title>
        <simpara>If you have an empty directory (e.g., "<literal>/path/to/emp-dir</literal>") in another partition with usable space, you can create a symlink to the directory with <literal>ln</literal>(8).</simpara>
        <screen>$ sudo mv work-dir old-dir
$ sudo mkdir -p /path/to/emp-dir
$ sudo ln -sf /path/to/emp-dir work-dir
$ sudo cp -a old-dir/* work-dir
$ sudo rm -rf old-dir</screen>
        <caution>
          <simpara>Some software may not function well with "symlink to a directory".</simpara>
        </caution>
      </section>
      <section id="_expand_usable_storage_space_using_aufs">
        <title>Expand usable storage space using aufs</title>
        <simpara>If you have usable space in another partition (e.g., "<literal>/path/to/</literal>"), you can create a directory in it and stack that on to a directory where you need space with <ulink url="&aufs;">aufs</ulink>.</simpara>
        <screen>$ sudo mv work-dir old-dir
$ sudo mkdir -p /path/to/emp-dir
$ sudo mount -t aufs -o br:/path/to/emp-dir:old-dir none work-dir</screen>
        <caution>
          <simpara>Use of <ulink url="&aufs;">aufs</ulink> for long term data storage is not good idea since it is under development and its design change may introduce issues.</simpara>
        </caution>
        <tip>
          <simpara>In order to use <ulink url="&aufs;">aufs</ulink>, its utility package <literal>aufs-tools</literal> and kernel module package for <ulink url="&aufs;">aufs</ulink> such as <literal>aufs-modules-2.6-amd64</literal> need to be installed.</simpara>
        </tip>
        <tip>
          <simpara><ulink url="&aufs;">aufs</ulink> is used to provide writable root filesystem by many modern <ulink url="&livecd;">live CD</ulink> projects.</simpara>
        </tip>
      </section>
    </section>
    <section id="_data_encryption_tips">
      <title>Data encryption tips</title>
      <simpara>With physical access to your PC, anyone can easily gain root privilege and access all the files on your PC (see <xref linkend="_securing_the_root_password"/>).  This means that login password system can not secure your private and sensitive data against possible theft of your PC.  You must deploy data encryption technology to do it.  Although <ulink url="&gnuprivacyguard;">GNU privacy guard</ulink> (see <xref linkend="_data_security_infrastructure"/>) can encrypt files, it takes some user efforts.</simpara>
      <simpara><ulink url="&dmcrypt;">dm-crypt</ulink> and <ulink url="&ecryptfs;">eCryptfs</ulink> facilitates automatic data encryption natively via Linux kernel modules with minimal user efforts.</simpara>
      <table id="listofdataencryptionutilities" pgwide="0" frame="topbot" rowsep="1" colsep="1">
        <title>List of data encryption utilities.</title>
        <tgroup cols="4">
          <colspec colwidth="20%*" align="left"/>
          <colspec colwidth="20%*" align="left"/>
          <colspec colwidth="20%*" align="left"/>
          <colspec colwidth="40%*" align="left"/>
          <thead>
            <row>
              <entry>
    package
    </entry>
              <entry>
    popcon
    </entry>
              <entry>
    size
    </entry>
              <entry>
    function
    </entry>
            </row>
          </thead>
          <tbody>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/cryptsetup">
                <literal>cryptsetup</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/cryptsetup">&pop-cryptsetup;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/c/cryptsetup.html">&size-cryptsetup;</ulink></entry>
              <entry>
    Utilities for encrypted block device (<ulink url="&dmcrypt;">dm-crypt</ulink> / <ulink url="&luks;">LUKS</ulink>)
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/cryptmount">
                <literal>cryptmount</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/cryptmount">&pop-cryptmount;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/c/cryptmount.html">&size-cryptmount;</ulink></entry>
              <entry>
    Utilities forencrypted block device (<ulink url="&dmcrypt;">dm-crypt</ulink> / <ulink url="&luks;">LUKS</ulink>) with focus on mount/unmount by normal users
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/ecryptfs-utils">
                <literal>ecryptfs-utils</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/ecryptfs-utils">&pop-ecryptfsutils;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/e/ecryptfs-utils.html">&size-ecryptfsutils;</ulink></entry>
              <entry>
    Utilities for encrypted stacked filesystem (<ulink url="&ecryptfs;">eCryptfs</ulink>)
    </entry>
            </row>
          </tbody>
        </tgroup>
      </table>
      <simpara><ulink url="&dmcrypt;">Dm-crypt</ulink> is a cryptographic filesystem using <ulink url="&devicemapper;">device-mapper</ulink>. <ulink url="&devicemapper;">Device-mapper</ulink> maps one block device to another.</simpara>
      <simpara><ulink url="&ecryptfs;">eCryptfs</ulink> is another cryptographic filesystem using stacked filesystem.  Stacked filesystem stacks itself on top of an existing directory of a mounted filesystem.</simpara>
      <caution>
        <simpara>Data encryption costs CPU time etc.  Please weigh its benefits and costs.</simpara>
      </caution>
      <note>
        <simpara>Entire Debian system can be installed on a encrypted disk by the <ulink url="&debianinstaller;">debian installer</ulink> (lenny or newer) using <ulink url="&dmcrypt;">dm-crypt</ulink>/<ulink url="&luks;">LUKS</ulink> and initramfs.</simpara>
      </note>
      <tip>
        <simpara>See <xref linkend="_data_security_infrastructure"/> for user space encryption utility: <ulink url="&gnuprivacyguard;">GNU Privacy Guard</ulink>.</simpara>
      </tip>
      <section id="_removable_disk_encryption_with_dm_crypt_luks">
        <title>Removable disk encryption with dm-crypt/LUKS</title>
        <simpara>You can encrypt contents of removable mass storage devices, e.g. USB memory stick on "<literal>/dev/sdx</literal>", using <ulink url="&dmcrypt;">dm-crypt</ulink>/<ulink url="&luks;">LUKS</ulink>.  You simply formatting it as:</simpara>
        <screen># badblocks -c 10240 -s -w -t random -v /dev/sdx
# shred -v -n 1 /dev/sdx
# fdisk /dev/sdx
... "n" "p" "1" "return" "return" "w"
# cryptsetup luksFormat /dev/sdx1
...
# cryptsetup luksOpen /dev/sdx1 sdx1
...
# ls -l /dev/mapper/
total 0
crw-rw---- 1 root root  10, 60 2008-10-04 18:44 control
brw-rw---- 1 root disk 254,  0 2008-10-04 23:55 sdx1
# mkfs.vfat /dev/mapper/sdx1
...
# cryptsetup luksClose sdx1</screen>
        <simpara>Then, it can be mounted just like normal one on to "<literal>/media/&lt;disk_label&gt;</literal>", except for asking password (see <xref linkend="_removable_mass_storage_device"/>) under modern desktop environment, such as GNOME using <literal>gnome-mount</literal>(1).  The difference is that every data written to it is encrypted.  You may alternatively format media in different file format, e.g., ext3 with "<literal>mkfs.ext3 /dev/sdx1</literal>".</simpara>
        <note>
          <simpara>If you are really paranoid for the security of data, you may need to overwrite multiple times in the above example.  This operation is very time consuming though.</simpara>
        </note>
      </section>
      <section id="_encrypted_swap_partition_with_dm_crypt">
        <title>Encrypted swap partition with dm-crypt</title>
        <simpara>If your original "<literal>/etc/fstab</literal>" contains:</simpara>
        <screen>/dev/sda7 swap sw 0 0</screen>
        <simpara>then you can enable encrypted swap partition using <ulink url="&dmcrypt;">dm-crypt</ulink> by as</simpara>
        <screen># aptitude install cryptsetup
# swapoff -a
# echo "cswap /dev/sda7 /dev/urandom swap" &gt;&gt; /etc/crypttab
# perl -i -p -e "s/\/dev\/sda7/\/dev\/mapper\/cswap/" /etc/fstab
# /etc/init.d/cryptdisks restart
 ...
# swapon -a</screen>
      </section>
      <section id="_automatically_encrypting_files_with_ecryptfs">
        <title>Automatically encrypting files with eCryptfs</title>
        <simpara>You can encrypt files written under "<literal>~/Private/</literal>" automatically using <ulink url="&ecryptfs;">eCryptfs</ulink> and the <literal>ecryptfs-utils</literal> package.</simpara>
        <itemizedlist>
          <listitem>
            <simpara>
run <literal>ecryptfs-setup-private</literal>(1) and set up "<literal>~/Private/</literal>" by following prompts.
</simpara>
          </listitem>
          <listitem>
            <simpara>
activate "<literal>~/Private/</literal>" by running <literal>ecryptfs-mount-private</literal>(1).
</simpara>
          </listitem>
          <listitem>
            <simpara>
move sensitive data files to "<literal>~/Private/</literal>" and make symlinks as needed.
</simpara>
            <itemizedlist>
              <listitem>
                <simpara>
candidates: "<literal>~/.fetchmailrc</literal>", "<literal>~/.ssh/identity</literal>", "<literal>~/.ssh/id_rsa</literal>", "<literal>~/.ssh/id_dsa</literal>" and other files with "<literal>go-rwx</literal>".
</simpara>
              </listitem>
            </itemizedlist>
          </listitem>
          <listitem>
            <simpara>
move sensitive data directories to a subdirectory in "<literal>~/Private/</literal>" and make symlinks as needed.
</simpara>
            <itemizedlist>
              <listitem>
                <simpara>
candidates: "<literal>~/.gnupg</literal>" and other directories with "<literal>go-rwx</literal>".
</simpara>
              </listitem>
            </itemizedlist>
          </listitem>
          <listitem>
            <simpara>
create symlink from "<literal>~/Desktop/Private/</literal>" to "<literal>~/Private/</literal>" for easier desktop operations.
</simpara>
          </listitem>
          <listitem>
            <simpara>
deactivate "<literal>~/Private/</literal>" by running <literal>ecryptfs-umount-private</literal>(1).
</simpara>
          </listitem>
          <listitem>
            <simpara>
activate "<literal>~/Private/</literal>" by issuing "<literal>ecryptfs-mount-private</literal>" as you need encrypted data.
</simpara>
          </listitem>
        </itemizedlist>
        <tip>
          <simpara>Since <ulink url="&ecryptfs;">eCryptfs</ulink> selectively encrypt only the sensitive files, its system cost is much less than using <ulink url="&dmcrypt;">dm-crypt</ulink> on the entire root or home device.  It does not require any special on-disk storage allocation effort but cannot keep all filesystem metadata confidential.</simpara>
        </tip>
      </section>
      <section id="_automatically_mounting_ecryptfs">
        <title>Automatically mounting eCryptfs</title>
        <simpara>If you use your login password for wrapping encryption keys, you can automate mounting eCryptfs via
Pluggable Authentication Module by having a following line just before "<literal>pam_permit.so</literal>" in "<literal>/etc/pam.d/common-auth</literal>" as:</simpara>
        <screen>auth required pam_ecryptfs.so unwrap</screen>
        <simpara>and the last line in "<literal>/etc/pam.d/common-session</literal>" as:</simpara>
        <screen>session optional pam_ecryptfs.so unwrap</screen>
        <simpara>and the first active line in "<literal>/etc/pam.d/common-password</literal>" as:</simpara>
        <screen>password required pam_ecryptfs.so</screen>
        <simpara>This is quite convienient.</simpara>
        <warning>
          <simpara>Configuration errors of PAM may lock you out of your own system. See <xref linkend="_authentication"/>.</simpara>
        </warning>
        <caution>
          <simpara>If you use your login password for wrapping encryption keys, your encrypted data are as secure as your user login password (see <xref linkend="_good_password"/>).  Unless you are careful to set up a <ulink url="&strongpassword;">strong password</ulink>, your data will be at risk when someone runs <ulink url="&passwordcracking;">password cracking</ulink> software after stealing your laptop (see <xref linkend="_securing_the_root_password"/>).</simpara>
        </caution>
      </section>
    </section>
    <section id="_monitoring_controlling_and_starting_program_activities">
      <title>Monitoring, controlling, and starting program activities</title>
      <simpara>Program activities can be monitored and controlled using specialized tools.</simpara>
      <table id="listoftoolsformorogramactivities" pgwide="0" frame="topbot" rowsep="1" colsep="1">
        <title>List of tools for monitoring and controlling program activities</title>
        <tgroup cols="4">
          <colspec colwidth="20%*" align="left"/>
          <colspec colwidth="20%*" align="left"/>
          <colspec colwidth="20%*" align="left"/>
          <colspec colwidth="40%*" align="left"/>
          <thead>
            <row>
              <entry>
    package
    </entry>
              <entry>
    popcon
    </entry>
              <entry>
    size
    </entry>
              <entry>
    description
    </entry>
            </row>
          </thead>
          <tbody>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/time">
                <literal>time</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/time">&pop-time;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/t/time.html">&size-time;</ulink></entry>
              <entry><literal>time</literal>(1) runs a program to report system resource usages with respect to time.
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/coreutils">
                <literal>coreutils</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/coreutils">&pop-coreutils;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/c/coreutils.html">&size-coreutils;</ulink></entry>
              <entry><literal>nice</literal>(1) runs a program with modified scheduling priority.
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/bsdutils">
                <literal>bsdutils</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/bsdutils">&pop-bsdutils;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/b/bsdutils.html">&size-bsdutils;</ulink></entry>
              <entry><literal>renice</literal>(1) modifies the scheduling priority of a running process.
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/powertop">
                <literal>powertop</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/powertop">&pop-powertop;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/p/powertop.html">&size-powertop;</ulink></entry>
              <entry><literal>powertop</literal>(1) gives information about system power use on Intel-based laptops.
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/procps">
                <literal>procps</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/procps">&pop-procps;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/p/procps.html">&size-procps;</ulink></entry>
              <entry>
    The "<literal>/proc</literal>" file system utilities: <literal>ps</literal>(1), <literal>top</literal>(1), <literal>kill</literal>(1), <literal>watch</literal>(1), …
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/psmisc">
                <literal>psmisc</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/psmisc">&pop-psmisc;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/p/psmisc.html">&size-psmisc;</ulink></entry>
              <entry>
    The "<literal>/proc</literal>" file system utilities: <literal>killall</literal>(1), <literal>fuser</literal>(1), <literal>pstree</literal>(1)
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/cron">
                <literal>cron</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/cron">&pop-cron;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/c/cron.html">&size-cron;</ulink></entry>
              <entry>
    The <literal>cron</literal>(8) daemon runs processes according to a schedule (in background).
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/at">
                <literal>at</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/at">&pop-at;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/a/at.html">&size-at;</ulink></entry>
              <entry><literal>at</literal>(1) or <literal>batch</literal>(1) commands run a job at a specified time or below certain load level.
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/lsof">
                <literal>lsof</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/lsof">&pop-lsof;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/l/lsof.html">&size-lsof;</ulink></entry>
              <entry><literal>lsof</literal>(8) lists open files by a running process using "<literal>-p</literal>" option.
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/strace">
                <literal>strace</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/strace">&pop-strace;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/s/strace.html">&size-strace;</ulink></entry>
              <entry><literal>strace</literal>(1) traces system calls and signals.
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/ltrace">
                <literal>ltrace</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/ltrace">&pop-ltrace;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/l/ltrace.html">&size-ltrace;</ulink></entry>
              <entry><literal>ltrace</literal>(1) traces library calls.
    </entry>
            </row>
            <row>
              <entry><ulink url="http://packages.debian.org/sid/xtrace">
                <literal>xtrace</literal>
              </ulink></entry>
              <entry><ulink url="http://bugs.debian.org/xtrace">&pop-xtrace;</ulink></entry>
              <entry><ulink url="http://packages.qa.debian.org/x/xtrace.html">&size-xtrace;</ulink></entry>
              <entry><literal>xtrace</literal>(1) traces communication between X11 client and server.
    </entry>
            </row>
          </tbody>
        </tgroup>
      </table>
      <section id="_time_a_process">
        <title>Time a process</title>
        <simpara>Display time used by the process invoked by the command.</simpara>
        <screen># time some_command &gt;/dev/null
real    0m0.035s       # time on wall clock (elapsed real time)
user    0m0.000s       # time in user mode
sys     0m0.020s       # time in kernel mode</screen>
      </section>
      <section id="_the_scheduling_priority">
        <title>The scheduling priority</title>
        <simpara>A nice value is used to control the scheduling priority for the process.</simpara>
        <table id="listofnicevalueshedulingpriority" pgwide="0" frame="topbot" rowsep="1" colsep="1">
          <title>List of nice values for the scheduling priority.</title>
          <tgroup cols="2">
            <colspec colwidth="30%*" align="left"/>
            <colspec colwidth="70%*" align="left"/>
            <thead>
              <row>
                <entry>
    nice value
    </entry>
                <entry>
    scheduling priority
    </entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry>
    19
    </entry>
                <entry>
    lowest priority process (nice)
    </entry>
              </row>
              <row>
                <entry>
    0
    </entry>
                <entry>
    very high priority process for user.
    </entry>
              </row>
              <row>
                <entry>
    -20
    </entry>
                <entry>
    very high priority process for root. (not-nice)
    </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
        <screen># nice  -19 top                                      # very nice
# nice --20 wodim -v -eject speed=2 dev=0,0 disk.img # very fast</screen>
        <simpara>Sometimes an extreme nice value does more harm than good to the system.  Use this command carefully.</simpara>
      </section>
      <section id="_the_ps_command">
        <title>The ps command</title>
        <simpara>The <literal>ps</literal>(1) command on the Debian support both BSD and SystemV features and helps to identify the process activity statically.</simpara>
        <table id="listofpscommandstyles" pgwide="0" frame="topbot" rowsep="1" colsep="1">
          <title>List of ps command styles.</title>
          <tgroup cols="3">
            <colspec colwidth="30%*" align="left"/>
            <colspec colwidth="30%*" align="left"/>
            <colspec colwidth="40%*" align="left"/>
            <thead>
              <row>
                <entry>
    style
    </entry>
                <entry>
    typical command
    </entry>
                <entry>
    feature
    </entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry>
    BSD
    </entry>
                <entry>
                  <literal>ps aux</literal>
                </entry>
                <entry>
    display %CPU %MEM
    </entry>
              </row>
              <row>
                <entry>
    System V
    </entry>
                <entry>
                  <literal>ps -efH</literal>
                </entry>
                <entry>
    display PPID
    </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
        <simpara>For the zombie (defunct) children process, you can kill them by the parent process ID identified in the (<literal>PPID</literal>) field.</simpara>
        <simpara>The <literal>pstree</literal>(1) command display a tree of processes.</simpara>
      </section>
      <section id="_the_top_command">
        <title>The top command</title>
        <simpara><literal>top</literal>(1) on the Debian has rich features and helps to identify what process is acting funny dynamically.</simpara>
        <table id="listofcommandsfortop" pgwide="0" frame="topbot" rowsep="1" colsep="1">
          <title>List of commands for top.</title>
          <tgroup cols="2">
            <colspec colwidth="30%*" align="left"/>
            <colspec colwidth="70%*" align="left"/>
            <thead>
              <row>
                <entry>
    command key
    </entry>
                <entry>
    response
    </entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry><literal>h</literal> or <literal>?</literal>
    </entry>
                <entry>
    To show help.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>f</literal>
                </entry>
                <entry>
    To set/reset display field.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>o</literal>
                </entry>
                <entry>
    To reorder display field.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>F</literal>
                </entry>
                <entry>
    To set sort key field.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>k</literal>
                </entry>
                <entry>
    To kill a process.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>r</literal>
                </entry>
                <entry>
    To renice a process.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>q</literal>
                </entry>
                <entry>
    To quit the <literal>top</literal> command.
    </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
      </section>
      <section id="_list_files_opened_by_a_process">
        <title>List files opened by a process</title>
        <simpara>You can list all files opened by a process with a process ID (PID), e.g. 1 as:</simpara>
        <screen>$ sudo lsof -p 1</screen>
        <simpara>PID=1 is usually <literal>init</literal> program.</simpara>
      </section>
      <section id="_trace_program_activities">
        <title>Trace program activities</title>
        <simpara>You can trace program activity with <literal>strace</literal>(1), <literal>ltrace</literal>(1), or <literal>xtrace</literal>(1) for system calls and signals, library calls, or communication between X11 client and server.  For example:</simpara>
        <screen>$ sudo strace ls
...</screen>
      </section>
      <section id="_identify_processes_using_files_or_sockets">
        <title>Identify processes using files or sockets</title>
        <simpara>You can also identify processes using files or sockets by <literal>fuser</literal>(1).  For example:</simpara>
        <screen>$ sudo fuser -v /var/log/mail.log
                     USER        PID ACCESS COMMAND
/var/log/mail.log:   root       2946 F.... syslogd</screen>
        <simpara>You see that file "<literal>/var/log/mail.log</literal>" is open for writing by the <literal>syslogd</literal>(8) command.</simpara>
        <screen>$ sudo fuser -v smtp/tcp
                     USER        PID ACCESS COMMAND
smtp/tcp:            Debian-exim   3379 F.... exim4</screen>
        <simpara>Now you know your system runs <literal>exim4</literal>(8) to handle <ulink url="&tcp;">TCP</ulink> connections to <ulink url="&smtp;">SMTP</ulink> port (25).</simpara>
      </section>
      <section id="_repeating_a_command_with_a_constant_interval">
        <title>Repeating a command with a constant interval</title>
        <simpara><literal>watch</literal>(1) executes a program repeatedly with a constant interval while showing its output in fullscreen.</simpara>
        <screen>$ watch w</screen>
        <simpara>This will display who is logged on to the system updated every 2 seconds.</simpara>
      </section>
      <section id="_repeating_a_command_looping_over_files">
        <title>Repeating a command looping over files</title>
        <simpara>There are several ways to repeat a command looping over files matching some condition, e.g. matching glob pattern "<literal>*.ext</literal>".</simpara>
        <itemizedlist>
          <listitem>
            <simpara>
Shell for-loop method (see <xref linkend="_shell_loops"/>):
</simpara>
          </listitem>
        </itemizedlist>
        <screen>for x in *.ext; do if [ -f "$x"]; then command "$x" ; fi; done</screen>
        <itemizedlist>
          <listitem>
            <simpara><literal>find</literal>(1) and <literal>xargs</literal>(1) combination:
</simpara>
          </listitem>
        </itemizedlist>
        <screen>find . -type f -maxdepth 1 -name '*.ext' -print0 | xargs -0 -n 1 command</screen>
        <itemizedlist>
          <listitem>
            <simpara><literal>find</literal>(1) with "<literal>-exec</literal>" option with a command:
</simpara>
          </listitem>
        </itemizedlist>
        <screen>find . -type f -maxdepth 1 -name '*.ext' -exec command '{}' \;</screen>
        <itemizedlist>
          <listitem>
            <simpara><literal>find</literal>(1) with "<literal>-exec</literal>" option with a short shell script:
</simpara>
          </listitem>
        </itemizedlist>
        <screen>find . -type f -maxdepth 1 -name '*.ext' -exec sh -c "command '{}' &amp;&amp; echo 'successful'" \;</screen>
        <simpara>The above examples are written to ensure proper handling of funny file names such as ones containing spaces.  See <xref linkend="_idioms_for_the_selection_of_files"/> for more advance uses of <literal>find</literal>(1).</simpara>
      </section>
      <section id="_starting_a_program_from_gui">
        <title>Starting a program from GUI</title>
        <simpara>You can set up to start a process from <ulink url="&graphicaluserinterfacegui;">graphical user interface (GUI)</ulink>.</simpara>
        <simpara>Under GNOME desktop environment, a program program can be started with proper argument by <emphasis role="strong">drag-and-drop</emphasis> of an icon to the launcher icon or by "<emphasis role="strong">Open with …</emphasis>" menu with right clicking. KDE can do the equivalent, too. Here is an example for GNOME to set up <literal>mc</literal>(1) started in <literal>gnome-terminal</literal>(1):</simpara>
        <itemizedlist>
          <listitem>
            <simpara>
create an executable program "<literal>mc-term</literal>" as:
</simpara>
          </listitem>
        </itemizedlist>
        <screen># cat &gt;/usr/local/bin/mc-term &lt;&lt;EOF
#!/bin/sh
gnome-terminal -e "mc \$1"
EOF
# chmod 755 /usr/local/bin/mc-term</screen>
        <itemizedlist>
          <listitem>
            <simpara>
create a desktop launcher
</simpara>
            <itemizedlist>
              <listitem>
                <simpara>
right clicking desktop space to select "<literal>Create Launcher …</literal>"
</simpara>
              </listitem>
              <listitem>
                <simpara>
set "Type" to "<literal>Application</literal>"
</simpara>
              </listitem>
              <listitem>
                <simpara>
set "Name" to "<literal>mc</literal>"
</simpara>
              </listitem>
              <listitem>
                <simpara>
set "Command" to "<literal>mc-term %f</literal>"
</simpara>
              </listitem>
              <listitem>
                <simpara>
click "OK"
</simpara>
              </listitem>
            </itemizedlist>
          </listitem>
          <listitem>
            <simpara>
create an open-with association
</simpara>
            <itemizedlist>
              <listitem>
                <simpara>
right click folder to select "<literal>Open with Other Application …</literal>"
</simpara>
              </listitem>
              <listitem>
                <simpara>
click open "Use a custom command" dialog and enter "<literal>mc-term %f</literal>"
</simpara>
              </listitem>
              <listitem>
                <simpara>
click "Open".
</simpara>
              </listitem>
            </itemizedlist>
          </listitem>
        </itemizedlist>
        <tip>
          <simpara>Launcher is a file at "<literal>~/Desktop</literal>" with "<literal>.desktop</literal>" as its extension.</simpara>
        </tip>
      </section>
      <section id="_customizing_program_to_be_started">
        <title>Customizing program to be started</title>
        <simpara>Some programs start another program automatically.  Here are check points for customizing this process:</simpara>
        <itemizedlist>
          <listitem>
            <simpara>
application configuration menu:
</simpara>
            <itemizedlist>
              <listitem>
                <simpara>
GNOME desktop: "System" → "Preferences" → "Preferred Application"
</simpara>
              </listitem>
              <listitem>
                <simpara>
KDE desktop: "K" → "Control Center" → "KDE Components" → "Component Chooser"
</simpara>
              </listitem>
              <listitem>
                <simpara>
Iceweasle browser: "Edit" → "Preferences" → "Applications"
</simpara>
              </listitem>
              <listitem>
                <simpara><literal>mc</literal>(1): "<literal>/etc/mc/mc.ext</literal>"
</simpara>
              </listitem>
            </itemizedlist>
          </listitem>
          <listitem>
            <simpara>
environment variables such as "<literal>$BROWSER</literal>", "<literal>$EDITOR</literal>", "<literal>$VISUAL</literal>", and "<literal>$PAGER</literal>" (see <literal>eviron</literal>(7)).
</simpara>
          </listitem>
          <listitem>
            <simpara>
the <literal>update-alternatives</literal>(8) system for programs such as "<literal>editor</literal>", "<literal>view</literal>", "<literal>x-www-browser</literal>", "<literal>gnome-www-browser</literal>", and "<literal>www-browser</literal>" (see <xref linkend="_setting_a_default_text_editor"/>).
</simpara>
          </listitem>
          <listitem>
            <simpara>
the "<literal>~/.mailcap</literal>" and "<literal>/etc/mailcap</literal>" file contents which associate <ulink url="&mime;">MIME</ulink> type with program (see <literal>mailcap</literal>(5)).
</simpara>
          </listitem>
          <listitem>
            <simpara>
the the "<literal>~/.mime.types</literal>" and "<literal>/etc/mime.types</literal>" file contents which associate file name extension with <ulink url="&mime;">MIME</ulink> type (see <literal>run-mailcap</literal>(1)).
</simpara>
          </listitem>
        </itemizedlist>
        <tip>
          <simpara><literal>update-mime</literal>(8) updates the "<literal>/etc/mailcap</literal>" file using "<literal>/etc/mailcap.order</literal>" file (see <literal>mailcap.order</literal>(5)).</simpara>
        </tip>
        <tip>
          <simpara>The <literal>debianutils</literal> package provides <literal>sensible-browser</literal>(1), <literal>sensible-editor</literal>(1), and <literal>sensible-pager</literal>(1) which make sensible decisions on which editor, pager, and web browser to call, respectively.  I recommend you to read these shell commands.</simpara>
        </tip>
        <tip>
          <simpara>In order to run a console application such as <literal>mutt</literal> under X as your prefered application, you should create an X application as following and set "<literal>/usr/local/bin/mutt-term</literal>" as your prefered application to be started as described.</simpara>
        </tip>
        <screen># cat /usr/local/bin/mutt-term &lt;&lt;EOF
#!/bin/sh
gnome-terminal -e "mutt \$@"
EOF
chmod 755 /usr/local/bin/mutt-term</screen>
      </section>
      <section id="_kill_a_process">
        <title>Kill a process</title>
        <simpara>Use <literal>kill</literal>(1) to kill (or send a signal to) a process by the process ID.</simpara>
        <simpara>Use <literal>killall</literal>(1) or <literal>pkill</literal>(1) to do the same by the process command name and other attributes.</simpara>
        <table id="listoffrequentlylsforkillcommand" pgwide="0" frame="topbot" rowsep="1" colsep="1">
          <title>List of frequently used signals for kill command.</title>
          <tgroup cols="3">
            <colspec colwidth="30%*" align="left"/>
            <colspec colwidth="30%*" align="left"/>
            <colspec colwidth="40%*" align="left"/>
            <thead>
              <row>
                <entry>
    signal value
    </entry>
                <entry>
    signal name
    </entry>
                <entry>
    function
    </entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry>
    1
    </entry>
                <entry>
    HUP
    </entry>
                <entry>
    restart daemon
    </entry>
              </row>
              <row>
                <entry>
    15
    </entry>
                <entry>
    TERM
    </entry>
                <entry>
    normal kill
    </entry>
              </row>
              <row>
                <entry>
    9
    </entry>
                <entry>
    KILL
    </entry>
                <entry>
    kill hard
    </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
      </section>
      <section id="_schedule_tasks_once">
        <title>Schedule tasks once</title>
        <simpara>Run the <literal>at</literal>(1) command to schedule a one-time job:</simpara>
        <screen>$ echo 'command -args'| at 3:40 monday</screen>
      </section>
      <section id="_schedule_tasks_regularly">
        <title>Schedule tasks regularly</title>
        <simpara>Use <literal>cron</literal>(8) to schedule tasks regularly.  See <literal>crontab</literal>(1) and <literal>crontab</literal>(5).</simpara>
        <simpara>Run the command "<literal>crontab -e</literal>" to create or edit a crontab file to set up regularly scheduled events.</simpara>
        <simpara>Example of a crontab file:</simpara>
        <screen># use /bin/sh to run commands, no matter what /etc/passwd says
SHELL=/bin/sh
# mail any output to paul, no matter whose crontab this is
MAILTO=paul
# Min Hour DayOfMonth Month DayOfWeek command (Day... are OR'ed)
# run at 00:05, every day
5  0  *  * *   $HOME/bin/daily.job &gt;&gt; $HOME/tmp/out 2&gt;&amp;1
# run at 14:15 on the first of every month -- output mailed to paul
15 14 1  * *   $HOME/bin/monthly
# run at 22:00 on weekdays(1-5), annoy Joe. % for newline, last % for cc:
0 22 *   * 1-5 mail -s "It's 10pm" joe%Joe,%%Where are your kids?%.%%
23 */2 1 2 *   echo "run 23 minutes after 0am, 2am, 4am ..., on Feb 1"
5  4 *   * sun echo "run at 04:05 every sunday"
# run at 03:40 on the first Monday of each month
40 3 1-7 * *   [ "$(date +%a)" == "Mon" ] &amp;&amp; command -args</screen>
        <tip>
          <simpara>For the system not running continuously, install the <literal>anacron</literal> package to schedule periodic command at the specified intervals as closely as machine-uptime permits.</simpara>
        </tip>
      </section>
      <section id="_alt_sysrq">
        <title>Alt-SysRq</title>
        <simpara>Insurance against system malfunction is provided by the kernel compile option "Magic SysRq key" (<ulink url="&sak;">SAK</ulink> key) which is now the default for the Debian kernel.  Pressing Alt-SysRq followed by one of the following keys does the magic of rescuing control of the system:</simpara>
        <table id="listofsakcommandkeys" pgwide="0" frame="topbot" rowsep="1" colsep="1">
          <title>List of SAK command keys.</title>
          <tgroup cols="2">
            <colspec colwidth="30%*" align="left"/>
            <colspec colwidth="70%*" align="left"/>
            <thead>
              <row>
                <entry>
    key following Alt-SysRq
    </entry>
                <entry>
    function
    </entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry>
                  <literal>r</literal>
                </entry>
                <entry>
    Un<emphasis role="strong">r</emphasis>aw restores the keyboard after things like X crashes.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>0</literal>
                </entry>
                <entry>
    Changing the console loglevel to <emphasis role="strong">0</emphasis> reduces error messages.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>k</literal>
                </entry>
                <entry>
    SAK (system attention key) <emphasis role="strong">k</emphasis>ills all processes on the <emphasis role="strong">current virtual console</emphasis>.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>e</literal>
                </entry>
                <entry>
    Send a SIGT<emphasis role="strong">E</emphasis>RM to all processes, except for <literal>init</literal>(8).
    </entry>
              </row>
              <row>
                <entry>
                  <literal>i</literal>
                </entry>
                <entry>
    Send a SIGK<emphasis role="strong">I</emphasis>LL to all processes, except for <literal>init</literal>(8).
    </entry>
              </row>
              <row>
                <entry>
                  <literal>s</literal>
                </entry>
                <entry><emphasis role="strong">S</emphasis>ync all mounted filesystems.
    </entry>
              </row>
              <row>
                <entry>
                  <literal>u</literal>
                </entry>
                <entry>
    Remount all mounted filesystems read-only (<emphasis role="strong">u</emphasis>mount).
    </entry>
              </row>
              <row>
                <entry>
                  <literal>b</literal>
                </entry>
                <entry>
    Re<emphasis role="strong">b</emphasis>oot the system without syncing or unmounting.
    </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
        <simpara>The combination of "Alt-SysRq s", "Alt-SysRq u", and "Alt-SysRq r" is good for getting out of really bad situations.</simpara>
        <simpara>See "<literal>/usr/share/doc/linux-doc-2.6.*/Documentation/sysrq.txt.gz</literal>".</simpara>
        <caution>
          <simpara>The Alt-SysRq feature may be considered a security risk by allowing users access to root-privileged functions.  Placing "<literal>echo 0 &gt;/proc/sys/kernel/sysrq</literal>" in "<literal>/etc/rc.local</literal>" or "<literal>kernel.sysrq = 0</literal>" in "<literal>/etc/sysctl.conf</literal>" will disable the Alt-SysRq feature.</simpara>
        </caution>
        <tip>
          <simpara>From SSH terminal etc., you can use the Alt-SysRq feature by writing to the "<literal>/proc/sysrq-trigger</literal>". For example, "<literal>echo s &gt; /proc/sysrq-trigger; echo u &gt; /proc/sysrq-trigger</literal>" from the root shell prompt will <emphasis role="strong">s</emphasis>ync and <emphasis role="strong">u</emphasis>mount all mounted filesystems.</simpara>
        </tip>
      </section>
    </section>
    <section id="_system_maintenance_tips">
      <title>System maintenance tips</title>
      <section id="_who_is_logged_on">
        <title>Who is logged on</title>
        <simpara>You can check who is logged on to the system with <literal>w</literal>(1) or <literal>who</literal>(1).</simpara>
      </section>
      <section id="_warn_everyone">
        <title>Warn everyone</title>
        <simpara>You can send message to everyone who is logged on to the system with <literal>wall</literal>(1):</simpara>
        <screen>$ echo "We are shutting down in 1 hour" | wall</screen>
      </section>
      <section id="_hardware_identification">
        <title>Hardware identification</title>
        <simpara>For the <ulink url="&pci;">PCI</ulink>-like devices (<ulink url="&agp;">AGP</ulink>, <ulink url="&pciexpress;">PCI-Express</ulink>, <ulink url="&cardbus;">CardBus</ulink>, <ulink url="&expresscard;">ExpressCard</ulink>, etc.), <literal>lspci</literal>(8) (probably with "<literal>-nn</literal>" option) is a good start for the hardware identification</simpara>
        <simpara>Alternatively, you can identify the hardware by reading contents of "<literal>/proc/bus/pci/devices</literal>" or browsing directory tree under "<literal>/sys/bus/pci</literal>" (see <xref linkend="_procfs_and_sysfs"/>).</simpara>
        <table id="listofhardwareidntificationtools" pgwide="0" frame="topbot" rowsep="1" colsep="1">
          <title>List of hardware identification tools.</title>
          <tgroup cols="4">
            <colspec colwidth="20%*" align="left"/>
            <colspec colwidth="20%*" align="left"/>
            <colspec colwidth="20%*" align="left"/>
            <colspec colwidth="40%*" align="left"/>
            <thead>
              <row>
                <entry>
    package
    </entry>
                <entry>
    popcon
    </entry>
                <entry>
    size
    </entry>
                <entry>
    description
    </entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/pciutils">
                  <literal>pciutils</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/pciutils">&pop-pciutils;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/p/pciutils.html">&size-pciutils;</ulink></entry>
                <entry>
    Linux PCI Utilities, <literal>lspci</literal>(8)
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/usbutils">
                  <literal>usbutils</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/usbutils">&pop-usbutils;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/u/usbutils.html">&size-usbutils;</ulink></entry>
                <entry>
    Linux USB utilities, <literal>lsusb</literal>(8)
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/pcmciautils">
                  <literal>pcmciautils</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/pcmciautils">&pop-pcmciautils;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/p/pcmciautils.html">&size-pcmciautils;</ulink></entry>
                <entry>
    PCMCIA utilities for Linux 2.6, <literal>pccardctl</literal>(8)
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/scsitools">
                  <literal>scsitools</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/scsitools">&pop-scsitools;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/s/scsitools.html">&size-scsitools;</ulink></entry>
                <entry>
    Collection of tools for SCSI hardware management, <literal>lsscsi</literal>(8)
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/pnputils">
                  <literal>pnputils</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/pnputils">&pop-pnputils;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/p/pnputils.html">&size-pnputils;</ulink></entry>
                <entry>
    Plug and Play BIOS utilities, <literal>lspnp</literal>(8)
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/procinfo">
                  <literal>procinfo</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/procinfo">&pop-procinfo;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/p/procinfo.html">&size-procinfo;</ulink></entry>
                <entry>
    Displays system information from "<literal>/proc</literal>", <literal>lsdev</literal>(8)
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/lshw">
                  <literal>lshw</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/lshw">&pop-lshw;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/l/lshw.html">&size-lshw;</ulink></entry>
                <entry>
    Information about hardware configuration, <literal>lshw</literal>(1)
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/discover">
                  <literal>discover</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/discover">&pop-discover;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/d/discover.html">&size-discover;</ulink></entry>
                <entry>
    Hardware identification system, <literal>discover</literal>(8)
    </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
      </section>
      <section id="_hardware_configuration">
        <title>Hardware configuration</title>
        <simpara>Although most of the hardware configuration on modern GUI desktop systems such as GNOME and KDE can be managed through accompanying GUI configuration tools, it is a good idea to know some basics methods to configure them.</simpara>
        <table id="listofhardwareconfigurationtools" pgwide="0" frame="topbot" rowsep="1" colsep="1">
          <title>List of hardware configuration tools.</title>
          <tgroup cols="4">
            <colspec colwidth="20%*" align="left"/>
            <colspec colwidth="20%*" align="left"/>
            <colspec colwidth="20%*" align="left"/>
            <colspec colwidth="40%*" align="left"/>
            <thead>
              <row>
                <entry>
    package
    </entry>
                <entry>
    popcon
    </entry>
                <entry>
    size
    </entry>
                <entry>
    description
    </entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/hal">
                  <literal>hal</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/hal">&pop-hal;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/h/hal.html">&size-hal;</ulink></entry>
                <entry>
    Hardware Abstraction Layer, <literal>lshal</literal>(1)
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/console-tools">
                  <literal>console-tools</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/console-tools">&pop-consoletools;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/c/console-tools.html">&size-consoletools;</ulink></entry>
                <entry>
    Linux console font and keytable utilities.
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/x11-xserver-utils">
                  <literal>x11-xserver-utils</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/x11-xserver-utils">&pop-xbbxserverutils;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/x/x11-xserver-utils.html">&size-xbbxserverutils;</ulink></entry>
                <entry>
    X server utilities. <literal>xset</literal>(1) and <literal>xmodmap</literal>(1).
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/acpid">
                  <literal>acpid</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/acpid">&pop-acpid;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/a/acpid.html">&size-acpid;</ulink></entry>
                <entry>
    Daemon to manage events delivered by the Advanced Configuration and Power Interface (ACPI)
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/acpi">
                  <literal>acpi</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/acpi">&pop-acpi;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/a/acpi.html">&size-acpi;</ulink></entry>
                <entry>
    Utilities for ACPI devices
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/apmd">
                  <literal>apmd</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/apmd">&pop-apmd;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/a/apmd.html">&size-apmd;</ulink></entry>
                <entry>
    Daemon to manage events delivered by the Advanced Power Management (APM)
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/powersaved">
                  <literal>powersaved</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/powersaved">&pop-powersaved;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/p/powersaved.html">&size-powersaved;</ulink></entry>
                <entry>
    Daemon to manage battery, temperature, ac, cpufreq (SpeedStep, Powernow!) control and monitor with ACPI and APM supports.
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/noflushd">
                  <literal>noflushd</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/noflushd">&pop-noflushd;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/n/noflushd.html">&size-noflushd;</ulink></entry>
                <entry>
    Allow idle hard disks to spin down
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/sleepd">
                  <literal>sleepd</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/sleepd">&pop-sleepd;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/s/sleepd.html">&size-sleepd;</ulink></entry>
                <entry>
    Puts a laptop to sleep during inactivity
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/hdparm">
                  <literal>hdparm</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/hdparm">&pop-hdparm;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/h/hdparm.html">&size-hdparm;</ulink></entry>
                <entry>
    Hard disk access optimization.  Very effective but dangerous.  You must read <literal>hdparm</literal>(8) first.
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/smartmontools">
                  <literal>smartmontools</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/smartmontools">&pop-smartmontools;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/s/smartmontools.html">&size-smartmontools;</ulink></entry>
                <entry>
    Control and monitor storage systems using S.M.A.R.T.
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/setserial">
                  <literal>setserial</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/setserial">&pop-setserial;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/s/setserial.html">&size-setserial;</ulink></entry>
                <entry>
    Collection of tools for serial port management.
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/memtest86+">
                  <literal>memtest86+</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/memtest86+">&pop-memtestig;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/m/memtest86+.html">&size-memtestig;</ulink></entry>
                <entry>
    Collection of tools for memory hardware management.
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/scsitools">
                  <literal>scsitools</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/scsitools">&pop-scsitools;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/s/scsitools.html">&size-scsitools;</ulink></entry>
                <entry>
    Collection of tools for SCSI hardware management.
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/tpconfig">
                  <literal>tpconfig</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/tpconfig">&pop-tpconfig;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/t/tpconfig.html">&size-tpconfig;</ulink></entry>
                <entry>
    A program to configure touchpad devices
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/setcd">
                  <literal>setcd</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/setcd">&pop-setcd;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/s/setcd.html">&size-setcd;</ulink></entry>
                <entry>
    Compact disc drive access optimization.
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/big-cursor">
                  <literal>big-cursor</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/big-cursor">&pop-bigcursor;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/b/big-cursor.html">&size-bigcursor;</ulink></entry>
                <entry>
    Larger mouse cursors for X
    </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
        <simpara>Here, ACPI is a newer framework for the power management system than APM.</simpara>
      </section>
      <section id="_system_and_hardware_time">
        <title>System and hardware time</title>
        <simpara>The following will set system and hardware time to MM/DD hh:mm, CCYY.</simpara>
        <screen># date MMDDhhmmCCYY
# hwclock --utc --systohc
# hwclock --show</screen>
        <simpara>Times are normally displayed in the local time on the Debian system but the hardware and system time usually use UTC.</simpara>
        <simpara>If the hardware (BIOS) time is set to GMT, change the setting to "<literal>UTC=yes</literal>" in the "<literal>/etc/default/rcS</literal>".</simpara>
        <simpara>If you wish to update system time via network, consider to use the NTP service with the packages such as <literal>ntp</literal>, <literal>ntpdate</literal>, and <literal>chrony</literal>. See:</simpara>
        <itemizedlist>
          <listitem>
            <simpara><ulink url="&managingaccuratedateandtimehowto;">Managing Accurate Date and Time HOWTO</ulink>.
</simpara>
          </listitem>
          <listitem>
            <simpara><ulink url="&ntppublicservicesproject;">NTP Public Services Project</ulink>.
</simpara>
          </listitem>
          <listitem>
            <simpara>
The <literal>ntp-doc</literal> package
</simpara>
          </listitem>
        </itemizedlist>
        <tip>
          <simpara><literal>ntptrace</literal>(8) in the <literal>ntp</literal> package can trace a chain of NTP servers back to the primary source.</simpara>
        </tip>
      </section>
      <section id="_the_terminal_configuration">
        <title>The terminal configuration</title>
        <simpara>There are several components to configure character console and <literal>ncurses</literal>(3) system features:</simpara>
        <itemizedlist>
          <listitem>
            <simpara>
the "<literal>/etc/terminfo/*/*</literal>" file (<literal>terminfo</literal>(5))
</simpara>
          </listitem>
          <listitem>
            <simpara>
the "<literal>$TERM</literal>" environment variable (<literal>term</literal>(7))
</simpara>
          </listitem>
          <listitem>
            <simpara><literal>setterm</literal>(1), <literal>stty</literal>(1), <literal>tic</literal>(1), and <literal>toe</literal>(1)
</simpara>
          </listitem>
        </itemizedlist>
        <simpara>If the <literal>terminfo</literal> entry for <literal>xterm</literal> doesn't work with a non-Debian <literal>xterm</literal>, change your terminal type, "<literal>$TERM</literal>", from "<literal>xterm</literal>" to one of the feature-limited versions such as "<literal>xterm-r6</literal>" when you log in to a Debian system remotely.  See "<literal>/usr/share/doc/libncurses5/FAQ</literal>" for more.  "<literal>dumb</literal>" is the lowest common denominator for "<literal>$TERM</literal>".</simpara>
      </section>
      <section id="_the_sound_infrastructure">
        <title>The sound infrastructure</title>
        <simpara>Device drivers for sound cards for current Linux 2.6 are provided by <ulink url="&advancedlinuxsouarchitecturealsa;">Advanced Linux Sound Architecture (ALSA)</ulink>.  ALSA provides emulation mode for previous <ulink url="&opensoundsystemoss;">Open Sound System (OSS)</ulink> for compatibility.</simpara>
        <simpara>Run "<literal>dpkg-reconfigure linux-sound-base</literal>" to select the sound system to use ALSA via blacklisting of kernel modules. Unless you have very new sound hardware, udev infrastructure should configure your sound system.</simpara>
        <tip>
          <simpara>Use "<literal>cat /dev/urandom &gt; /dev/audio</literal>" or <literal>speaker-test</literal>(1) to test speaker. (^C to stop)</simpara>
        </tip>
        <tip>
          <simpara>If you can not get sound, your speaker may be connected to a muted output.  Modern sound system has many outputs.  <literal>alsamixer</literal>(1) in the <literal>alsa-utils</literal> package is useful to configure volume and mute settings.</simpara>
        </tip>
        <simpara>Application softwares may be configured not only to access sound devices directly but also to access them via some standardized sound server system.</simpara>
        <table id="listofsoundpackages" pgwide="0" frame="topbot" rowsep="1" colsep="1">
          <title>List of sound packages</title>
          <tgroup cols="4">
            <colspec colwidth="20%*" align="left"/>
            <colspec colwidth="20%*" align="left"/>
            <colspec colwidth="20%*" align="left"/>
            <colspec colwidth="40%*" align="left"/>
            <thead>
              <row>
                <entry>
    package
    </entry>
                <entry>
    pocon
    </entry>
                <entry>
    size
    </entry>
                <entry>
    description
    </entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/linux-sound-base">
                  <literal>linux-sound-base</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/linux-sound-base">&pop-linuxsoundbase;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/l/linux-sound-base.html">&size-linuxsoundbase;</ulink></entry>
                <entry>
    Base package for ALSA and OSS sound systems
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/alsa-base">
                  <literal>alsa-base</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/alsa-base">&pop-alsabase;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/a/alsa-base.html">&size-alsabase;</ulink></entry>
                <entry>
    ALSA driver configuration files
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/alsa-utils">
                  <literal>alsa-utils</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/alsa-utils">&pop-alsautils;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/a/alsa-utils.html">&size-alsautils;</ulink></entry>
                <entry>
    Utilities for configuring and using ALSA
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/oss-compat">
                  <literal>oss-compat</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/oss-compat">&pop-osscompat;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/o/oss-compat.html">&size-osscompat;</ulink></entry>
                <entry>
    OSS compatibility under ALSA preventing "<literal>/dev/dsp not found</literal>" errors
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/esound-common">
                  <literal>esound-common</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/esound-common">&pop-esoundcommon;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/e/esound-common.html">&size-esoundcommon;</ulink></entry>
                <entry><ulink url="&enlightenedsounddaemonesd;">Enlightened Sound Daemon (ESD)</ulink> common (Enlightenment and GNOME)
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/esound">
                  <literal>esound</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/esound">&pop-esound;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/e/esound.html">&size-esound;</ulink></entry>
                <entry><ulink url="&enlightenedsounddaemonesd;">Enlightened Sound Daemon (ESD)</ulink> server (Enlightenment and GNOME)
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/esound-clients">
                  <literal>esound-clients</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/esound-clients">&pop-esoundclients;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/e/esound-clients.html">&size-esoundclients;</ulink></entry>
                <entry><ulink url="&enlightenedsounddaemonesd;">Enlightened Sound Daemon (ESD)</ulink> client (Enlightenment and GNOME)
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/libesd-alsa0">
                  <literal>libesd-alsa0</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/libesd-alsa0">&pop-libesdalsaa;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/libe/libesd-alsa0.html">&size-libesdalsaa;</ulink></entry>
                <entry><ulink url="&enlightenedsounddaemonesd;">Enlightened Sound Daemon (ESD)</ulink> library Enlightenment and GNOME)
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/libesd0">
                  <literal>libesd0</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/libesd0">&pop-libesda;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/libe/libesd0.html">&size-libesda;</ulink></entry>
                <entry><ulink url="&enlightenedsounddaemonesd;">Enlightened Sound Daemon (ESD)</ulink> library (Enlightenment and GNOME) - OSS
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/arts">
                  <literal>arts</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/arts">&pop-arts;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/a/arts.html">&size-arts;</ulink></entry>
                <entry><ulink url="&arts;">aRts</ulink> server (KDE)
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/libarts1c2a">
                  <literal>libarts1c2a</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/libarts1c2a">&pop-libartsbcca;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/liba/libarts1c2a.html">&size-libartsbcca;</ulink></entry>
                <entry><ulink url="&arts;">aRts</ulink> library (KDE)
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/libartsc0">
                  <literal>libartsc0</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/libartsc0">&pop-libartsca;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/liba/libartsc0.html">&size-libartsca;</ulink></entry>
                <entry><ulink url="&arts;">aRts</ulink> library (KDE)
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/jackd">
                  <literal>jackd</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/jackd">&pop-jackd;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/j/jackd.html">&size-jackd;</ulink></entry>
                <entry><ulink url="&jackaudioconnectionkitjack;">JACK Audio Connection Kit. (JACK)</ulink> server (low latency)
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/libjack0">
                  <literal>libjack0</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/libjack0">&pop-libjacka;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/libj/libjack0.html">&size-libjacka;</ulink></entry>
                <entry><ulink url="&jackaudioconnectionkitjack;">JACK Audio Connection Kit. (JACK)</ulink> library (low latency)
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/libjack0.100.0-0">
                  <literal>libjack0.100.0-0</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/libjack0.100.0-0">&pop-libjackabaaaa;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/libj/libjack0.100.0-0.html">&size-libjackabaaaa;</ulink></entry>
                <entry><ulink url="&jackaudioconnectionkitjack;">JACK Audio Connection Kit. (JACK)</ulink> library (low latency)
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/nas">
                  <literal>nas</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/nas">&pop-nas;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/n/nas.html">&size-nas;</ulink></entry>
                <entry><ulink url="&networkaudiosystemnas;">Network Audio System (NAS)</ulink> server
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/libaudio2">
                  <literal>libaudio2</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/libaudio2">&pop-libaudioc;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/liba/libaudio2.html">&size-libaudioc;</ulink></entry>
                <entry><ulink url="&networkaudiosystemnas;">Network Audio System (NAS)</ulink>  library
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/pulseaudio">
                  <literal>pulseaudio</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/pulseaudio">&pop-pulseaudio;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/p/pulseaudio.html">&size-pulseaudio;</ulink></entry>
                <entry><ulink url="&pulseaudio;">PulseAudio</ulink> server, replacement for ESD
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/libpulse0">
                  <literal>libpulse0</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/libpulse0">&pop-libpulsea;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/libp/libpulse0.html">&size-libpulsea;</ulink></entry>
                <entry><ulink url="&pulseaudio;">PulseAudio</ulink> client library, replacement for ESD
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/libpulsecore9">
                  <literal>libpulsecore9</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/libpulsecore9">&pop-libpulsecorej;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/libp/libpulsecore9.html">&size-libpulsecorej;</ulink></entry>
                <entry><ulink url="&pulseaudio;">PulseAudio</ulink> server library, replacement for ESD
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/libgstreamer0.10-0">
                  <literal>libgstreamer0.10-0</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/libgstreamer0.10-0">&pop-libgstreamerabaa;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/libg/libgstreamer0.10-0.html">&size-libgstreamerabaa;</ulink></entry>
                <entry><ulink url="&gstreamer;">GStreamer</ulink>: GNOME sound engine
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/libxine1">
                  <literal>libxine1</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/libxine1">&pop-libxineb;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/libx/libxine1.html">&size-libxineb;</ulink></entry>
                <entry><ulink url="&xine;">xine</ulink>: KDE older sound engine
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/libphonon4">
                  <literal>libphonon4</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/libphonon4">&pop-libphonone;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/libp/libphonon4.html">&size-libphonone;</ulink></entry>
                <entry><ulink url="&phonon;">Phonon</ulink>: KDE new sound engine
    </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
        <simpara>There is usually a common sound engine for each popular desktop environment. Each sound engine used by the application can choose to connect to different sound servers.</simpara>
      </section>
      <section id="_disable_the_screen_saver">
        <title>Disable the screen saver</title>
        <simpara>For disabling the screen saver, use following commands.</simpara>
        <table id="listofcommandsfongthescreensaver" pgwide="0" frame="topbot" rowsep="1" colsep="1">
          <title>List of commands for disabling the screen saver.</title>
          <tgroup cols="2">
            <colspec colwidth="30%*" align="left"/>
            <colspec colwidth="70%*" align="left"/>
            <thead>
              <row>
                <entry>
    environment
    </entry>
                <entry>
    command
    </entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry>
    The Linux console
    </entry>
                <entry>
                  <literal>setterm -powersave off</literal>
                </entry>
              </row>
              <row>
                <entry>
    The X Window by turning off screensaver
    </entry>
                <entry>
                  <literal>xset s off</literal>
                </entry>
              </row>
              <row>
                <entry>
    The X Window by disabling dpms
    </entry>
                <entry>
                  <literal>xset -dpms</literal>
                </entry>
              </row>
              <row>
                <entry>
    The X Window by GUI configuration of screen saver
    </entry>
                <entry>
                  <literal>xscreensaver-command -prefs</literal>
                </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
      </section>
      <section id="_disable_the_sound_beep">
        <title>Disable the sound (beep)</title>
        <simpara>One can always unplug the PC speaker.  ;-)  Removing <literal>pcspkr</literal> kernel module does this for you.</simpara>
        <simpara>The following will prevent the <literal>readline</literal>(3) program used by <literal>bash</literal>(1) to beep when encountering "<literal>\a</literal>" (ASCII=7):</simpara>
        <screen>$ echo "set bell-style none"&gt;&gt; ~/.inputrc</screen>
      </section>
      <section id="_memory_usage">
        <title>Memory usage</title>
        <simpara>The kernel boot message in the "<literal>/var/log/dmesg</literal>" contains the total exact size of available memory.</simpara>
        <simpara><literal>free</literal>(1) and <literal>top</literal>(1) display information on memory resources on the running system.</simpara>
        <screen>$ grep '\] Memory' /var/log/dmesg
[    0.004000] Memory: 990528k/1016784k available (1975k kernel code, 25868k reserved, 931k data, 296k init)
$ free -k
             total       used       free     shared    buffers     cached
Mem:        997184     976928      20256          0     129592     171932
-/+ buffers/cache:     675404     321780
Swap:      4545576          4    4545572</screen>
        <simpara>For my MacBook with 1GB=1048576k DRAM (video system steals some of this):</simpara>
        <table id="listofmemorysizesreported" pgwide="0" frame="topbot" rowsep="1" colsep="1">
          <title>List of memory sizes reported.</title>
          <tgroup cols="2">
            <colspec colwidth="30%*" align="left"/>
            <colspec colwidth="70%*" align="left"/>
            <thead>
              <row>
                <entry>
    report
    </entry>
                <entry>
    size
    </entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry>
    Total size in dmesg
    </entry>
                <entry>
    1016784k = 1GB - 31792k
    </entry>
              </row>
              <row>
                <entry>
    Free in dmesg
    </entry>
                <entry>
    990528k
    </entry>
              </row>
              <row>
                <entry>
    Total under shell
    </entry>
                <entry>
    997184k
    </entry>
              </row>
              <row>
                <entry>
    Free under shell
    </entry>
                <entry>
    20256k
    </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
        <simpara>Do not worry about the large size of "<literal>used</literal>" and the small size of "<literal>free</literal>" in the "<literal>Mem:</literal>" line, but read the one under them (675404 and 321780 in the example below) and relax.</simpara>
      </section>
      <section id="_system_security_and_integrity_check">
        <title>System security and integrity check</title>
        <simpara>Poor system maintenance may expose your system to external exploitation.</simpara>
        <simpara>For system security and integrity check, you should start with:</simpara>
        <itemizedlist>
          <listitem>
            <simpara>
the <literal>debsums</literal> package: See <literal>debsums</literal>(1) and <xref linkend="_top_level_release_file_and_authenticity"/>.
</simpara>
          </listitem>
          <listitem>
            <simpara>
the <literal>chkrootkit</literal> package: See <literal>chkrootkit</literal>(1).
</simpara>
          </listitem>
          <listitem>
            <simpara>
the <literal>clamav</literal> package family: See <literal>clamscan</literal>(1) and <literal>freahclam</literal>(1).
</simpara>
          </listitem>
          <listitem>
            <simpara><ulink url="&debiansecurityfaq;">Debian security FAQ</ulink>.
</simpara>
          </listitem>
          <listitem>
            <simpara><ulink url="&securingdebianmanual;">Securing Debian Manual</ulink>.
</simpara>
          </listitem>
        </itemizedlist>
        <table id="listoftoolsforsyndintegritycheck" pgwide="0" frame="topbot" rowsep="1" colsep="1">
          <title>List of tools for system security and integrity check</title>
          <tgroup cols="4">
            <colspec colwidth="20%*" align="left"/>
            <colspec colwidth="20%*" align="left"/>
            <colspec colwidth="20%*" align="left"/>
            <colspec colwidth="40%*" align="left"/>
            <thead>
              <row>
                <entry>
    package
    </entry>
                <entry>
    popcon
    </entry>
                <entry>
    size
    </entry>
                <entry>
    description
    </entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/logcheck">
                  <literal>logcheck</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/logcheck">&pop-logcheck;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/l/logcheck.html">&size-logcheck;</ulink></entry>
                <entry>
    This mails anomalies in the system logfiles to the administrator
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/debsums">
                  <literal>debsums</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/debsums">&pop-debsums;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/d/debsums.html">&size-debsums;</ulink></entry>
                <entry>
    This verifies installed package files against MD5 checksums.
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/chkrootkit">
                  <literal>chkrootkit</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/chkrootkit">&pop-chkrootkit;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/c/chkrootkit.html">&size-chkrootkit;</ulink></entry>
                <entry><ulink url="&rootkit;">Rootkit</ulink> detector.
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/clamav">
                  <literal>clamav</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/clamav">&pop-clamav;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/c/clamav.html">&size-clamav;</ulink></entry>
                <entry>
    Anti-virus utility for Unix - command-line interface.
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/tiger">
                  <literal>tiger</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/tiger">&pop-tiger;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/t/tiger.html">&size-tiger;</ulink></entry>
                <entry>
    Report system security vulnerabilities
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/tripwire">
                  <literal>tripwire</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/tripwire">&pop-tripwire;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/t/tripwire.html">&size-tripwire;</ulink></entry>
                <entry>
    File and directory integrity checker
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/john">
                  <literal>john</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/john">&pop-john;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/j/john.html">&size-john;</ulink></entry>
                <entry>
    Active password cracking tool
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/aide">
                  <literal>aide</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/aide">&pop-aide;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/a/aide.html">&size-aide;</ulink></entry>
                <entry>
    Advanced Intrusion Detection Environment - static binary
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/bastille">
                  <literal>bastille</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/bastille">&pop-bastille;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/b/bastille.html">&size-bastille;</ulink></entry>
                <entry>
    Security hardening tool
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/integrit">
                  <literal>integrit</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/integrit">&pop-integrit;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/i/integrit.html">&size-integrit;</ulink></entry>
                <entry>
    A file integrity verification program
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/crack">
                  <literal>crack</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/crack">&pop-crack;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/c/crack.html">&size-crack;</ulink></entry>
                <entry>
    Password guessing program
    </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
        <simpara>Here is a simple script to check for typical world writable incorrect file permissions.</simpara>
        <screen># find / -perm 777 -a \! -type s -a \! -type l -a \! \( -type d -a -perm 1777 \)</screen>
        <caution>
          <simpara>Since the <literal>debsums</literal> package uses MD5 checksums stored locally, it can not be fully trusted as the system security audit tool against malicious attacks.</simpara>
        </caution>
      </section>
    </section>
    <section id="_the_kernel">
      <title>The kernel</title>
      <simpara>Debian distributes modularized Linux kernel as packages for supported architectures.</simpara>
      <section id="_linux_kernel_2_6">
        <title>Linux kernel 2.6</title>
        <simpara>There are few notable features on Linux kernel 2.6 compared to 2.4.</simpara>
        <itemizedlist>
          <listitem>
            <simpara>
Devices are created by the udev system (see <xref linkend="_the_udev_system"/>).
</simpara>
          </listitem>
          <listitem>
            <simpara>
Read/write accesses to IDE CD/DVD devices do not use the <literal>ide-scsi</literal> module.
</simpara>
          </listitem>
          <listitem>
            <simpara>
Network packet filtering functions use <literal>iptable</literal> kernel modules.
</simpara>
          </listitem>
        </itemizedlist>
      </section>
      <section id="_kernel_headers">
        <title>Kernel headers</title>
        <simpara>Most <emphasis role="strong">normal programs</emphasis> don't need kernel headers and in fact may break if you use them directly for compiling. They should be compiled against the headers in "<literal>/usr/include/linux</literal>" and "<literal>/usr/include/asm</literal>" provided by the <literal>libc6-dev</literal> package (created from the <literal>glibc</literal> source package) on the Debian system.</simpara>
        <note>
          <simpara>For compiling some kernel-specific programs such as the kernel modules from the external source and the automounter daemon (<literal>amd</literal>), you must include path to the corresponding kernel headers, e.g. "<literal>-I/usr/src/linux-particular-version/include/</literal>", to your command line. <literal>module-assistant</literal>(8) (or its short form <literal>m-a</literal>) helps users to build and install module package(s) easily for one or more custom kernels.</simpara>
        </note>
      </section>
      <section id="_kernel_and_module_compile">
        <title>Kernel and module compile</title>
        <simpara>Debian has its own method of compiling the kernel and related modules.</simpara>
        <table id="listofkeypackagenthedebiansystem" pgwide="0" frame="topbot" rowsep="1" colsep="1">
          <title>List of key packages to be installed for the kernel recompilation on the Debian system</title>
          <tgroup cols="4">
            <colspec colwidth="20%*" align="left"/>
            <colspec colwidth="20%*" align="left"/>
            <colspec colwidth="20%*" align="left"/>
            <colspec colwidth="40%*" align="left"/>
            <thead>
              <row>
                <entry>
    package
    </entry>
                <entry>
    popcon
    </entry>
                <entry>
    size
    </entry>
                <entry>
    description
    </entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/build-essential">
                  <literal>build-essential</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/build-essential">&pop-buildessential;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/b/build-essential.html">&size-buildessential;</ulink></entry>
                <entry>
    essential packages for building Debian packages: <literal>make</literal>, <literal>gcc</literal>, …
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/bzip2">
                  <literal>bzip2</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/bzip2">&pop-bzipc;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/b/bzip2.html">&size-bzipc;</ulink></entry>
                <entry>
    compress and decompress utilities for bz2 files
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/libncurses5-dev">
                  <literal>libncurses5-dev</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/libncurses5-dev">&pop-libncursesfdev;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/libn/libncurses5-dev.html">&size-libncursesfdev;</ulink></entry>
                <entry>
    developer's libraries and docs for ncurses
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/git-core">
                  <literal>git-core</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/git-core">&pop-gitcore;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/g/git-core.html">&size-gitcore;</ulink></entry>
                <entry>
    git: distributed revision control system used by the Linux kernel
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/fakeroot">
                  <literal>fakeroot</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/fakeroot">&pop-fakeroot;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/f/fakeroot.html">&size-fakeroot;</ulink></entry>
                <entry>
    provide fakeroot environment for building package as non-root
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/initramfs-tools">
                  <literal>initramfs-tools</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/initramfs-tools">&pop-initramfstools;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/i/initramfs-tools.html">&size-initramfstools;</ulink></entry>
                <entry>
    tool to build an initramfs (Debian specific)
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/kernel-package">
                  <literal>kernel-package</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/kernel-package">&pop-kernelpackage;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/k/kernel-package.html">&size-kernelpackage;</ulink></entry>
                <entry>
    tool to build Linux kernel packages (Debian specific)
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/module-assistant">
                  <literal>module-assistant</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/module-assistant">&pop-moduleassistant;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/m/module-assistant.html">&size-moduleassistant;</ulink></entry>
                <entry>
    tool to help build module packages (Debian specific)
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/devscripts">
                  <literal>devscripts</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/devscripts">&pop-devscripts;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/d/devscripts.html">&size-devscripts;</ulink></entry>
                <entry>
    helper scripts for a Debian Package maintainer (Debian specific)
    </entry>
              </row>
              <row>
                <entry>
                  <literal>linux-tree-2.6.*</literal>
                </entry>
                <entry>
    N/A
    </entry>
                <entry>
    N/A
    </entry>
                <entry>
    Linux kernel source tree meta package (Debian specific)
    </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
        <simpara>If you use <literal>initrd</literal> in <xref linkend="_stage_2_the_boot_loader"/>, make sure to read the related information in <literal>initramfs-tools</literal>(8), <literal>update-initramfs</literal>(8), <literal>mkinitramfs</literal>(8) and <literal>initramfs.conf</literal>(5).</simpara>
        <warning>
          <simpara>Do not put symlinks to the directories in the source tree (e.g. "<literal>/usr/src/linux*</literal>") from "<literal>/usr/include/linux</literal>" and "<literal>/usr/include/asm</literal>" when compiling the Linux kernel source. (Some outdated documents suggest this.)</simpara>
        </warning>
        <note>
          <simpara>When compiling the latest Linux kernel on the Debian <literal>stable</literal> system, the use of backported latest tools from the Debian <literal>unstable</literal> may be needed.</simpara>
        </note>
      </section>
      <section id="_kernel_source_compile_debian_standard_method">
        <title>Kernel source compile: Debian standard method</title>
        <simpara>The Debian standard method for compiling kernel source to create a custom kernel package uses <literal>make-kpkg</literal>(1). The official documentation is in (the bottom of) "<literal>/usr/share/doc/kernel-package/README.gz</literal>".  See <literal>kernel-pkg.conf</literal>(5) and <literal>kernel-img.conf</literal>(5) for customization.</simpara>
        <simpara>Here is an example for amd64 system:</simpara>
        <screen># aptitude install linux-tree-&lt;version&gt;
$ cd /usr/src
$ tar -xjvf linux-source-&lt;version&gt;.tar.bz2
$ cd linux-source-&lt;version&gt;
$ cp /boot/config-&lt;oldversion&gt; .config
$ make menuconfig
 ...
$ make-kpkg clean
$ fakeroot make-kpkg --append_to_version -amd64 --initrd --revision=rev.01 kernel_image modules_image
$ cd ..
# dpkg -i linux-image*.deb</screen>
        <itemizedlist>
          <listitem>
            <simpara>
reboot to new kernel with "<literal>shutdown -r now</literal>" .
</simpara>
          </listitem>
        </itemizedlist>
        <caution>
          <simpara>When you intend to create a non-modularized kernel compiled only for one machine, invoke <literal>make-kpkg</literal> without "<literal>--initrd</literal>" option since initrd is not used. Invocation of "<literal>make oldconfig</literal>" and "<literal>make dep</literal>" are not required since "<literal>make-kpkg kernel_image</literal>" invokes them.</simpara>
        </caution>
      </section>
      <section id="_module_source_compile_debian_standard_method">
        <title>Module source compile: Debian standard method</title>
        <simpara>The Debian standard method for creating and installing a custom module package for a custom kernel package uses <literal>module-assistant</literal>(8) and module-source packages. For example, following will build the <literal>unionfs</literal> kernel module package and installs it.</simpara>
        <screen>$ sudo aptitude install module-assistant
...
$ sudo aptitude install unionfs-source unionfs-tools unionfs-utils
$ sudo m-a update
$ sudo m-a prepare
$ sudo m-a auto-install unionfs
...
$ sudo apt-get autoremove</screen>
      </section>
      <section id="_kernel_source_compile_classic_method">
        <title>Kernel source compile: classic method</title>
        <simpara>You can still build <ulink url="&linuxkernelfromtepristinesources;">Linux kernel from the pristine sources</ulink> with the classic method.  You must take care the details of the system configuration manually.</simpara>
        <screen>$ cd /usr/src
$ wget http://www.kernel.org/pub/linux/kernel/v2.6/linux-&lt;version&gt;.tar.bz2
$ tar -xjvf linux-&lt;version&gt;.tar.bz2
$ cd linux-&lt;version&gt;
$ cp /boot/config-&lt;version&gt; .config
$ make menuconfig
 ...
$ make dep; make bzImage
$ make modules
# cp ./arch/x86_64/boot/bzImage /boot/vmlinuz-&lt;version&gt;
# make modules_install
# depmod -a
# update-initramfs -c -k &lt;version&gt;</screen>
        <itemizedlist>
          <listitem>
            <simpara>
set up bootloader
</simpara>
            <itemizedlist>
              <listitem>
                <simpara>
edit "<literal>/etc/lilo.conf</literal>" and run "<literal>/sbin/lilo</literal>", if you use <literal>lilo</literal>.
</simpara>
              </listitem>
              <listitem>
                <simpara>
edit "<literal>/boot/grub/menu.lst</literal>", if you use <literal>grub</literal>.
</simpara>
              </listitem>
            </itemizedlist>
          </listitem>
          <listitem>
            <simpara>
reboot to new kernel with "<literal>shutdown -r now</literal>".
</simpara>
          </listitem>
        </itemizedlist>
      </section>
      <section id="_non_free_hardware_drivers">
        <title>Non-free hardware drivers</title>
        <simpara>Although most of hardware drivers are available as free software and as a part of the Debian system, you may need to load some non-free external drivers to support some hardwares, such as Winmodem, on your system.</simpara>
        <simpara>Check pertinent resources:</simpara>
        <itemizedlist>
          <listitem>
            <simpara>
              <ulink url="&httpenwikipediaorgwikisoftmodem;">http://en.wikipedia.org/wiki/Softmodem</ulink>
            </simpara>
          </listitem>
          <listitem>
            <simpara>
              <ulink url="&httpenwikipediaowireless_drivers;">http://en.wikipedia.org/wiki/Comparison_of_open_source_wireless_drivers</ulink>
            </simpara>
          </listitem>
          <listitem>
            <simpara><ulink url="&google;">Google</ulink> or other search engines with keyword "Linmodem".
</simpara>
          </listitem>
          <listitem>
            <simpara>
              <ulink url="&httpndiswrappersourceforgenet;">http://ndiswrapper.sourceforge.net</ulink>
            </simpara>
          </listitem>
          <listitem>
            <simpara>
              <ulink url="&httplinuxwirelessorg;">http://linuxwireless.org</ulink>
            </simpara>
          </listitem>
          <listitem>
            <simpara><ulink url="&httpmadwifiprojectorg;">http://madwifi-project.org</ulink> (there is ath5k which contains free drivers)
</simpara>
          </listitem>
        </itemizedlist>
      </section>
    </section>
    <section id="_virtualized_system">
      <title>Virtualized system</title>
      <simpara>Use of virtualized system enables us to run multiple instances of system simultaneously on a single hardware.</simpara>
      <section id="_virtualization_tools">
        <title>Virtualization tools</title>
        <simpara>Virturization involves 2 steps:</simpara>
        <itemizedlist>
          <listitem>
            <simpara>
create file system populated with required package data.  Programs such as <literal>debootstrap</literal> and <literal>cdebootstrap</literal> helps this process.
</simpara>
          </listitem>
          <listitem>
            <simpara>
run a program under virturized environment.  Most basic method is provided by <ulink url="&chroot;">chroot</ulink>.
</simpara>
          </listitem>
        </itemizedlist>
        <simpara>There are several system <ulink url="&virtualization;">virtualization</ulink> and <ulink url="&emulation;">emulation</ulink> related packages in Debian beyond simple <ulink url="&chroot;">chroot</ulink>.  Some packages also help you to setup such system.</simpara>
        <table id="listofvirtualizationtools" pgwide="0" frame="topbot" rowsep="1" colsep="1">
          <title>List of virtualization tools</title>
          <tgroup cols="4">
            <colspec colwidth="20%*" align="left"/>
            <colspec colwidth="20%*" align="left"/>
            <colspec colwidth="20%*" align="left"/>
            <colspec colwidth="40%*" align="left"/>
            <thead>
              <row>
                <entry>
    package
    </entry>
                <entry>
    pocon
    </entry>
                <entry>
    size
    </entry>
                <entry>
    description
    </entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/schroot">
                  <literal>schroot</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/schroot">&pop-schroot;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/s/schroot.html">&size-schroot;</ulink></entry>
                <entry>
    Specialized tool for executing Debian binary packages in chroot
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/sbuild">
                  <literal>sbuild</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/sbuild">&pop-sbuild;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/s/sbuild.html">&size-sbuild;</ulink></entry>
                <entry>
    Tool for building Debian binary packages from Debian sources
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/pbuilder">
                  <literal>pbuilder</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/pbuilder">&pop-pbuilder;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/p/pbuilder.html">&size-pbuilder;</ulink></entry>
                <entry>
    Personal package builder for Debian packages
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/debootstrap">
                  <literal>debootstrap</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/debootstrap">&pop-debootstrap;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/d/debootstrap.html">&size-debootstrap;</ulink></entry>
                <entry>
    Bootstrap a basic Debian system (written in sh)
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/cdebootstrap">
                  <literal>cdebootstrap</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/cdebootstrap">&pop-cdebootstrap;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/c/cdebootstrap.html">&size-cdebootstrap;</ulink></entry>
                <entry>
    Bootstrap a Debian system (written in C)
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/rootstrap">
                  <literal>rootstrap</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/rootstrap">&pop-rootstrap;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/r/rootstrap.html">&size-rootstrap;</ulink></entry>
                <entry>
    A tool for building complete Linux filesystem images
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/user-mode-linux">
                  <literal>user-mode-linux</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/user-mode-linux">&pop-usermodelinux;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/u/user-mode-linux.html">&size-usermodelinux;</ulink></entry>
                <entry><ulink url="&usermodelinux;">User-mode Linux</ulink> (kernel)
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/xen-tools">
                  <literal>xen-tools</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/xen-tools">&pop-xentools;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/x/xen-tools.html">&size-xentools;</ulink></entry>
                <entry>
    Tools to manage debian <ulink url="&xen;">XEN</ulink> virtual server
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/bochs">
                  <literal>bochs</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/bochs">&pop-bochs;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/b/bochs.html">&size-bochs;</ulink></entry>
                <entry><ulink url="&bochs;">Bochs</ulink>: IA-32 PC emulator
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/qemu">
                  <literal>qemu</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/qemu">&pop-qemu;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/q/qemu.html">&size-qemu;</ulink></entry>
                <entry><ulink url="&qemu;">Qemu</ulink>: fast generic processor emulator
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/virtualbox-ose">
                  <literal>virtualbox-ose</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/virtualbox-ose">&pop-virtualboxose;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/v/virtualbox-ose.html">&size-virtualboxose;</ulink></entry>
                <entry><ulink url="&virtualbox;">VirtualBox</ulink>: x86 virtualization solution on i386 and amd64
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/wine">
                  <literal>wine</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/wine">&pop-wine;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/w/wine.html">&size-wine;</ulink></entry>
                <entry><ulink url="&wine;">Wine</ulink>: Windows API Implementation (standard suite)
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/dosbox">
                  <literal>dosbox</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/dosbox">&pop-dosbox;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/d/dosbox.html">&size-dosbox;</ulink></entry>
                <entry><ulink url="&dosbox;">DOSBox</ulink>: x86 emulator with Tandy/Herc/CGA/EGA/VGA/SVGA graphics, sound and DOS
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/util-vserver">
                  <literal>util-vserver</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/util-vserver">&pop-utilvserver;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/u/util-vserver.html">&size-utilvserver;</ulink></entry>
                <entry><ulink url="&linuxvserver;">Linux-VServer</ulink> virtual private servers - user-space tools
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/vzctl">
                  <literal>vzctl</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/vzctl">&pop-vzctl;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/v/vzctl.html">&size-vzctl;</ulink></entry>
                <entry><ulink url="&openvz;">OpenVZ</ulink> server virtualization solution - control tools
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/vzquota">
                  <literal>vzquota</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/vzquota">&pop-vzquota;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/v/vzquota.html">&size-vzquota;</ulink></entry>
                <entry><ulink url="&openvz;">OpenVZ</ulink> server virtualization solution - quota tools
    </entry>
              </row>
            </tbody>
          </tgroup>
        </table>
        <simpara>See Wikipedia article <ulink url="&comparisonofvirtualmachines;">Comparison of virtual machines</ulink> for detail comparison of different virtualization solutions.</simpara>
      </section>
      <section id="_chroot_system">
        <title>Chroot system</title>
        <simpara><literal>chroot</literal>(8) offers most basic way to run different instances of the GNU/Linux environment on a single system simultaneously without rebooting.</simpara>
        <caution>
          <simpara>Examples below assumes both parent system and chroot system share the same CPU architecture.</simpara>
        </caution>
        <simpara>You can learn how to setup and use <literal>chroot</literal>(8) by running <literal>pbuilder</literal>(8) program under <literal>script</literal>(1) as follows.</simpara>
        <screen>$ sudo mkdir /sid-root
$ sudo pbuilder --create --no-targz --debug --buildplace /sid-root</screen>
        <simpara>You will see how <literal>debootstrap</literal>(8) or <literal>debootstrap</literal>(1) populate system data for <literal>sid</literal> environment under "<literal>/sid-root</literal>".</simpara>
        <tip>
          <simpara>These <literal>debootstrap</literal>(8) or <literal>debootstrap</literal>(1) are used to <ulink url="&installdebian;">install Debian</ulink> by the Debian Installer.  These can also be used to install Debian to a system without using a Debian install disk, but instead from another GNU/Linux distribution.</simpara>
        </tip>
        <screen>$ sudo pbuilder --login --no-targz  --debug --buildplace /sid-root</screen>
        <simpara>You will see how a system shell running under <literal>sid</literal> environment is created:</simpara>
        <itemizedlist>
          <listitem>
            <simpara>
copying local configuration (<literal>"/etc/hosts</literal>", <literal>"/etc/hostname</literal>", <literal>"/etc/resolv.conf</literal>")
</simpara>
          </listitem>
          <listitem>
            <simpara>
mounting "<literal>/proc</literal>" filesystem
</simpara>
          </listitem>
          <listitem>
            <simpara>
mounting "<literal>/dev/pts</literal>" filesystem
</simpara>
          </listitem>
          <listitem>
            <simpara>
"<literal>/usr/sbin/policy-rc.d</literal>" created (this always exits with 101)
</simpara>
          </listitem>
          <listitem>
            <simpara>
run "<literal>chroot /sid-root bin/bash -c 'exec -a -bash bin/bash'</literal>"
</simpara>
          </listitem>
        </itemizedlist>
        <note>
          <simpara>Some programs under chroot may require access to more files from the parent system to function than <literal>pbuilder</literal> provides.  For example, "<literal>/sys</literal>", "<literal>/etc/passwd</literal>", "<literal>/etc/group</literal>", "<literal>/var/run/utmp</literal>", "<literal>/var/log/wtmp</literal>", etc.. may need to be bind-mounted or copied.</simpara>
        </note>
        <note>
          <simpara>The "<literal>/usr/sbin/policy-rc.d</literal>" file prevents daemon programs to be started automatically on Debian system.  See "<literal>/usr/share/doc/sysv-rc/README.policy-rc.d.gz</literal>".</simpara>
        </note>
        <tip>
          <simpara>The original purpose of the specialized chroot package, <literal>pbuilder</literal> is to construct a chroot system and builds a package inside the chroot.  It is an ideal system to use to check that a package's build-dependencies are correct, and to be sure that unnecessary and wrong build dependencies will not exist in the resulting package.</simpara>
        </tip>
        <tip>
          <simpara>Similar <literal>schroot</literal> package may give you an idea to run <literal>i386</literal> chroot system under <literal>amd64</literal> parent system.</simpara>
        </tip>
        <tip>
          <simpara>By installing a system into a separate partition using the installer of other distributions and using this system for <literal>chroot</literal>(8), you can run other distributions under <literal>chroot</literal>(8).</simpara>
        </tip>
      </section>
      <section id="_setting_up_login_for_chroot">
        <title>Setting up login for chroot</title>
        <simpara>You can run another login process on a separate virtual terminal where you can log in to the chroot system directly.  Since on default Debian systems <literal>tty1</literal> to <literal>tty6</literal> run Linux consoles and <literal>tty7</literal> runs the X Window System, let's set up <literal>tty8</literal> for a chrooted console as an example.  After creating a <literal>sid</literal> chroot system under "<literal>/sid-root</literal>" by following steps you learned from <literal>pbuilder</literal>(8), type from the root shell of the main system:</simpara>
        <screen>main # echo "8:23:respawn:/usr/sbin/chroot /sid-root /sbin/getty 38400 tty8"  &gt;&gt; /etc/inittab
main # init q</screen>
        <itemizedlist>
          <listitem>
            <simpara>
reload init
</simpara>
          </listitem>
        </itemizedlist>
      </section>
    </section>
  </chapter>
  <chapter id="_data_management">
    <title>Data management</title>
    <simpara>Tools and tips for managing binary and text data on the Debian system are described.</simpara>
    <section id="_sharing_copying_and_archiving">
      <title>Sharing, copying, and archiving</title>
      <simpara>The security of the data and its controlled sharing have several aspects:</simpara>
      <itemizedlist>
        <listitem>
          <simpara>
the creation of data archive,
</simpara>
        </listitem>
        <listitem>
          <simpara>
the remote storage access,
</simpara>
        </listitem>
        <listitem>
          <simpara>
the duplication,
</simpara>
        </listitem>
        <listitem>
          <simpara>
the tracking of the modification history,
</simpara>
        </listitem>
        <listitem>
          <simpara>
the facilitation of data sharing,
</simpara>
        </listitem>
        <listitem>
          <simpara>
the prevention of unauthorized file access, and
</simpara>
        </listitem>
        <listitem>
          <simpara>
the detection of unauthorized file modification.
</simpara>
        </listitem>
      </itemizedlist>
      <simpara>These can be realized by using some combination of:</simpara>
      <itemizedlist>
        <listitem>
          <simpara>
the archive and compression tools,
</simpara>
        </listitem>
        <listitem>
          <simpara>
the copy and synchronization tools,
</simpara>
        </listitem>
        <listitem>
          <simpara>
the network file system,
</simpara>
        </listitem>
        <listitem>
          <simpara>
the removable storage media,
</simpara>
        </listitem>
        <listitem>
          <simpara>
the secure shell,
</simpara>
        </listitem>
        <listitem>
          <simpara>
the authentication system,
</simpara>
        </listitem>
        <listitem>
          <simpara>
the version control system tools, and
</simpara>
        </listitem>
        <listitem>
          <simpara>
hash and cryptographic encryption tools.
</simpara>
        </listitem>
      </itemizedlist>
      <section id="_archive_and_compression_tools">
        <title>Archive and compression tools</title>
        <simpara>Here is a summary of archive and compression tools available on the Debian system:</simpara>
        <table id="listofarchiveandcompressiontools" pgwide="0" frame="topbot" rowsep="1" colsep="1">
          <title>List of archive and compression tools.</title>
          <tgroup cols="6">
            <colspec colwidth="10%*" align="left"/>
            <colspec colwidth="10%*" align="left"/>
            <colspec colwidth="10%*" align="left"/>
            <colspec colwidth="10%*" align="left"/>
            <colspec colwidth="10%*" align="left"/>
            <colspec colwidth="50%*" align="left"/>
            <thead>
              <row>
                <entry>
    package
    </entry>
                <entry>
    popcon
    </entry>
                <entry>
    size
    </entry>
                <entry>
    command
    </entry>
                <entry>
    extension
    </entry>
                <entry>
    comment
    </entry>
              </row>
            </thead>
            <tbody>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/tar">
                  <literal>tar</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/tar">&pop-tar;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/t/tar.html">&size-tar;</ulink></entry>
                <entry><literal>tar</literal>(1)
    </entry>
                <entry>
                  <literal>.tar</literal>
                </entry>
                <entry>
    the standard archiver (de facto standard)
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/cpio">
                  <literal>cpio</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/cpio">&pop-cpio;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/c/cpio.html">&size-cpio;</ulink></entry>
                <entry><literal>cpio</literal>(1)
    </entry>
                <entry>
                  <literal>.cpio</literal>
                </entry>
                <entry>
    Unix System V style archiver, use with <literal>find</literal>(1)
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/binutils">
                  <literal>binutils</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/binutils">&pop-binutils;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/b/binutils.html">&size-binutils;</ulink></entry>
                <entry><literal>ar</literal>(1)
    </entry>
                <entry>
                  <literal>.ar</literal>
                </entry>
                <entry>
    archiver for the creation of static libraries
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/fastjar">
                  <literal>fastjar</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/fastjar">&pop-fastjar;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/f/fastjar.html">&size-fastjar;</ulink></entry>
                <entry><literal>fastjar</literal>(1)
    </entry>
                <entry>
                  <literal>.jar</literal>
                </entry>
                <entry>
    archiver for Java (zip like)
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/pax">
                  <literal>pax</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/pax">&pop-pax;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/p/pax.html">&size-pax;</ulink></entry>
                <entry><literal>pax</literal>(1)
    </entry>
                <entry>
                  <literal>.pax</literal>
                </entry>
                <entry>
    new POSIX standard archiver, compromise between <literal>tar</literal> and <literal>cpio</literal>
    </entry>
              </row>
              <row>
                <entry><ulink url="http://packages.debian.org/sid/afio">
                  <literal>afio</literal>
                </ulink></entry>
                <entry><ulink url="http://bugs.debian.org/afio">&pop-afio;</ulink></entry>
                <entry><ulink url="http://packages.qa.debian.org/a/afio.html">&size-afio;</ulink></entry>
                <entry><literal>afio</literal>(1)
    </entry>
                <entry>
                  <literal>.afio</literal>
                </entry>
                <entry>
    extended <literal>cpio</literal> with per-file compression etc.
    </entry>
              </row>
              <row>
                <entry><ulink url="http