Parent Directory
|
Revision Log
more translation and kee up with asciidoc changes
| 1 | <?xml version="1.0"?> |
| 2 | <!-- -*- DocBook -*- --> |
| 3 | <!DOCTYPE book PUBLIC "-//OASIS//DTD DocBook XML V4.2//EN" |
| 4 | "/usr/share/sgml/docbook/dtd/xml/4.2/docbookx.dtd" [ |
| 5 | <!ENTITY % sgml.features "IGNORE"> |
| 6 | <!ENTITY % xml.features "INCLUDE"> |
| 7 | <!ENTITY % dbcent PUBLIC |
| 8 | "-//OASIS//ENTITIES DocBook Character Entities V4.2//EN" |
| 9 | "/usr/share/sgml/docbook/dtd/xml/4.2/dbcentx.mod"> %dbcent; |
| 10 | <!ENTITY % commondata SYSTEM "common.ent" > %commondata; |
| 11 | <!ENTITY % popcon SYSTEM "popcon.ent" > %popcon; |
| 12 | <!ENTITY % datadate1 SYSTEM "datadatepop.ent" > %datadate1; |
| 13 | <!ENTITY % pkgsize SYSTEM "pkgsize.ent" > %pkgsize; |
| 14 | <!ENTITY % datadate2 SYSTEM "datadatesize.ent"> %datadate2; |
| 15 | <!ENTITY % urlsdata SYSTEM "urls.ent" > %urlsdata; |
| 16 | ]> |
| 17 | <book lang="en"> |
| 18 | <bookinfo> |
| 19 | <title>Debian Reference</title> |
| 20 | <author> |
| 21 | <firstname>Osamu</firstname> |
| 22 | <surname>Aoki</surname> |
| 23 | </author> |
| 24 | <authorinitials>OA</authorinitials> |
| 25 | <abstract> |
| 26 | <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> |
| 27 | </abstract> |
| 28 | <copyright> |
| 29 | <year>2007-2009</year> |
| 30 | <holder>Osamu Aoki</holder> |
| 31 | </copyright> |
| 32 | <legalnotice> |
| 33 | <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> |
| 34 | </legalnotice> |
| 35 | </bookinfo> |
| 36 | <preface id="_preface"> |
| 37 | <title>Preface</title> |
| 38 | <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> |
| 39 | <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> |
| 40 | <section id="_disclaimer"> |
| 41 | <title>Disclaimer</title> |
| 42 | <simpara>All warranties are disclaimed. All trademarks are property of their respective trademark owners.</simpara> |
| 43 | <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> |
| 44 | <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> |
| 45 | </section> |
| 46 | <section id="_what_is_debian"> |
| 47 | <title>What is Debian</title> |
| 48 | <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> |
| 49 | <itemizedlist> |
| 50 | <listitem> |
| 51 | <simpara> |
| 52 | Commitment to the software freedom: <ulink url="&debiansocialcontreguidelinesdfsg;">Debian Social Contract and Debian Free Software Guidelines (DFSG)</ulink>. |
| 53 | </simpara> |
| 54 | </listitem> |
| 55 | <listitem> |
| 56 | <simpara> |
| 57 | Internet based distributed unpaid volunteer effort: <ulink url="&httpwwwdebianorg;">http://www.debian.org</ulink> |
| 58 | </simpara> |
| 59 | </listitem> |
| 60 | <listitem> |
| 61 | <simpara> |
| 62 | Large number of pre-compiled high quality softwares. |
| 63 | </simpara> |
| 64 | </listitem> |
| 65 | <listitem> |
| 66 | <simpara> |
| 67 | Focus on stability and security with easy access to the security updates. |
| 68 | </simpara> |
| 69 | </listitem> |
| 70 | <listitem> |
| 71 | <simpara> |
| 72 | Focus on smooth upgrade to latest softwares with <literal>unstable</literal> and <literal>testing</literal> archives. |
| 73 | </simpara> |
| 74 | </listitem> |
| 75 | <listitem> |
| 76 | <simpara> |
| 77 | Large number of supported hardware architectures. |
| 78 | </simpara> |
| 79 | </listitem> |
| 80 | </itemizedlist> |
| 81 | <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> |
| 82 | </section> |
| 83 | <section id="_about_this_document"> |
| 84 | <title>About this document</title> |
| 85 | <section id="_guiding_rules"> |
| 86 | <title>Guiding rules</title> |
| 87 | <simpara>Following guiding rules were followed while compiling this document:</simpara> |
| 88 | <itemizedlist> |
| 89 | <listitem> |
| 90 | <simpara> |
| 91 | don't explain in details what is well documented elsewhere (in the judgment of the author) |
| 92 | </simpara> |
| 93 | </listitem> |
| 94 | <listitem> |
| 95 | <simpara> |
| 96 | Provide overview and skip corner cases (<emphasis role="strong">Big Picture</emphasis>) |
| 97 | </simpara> |
| 98 | </listitem> |
| 99 | <listitem> |
| 100 | <simpara> |
| 101 | Keep It Short and Simple. (<emphasis role="strong">KISS</emphasis>) |
| 102 | </simpara> |
| 103 | </listitem> |
| 104 | <listitem> |
| 105 | <simpara> |
| 106 | Focus on non-GUI tools and consoles. (Use <emphasis role="strong">shell examples</emphasis>) |
| 107 | </simpara> |
| 108 | </listitem> |
| 109 | <listitem> |
| 110 | <simpara> |
| 111 | Do not reinvent the wheel. (Use pointers to <emphasis role="strong">the existing references</emphasis>) |
| 112 | </simpara> |
| 113 | </listitem> |
| 114 | <listitem> |
| 115 | <simpara> |
| 116 | Be objective. (Use <ulink url="&popcon;">popcon</ulink> etc.) |
| 117 | </simpara> |
| 118 | </listitem> |
| 119 | </itemizedlist> |
| 120 | <simpara>I tried to elucidate hierarchical aspects and lower levels of the system.</simpara> |
| 121 | </section> |
| 122 | <section id="_prerequisites"> |
| 123 | <title>Prerequisites</title> |
| 124 | <simpara>You are required to seek help from (in approximate order of importance, starting with the most important sources):</simpara> |
| 125 | <itemizedlist> |
| 126 | <listitem> |
| 127 | <simpara> |
| 128 | the Debian site at <ulink url="&httpwwwdebianorg;">http://www.debian.org</ulink> for the general information, |
| 129 | </simpara> |
| 130 | </listitem> |
| 131 | <listitem> |
| 132 | <simpara> |
| 133 | the documentation under the "<literal>/usr/share/doc/<package_name></literal>" directory, |
| 134 | </simpara> |
| 135 | </listitem> |
| 136 | <listitem> |
| 137 | <simpara> |
| 138 | the Unix style <emphasis role="strong">manpage</emphasis>: "<literal>dpkg -L <package_name> |grep '/man/man.*/'</literal>", |
| 139 | </simpara> |
| 140 | </listitem> |
| 141 | <listitem> |
| 142 | <simpara> |
| 143 | the GNU style <emphasis role="strong">info page</emphasis>: "<literal>dpkg -L <package_name> |grep '/info/'</literal>", |
| 144 | </simpara> |
| 145 | </listitem> |
| 146 | <listitem> |
| 147 | <simpara> |
| 148 | the bug report: <ulink url="&httpbugsdebianorgpackage_name;">http://bugs.debian.org/<package_name></ulink>, |
| 149 | </simpara> |
| 150 | </listitem> |
| 151 | <listitem> |
| 152 | <simpara> |
| 153 | the Debian Wiki at <ulink url="&httpwikidebianorg;">http://wiki.debian.org/</ulink> for the moving and specific topics, |
| 154 | </simpara> |
| 155 | </listitem> |
| 156 | <listitem> |
| 157 | <simpara> |
| 158 | the HOWTOs from The Linux Documentation Project (TLDP) at <ulink url="&httptldporg;">http://tldp.org/</ulink> , |
| 159 | </simpara> |
| 160 | </listitem> |
| 161 | <listitem> |
| 162 | <simpara> |
| 163 | the Single UNIX Specification from the Open Group's The UNIX System Home Page at <ulink url="&httpwwwunixorg;">http://www.unix.org/</ulink> , and |
| 164 | </simpara> |
| 165 | </listitem> |
| 166 | <listitem> |
| 167 | <simpara> |
| 168 | the free encyclopedia from Wikipedia at <ulink url="&httpwikipediaorg;">http://wikipedia.org/</ulink>. |
| 169 | </simpara> |
| 170 | </listitem> |
| 171 | </itemizedlist> |
| 172 | <note> |
| 173 | <simpara>For detailed documentation, you may need to install the corresponding documentation package named with "<literal>-doc</literal>" as its suffix.</simpara> |
| 174 | </note> |
| 175 | </section> |
| 176 | <section id="_conventions"> |
| 177 | <title>Conventions</title> |
| 178 | <simpara>This document provides information through the following simplified presentation style with <literal>bash</literal>(1) shell command examples and bullets:</simpara> |
| 179 | <screen># <command in root account> |
| 180 | $ <command in user account></screen> |
| 181 | <itemizedlist> |
| 182 | <listitem> |
| 183 | <simpara> |
| 184 | <description of action> |
| 185 | </simpara> |
| 186 | </listitem> |
| 187 | </itemizedlist> |
| 188 | <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> |
| 189 | <note> |
| 190 | <simpara>See the meaning of the "<literal>$PS1</literal>" and "<literal>$PS2</literal>" environment variables in <literal>bash</literal>(1).</simpara> |
| 191 | </note> |
| 192 | <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> |
| 193 | <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> |
| 194 | <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> |
| 195 | <screen>$ man 1 bash</screen> |
| 196 | <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> |
| 197 | <screen>$ man 5 sources.list</screen> |
| 198 | <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> |
| 199 | <screen>$ info make</screen> |
| 200 | <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> |
| 201 | <screen>$ sensible-pager "/etc/passwd"</screen> |
| 202 | <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> |
| 203 | <screen>$ mc "/etc/init.d/"</screen> |
| 204 | <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> |
| 205 | <screen>$ dpkg -L vim |
| 206 | $ apt-cache show vim |
| 207 | $ aptitude show vim</screen> |
| 208 | <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> |
| 209 | <screen>$ zcat "/usr/share/doc/sysv-rc/README.runlevels.gz" | sensible-pager |
| 210 | $ sensible-browser "/usr/share/doc/base-passwd/users-and-groups.html" |
| 211 | $ sensible-browse "http://www.debian.org"</screen> |
| 212 | <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> |
| 213 | <screen>$ echo "$TERM"</screen> |
| 214 | </section> |
| 215 | <section id="_the_popcon"> |
| 216 | <title>The popcon</title> |
| 217 | <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> |
| 218 | <note> |
| 219 | <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> |
| 220 | </note> |
| 221 | <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> |
| 222 | <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> |
| 223 | <note> |
| 224 | <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> |
| 225 | </note> |
| 226 | </section> |
| 227 | <section id="_the_package_size"> |
| 228 | <title>The package size</title> |
| 229 | <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> |
| 230 | <note> |
| 231 | <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> |
| 232 | </note> |
| 233 | </section> |
| 234 | <section id="_bug_reports"> |
| 235 | <title>Bug reports</title> |
| 236 | <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> |
| 237 | </section> |
| 238 | </section> |
| 239 | <section id="_some_quotes_for_new_users"> |
| 240 | <title>Some quotes for new users</title> |
| 241 | <simpara>Here are some interesting quotes from the Debian mailing list which may help enlighten new users:</simpara> |
| 242 | <itemizedlist> |
| 243 | <listitem> |
| 244 | <simpara> |
| 245 | "This is Unix. It gives you enough rope to hang yourself." --- Miquel van Smoorenburg <literal><miquels at cistron.nl></literal> |
| 246 | </simpara> |
| 247 | </listitem> |
| 248 | <listitem> |
| 249 | <simpara> |
| 250 | "Unix IS user friendly… It's just selective about who its friends are." --- Tollef Fog Heen <literal><tollef at add.no></literal> |
| 251 | </simpara> |
| 252 | </listitem> |
| 253 | </itemizedlist> |
| 254 | </section> |
| 255 | </preface> |
| 256 | <chapter id="_gnu_linux_tutorials"> |
| 257 | <title>GNU/Linux tutorials</title> |
| 258 | <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> |
| 259 | <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> |
| 260 | <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> |
| 261 | <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> |
| 262 | <note> |
| 263 | <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> |
| 264 | </note> |
| 265 | <section id="_console_basics"> |
| 266 | <title>Console basics</title> |
| 267 | <section id="_the_shell_prompt"> |
| 268 | <title>The shell prompt</title> |
| 269 | <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> |
| 270 | <screen>foo login:</screen> |
| 271 | <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> |
| 272 | <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> |
| 273 | <note> |
| 274 | <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> |
| 275 | </note> |
| 276 | <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> |
| 277 | <screen>Debian GNU/Linux lenny/sid foo tty1 |
| 278 | foo login: penguin |
| 279 | Password: |
| 280 | Last login: Sun Apr 22 09:29:34 2007 on tty1 |
| 281 | Linux snoopy 2.6.20-1-amd64 #1 SMP Sun Apr 15 20:25:49 UTC 2007 x86_64 |
| 282 | |
| 283 | The programs included with the Debian GNU/Linux system are free software; |
| 284 | the exact distribution terms for each program are described in the |
| 285 | individual files in /usr/share/doc/*/copyright. |
| 286 | |
| 287 | Debian GNU/Linux comes with ABSOLUTELY NO WARRANTY, to the extent |
| 288 | permitted by applicable law. |
| 289 | foo:~$</screen> |
| 290 | <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> |
| 291 | <simpara>Now you are in the <ulink url="&shell;">shell</ulink>. The shell interprets your commands.</simpara> |
| 292 | </section> |
| 293 | <section id="_the_shell_prompt_under_x"> |
| 294 | <title>The shell prompt under X</title> |
| 295 | <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> |
| 296 | <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> |
| 297 | <simpara>You can also see the section below <xref linkend="_virtual_consoles"/>.</simpara> |
| 298 | <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> |
| 299 | </section> |
| 300 | <section id="_the_root_account"> |
| 301 | <title>The root account</title> |
| 302 | <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> |
| 303 | <itemizedlist> |
| 304 | <listitem> |
| 305 | <simpara> |
| 306 | read, write, and remove any files on the system irrespective of their file permissions |
| 307 | </simpara> |
| 308 | </listitem> |
| 309 | <listitem> |
| 310 | <simpara> |
| 311 | set file ownership and permissions of any files on the system |
| 312 | </simpara> |
| 313 | </listitem> |
| 314 | <listitem> |
| 315 | <simpara> |
| 316 | set the password of any non-privileged users on the system |
| 317 | </simpara> |
| 318 | </listitem> |
| 319 | <listitem> |
| 320 | <simpara> |
| 321 | login to any accounts without their passwords |
| 322 | </simpara> |
| 323 | </listitem> |
| 324 | </itemizedlist> |
| 325 | <simpara>This unlimited power of root account requires you to be considerate and responsible when using it.</simpara> |
| 326 | <warning> |
| 327 | <simpara>Never share the root password with others.</simpara> |
| 328 | </warning> |
| 329 | <note> |
| 330 | <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> |
| 331 | </note> |
| 332 | </section> |
| 333 | <section id="_the_root_shell_prompt"> |
| 334 | <title>The root shell prompt</title> |
| 335 | <simpara>Here are a few basic methods to gain the root shell prompt by using the root password:</simpara> |
| 336 | <itemizedlist> |
| 337 | <listitem> |
| 338 | <simpara> |
| 339 | At the character based login prompt, you simply type <literal>root</literal>. |
| 340 | </simpara> |
| 341 | </listitem> |
| 342 | <listitem> |
| 343 | <simpara> |
| 344 | Under the GNOME Desktop environment, click "Applications" → "Accessories" → "Root Terminal". |
| 345 | </simpara> |
| 346 | </listitem> |
| 347 | <listitem> |
| 348 | <simpara> |
| 349 | From any user shell prompt, type "<literal>su -l</literal>". (This does not preserve the environment of the current user) |
| 350 | </simpara> |
| 351 | </listitem> |
| 352 | <listitem> |
| 353 | <simpara> |
| 354 | From any user shell prompt, type "<literal>su</literal>". (This preserves some of the environment of the current user) |
| 355 | </simpara> |
| 356 | </listitem> |
| 357 | </itemizedlist> |
| 358 | </section> |
| 359 | <section id="_gui_system_administration_tools"> |
| 360 | <title>GUI system administration tools</title> |
| 361 | <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> |
| 362 | <warning> |
| 363 | <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> |
| 364 | </warning> |
| 365 | <warning> |
| 366 | <simpara>Never run untrusted remote GUI program under X window when critical information is displayed since it may eavesdrop your X screen.</simpara> |
| 367 | </warning> |
| 368 | </section> |
| 369 | <section id="_virtual_consoles"> |
| 370 | <title>Virtual consoles</title> |
| 371 | <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> |
| 372 | <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> |
| 373 | <simpara>You can alternatively change to another virtual console, e.g. to the console 1, by the command:</simpara> |
| 374 | <screen># chvt 1</screen> |
| 375 | </section> |
| 376 | <section id="_how_to_leave_the_command_prompt"> |
| 377 | <title>How to leave the command prompt</title> |
| 378 | <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> |
| 379 | <simpara>If you are at <literal>x-terminal-emulator</literal>(1), you can close <literal>x-terminal-emulator</literal> window with this.</simpara> |
| 380 | </section> |
| 381 | <section id="_how_to_shutdown_the_system"> |
| 382 | <title>How to shutdown the system</title> |
| 383 | <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> |
| 384 | <simpara>Under the normal multiuser mode, use following from the root command prompt to shutdown the system:</simpara> |
| 385 | <screen># shutdown -h now</screen> |
| 386 | <simpara>Under the single-user mode, use following from the root command prompt to shutdown the system:</simpara> |
| 387 | <screen># poweroff -i -f</screen> |
| 388 | <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> |
| 389 | </section> |
| 390 | <section id="_recovering_a_sane_console"> |
| 391 | <title>Recovering a sane console</title> |
| 392 | <simpara>When the screen goes berserk after doing some funny things such as "<literal>cat <some-binary-file></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> |
| 393 | </section> |
| 394 | <section id="_additional_package_suggestions_for_the_newbie"> |
| 395 | <title>Additional package suggestions for the newbie</title> |
| 396 | <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> |
| 397 | <screen># aptitude update |
| 398 | ... |
| 399 | # aptitude install mc vim sudo |
| 400 | ...</screen> |
| 401 | <simpara>If you already had these packages installed, nothing will be installed.</simpara> |
| 402 | <table id="listofinterestineprogrampackages" pgwide="0" frame="topbot" rowsep="1" colsep="1"> |
| 403 | <title>List of interesting text-mode program packages.</title> |
| 404 | <tgroup cols="4"> |
| 405 | <colspec colwidth="72" align="left"/> |
| 406 | <colspec colwidth="72" align="left"/> |
| 407 | <colspec colwidth="72" align="left"/> |
| 408 | <colspec colwidth="288" align="left"/> |
| 409 | <thead> |
| 410 | <row> |
| 411 | <entry> |
| 412 | package |
| 413 | </entry> |
| 414 | <entry> |
| 415 | popcon |
| 416 | </entry> |
| 417 | <entry> |
| 418 | size |
| 419 | </entry> |
| 420 | <entry> |
| 421 | description |
| 422 | </entry> |
| 423 | </row> |
| 424 | </thead> |
| 425 | <tbody> |
| 426 | <row> |
| 427 | <entry><ulink url="http://packages.debian.org/sid/mc"> |
| 428 | <literal>mc</literal> |
| 429 | </ulink></entry> |
| 430 | <entry><ulink url="http://bugs.debian.org/mc">&pop-mc;</ulink></entry> |
| 431 | <entry><ulink url="http://packages.qa.debian.org/m/mc.html">&size-mc;</ulink></entry> |
| 432 | <entry> |
| 433 | A text-mode full-screen file manager |
| 434 | </entry> |
| 435 | </row> |
| 436 | <row> |
| 437 | <entry><ulink url="http://packages.debian.org/sid/sudo"> |
| 438 | <literal>sudo</literal> |
| 439 | </ulink></entry> |
| 440 | <entry><ulink url="http://bugs.debian.org/sudo">&pop-sudo;</ulink></entry> |
| 441 | <entry><ulink url="http://packages.qa.debian.org/s/sudo.html">&size-sudo;</ulink></entry> |
| 442 | <entry> |
| 443 | A program to allow limited root privileges to users |
| 444 | </entry> |
| 445 | </row> |
| 446 | <row> |
| 447 | <entry><ulink url="http://packages.debian.org/sid/vim"> |
| 448 | <literal>vim</literal> |
| 449 | </ulink></entry> |
| 450 | <entry><ulink url="http://bugs.debian.org/vim">&pop-vim;</ulink></entry> |
| 451 | <entry><ulink url="http://packages.qa.debian.org/v/vim.html">&size-vim;</ulink></entry> |
| 452 | <entry> |
| 453 | Unix text editor Vi IMproved, a programmers text editor (standard version) |
| 454 | </entry> |
| 455 | </row> |
| 456 | <row> |
| 457 | <entry><ulink url="http://packages.debian.org/sid/vim-tiny"> |
| 458 | <literal>vim-tiny</literal> |
| 459 | </ulink></entry> |
| 460 | <entry><ulink url="http://bugs.debian.org/vim-tiny">&pop-vimtiny;</ulink></entry> |
| 461 | <entry><ulink url="http://packages.qa.debian.org/v/vim-tiny.html">&size-vimtiny;</ulink></entry> |
| 462 | <entry> |
| 463 | Unix text editor Vi IMproved, a programmers text editor (compact version) |
| 464 | </entry> |
| 465 | </row> |
| 466 | <row> |
| 467 | <entry><ulink url="http://packages.debian.org/sid/emacs21"> |
| 468 | <literal>emacs21</literal> |
| 469 | </ulink></entry> |
| 470 | <entry><ulink url="http://bugs.debian.org/emacs21">&pop-emacscb;</ulink></entry> |
| 471 | <entry><ulink url="http://packages.qa.debian.org/e/emacs21.html">&size-emacscb;</ulink></entry> |
| 472 | <entry> |
| 473 | GNU project Emacs, the Lisp based extensible text editor (version 21) |
| 474 | </entry> |
| 475 | </row> |
| 476 | <row> |
| 477 | <entry><ulink url="http://packages.debian.org/sid/emacs22"> |
| 478 | <literal>emacs22</literal> |
| 479 | </ulink></entry> |
| 480 | <entry><ulink url="http://bugs.debian.org/emacs22">&pop-emacscc;</ulink></entry> |
| 481 | <entry><ulink url="http://packages.qa.debian.org/e/emacs22.html">&size-emacscc;</ulink></entry> |
| 482 | <entry> |
| 483 | GNU project Emacs, the Lisp based extensible text editor (version 22) |
| 484 | </entry> |
| 485 | </row> |
| 486 | <row> |
| 487 | <entry><ulink url="http://packages.debian.org/sid/w3m"> |
| 488 | <literal>w3m</literal> |
| 489 | </ulink></entry> |
| 490 | <entry><ulink url="http://bugs.debian.org/w3m">&pop-wdm;</ulink></entry> |
| 491 | <entry><ulink url="http://packages.qa.debian.org/w/w3m.html">&size-wdm;</ulink></entry> |
| 492 | <entry> |
| 493 | Text-mode WWW browsers |
| 494 | </entry> |
| 495 | </row> |
| 496 | <row> |
| 497 | <entry><ulink url="http://packages.debian.org/sid/gpm"> |
| 498 | <literal>gpm</literal> |
| 499 | </ulink></entry> |
| 500 | <entry><ulink url="http://bugs.debian.org/gpm">&pop-gpm;</ulink></entry> |
| 501 | <entry><ulink url="http://packages.qa.debian.org/g/gpm.html">&size-gpm;</ulink></entry> |
| 502 | <entry> |
| 503 | The Unix style cut-and-paste on the text console (daemon) |
| 504 | </entry> |
| 505 | </row> |
| 506 | </tbody> |
| 507 | </tgroup> |
| 508 | </table> |
| 509 | <simpara>It may be a good idea to read some informative documentations.</simpara> |
| 510 | <table id="listofinformativentationpackages" pgwide="0" frame="topbot" rowsep="1" colsep="1"> |
| 511 | <title>List of informative documentation packages.</title> |
| 512 | <tgroup cols="4"> |
| 513 | <colspec colwidth="72" align="left"/> |
| 514 | <colspec colwidth="72" align="left"/> |
| 515 | <colspec colwidth="72" align="left"/> |
| 516 | <colspec colwidth="288" align="left"/> |
| 517 | <thead> |
| 518 | <row> |
| 519 | <entry> |
| 520 | package |
| 521 | </entry> |
| 522 | <entry> |
| 523 | popcon |
| 524 | </entry> |
| 525 | <entry> |
| 526 | size |
| 527 | </entry> |
| 528 | <entry> |
| 529 | description |
| 530 | </entry> |
| 531 | </row> |
| 532 | </thead> |
| 533 | <tbody> |
| 534 | <row> |
| 535 | <entry><ulink url="http://packages.debian.org/sid/doc-debian"> |
| 536 | <literal>doc-debian</literal> |
| 537 | </ulink></entry> |
| 538 | <entry><ulink url="http://bugs.debian.org/doc-debian">&pop-docdebian;</ulink></entry> |
| 539 | <entry><ulink url="http://packages.qa.debian.org/d/doc-debian.html">&size-docdebian;</ulink></entry> |
| 540 | <entry> |
| 541 | Debian Project documentation, (Debian FAQ) and other documents |
| 542 | </entry> |
| 543 | </row> |
| 544 | <row> |
| 545 | <entry><ulink url="http://packages.debian.org/sid/debian-policy"> |
| 546 | <literal>debian-policy</literal> |
| 547 | </ulink></entry> |
| 548 | <entry><ulink url="http://bugs.debian.org/debian-policy">&pop-debianpolicy;</ulink></entry> |
| 549 | <entry><ulink url="http://packages.qa.debian.org/d/debian-policy.html">&size-debianpolicy;</ulink></entry> |
| 550 | <entry> |
| 551 | Debian Policy Manual and related documents |
| 552 | </entry> |
| 553 | </row> |
| 554 | <row> |
| 555 | <entry><ulink url="http://packages.debian.org/sid/developers-reference"> |
| 556 | <literal>developers-reference</literal> |
| 557 | </ulink></entry> |
| 558 | <entry><ulink url="http://bugs.debian.org/developers-reference">&pop-developersreference;</ulink></entry> |
| 559 | <entry><ulink url="http://packages.qa.debian.org/d/developers-reference.html">&size-developersreference;</ulink></entry> |
| 560 | <entry> |
| 561 | Guidelines and information for Debian developers |
| 562 | </entry> |
| 563 | </row> |
| 564 | <row> |
| 565 | <entry><ulink url="http://packages.debian.org/sid/maint-guide"> |
| 566 | <literal>maint-guide</literal> |
| 567 | </ulink></entry> |
| 568 | <entry><ulink url="http://bugs.debian.org/maint-guide">&pop-maintguide;</ulink></entry> |
| 569 | <entry><ulink url="http://packages.qa.debian.org/m/maint-guide.html">&size-maintguide;</ulink></entry> |
| 570 | <entry> |
| 571 | Debian New Maintainers' Guide |
| 572 | </entry> |
| 573 | </row> |
| 574 | <row> |
| 575 | <entry><ulink url="http://packages.debian.org/sid/debian-history"> |
| 576 | <literal>debian-history</literal> |
| 577 | </ulink></entry> |
| 578 | <entry><ulink url="http://bugs.debian.org/debian-history">&pop-debianhistory;</ulink></entry> |
| 579 | <entry><ulink url="http://packages.qa.debian.org/d/debian-history.html">&size-debianhistory;</ulink></entry> |
| 580 | <entry> |
| 581 | History of the Debian Project |
| 582 | </entry> |
| 583 | </row> |
| 584 | <row> |
| 585 | <entry><ulink url="http://packages.debian.org/sid/debian-faq"> |
| 586 | <literal>debian-faq</literal> |
| 587 | </ulink></entry> |
| 588 | <entry><ulink url="http://bugs.debian.org/debian-faq">&pop-debianfaq;</ulink></entry> |
| 589 | <entry><ulink url="http://packages.qa.debian.org/d/debian-faq.html">&size-debianfaq;</ulink></entry> |
| 590 | <entry> |
| 591 | Debian FAQ |
| 592 | </entry> |
| 593 | </row> |
| 594 | <row> |
| 595 | <entry><ulink url="http://packages.debian.org/sid/doc-linux-text"> |
| 596 | <literal>doc-linux-text</literal> |
| 597 | </ulink></entry> |
| 598 | <entry><ulink url="http://bugs.debian.org/doc-linux-text">&pop-doclinuxtext;</ulink></entry> |
| 599 | <entry><ulink url="http://packages.qa.debian.org/d/doc-linux-text.html">&size-doclinuxtext;</ulink></entry> |
| 600 | <entry> |
| 601 | Linux HOWTOs and FAQ (text) |
| 602 | </entry> |
| 603 | </row> |
| 604 | <row> |
| 605 | <entry><ulink url="http://packages.debian.org/sid/doc-linux-html"> |
| 606 | <literal>doc-linux-html</literal> |
| 607 | </ulink></entry> |
| 608 | <entry><ulink url="http://bugs.debian.org/doc-linux-html">&pop-doclinuxhtml;</ulink></entry> |
| 609 | <entry><ulink url="http://packages.qa.debian.org/d/doc-linux-html.html">&size-doclinuxhtml;</ulink></entry> |
| 610 | <entry> |
| 611 | Linux HOWTOs and FAQ (html) |
| 612 | </entry> |
| 613 | </row> |
| 614 | <row> |
| 615 | <entry><ulink url="http://packages.debian.org/sid/sysadmin-guide"> |
| 616 | <literal>sysadmin-guide</literal> |
| 617 | </ulink></entry> |
| 618 | <entry><ulink url="http://bugs.debian.org/sysadmin-guide">&pop-sysadminguide;</ulink></entry> |
| 619 | <entry><ulink url="http://packages.qa.debian.org/s/sysadmin-guide.html">&size-sysadminguide;</ulink></entry> |
| 620 | <entry> |
| 621 | The Linux System Administrators' Guide |
| 622 | </entry> |
| 623 | </row> |
| 624 | <row> |
| 625 | <entry><ulink url="http://packages.debian.org/sid/rutebook"> |
| 626 | <literal>rutebook</literal> |
| 627 | </ulink></entry> |
| 628 | <entry><ulink url="http://bugs.debian.org/rutebook">&pop-rutebook;</ulink></entry> |
| 629 | <entry><ulink url="http://packages.qa.debian.org/r/rutebook.html">&size-rutebook;</ulink></entry> |
| 630 | <entry> |
| 631 | Linux: Rute User's Tutorial and Exposition (non-free) |
| 632 | </entry> |
| 633 | </row> |
| 634 | </tbody> |
| 635 | </tgroup> |
| 636 | </table> |
| 637 | <simpara>You can install some of these packages by issuing the following command from the root shell prompt:</simpara> |
| 638 | <screen># aptitude install package_name</screen> |
| 639 | </section> |
| 640 | <section id="_an_extra_user_account"> |
| 641 | <title>An extra user account</title> |
| 642 | <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> |
| 643 | <screen># adduser fish</screen> |
| 644 | <itemizedlist> |
| 645 | <listitem> |
| 646 | <simpara> |
| 647 | answer all the questions |
| 648 | </simpara> |
| 649 | </listitem> |
| 650 | </itemizedlist> |
| 651 | <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> |
| 652 | <screen># deluser --remove-home fish</screen> |
| 653 | </section> |
| 654 | <section id="_sudo_configuration"> |
| 655 | <title>sudo configuration</title> |
| 656 | <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> |
| 657 | <screen># echo "penguin ALL=(ALL) ALL" >> /etc/sudoers</screen> |
| 658 | <simpara>This trick should only be used for the single user workstation which you administer and where you are the only user.</simpara> |
| 659 | <warning> |
| 660 | <simpara>Do not set up accounts of regular users on multiuser workstation like this because it would be very bad for system security.</simpara> |
| 661 | </warning> |
| 662 | <caution> |
| 663 | <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> |
| 664 | </caution> |
| 665 | <caution> |
| 666 | <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> |
| 667 | </caution> |
| 668 | <note> |
| 669 | <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> |
| 670 | </note> |
| 671 | <note> |
| 672 | <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> |
| 673 | </note> |
| 674 | </section> |
| 675 | <section id="_play_time"> |
| 676 | <title>Play time</title> |
| 677 | <simpara>Now you are ready to play with the Debian system without risks as long as you use the non-privileged user account.</simpara> |
| 678 | <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> |
| 679 | <simpara>We will learn the Debian system as a <ulink url="&unixlike;">Unix-like</ulink> system with:</simpara> |
| 680 | <itemizedlist> |
| 681 | <listitem> |
| 682 | <simpara><xref linkend="_unix_like_filesystem"/> (basic concept), |
| 683 | </simpara> |
| 684 | </listitem> |
| 685 | <listitem> |
| 686 | <simpara><xref linkend="_midnight_commander_mc"/> (survival method), |
| 687 | </simpara> |
| 688 | </listitem> |
| 689 | <listitem> |
| 690 | <simpara><xref linkend="_the_basic_unix_like_work_environment"/> (basic method), |
| 691 | </simpara> |
| 692 | </listitem> |
| 693 | <listitem> |
| 694 | <simpara><xref linkend="_the_simple_shell_command"/> (shell mechanism), and |
| 695 | </simpara> |
| 696 | </listitem> |
| 697 | <listitem> |
| 698 | <simpara><xref linkend="_unix_like_text_processing"/> (text processing method). |
| 699 | </simpara> |
| 700 | </listitem> |
| 701 | </itemizedlist> |
| 702 | </section> |
| 703 | </section> |
| 704 | <section id="_unix_like_filesystem"> |
| 705 | <title>Unix-like filesystem</title> |
| 706 | <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> |
| 707 | <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> |
| 708 | <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> |
| 709 | <section id="_unix_file_basics"> |
| 710 | <title>Unix file basics</title> |
| 711 | <simpara>Here are Unix file basics:</simpara> |
| 712 | <itemizedlist> |
| 713 | <listitem> |
| 714 | <simpara> |
| 715 | Filenames are <emphasis role="strong">case sensitive</emphasis>. That is, "<literal>MYFILE</literal>" and "<literal>MyFile</literal>" are different files. |
| 716 | </simpara> |
| 717 | </listitem> |
| 718 | <listitem> |
| 719 | <simpara> |
| 720 | 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>". |
| 721 | </simpara> |
| 722 | </listitem> |
| 723 | <listitem> |
| 724 | <simpara> |
| 725 | 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. |
| 726 | </simpara> |
| 727 | </listitem> |
| 728 | <listitem> |
| 729 | <simpara> |
| 730 | 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. |
| 731 | </simpara> |
| 732 | </listitem> |
| 733 | <listitem> |
| 734 | <simpara> |
| 735 | 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. |
| 736 | </simpara> |
| 737 | </listitem> |
| 738 | <listitem> |
| 739 | <simpara> |
| 740 | 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. |
| 741 | </simpara> |
| 742 | </listitem> |
| 743 | <listitem> |
| 744 | <simpara> |
| 745 | 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="µsoftwindows;">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"/>.) |
| 746 | </simpara> |
| 747 | </listitem> |
| 748 | </itemizedlist> |
| 749 | <note> |
| 750 | <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>{ } ( ) [ ] ' ` " \ / > < | ; ! # & ^ * % @ $</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> |
| 751 | </note> |
| 752 | <note> |
| 753 | <simpara>The word "root" can mean either "root user" or "root directory". The context of their usage should make it clear.</simpara> |
| 754 | </note> |
| 755 | <note> |
| 756 | <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> |
| 757 | </note> |
| 758 | <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> |
| 759 | <table id="listofusageofkeydirectories" pgwide="0" frame="topbot" rowsep="1" colsep="1"> |
| 760 | <title>List of usage of key directories.</title> |
| 761 | <tgroup cols="2"> |
| 762 | <colspec colwidth="144" align="left"/> |
| 763 | <colspec colwidth="360" align="left"/> |
| 764 | <thead> |
| 765 | <row> |
| 766 | <entry> |
| 767 | directory |
| 768 | </entry> |
| 769 | <entry> |
| 770 | usage |
| 771 | </entry> |
| 772 | </row> |
| 773 | </thead> |
| 774 | <tbody> |
| 775 | <row> |
| 776 | <entry> |
| 777 | <literal>/</literal> |
| 778 | </entry> |
| 779 | <entry> |
| 780 | A simple "<literal>/</literal>" represents the root directory. |
| 781 | </entry> |
| 782 | </row> |
| 783 | <row> |
| 784 | <entry> |
| 785 | <literal>/etc/</literal> |
| 786 | </entry> |
| 787 | <entry> |
| 788 | This is the place for the system wide configuration files. |
| 789 | </entry> |
| 790 | </row> |
| 791 | <row> |
| 792 | <entry> |
| 793 | <literal>/var/log/</literal> |
| 794 | </entry> |
| 795 | <entry> |
| 796 | This is the place for the system log files. |
| 797 | </entry> |
| 798 | </row> |
| 799 | <row> |
| 800 | <entry> |
| 801 | <literal>/home/</literal> |
| 802 | </entry> |
| 803 | <entry> |
| 804 | This is the directory which contains all the home directories for all non-privileged users. |
| 805 | </entry> |
| 806 | </row> |
| 807 | </tbody> |
| 808 | </tgroup> |
| 809 | </table> |
| 810 | </section> |
| 811 | <section id="_filesystem_internals"> |
| 812 | <title>Filesystem internals</title> |
| 813 | <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> |
| 814 | <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> |
| 815 | <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> |
| 816 | <tip> |
| 817 | <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> |
| 818 | </tip> |
| 819 | </section> |
| 820 | <section id="_filesystem_permissions"> |
| 821 | <title>Filesystem permissions</title> |
| 822 | <simpara><ulink url="&filesystempermissions;">Filesystem permissions</ulink> of <ulink url="&unixlike;">Unix-like</ulink> system are defined for three categories of affected users:</simpara> |
| 823 | <itemizedlist> |
| 824 | <listitem> |
| 825 | <simpara> |
| 826 | the <emphasis role="strong">user</emphasis> who owns the file (<emphasis role="strong">u</emphasis>), |
| 827 | </simpara> |
| 828 | </listitem> |
| 829 | <listitem> |
| 830 | <simpara> |
| 831 | other users in the <emphasis role="strong">group</emphasis> which the file belongs to (<emphasis role="strong">g</emphasis>), and |
| 832 | </simpara> |
| 833 | </listitem> |
| 834 | <listitem> |
| 835 | <simpara> |
| 836 | all <emphasis role="strong">other</emphasis> users (<emphasis role="strong">o</emphasis>) also referred to as "world" and "everyone". |
| 837 | </simpara> |
| 838 | </listitem> |
| 839 | </itemizedlist> |
| 840 | <simpara>For the file, each corresponding permission allows:</simpara> |
| 841 | <itemizedlist> |
| 842 | <listitem> |
| 843 | <simpara><emphasis role="strong">read</emphasis> (<emphasis role="strong">r</emphasis>): to examine contents of the file, |
| 844 | </simpara> |
| 845 | </listitem> |
| 846 | <listitem> |
| 847 | <simpara><emphasis role="strong">write</emphasis> (<emphasis role="strong">w</emphasis>): to modify the file, and |
| 848 | </simpara> |
| 849 | </listitem> |
| 850 | <listitem> |
| 851 | <simpara><emphasis role="strong">execute</emphasis> (<emphasis role="strong">x</emphasis>): to run the file as a command. |
| 852 | </simpara> |
| 853 | </listitem> |
| 854 | </itemizedlist> |
| 855 | <simpara>For the directory, each corresponding permission allows:</simpara> |
| 856 | <itemizedlist> |
| 857 | <listitem> |
| 858 | <simpara><emphasis role="strong">read</emphasis> (<emphasis role="strong">r</emphasis>): to list contents of the directory, |
| 859 | </simpara> |
| 860 | </listitem> |
| 861 | <listitem> |
| 862 | <simpara><emphasis role="strong">write</emphasis> (<emphasis role="strong">w</emphasis>): to add or remove files in the directory, and |
| 863 | </simpara> |
| 864 | </listitem> |
| 865 | <listitem> |
| 866 | <simpara><emphasis role="strong">execute</emphasis> (<emphasis role="strong">x</emphasis>): to access files in the directory. |
| 867 | </simpara> |
| 868 | </listitem> |
| 869 | </itemizedlist> |
| 870 | <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> |
| 871 | <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> |
| 872 | <itemizedlist> |
| 873 | <listitem> |
| 874 | <simpara> |
| 875 | the <emphasis role="strong">type of file</emphasis> (first character) |
| 876 | </simpara> |
| 877 | </listitem> |
| 878 | <listitem> |
| 879 | <simpara> |
| 880 | 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) |
| 881 | </simpara> |
| 882 | </listitem> |
| 883 | <listitem> |
| 884 | <simpara> |
| 885 | the <emphasis role="strong">number of hard links</emphasis> to the file |
| 886 | </simpara> |
| 887 | </listitem> |
| 888 | <listitem> |
| 889 | <simpara> |
| 890 | the name of the <emphasis role="strong">user</emphasis> who owns the file |
| 891 | </simpara> |
| 892 | </listitem> |
| 893 | <listitem> |
| 894 | <simpara> |
| 895 | the name of the <emphasis role="strong">group</emphasis> which the file belongs to |
| 896 | </simpara> |
| 897 | </listitem> |
| 898 | <listitem> |
| 899 | <simpara> |
| 900 | the <emphasis role="strong">size</emphasis> of the file in characters (bytes) |
| 901 | </simpara> |
| 902 | </listitem> |
| 903 | <listitem> |
| 904 | <simpara> |
| 905 | the <emphasis role="strong">date and time</emphasis> of the file (mtime) |
| 906 | </simpara> |
| 907 | </listitem> |
| 908 | <listitem> |
| 909 | <simpara> |
| 910 | the <emphasis role="strong">name</emphasis> of the file. |
| 911 | </simpara> |
| 912 | </listitem> |
| 913 | </itemizedlist> |
| 914 | <table id="listofthefirstchacteroflsloutput" pgwide="0" frame="topbot" rowsep="1" colsep="1"> |
| 915 | <title>List of the first character of "<literal>ls -l</literal>" output</title> |
| 916 | <tgroup cols="2"> |
| 917 | <colspec colwidth="144" align="left"/> |
| 918 | <colspec colwidth="360" align="left"/> |
| 919 | <thead> |
| 920 | <row> |
| 921 | <entry> |
| 922 | character |
| 923 | </entry> |
| 924 | <entry> |
| 925 | meaning |
| 926 | </entry> |
| 927 | </row> |
| 928 | </thead> |
| 929 | <tbody> |
| 930 | <row> |
| 931 | <entry> |
| 932 | <literal>-</literal> |
| 933 | </entry> |
| 934 | <entry> |
| 935 | normal file |
| 936 | </entry> |
| 937 | </row> |
| 938 | <row> |
| 939 | <entry> |
| 940 | <literal>d</literal> |
| 941 | </entry> |
| 942 | <entry> |
| 943 | directory |
| 944 | </entry> |
| 945 | </row> |
| 946 | <row> |
| 947 | <entry> |
| 948 | <literal>l</literal> |
| 949 | </entry> |
| 950 | <entry> |
| 951 | symlink |
| 952 | </entry> |
| 953 | </row> |
| 954 | <row> |
| 955 | <entry> |
| 956 | <literal>c</literal> |
| 957 | </entry> |
| 958 | <entry> |
| 959 | character device node |
| 960 | </entry> |
| 961 | </row> |
| 962 | <row> |
| 963 | <entry> |
| 964 | <literal>b</literal> |
| 965 | </entry> |
| 966 | <entry> |
| 967 | block device node |
| 968 | </entry> |
| 969 | </row> |
| 970 | <row> |
| 971 | <entry> |
| 972 | <literal>p</literal> |
| 973 | </entry> |
| 974 | <entry> |
| 975 | named pipe |
| 976 | </entry> |
| 977 | </row> |
| 978 | <row> |
| 979 | <entry> |
| 980 | <literal>s</literal> |
| 981 | </entry> |
| 982 | <entry> |
| 983 | socket |
| 984 | </entry> |
| 985 | </row> |
| 986 | </tbody> |
| 987 | </tgroup> |
| 988 | </table> |
| 989 | <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> |
| 990 | <screen># chown <newowner> foo |
| 991 | # chgrp <newgroup> foo |
| 992 | # chmod [ugoa][+-=][rwxXst][,...] foo</screen> |
| 993 | <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> |
| 994 | <screen># cd /some/location/ |
| 995 | # chown -R foo:bar . |
| 996 | # chmod -R ug+rwX,o=rX .</screen> |
| 997 | <simpara>There are three more special permission bits:</simpara> |
| 998 | <itemizedlist> |
| 999 | <listitem> |
| 1000 | <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>), |
| 1001 | </simpara> |
| 1002 | </listitem> |
| 1003 | <listitem> |
| 1004 | <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 |
| 1005 | </simpara> |
| 1006 | </listitem> |
| 1007 | <listitem> |
| 1008 | <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>). |
| 1009 | </simpara> |
| 1010 | </listitem> |
| 1011 | </itemizedlist> |
| 1012 | <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> |
| 1013 | <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> |
| 1014 | <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> |
| 1015 | <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> |
| 1016 | <simpara>Here are a few interesting examples of file permissions.</simpara> |
| 1017 | <screen>$ ls -l /etc/passwd /etc/shadow /dev/ppp /usr/sbin/exim4 |
| 1018 | crw------- 1 root root 108, 0 2007-04-29 07:00 /dev/ppp |
| 1019 | -rw-r--r-- 1 root root 1427 2007-04-16 00:19 /etc/passwd |
| 1020 | -rw-r----- 1 root shadow 943 2007-04-16 00:19 /etc/shadow |
| 1021 | -rwsr-xr-x 1 root root 700056 2007-04-22 05:29 /usr/sbin/exim4 |
| 1022 | $ ls -ld /tmp /var/tmp /usr/local /var/mail /usr/src |
| 1023 | drwxrwxrwt 10 root root 4096 2007-04-29 07:59 /tmp |
| 1024 | drwxrwsr-x 10 root staff 4096 2007-03-24 18:48 /usr/local |
| 1025 | drwxrwsr-x 4 root src 4096 2007-04-27 00:31 /usr/src |
| 1026 | drwxrwsr-x 2 root mail 4096 2007-03-28 23:33 /var/mail |
| 1027 | drwxrwxrwt 2 root root 4096 2007-04-29 07:11 /var/tmp</screen> |
| 1028 | <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> |
| 1029 | <table id="thenumericmodefoinchmodbcommands" pgwide="0" frame="topbot" rowsep="1" colsep="1"> |
| 1030 | <title>The numeric mode for file permissions in <literal>chmod</literal>(1) commands.</title> |
| 1031 | <tgroup cols="2"> |
| 1032 | <colspec colwidth="144" align="left"/> |
| 1033 | <colspec colwidth="360" align="left"/> |
| 1034 | <thead> |
| 1035 | <row> |
| 1036 | <entry> |
| 1037 | digit |
| 1038 | </entry> |
| 1039 | <entry> |
| 1040 | meaning |
| 1041 | </entry> |
| 1042 | </row> |
| 1043 | </thead> |
| 1044 | <tbody> |
| 1045 | <row> |
| 1046 | <entry> |
| 1047 | 1st optional digit |
| 1048 | </entry> |
| 1049 | <entry> |
| 1050 | 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) |
| 1051 | </entry> |
| 1052 | </row> |
| 1053 | <row> |
| 1054 | <entry> |
| 1055 | 2nd digit |
| 1056 | </entry> |
| 1057 | <entry> |
| 1058 | 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> |
| 1059 | </entry> |
| 1060 | </row> |
| 1061 | <row> |
| 1062 | <entry> |
| 1063 | 3rd digit |
| 1064 | </entry> |
| 1065 | <entry> |
| 1066 | ditto for <emphasis role="strong">group</emphasis> |
| 1067 | </entry> |
| 1068 | </row> |
| 1069 | <row> |
| 1070 | <entry> |
| 1071 | 4th digit |
| 1072 | </entry> |
| 1073 | <entry> |
| 1074 | ditto for <emphasis role="strong">other</emphasis> |
| 1075 | </entry> |
| 1076 | </row> |
| 1077 | </tbody> |
| 1078 | </tgroup> |
| 1079 | </table> |
| 1080 | <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> |
| 1081 | <screen>$ touch foo bar |
| 1082 | $ chmod u=rw,go=r foo |
| 1083 | $ chmod 644 bar |
| 1084 | $ ls -l foo bar |
| 1085 | -rw-r--r-- 1 penguin penguin 17 2007-04-29 08:22 bar |
| 1086 | -rw-r--r-- 1 penguin penguin 12 2007-04-29 08:22 foo</screen> |
| 1087 | <tip> |
| 1088 | <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> |
| 1089 | </tip> |
| 1090 | </section> |
| 1091 | <section id="_control_of_permissions_for_newly_created_files_umask"> |
| 1092 | <title>Control of permissions for newly created files: umask</title> |
| 1093 | <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> |
| 1094 | <screen> (file permissions) = (requested file permissions) & ~(umask value)</screen> |
| 1095 | <table id="theumaskvalueexamples" pgwide="0" frame="topbot" rowsep="1" colsep="1"> |
| 1096 | <title>The <emphasis role="strong">umask</emphasis> value examples.</title> |
| 1097 | <tgroup cols="4"> |
| 1098 | <colspec colwidth="72" align="left"/> |
| 1099 | <colspec colwidth="72" align="left"/> |
| 1100 | <colspec colwidth="72" align="left"/> |
| 1101 | <colspec colwidth="288" align="left"/> |
| 1102 | <thead> |
| 1103 | <row> |
| 1104 | <entry> |
| 1105 | umask |
| 1106 | </entry> |
| 1107 | <entry> |
| 1108 | usage |
| 1109 | </entry> |
| 1110 | <entry> |
| 1111 | file permissions created |
| 1112 | </entry> |
| 1113 | <entry> |
| 1114 | directory permissions created |
| 1115 | </entry> |
| 1116 | </row> |
| 1117 | </thead> |
| 1118 | <tbody> |
| 1119 | <row> |
| 1120 | <entry> |
| 1121 | <literal>0022</literal> |
| 1122 | </entry> |
| 1123 | <entry> |
| 1124 | writable only by the user |
| 1125 | </entry> |
| 1126 | <entry> |
| 1127 | <literal>-rw-r--r--</literal> |
| 1128 | </entry> |
| 1129 | <entry> |
| 1130 | <literal>-rwxr-xr-x</literal> |
| 1131 | </entry> |
| 1132 | </row> |
| 1133 | <row> |
| 1134 | <entry> |
| 1135 | <literal>0002</literal> |
| 1136 | </entry> |
| 1137 | <entry> |
| 1138 | writable by the group |
| 1139 | </entry> |
| 1140 | <entry> |
| 1141 | <literal>-rw-rw-r--</literal> |
| 1142 | </entry> |
| 1143 | <entry> |
| 1144 | <literal>-rwxrwxr-x</literal> |
| 1145 | </entry> |
| 1146 | </row> |
| 1147 | </tbody> |
| 1148 | </tgroup> |
| 1149 | </table> |
| 1150 | <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> |
| 1151 | </section> |
| 1152 | <section id="_permissions_for_groups_of_users_group"> |
| 1153 | <title>Permissions for groups of users (group)</title> |
| 1154 | <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> |
| 1155 | <note> |
| 1156 | <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> |
| 1157 | </note> |
| 1158 | <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> |
| 1159 | <simpara>Some notable system-provided groups allow their members to access particular files and devices without <literal>root</literal> privilege.</simpara> |
| 1160 | <table id="listofnotablesysupsforfileaccess" pgwide="0" frame="topbot" rowsep="1" colsep="1"> |
| 1161 | <title>List of notable system-provided groups for file access.</title> |
| 1162 | <tgroup cols="2"> |
| 1163 | <colspec colwidth="144" align="left"/> |
| 1164 | <colspec colwidth="360" align="left"/> |
| 1165 | <thead> |
| 1166 | <row> |
| 1167 | <entry> |
| 1168 | group |
| 1169 | </entry> |
| 1170 | <entry> |
| 1171 | accessible files and devices |
| 1172 | </entry> |
| 1173 | </row> |
| 1174 | </thead> |
| 1175 | <tbody> |
| 1176 | <row> |
| 1177 | <entry> |
| 1178 | <literal>dialout</literal> |
| 1179 | </entry> |
| 1180 | <entry> |
| 1181 | Full and direct access to serial ports ("<literal>/dev/ttyS[0-3]</literal>"). |
| 1182 | </entry> |
| 1183 | </row> |
| 1184 | <row> |
| 1185 | <entry> |
| 1186 | <literal>dip</literal> |
| 1187 | </entry> |
| 1188 | <entry> |
| 1189 | Limited access to serial ports for <emphasis role="strong">Dialup IP</emphasis> connection to trusted peers. |
| 1190 | </entry> |
| 1191 | </row> |
| 1192 | <row> |
| 1193 | <entry> |
| 1194 | <literal>cdrom</literal> |
| 1195 | </entry> |
| 1196 | <entry> |
| 1197 | CD-ROM, DVD+/-RW drives. |
| 1198 | </entry> |
| 1199 | </row> |
| 1200 | <row> |
| 1201 | <entry> |
| 1202 | <literal>audio</literal> |
| 1203 | </entry> |
| 1204 | <entry> |
| 1205 | An audio device. |
| 1206 | </entry> |
| 1207 | </row> |
| 1208 | <row> |
| 1209 | <entry> |
| 1210 | <literal>video</literal> |
| 1211 | </entry> |
| 1212 | <entry> |
| 1213 | A video device. |
| 1214 | </entry> |
| 1215 | </row> |
| 1216 | <row> |
| 1217 | <entry> |
| 1218 | <literal>scanner</literal> |
| 1219 | </entry> |
| 1220 | <entry> |
| 1221 | Scanner(s). |
| 1222 | </entry> |
| 1223 | </row> |
| 1224 | <row> |
| 1225 | <entry> |
| 1226 | <literal>adm</literal> |
| 1227 | </entry> |
| 1228 | <entry> |
| 1229 | System monitoring logs. |
| 1230 | </entry> |
| 1231 | </row> |
| 1232 | <row> |
| 1233 | <entry> |
| 1234 | <literal>staff</literal> |
| 1235 | </entry> |
| 1236 | <entry> |
| 1237 | Some directories for junior administrative work: "<literal>/usr/local</literal>", "<literal>/home</literal>". |
| 1238 | </entry> |
| 1239 | </row> |
| 1240 | </tbody> |
| 1241 | </tgroup> |
| 1242 | </table> |
| 1243 | <tip> |
| 1244 | <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> |
| 1245 | </tip> |
| 1246 | <simpara>Some notable system-provided groups allow their members to execute particular commands without <literal>root</literal> privilege.</simpara> |
| 1247 | <table id="listofnotablesysommandexecutions" pgwide="0" frame="topbot" rowsep="1" colsep="1"> |
| 1248 | <title>List of notable system provided groups for particular command executions.</title> |
| 1249 | <tgroup cols="2"> |
| 1250 | <colspec colwidth="144" align="left"/> |
| 1251 | <colspec colwidth="360" align="left"/> |
| 1252 | <thead> |
| 1253 | <row> |
| 1254 | <entry> |
| 1255 | group |
| 1256 | </entry> |
| 1257 | <entry> |
| 1258 | accessible commands |
| 1259 | </entry> |
| 1260 | </row> |
| 1261 | </thead> |
| 1262 | <tbody> |
| 1263 | <row> |
| 1264 | <entry> |
| 1265 | <literal>sudo</literal> |
| 1266 | </entry> |
| 1267 | <entry> |
| 1268 | execute <literal>sudo</literal> without their password. |
| 1269 | </entry> |
| 1270 | </row> |
| 1271 | <row> |
| 1272 | <entry> |
| 1273 | <literal>lpadmin</literal> |
| 1274 | </entry> |
| 1275 | <entry> |
| 1276 | execute commands to add, modify, and remove printers from printer databases. |
| 1277 | </entry> |
| 1278 | </row> |
| 1279 | <row> |
| 1280 | <entry> |
| 1281 | <literal>plugdev</literal> |
| 1282 | </entry> |
| 1283 | <entry> |
| 1284 | execute <literal>pmount</literal>(1) for removable devices such as USB memories. |
| 1285 | </entry> |
| 1286 | </row> |
| 1287 | </tbody> |
| 1288 | </tgroup> |
| 1289 | </table> |
| 1290 | <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> |
| 1291 | <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> |
| 1292 | </section> |
| 1293 | <section id="_timestamps"> |
| 1294 | <title>Timestamps</title> |
| 1295 | <simpara>There are three types of timestamps for a GNU/Linux file.</simpara> |
| 1296 | <table id="listoftypesoftimestamps" pgwide="0" frame="topbot" rowsep="1" colsep="1"> |
| 1297 | <title>List of types of timestamps.</title> |
| 1298 | <tgroup cols="2"> |
| 1299 | <colspec colwidth="144" align="left"/> |
| 1300 | <colspec colwidth="360" align="left"/> |
| 1301 | <thead> |
| 1302 | <row> |
| 1303 | <entry> |
| 1304 | type |
| 1305 | </entry> |
| 1306 | <entry> |
| 1307 | meaning |
| 1308 | </entry> |
| 1309 | </row> |
| 1310 | </thead> |
| 1311 | <tbody> |
| 1312 | <row> |
| 1313 | <entry> |
| 1314 | <emphasis role="strong">mtime</emphasis> |
| 1315 | </entry> |
| 1316 | <entry> |
| 1317 | the file modification time (<literal>ls -l</literal>) |
| 1318 | </entry> |
| 1319 | </row> |
| 1320 | <row> |
| 1321 | <entry> |
| 1322 | <emphasis role="strong">ctime</emphasis> |
| 1323 | </entry> |
| 1324 | <entry> |
| 1325 | the file status change time (<literal>ls -lc</literal>) |
| 1326 | </entry> |
| 1327 | </row> |
| 1328 | <row> |
| 1329 | <entry> |
| 1330 | <emphasis role="strong">atime</emphasis> |
| 1331 | </entry> |
| 1332 | <entry> |
| 1333 | the last file access time (<literal>ls -lu</literal>) |
| 1334 | </entry> |
| 1335 | </row> |
| 1336 | </tbody> |
| 1337 | </tgroup> |
| 1338 | </table> |
| 1339 | <simpara>Note that <emphasis role="strong">ctime</emphasis> is not file creation time.</simpara> |
| 1340 | <itemizedlist> |
| 1341 | <listitem> |
| 1342 | <simpara> |
| 1343 | 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. |
| 1344 | </simpara> |
| 1345 | </listitem> |
| 1346 | <listitem> |
| 1347 | <simpara> |
| 1348 | 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. |
| 1349 | </simpara> |
| 1350 | </listitem> |
| 1351 | <listitem> |
| 1352 | <simpara> |
| 1353 | Reading a file will change the <emphasis role="strong">atime</emphasis> of the file. |
| 1354 | 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). |
| 1355 | </simpara> |
| 1356 | </listitem> |
| 1357 | </itemizedlist> |
| 1358 | <simpara>Use <literal>touch</literal>(1) command to change timestamps of existing files.</simpara> |
| 1359 | <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> |
| 1360 | <screen>$ LANG=en_US.UTF-8 ls -l foo |
| 1361 | -rw-r--r-- 1 penguin penguin 3 2008-03-05 00:47 foo |
| 1362 | $ LANG=C ls -l foo |
| 1363 | -rw-r--r-- 1 penguin penguin 3 Mar 5 00:47 foo</screen> |
| 1364 | <tip> |
| 1365 | <simpara>See <xref linkend="_customized_display_of_time_and_date"/> to cutomize "<literal>ls -l</literal>" output.</simpara> |
| 1366 | </tip> |
| 1367 | </section> |
| 1368 | <section id="_links"> |
| 1369 | <title>Links</title> |
| 1370 | <simpara>There are two methods of associating a file "<literal>foo</literal>" with a different filename "<literal>bar</literal>".</simpara> |
| 1371 | <itemizedlist> |
| 1372 | <listitem> |
| 1373 | <simpara> |
| 1374 | a <ulink url="&hardlink;">hard link</ulink> is a duplicate name for an existing file (<literal>ln foo bar</literal>), |
| 1375 | </simpara> |
| 1376 | </listitem> |
| 1377 | <listitem> |
| 1378 | <simpara> |
| 1379 | 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>). |
| 1380 | </simpara> |
| 1381 | </listitem> |
| 1382 | </itemizedlist> |
| 1383 | <simpara>See the following example for changes in link counts and the subtle differences in the result of the <literal>rm</literal> command.</simpara> |
| 1384 | <screen>$ echo "Original Content" > foo |
| 1385 | $ ls -li foo |
| 1386 | 2398521 -rw-r--r-- 1 penguin penguin 17 2007-04-29 08:15 foo |
| 1387 | $ ln foo bar # hard link |
| 1388 | $ ln -s foo baz # symlink |
| 1389 | $ ls -li foo bar baz |
| 1390 | 2398521 -rw-r--r-- 2 penguin penguin 17 2007-04-29 08:15 bar |
| 1391 | 2398538 lrwxrwxrwx 1 penguin penguin 3 2007-04-29 08:16 baz -> foo |
| 1392 | 2398521 -rw-r--r-- 2 penguin penguin 17 2007-04-29 08:15 foo |
| 1393 | $ rm foo |
| 1394 | $ echo "New Content" > foo |
| 1395 | $ ls -li foo bar baz |
| 1396 | 2398521 -rw-r--r-- 1 penguin penguin 17 2007-04-29 08:15 bar |
| 1397 | 2398538 lrwxrwxrwx 1 penguin penguin 3 2007-04-29 08:16 baz -> foo |
| 1398 | 2398540 -rw-r--r-- 1 penguin penguin 12 2007-04-29 08:17 foo |
| 1399 | $ cat bar |
| 1400 | Original Content |
| 1401 | $ cat baz |
| 1402 | New Content</screen> |
| 1403 | <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> |
| 1404 | <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> |
| 1405 | <caution> |
| 1406 | <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> |
| 1407 | </caution> |
| 1408 | <note> |
| 1409 | <simpara>It is generally preferable to use symbolic links rather than hardlinks unless you have a good reason for using a hardlink.</simpara> |
| 1410 | </note> |
| 1411 | <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> |
| 1412 | <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> |
| 1413 | </section> |
| 1414 | <section id="_named_pipes_fifos"> |
| 1415 | <title>Named pipes (FIFOs)</title> |
| 1416 | <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> |
| 1417 | <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> |
| 1418 | <simpara>You can try it by doing the following:</simpara> |
| 1419 | <screen>$ cd; mkfifo mypipe |
| 1420 | $ echo "hello" >mypipe & # put into background |
| 1421 | [1] 8022 |
| 1422 | $ ls -l mypipe |
| 1423 | prw-r--r-- 1 penguin penguin 0 2007-04-29 08:25 mypipe |
| 1424 | $ cat mypipe |
| 1425 | hello |
| 1426 | [1]+ Done echo "hello" >mypipe |
| 1427 | $ ls mypipe |
| 1428 | mypipe |
| 1429 | $ rm mypipe</screen> |
| 1430 | </section> |
| 1431 | <section id="_sockets"> |
| 1432 | <title>Sockets</title> |
| 1433 | <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> |
| 1434 | <tip> |
| 1435 | <simpara>"<literal>netstat -an</literal>" will provide a very useful overview of sockets that are open on a given system.</simpara> |
| 1436 | </tip> |
| 1437 | </section> |
| 1438 | <section id="_device_files"> |
| 1439 | <title>Device files</title> |
| 1440 | <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> |
| 1441 | <table id="thedevicetypes" pgwide="0" frame="topbot" rowsep="1" colsep="1"> |
| 1442 | <title>The device types.</title> |
| 1443 | <tgroup cols="2"> |
| 1444 | <colspec colwidth="144" align="left"/> |
| 1445 | <colspec colwidth="360" align="left"/> |
| 1446 | <thead> |
| 1447 | <row> |
| 1448 | <entry> |
| 1449 | device type |
| 1450 | </entry> |
| 1451 | <entry> |
| 1452 | meaning |
| 1453 | </entry> |
| 1454 | </row> |
| 1455 | </thead> |
| 1456 | <tbody> |
| 1457 | <row> |
| 1458 | <entry> |
| 1459 | <emphasis role="strong">character device</emphasis> |
| 1460 | </entry> |
| 1461 | <entry> |
| 1462 | 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). |
| 1463 | </entry> |
| 1464 | </row> |
| 1465 | <row> |
| 1466 | <entry> |
| 1467 | <emphasis role="strong">block device</emphasis> |
| 1468 | </entry> |
| 1469 | <entry> |
| 1470 | This must be accessed in larger units called blocks, which contain a number of characters. Your hard disk is a block device. |
| 1471 | </entry> |
| 1472 | </row> |
| 1473 | </tbody> |
| 1474 | </tgroup> |
| 1475 | </table> |
| 1476 | <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> |
| 1477 | <note> |
| 1478 | <simpara>For the normal access to a printer, use <literal>lp</literal>(1).</simpara> |
| 1479 | </note> |
| 1480 | <simpara>The device node number are displayed by executing <literal>ls</literal>(1) as:</simpara> |
| 1481 | <screen>$ ls -l /dev/hda /dev/ttyS0 /dev/zero |
| 1482 | brw-rw---- 1 root cdrom 3, 0 2007-04-29 07:00 /dev/hda |
| 1483 | crw-rw---- 1 root dialout 4, 64 2007-04-29 07:00 /dev/ttyS0 |
| 1484 | crw-rw-rw- 1 root root 1, 5 2007-04-29 07:00 /dev/zero</screen> |
| 1485 | <simpara>Here,</simpara> |
| 1486 | <itemizedlist> |
| 1487 | <listitem> |
| 1488 | <simpara> |
| 1489 | "<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, |
| 1490 | </simpara> |
| 1491 | </listitem> |
| 1492 | <listitem> |
| 1493 | <simpara> |
| 1494 | "<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 |
| 1495 | </simpara> |
| 1496 | </listitem> |
| 1497 | <listitem> |
| 1498 | <simpara> |
| 1499 | "<literal>/dev/zero</literal>" has the major device number 1 and the minor device number 5. This is read/write accessible by anyone. |
| 1500 | </simpara> |
| 1501 | </listitem> |
| 1502 | </itemizedlist> |
| 1503 | <simpara>In the Linux 2.6 system, the filesystem under "<literal>/dev/</literal>" is automatically populated by the <literal>udev</literal>(7) mechanism.</simpara> |
| 1504 | </section> |
| 1505 | <section id="_special_device_files"> |
| 1506 | <title>Special device files</title> |
| 1507 | <simpara>There are some special device files.</simpara> |
| 1508 | <table id="listofspecialdevicefiles" pgwide="0" frame="topbot" rowsep="1" colsep="1"> |
| 1509 | <title>List of special device files.</title> |
| 1510 | <tgroup cols="3"> |
| 1511 | <colspec colwidth="108" align="left"/> |
| 1512 | <colspec colwidth="108" align="left"/> |
| 1513 | <colspec colwidth="288" align="left"/> |
| 1514 | <thead> |
| 1515 | <row> |
| 1516 | <entry> |
| 1517 | device file |
| 1518 | </entry> |
| 1519 | <entry> |
| 1520 | action |
| 1521 | </entry> |
| 1522 | <entry> |
| 1523 | response |
| 1524 | </entry> |
| 1525 | </row> |
| 1526 | </thead> |
| 1527 | <tbody> |
| 1528 | <row> |
| 1529 | <entry> |
| 1530 | <literal>/dev/null</literal> |
| 1531 | </entry> |
| 1532 | <entry> |
| 1533 | read |
| 1534 | </entry> |
| 1535 | <entry> |
| 1536 | it returns "end-of-file (EOF) character". |
| 1537 | </entry> |
| 1538 | </row> |
| 1539 | <row> |
| 1540 | <entry> |
| 1541 | <literal>/dev/null</literal> |
| 1542 | </entry> |
| 1543 | <entry> |
| 1544 | write |
| 1545 | </entry> |
| 1546 | <entry> |
| 1547 | it is a bottomless data dump pit. |
| 1548 | </entry> |
| 1549 | </row> |
| 1550 | <row> |
| 1551 | <entry> |
| 1552 | <literal>/dev/zero</literal> |
| 1553 | </entry> |
| 1554 | <entry> |
| 1555 | read |
| 1556 | </entry> |
| 1557 | <entry> |
| 1558 | it returns "the <literal>\0</literal> (NUL) character" (not the same as the number zero ASCII). |
| 1559 | </entry> |
| 1560 | </row> |
| 1561 | <row> |
| 1562 | <entry> |
| 1563 | <literal>/dev/random</literal> |
| 1564 | </entry> |
| 1565 | <entry> |
| 1566 | read |
| 1567 | </entry> |
| 1568 | <entry> |
| 1569 | it returns random characters from a true random number generator, delivering real entropy. (slow) |
| 1570 | </entry> |
| 1571 | </row> |
| 1572 | <row> |
| 1573 | <entry> |
| 1574 | <literal>/dev/urandom</literal> |
| 1575 | </entry> |
| 1576 | <entry> |
| 1577 | read |
| 1578 | </entry> |
| 1579 | <entry> |
| 1580 | it returns random characters from a cryptographically secure pseudorandom number generator. |
| 1581 | </entry> |
| 1582 | </row> |
| 1583 | <row> |
| 1584 | <entry> |
| 1585 | <literal>/dev/full</literal> |
| 1586 | </entry> |
| 1587 | <entry> |
| 1588 | write |
| 1589 | </entry> |
| 1590 | <entry> |
| 1591 | it returns the disk-full (ENOSPC) error. |
| 1592 | </entry> |
| 1593 | </row> |
| 1594 | </tbody> |
| 1595 | </tgroup> |
| 1596 | </table> |
| 1597 | <simpara>These are frequently used in conjunction with the shell redirection (see <xref linkend="_typical_command_sequences_and_shell_redirection"/>).</simpara> |
| 1598 | </section> |
| 1599 | <section id="_procfs_and_sysfs"> |
| 1600 | <title>procfs and sysfs</title> |
| 1601 | <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> |
| 1602 | <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> |
| 1603 | <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> |
| 1604 | <note> |
| 1605 | <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" > /proc/sys/fs/file-max</literal>" (This was needed on older kernels).</simpara> |
| 1606 | </note> |
| 1607 | <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> |
| 1608 | <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> |
| 1609 | <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> |
| 1610 | </section> |
| 1611 | </section> |
| 1612 | <section id="_midnight_commander_mc"> |
| 1613 | <title>Midnight Commander (MC)</title> |
| 1614 | <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> |
| 1615 | <simpara>You may need to install the Midnight Commander package which is titled "<literal>mc</literal>".</simpara> |
| 1616 | <screen>$ sudo aptitude install mc</screen> |
| 1617 | <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> |
| 1618 | <itemizedlist> |
| 1619 | <listitem> |
| 1620 | <simpara> |
| 1621 | "<literal>/etc</literal>" and its subdirectories. |
| 1622 | </simpara> |
| 1623 | </listitem> |
| 1624 | <listitem> |
| 1625 | <simpara> |
| 1626 | "<literal>/var/log</literal>" and its subdirectories. |
| 1627 | </simpara> |
| 1628 | </listitem> |
| 1629 | <listitem> |
| 1630 | <simpara> |
| 1631 | "<literal>/usr/share/doc</literal>" and its subdirectories. |
| 1632 | </simpara> |
| 1633 | </listitem> |
| 1634 | <listitem> |
| 1635 | <simpara> |
| 1636 | "<literal>/sbin</literal>" and "<literal>/bin</literal>" |
| 1637 | </simpara> |
| 1638 | </listitem> |
| 1639 | </itemizedlist> |
| 1640 | <section id="_customization_of_mc"> |
| 1641 | <title>Customization of MC</title> |
| 1642 | <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> |
| 1643 | <screen>. /usr/share/mc/bin/mc.sh</screen> |
| 1644 | <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> |
| 1645 | </section> |
| 1646 | <section id="_starting_mc"> |
| 1647 | <title>Starting MC</title> |
| 1648 | <simpara>MC can be started by:</simpara> |
| 1649 | <screen>$ mc</screen> |
| 1650 | <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> |
| 1651 | <note> |
| 1652 | <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> |
| 1653 | </note> |
| 1654 | <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> |
| 1655 | <simpara>If this doesn't clear up your display problems with MC, see <xref linkend="_the_terminal_configuration"/>.</simpara> |
| 1656 | </section> |
| 1657 | <section id="_file_manager_in_mc"> |
| 1658 | <title>File manager in MC</title> |
| 1659 | <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> |
| 1660 | <table id="thekeybindingsofmc" pgwide="0" frame="topbot" rowsep="1" colsep="1"> |
| 1661 | <title>The key bindings of MC.</title> |
| 1662 | <tgroup cols="2"> |
| 1663 | <colspec colwidth="144" align="left"/> |
| 1664 | <colspec colwidth="360" align="left"/> |
| 1665 | <thead> |
| 1666 | <row> |
| 1667 | <entry> |
| 1668 | key |
| 1669 | </entry> |
| 1670 | <entry> |
| 1671 | key binding |
| 1672 | </entry> |
| 1673 | </row> |
| 1674 | </thead> |
| 1675 | <tbody> |
| 1676 | <row> |
| 1677 | <entry> |
| 1678 | <literal>F1</literal> |
| 1679 | </entry> |
| 1680 | <entry> |
| 1681 | Help menu |
| 1682 | </entry> |
| 1683 | </row> |
| 1684 | <row> |
| 1685 | <entry> |
| 1686 | <literal>F3</literal> |
| 1687 | </entry> |
| 1688 | <entry> |
| 1689 | Internal file viewer |
| 1690 | </entry> |
| 1691 | </row> |
| 1692 | <row> |
| 1693 | <entry> |
| 1694 | <literal>F4</literal> |
| 1695 | </entry> |
| 1696 | <entry> |
| 1697 | Internal editor |
| 1698 | </entry> |
| 1699 | </row> |
| 1700 | <row> |
| 1701 | <entry> |
| 1702 | <literal>F9</literal> |
| 1703 | </entry> |
| 1704 | <entry> |
| 1705 | Activate pull down menu |
| 1706 | </entry> |
| 1707 | </row> |
| 1708 | <row> |
| 1709 | <entry> |
| 1710 | <literal>F10</literal> |
| 1711 | </entry> |
| 1712 | <entry> |
| 1713 | Exit Midnight Commander |
| 1714 | </entry> |
| 1715 | </row> |
| 1716 | <row> |
| 1717 | <entry> |
| 1718 | <literal>Tab</literal> |
| 1719 | </entry> |
| 1720 | <entry> |
| 1721 | Move between two windows |
| 1722 | </entry> |
| 1723 | </row> |
| 1724 | <row> |
| 1725 | <entry><literal>Insert</literal> or <literal>Ctrl-T</literal> |
| 1726 | </entry> |
| 1727 | <entry> |
| 1728 | Mark file for a multiple-file operation such as copy |
| 1729 | </entry> |
| 1730 | </row> |
| 1731 | <row> |
| 1732 | <entry> |
| 1733 | <literal>Del</literal> |
| 1734 | </entry> |
| 1735 | <entry> |
| 1736 | Delete file (be careful---set MC to safe delete mode) |
| 1737 | </entry> |
| 1738 | </row> |
| 1739 | <row> |
| 1740 | <entry> |
| 1741 | Cursor keys |
| 1742 | </entry> |
| 1743 | <entry> |
| 1744 | Self-explanatory |
| 1745 | </entry> |
| 1746 | </row> |
| 1747 | </tbody> |
| 1748 | </tgroup> |
| 1749 | </table> |
| 1750 | </section> |
| 1751 | <section id="_command_line_tricks_in_mc"> |
| 1752 | <title>Command-line tricks in MC</title> |
| 1753 | <itemizedlist> |
| 1754 | <listitem> |
| 1755 | <simpara> |
| 1756 | Any <literal>cd</literal> command will change the directory shown on the selected screen. |
| 1757 | </simpara> |
| 1758 | </listitem> |
| 1759 | <listitem> |
| 1760 | <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. |
| 1761 | </simpara> |
| 1762 | </listitem> |
| 1763 | <listitem> |
| 1764 | <simpara><literal>Alt-Tab</literal> will show shell filename expansion choices. |
| 1765 | </simpara> |
| 1766 | </listitem> |
| 1767 | <listitem> |
| 1768 | <simpara> |
| 1769 | One can specify the starting directory for both windows as arguments to MC; for example, "<literal>mc /etc /root</literal>". |
| 1770 | </simpara> |
| 1771 | </listitem> |
| 1772 | <listitem> |
| 1773 | <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>) |
| 1774 | </simpara> |
| 1775 | </listitem> |
| 1776 | <listitem> |
| 1777 | <simpara> |
| 1778 | 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>" |
| 1779 | </simpara> |
| 1780 | </listitem> |
| 1781 | </itemizedlist> |
| 1782 | </section> |
| 1783 | <section id="_the_internal_editor_in_mc"> |
| 1784 | <title>The internal editor in MC</title> |
| 1785 | <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> |
| 1786 | <simpara>This editor can be directly started on a file:</simpara> |
| 1787 | <screen>$ mc -e filename_to_edit |
| 1788 | $ mcedit filename_to_edit</screen> |
| 1789 | <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<n> 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> |
| 1790 | <simpara>This internal editor can be replaced with any external editor of choice.</simpara> |
| 1791 | <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> |
| 1792 | <screen>... |
| 1793 | export EDITOR=mcedit |
| 1794 | export VISUAL=mcedit |
| 1795 | ...</screen> |
| 1796 | <simpara>I do recommend setting these to "<literal>vim</literal>" if possible.</simpara> |
| 1797 | <simpara>If you are uncomfortable with <literal>vim</literal>(1), you can keep using <literal>mcedit</literal>(1) for most system maintenance tasks.</simpara> |
| 1798 | </section> |
| 1799 | <section id="_the_internal_viewer_in_mc"> |
| 1800 | <title>The internal viewer in MC</title> |
| 1801 | <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> |
| 1802 | <screen>$ mc -v path/to/filename_to_view |
| 1803 | $ mcview path/to/filename_to_view</screen> |
| 1804 | </section> |
| 1805 | <section id="_auto_start_features_of_mc"> |
| 1806 | <title>Auto-start features of MC</title> |
| 1807 | <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> |
| 1808 | <table id="thereactiontotheenterkeyinmc" pgwide="0" frame="topbot" rowsep="1" colsep="1"> |
| 1809 | <title>The reaction to the enter key in MC.</title> |
| 1810 | <tgroup cols="2"> |
| 1811 | <colspec colwidth="144" align="left"/> |
| 1812 | <colspec colwidth="360" align="left"/> |
| 1813 | <thead> |
| 1814 | <row> |
| 1815 | <entry> |
| 1816 | file type |
| 1817 | </entry> |
| 1818 | <entry> |
| 1819 | reaction to enter key |
| 1820 | </entry> |
| 1821 | </row> |
| 1822 | </thead> |
| 1823 | <tbody> |
| 1824 | <row> |
| 1825 | <entry> |
| 1826 | executable file |
| 1827 | </entry> |
| 1828 | <entry> |
| 1829 | Execute command |
| 1830 | </entry> |
| 1831 | </row> |
| 1832 | <row> |
| 1833 | <entry> |
| 1834 | man file |
| 1835 | </entry> |
| 1836 | <entry> |
| 1837 | Pipe content to viewer software |
| 1838 | </entry> |
| 1839 | </row> |
| 1840 | <row> |
| 1841 | <entry> |
| 1842 | html file |
| 1843 | </entry> |
| 1844 | <entry> |
| 1845 | Pipe content to web browser |
| 1846 | </entry> |
| 1847 | </row> |
| 1848 | <row> |
| 1849 | <entry> |
| 1850 | "<literal>*.tar.gz</literal>" and "<literal>*.deb</literal>" file |
| 1851 | </entry> |
| 1852 | <entry> |
| 1853 | Browse its contents as if subdirectory |
| 1854 | </entry> |
| 1855 | </row> |
| 1856 | </tbody> |
| 1857 | </tgroup> |
| 1858 | </table> |
| 1859 | <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> |
| 1860 | </section> |
| 1861 | <section id="_ftp_virtual_filesystem_of_mc"> |
| 1862 | <title>FTP virtual filesystem of MC</title> |
| 1863 | <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> |
| 1864 | <simpara>Try "[http.us.debian.org/debian]" as the URL and browse the Debian archive.</simpara> |
| 1865 | </section> |
| 1866 | </section> |
| 1867 | <section id="_the_basic_unix_like_work_environment"> |
| 1868 | <title>The basic Unix-like work environment</title> |
| 1869 | <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> |
| 1870 | <section id="_the_login_shell"> |
| 1871 | <title>The login shell</title> |
| 1872 | <simpara>You can select your login shell with <literal>chsh</literal>(1).</simpara> |
| 1873 | <table id="list-of-shell-programs" pgwide="0" frame="topbot" rowsep="1" colsep="1"> |
| 1874 | <title>List of shell programs.</title> |
| 1875 | <tgroup cols="5"> |
| 1876 | <colspec colwidth="72" align="left"/> |
| 1877 | <colspec colwidth="72" align="left"/> |
| 1878 | <colspec colwidth="72" align="left"/> |
| 1879 | <colspec colwidth="72" align="left"/> |
| 1880 | <colspec colwidth="216" align="left"/> |
| 1881 | <thead> |
| 1882 | <row> |
| 1883 | <entry> |
| 1884 | package |
| 1885 | </entry> |
| 1886 | <entry> |
| 1887 | popcon |
| 1888 | </entry> |
| 1889 | <entry> |
| 1890 | size |
| 1891 | </entry> |
| 1892 | <entry> |
| 1893 | POSIX shell |
| 1894 | </entry> |
| 1895 | <entry> |
| 1896 | description |
| 1897 | </entry> |
| 1898 | </row> |
| 1899 | </thead> |
| 1900 | <tbody> |
| 1901 | <row> |
| 1902 | <entry><ulink url="http://packages.debian.org/sid/bash"> |
| 1903 | <literal>bash</literal> |
| 1904 | </ulink></entry> |
| 1905 | <entry><ulink url="http://bugs.debian.org/bash">&pop-bash;</ulink></entry> |
| 1906 | <entry><ulink url="http://packages.qa.debian.org/b/bash.html">&size-bash;</ulink></entry> |
| 1907 | <entry> |
| 1908 | Yes |
| 1909 | </entry> |
| 1910 | <entry><ulink url="&bash;">Bash</ulink>: the GNU Bourne Again SHell. (de facto standard) |
| 1911 | </entry> |
| 1912 | </row> |
| 1913 | <row> |
| 1914 | <entry><ulink url="http://packages.debian.org/sid/tcsh"> |
| 1915 | <literal>tcsh</literal> |
| 1916 | </ulink></entry> |
| 1917 | <entry><ulink url="http://bugs.debian.org/tcsh">&pop-tcsh;</ulink></entry> |
| 1918 | <entry><ulink url="http://packages.qa.debian.org/t/tcsh.html">&size-tcsh;</ulink></entry> |
| 1919 | <entry> |
| 1920 | No |
| 1921 | </entry> |
| 1922 | <entry><ulink url="&tenexcshell;">TENEX C Shell</ulink>: an enhanced version of <ulink url="&berkeleycsh;">Berkeley csh</ulink>. |
| 1923 | </entry> |
| 1924 | </row> |
| 1925 | <row> |
| 1926 | <entry><ulink url="http://packages.debian.org/sid/dash"> |
| 1927 | <literal>dash</literal> |
| 1928 | </ulink></entry> |
| 1929 | <entry><ulink url="http://bugs.debian.org/dash">&pop-dash;</ulink></entry> |
| 1930 | <entry><ulink url="http://packages.qa.debian.org/d/dash.html">&size-dash;</ulink></entry> |
| 1931 | <entry> |
| 1932 | Yes |
| 1933 | </entry> |
| 1934 | <entry> |
| 1935 | The Debian <ulink url="&almquistshell;">Almquist Shell</ulink>. Good for shell script. |
| 1936 | </entry> |
| 1937 | </row> |
| 1938 | <row> |
| 1939 | <entry><ulink url="http://packages.debian.org/sid/zsh"> |
| 1940 | <literal>zsh</literal> |
| 1941 | </ulink></entry> |
| 1942 | <entry><ulink url="http://bugs.debian.org/zsh">&pop-zsh;</ulink></entry> |
| 1943 | <entry><ulink url="http://packages.qa.debian.org/z/zsh.html">&size-zsh;</ulink></entry> |
| 1944 | <entry> |
| 1945 | Yes |
| 1946 | </entry> |
| 1947 | <entry><ulink url="&zshell;">Z shell</ulink>: the standard shell with many enhancements. |
| 1948 | </entry> |
| 1949 | </row> |
| 1950 | <row> |
| 1951 | <entry><ulink url="http://packages.debian.org/sid/pdksh"> |
| 1952 | <literal>pdksh</literal> |
| 1953 | </ulink></entry> |
| 1954 | <entry><ulink url="http://bugs.debian.org/pdksh">&pop-pdksh;</ulink></entry> |
| 1955 | <entry><ulink url="http://packages.qa.debian.org/p/pdksh.html">&size-pdksh;</ulink></entry> |
| 1956 | <entry> |
| 1957 | Yes |
| 1958 | </entry> |
| 1959 | <entry> |
| 1960 | A public domain version of the <ulink url="&kornshell;">Korn shell</ulink>. |
| 1961 | </entry> |
| 1962 | </row> |
| 1963 | <row> |
| 1964 | <entry><ulink url="http://packages.debian.org/sid/csh"> |
| 1965 | <literal>csh</literal> |
| 1966 | </ulink></entry> |
| 1967 | <entry><ulink url="http://bugs.debian.org/csh">&pop-csh;</ulink></entry> |
| 1968 | <entry><ulink url="http://packages.qa.debian.org/c/csh.html">&size-csh;</ulink></entry> |
| 1969 | <entry> |
| 1970 | No |
| 1971 | </entry> |
| 1972 | <entry><ulink url="&openbsd;">OpenBSD</ulink> C Shell, a version of <ulink url="&berkeleycsh;">Berkeley csh</ulink>. |
| 1973 | </entry> |
| 1974 | </row> |
| 1975 | <row> |
| 1976 | <entry><ulink url="http://packages.debian.org/sid/sash"> |
| 1977 | <literal>sash</literal> |
| 1978 | </ulink></entry> |
| 1979 | <entry><ulink url="http://bugs.debian.org/sash">&pop-sash;</ulink></entry> |
| 1980 | <entry><ulink url="http://packages.qa.debian.org/s/sash.html">&size-sash;</ulink></entry> |
| 1981 | <entry> |
| 1982 | Yes |
| 1983 | </entry> |
| 1984 | <entry><ulink url="&standaloneshell;">Stand-alone shell</ulink> with builtin commands. (Not meant for standard "<literal>/bin/sh</literal>".) |
| 1985 | </entry> |
| 1986 | </row> |
| 1987 | <row> |
| 1988 | <entry><ulink url="http://packages.debian.org/sid/ksh"> |
| 1989 | <literal>ksh</literal> |
| 1990 | </ulink></entry> |
| 1991 | <entry><ulink url="http://bugs.debian.org/ksh">&pop-ksh;</ulink></entry> |
| 1992 | <entry><ulink url="http://packages.qa.debian.org/k/ksh.html">&size-ksh;</ulink></entry> |
| 1993 | <entry> |
| 1994 | Yes |
| 1995 | </entry> |
| 1996 | <entry> |
| 1997 | The real, AT&T version of the <ulink url="&kornshell;">Korn shell</ulink>. |
| 1998 | </entry> |
| 1999 | </row> |
| 2000 | <row> |
| 2001 | <entry><ulink url="http://packages.debian.org/sid/rc"> |
| 2002 | <literal>rc</literal> |
| 2003 | </ulink></entry> |
| 2004 | <entry><ulink url="http://bugs.debian.org/rc">&pop-rc;</ulink></entry> |
| 2005 | <entry><ulink url="http://packages.qa.debian.org/r/rc.html">&size-rc;</ulink></entry> |
| 2006 | <entry> |
| 2007 | No |
| 2008 | </entry> |
| 2009 | <entry> |
| 2010 | An implementation of the <ulink url="&attplanj;">AT&T Plan 9</ulink> <ulink url="&rcshell;">rc shell</ulink>. |
| 2011 | </entry> |
| 2012 | </row> |
| 2013 | <row> |
| 2014 | <entry><ulink url="http://packages.debian.org/sid/posh"> |
| 2015 | <literal>posh</literal> |
| 2016 | </ulink></entry> |
| 2017 | <entry><ulink url="http://bugs.debian.org/posh">&pop-posh;</ulink></entry> |
| 2018 | <entry><ulink url="http://packages.qa.debian.org/p/posh.html">&size-posh;</ulink></entry> |
| 2019 | <entry> |
| 2020 | Yes |
| 2021 | </entry> |
| 2022 | <entry> |
| 2023 | Policy-compliant Ordinary SHell. A <literal>pdksh</literal> derivative. |
| 2024 | </entry> |
| 2025 | </row> |
| 2026 | </tbody> |
| 2027 | </tgroup> |
| 2028 | </table> |
| 2029 | <simpara>In this tutorial chapter, the interactive shell always means <literal>bash</literal>.</simpara> |
| 2030 | </section> |
| 2031 | <section id="_customizing_bash"> |
| 2032 | <title>Customizing bash</title> |
| 2033 | <simpara>You can customize <literal>bash</literal>(1) behavior by "<literal>~/.bashrc</literal>". For example, I added followings to "<literal>~/.bashrc</literal>":</simpara> |
| 2034 | <screen># CD upon exiting MC |
| 2035 | . /usr/share/mc/bin/mc.sh |
| 2036 | |
| 2037 | # set CDPATH to good one |
| 2038 | CDPATH=.:/usr/share/doc:~/Desktop/src:~/Desktop:~ |
| 2039 | export CDPATH |
| 2040 | |
| 2041 | PATH="${PATH}":/usr/sbin:/sbin |
| 2042 | # set PATH so it includes user's private bin if it exists |
| 2043 | if [ -d ~/bin ] ; then |
| 2044 | PATH=~/bin:"${PATH}" |
| 2045 | fi |
| 2046 | export PATH |
| 2047 | |
| 2048 | EDITOR=vim |
| 2049 | export EDITOR</screen> |
| 2050 | <tip> |
| 2051 | <simpara>You can find more <literal>bash</literal> customization tips, such as <xref linkend="_colorized_commands"/>, in <xref linkend="_system_tips"/>.</simpara> |
| 2052 | </tip> |
| 2053 | </section> |
| 2054 | <section id="_special_key_strokes"> |
| 2055 | <title>Special key strokes</title> |
| 2056 | <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> |
| 2057 | <table id="listofkeybindingsforbash" pgwide="0" frame="topbot" rowsep="1" colsep="1"> |
| 2058 | <title>List of key bindings for bash.</title> |
| 2059 | <tgroup cols="2"> |
| 2060 | <colspec colwidth="144" align="left"/> |
| 2061 | <colspec colwidth="360" align="left"/> |
| 2062 | <thead> |
| 2063 | <row> |
| 2064 | <entry> |
| 2065 | key |
| 2066 | </entry> |
| 2067 | <entry> |
| 2068 | key binding |
| 2069 | </entry> |
| 2070 | </row> |
| 2071 | </thead> |
| 2072 | <tbody> |
| 2073 | <row> |
| 2074 | <entry> |
| 2075 | <literal>Ctrl-U</literal> |
| 2076 | </entry> |
| 2077 | <entry> |
| 2078 | Erase line before cursor. |
| 2079 | </entry> |
| 2080 | </row> |
| 2081 | <row> |
| 2082 | <entry> |
| 2083 | <literal>Ctrl-H</literal> |
| 2084 | </entry> |
| 2085 | <entry> |
| 2086 | Erase a character before cursor. |
| 2087 | </entry> |
| 2088 | </row> |
| 2089 | <row> |
| 2090 | <entry> |
| 2091 | <literal>Ctrl-D</literal> |
| 2092 | </entry> |
| 2093 | <entry> |
| 2094 | Terminate input. (exit shell if you are using shell) |
| 2095 | </entry> |
| 2096 | </row> |
| 2097 | <row> |
| 2098 | <entry> |
| 2099 | <literal>Ctrl-C</literal> |
| 2100 | </entry> |
| 2101 | <entry> |
| 2102 | Terminate a running program. |
| 2103 | </entry> |
| 2104 | </row> |
| 2105 | <row> |
| 2106 | <entry> |
| 2107 | <literal>Ctrl-Z</literal> |
| 2108 | </entry> |
| 2109 | <entry> |
| 2110 | Temporarily stop program by moving it to the background job |
| 2111 | </entry> |
| 2112 | </row> |
| 2113 | <row> |
| 2114 | <entry> |
| 2115 | <literal>Ctrl-S</literal> |
| 2116 | </entry> |
| 2117 | <entry> |
| 2118 | Halt output to screen. |
| 2119 | </entry> |
| 2120 | </row> |
| 2121 | <row> |
| 2122 | <entry> |
| 2123 | <literal>Ctrl-Q</literal> |
| 2124 | </entry> |
| 2125 | <entry> |
| 2126 | Reactivate output to screen. |
| 2127 | </entry> |
| 2128 | </row> |
| 2129 | <row> |
| 2130 | <entry> |
| 2131 | <literal>Ctrl-Alt-Del</literal> |
| 2132 | </entry> |
| 2133 | <entry> |
| 2134 | Reboot/halt the system, see <literal>inittab</literal>(5). |
| 2135 | </entry> |
| 2136 | </row> |
| 2137 | <row> |
| 2138 | <entry><literal>Left-Alt-key</literal> (optionally, <literal>Windows-key</literal>) |
| 2139 | </entry> |
| 2140 | <entry> |
| 2141 | Meta-key for Emacs and the similar UI. |
| 2142 | </entry> |
| 2143 | </row> |
| 2144 | <row> |
| 2145 | <entry> |
| 2146 | <literal>Up-arrow</literal> |
| 2147 | </entry> |
| 2148 | <entry> |
| 2149 | Start command history search under <literal>bash</literal>. |
| 2150 | </entry> |
| 2151 | </row> |
| 2152 | <row> |
| 2153 | <entry> |
| 2154 | <literal>Ctrl-R</literal> |
| 2155 | </entry> |
| 2156 | <entry> |
| 2157 | Start incremental command history search under <literal>bash</literal>. |
| 2158 | </entry> |
| 2159 | </row> |
| 2160 | <row> |
| 2161 | <entry> |
| 2162 | <literal>Tab</literal> |
| 2163 | </entry> |
| 2164 | <entry> |
| 2165 | Complete input of the filename to the command line under <literal>bash</literal>. |
| 2166 | </entry> |
| 2167 | </row> |
| 2168 | <row> |
| 2169 | <entry> |
| 2170 | <literal>Ctrl-V</literal> |
| 2171 | <literal>Tab</literal> |
| 2172 | </entry> |
| 2173 | <entry> |
| 2174 | Input <literal>Tab</literal> without expansion to the command line under <literal>bash</literal>. |
| 2175 | </entry> |
| 2176 | </row> |
| 2177 | </tbody> |
| 2178 | </tgroup> |
| 2179 | </table> |
| 2180 | <tip> |
| 2181 | <simpara>The terminal feature of <literal>Ctrl-S</literal> can be disabled using <literal>stty</literal>(1).</simpara> |
| 2182 | </tip> |
| 2183 | </section> |
| 2184 | <section id="_unix_style_mouse_operations"> |
| 2185 | <title>Unix style mouse operations</title> |
| 2186 | <simpara>Unix style mouse operations are based on the 3 button mouse system.</simpara> |
| 2187 | <table id="listofunixstylemouseoperations" pgwide="0" frame="topbot" rowsep="1" colsep="1"> |
| 2188 | <title>List of Unix style mouse operations.</title> |
| 2189 | <tgroup cols="2"> |
| 2190 | <colspec colwidth="144" align="left"/> |
| 2191 | <colspec colwidth="360" align="left"/> |
| 2192 | <thead> |
| 2193 | <row> |
| 2194 | <entry> |
| 2195 | action |
| 2196 | </entry> |
| 2197 | <entry> |
| 2198 | response |
| 2199 | </entry> |
| 2200 | </row> |
| 2201 | </thead> |
| 2202 | <tbody> |
| 2203 | <row> |
| 2204 | <entry> |
| 2205 | Left-click-and-drag mouse |
| 2206 | </entry> |
| 2207 | <entry> |
| 2208 | Select and copy to the clipboard. |
| 2209 | </entry> |
| 2210 | </row> |
| 2211 | <row> |
| 2212 | <entry> |
| 2213 | Left-click |
| 2214 | </entry> |
| 2215 | <entry> |
| 2216 | Select the start of selection. |
| 2217 | </entry> |
| 2218 | </row> |
| 2219 | <row> |
| 2220 | <entry> |
| 2221 | Right-click |
| 2222 | </entry> |
| 2223 | <entry> |
| 2224 | Select the end of selection and copy to the clipboard. |
| 2225 | </entry> |
| 2226 | </row> |
| 2227 | <row> |
| 2228 | <entry> |
| 2229 | Middle-click |
| 2230 | </entry> |
| 2231 | <entry> |
| 2232 | Paste clipboard at the cursor. |
| 2233 | </entry> |
| 2234 | </row> |
| 2235 | </tbody> |
| 2236 | </tgroup> |
| 2237 | </table> |
| 2238 | <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> |
| 2239 | </section> |
| 2240 | <section id="_the_pager"> |
| 2241 | <title>The pager</title> |
| 2242 | <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> |
| 2243 | </section> |
| 2244 | <section id="_the_text_editor"> |
| 2245 | <title>The text editor</title> |
| 2246 | <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> |
| 2247 | <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> |
| 2248 | <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> |
| 2249 | <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> |
| 2250 | <note> |
| 2251 | <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> |
| 2252 | </note> |
| 2253 | </section> |
| 2254 | <section id="_setting_a_default_text_editor"> |
| 2255 | <title>Setting a default text editor</title> |
| 2256 | <simpara>Debian comes with a number of different editors. We recommend to install the <literal>vim</literal> package, as mentioned above.</simpara> |
| 2257 | <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> |
| 2258 | <screen>$ sudo update-alternatives --config editor</screen> |
| 2259 | <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> |
| 2260 | <tip> |
| 2261 | <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> |
| 2262 | </tip> |
| 2263 | </section> |
| 2264 | <section id="_customizing_vim"> |
| 2265 | <title>Customizing vim</title> |
| 2266 | <simpara>You can customize <literal>vim</literal>(1) behavior by "<literal>~/.vimrc</literal>". For example, I use:</simpara> |
| 2267 | <screen>" ------------------------------- |
| 2268 | " Local configuration |
| 2269 | " |
| 2270 | set nocompatible |
| 2271 | set nopaste |
| 2272 | set pastetoggle=<f2> |
| 2273 | syn on |
| 2274 | if $USER == "root" |
| 2275 | set nomodeline |
| 2276 | set noswapfile |
| 2277 | else |
| 2278 | set modeline |
| 2279 | set swapfile |
| 2280 | endif |
| 2281 | " filler to avoid the line above being recognized as a modeline |
| 2282 | " filler |
| 2283 | " filler</screen> |
| 2284 | </section> |
| 2285 | <section id="_recording_the_shell_activities"> |
| 2286 | <title>Recording the shell activities</title> |
| 2287 | <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> |
| 2288 | <simpara>The basic method of recording the shell activity is to run it under <literal>script</literal>(1).</simpara> |
| 2289 | <screen>$ script |
| 2290 | Script started, file is typescript</screen> |
| 2291 | <itemizedlist> |
| 2292 | <listitem> |
| 2293 | <simpara> |
| 2294 | do whatever shell commands … |
| 2295 | </simpara> |
| 2296 | </listitem> |
| 2297 | <listitem> |
| 2298 | <simpara> |
| 2299 | press <literal>Ctrl-D</literal> to exit <literal>script</literal>. |
| 2300 | </simpara> |
| 2301 | </listitem> |
| 2302 | </itemizedlist> |
| 2303 | <screen>$ vim typescript</screen> |
| 2304 | <simpara>See <xref linkend="_recording_the_shell_activities_cleanly"/> .</simpara> |
| 2305 | </section> |
| 2306 | <section id="_basic_unix_commands"> |
| 2307 | <title>Basic Unix commands</title> |
| 2308 | <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> |
| 2309 | <simpara>Try all following commands from the non-privileged user account:</simpara> |
| 2310 | <table id="listofbasicunixcommands" pgwide="0" frame="topbot" rowsep="1" colsep="1"> |
| 2311 | <title>List of basic Unix commands.</title> |
| 2312 | <tgroup cols="2"> |
| 2313 | <colspec colwidth="144" align="left"/> |
| 2314 | <colspec colwidth="360" align="left"/> |
| 2315 | <thead> |
| 2316 | <row> |
| 2317 | <entry> |
| 2318 | command |
| 2319 | </entry> |
| 2320 | <entry> |
| 2321 | description |
| 2322 | </entry> |
| 2323 | </row> |
| 2324 | </thead> |
| 2325 | <tbody> |
| 2326 | <row> |
| 2327 | <entry> |
| 2328 | <literal>pwd</literal> |
| 2329 | </entry> |
| 2330 | <entry> |
| 2331 | Display name of current/working directory. |
| 2332 | </entry> |
| 2333 | </row> |
| 2334 | <row> |
| 2335 | <entry> |
| 2336 | <literal>whoami</literal> |
| 2337 | </entry> |
| 2338 | <entry> |
| 2339 | Display current user name. |
| 2340 | </entry> |
| 2341 | </row> |
| 2342 | <row> |
| 2343 | <entry> |
| 2344 | <literal>id</literal> |
| 2345 | </entry> |
| 2346 | <entry> |
| 2347 | Display current user identity (name, uid, gid, and associated groups). |
| 2348 | </entry> |
| 2349 | </row> |
| 2350 | <row> |
| 2351 | <entry> |
| 2352 | <literal>file <foo></literal> |
| 2353 | </entry> |
| 2354 | <entry> |
| 2355 | Display a type of file for the file "<literal><foo></literal>". |
| 2356 | </entry> |
| 2357 | </row> |
| 2358 | <row> |
| 2359 | <entry> |
| 2360 | <literal>type -p <commandname></literal> |
| 2361 | </entry> |
| 2362 | <entry> |
| 2363 | Display a file location of command "<literal><commandname></literal>". |
| 2364 | </entry> |
| 2365 | </row> |
| 2366 | <row> |
| 2367 | <entry> |
| 2368 | <literal>which <commandname></literal> |
| 2369 | </entry> |
| 2370 | <entry> |
| 2371 | , , |
| 2372 | </entry> |
| 2373 | </row> |
| 2374 | <row> |
| 2375 | <entry> |
| 2376 | <literal>type <commandname></literal> |
| 2377 | </entry> |
| 2378 | <entry> |
| 2379 | Display information on command "<literal><commandname></literal>". |
| 2380 | </entry> |
| 2381 | </row> |
| 2382 | <row> |
| 2383 | <entry> |
| 2384 | <literal>apropos <key-word></literal> |
| 2385 | </entry> |
| 2386 | <entry> |
| 2387 | Find commands related to "<literal><key-word></literal>". |
| 2388 | </entry> |
| 2389 | </row> |
| 2390 | <row> |
| 2391 | <entry> |
| 2392 | <literal>man -k <key-word></literal> |
| 2393 | </entry> |
| 2394 | <entry> |
| 2395 | , , |
| 2396 | </entry> |
| 2397 | </row> |
| 2398 | <row> |
| 2399 | <entry> |
| 2400 | <literal>whatis <commandname></literal> |
| 2401 | </entry> |
| 2402 | <entry> |
| 2403 | Display one line explanation on command "<literal><commandname></literal>". |
| 2404 | </entry> |
| 2405 | </row> |
| 2406 | <row> |
| 2407 | <entry> |
| 2408 | <literal>man -a <commandname></literal> |
| 2409 | </entry> |
| 2410 | <entry> |
| 2411 | Display explanation on command "<literal><commandname></literal>". (Unix style) |
| 2412 | </entry> |
| 2413 | </row> |
| 2414 | <row> |
| 2415 | <entry> |
| 2416 | <literal>info <commandname></literal> |
| 2417 | </entry> |
| 2418 | <entry> |
| 2419 | Display rather long explanation on command "<literal><commandname></literal>". (GNU style) |
| 2420 | </entry> |
| 2421 | </row> |
| 2422 | <row> |
| 2423 | <entry> |
| 2424 | <literal>ls</literal> |
| 2425 | </entry> |
| 2426 | <entry> |
| 2427 | List contents of directory. (non-dot files and directories) |
| 2428 | </entry> |
| 2429 | </row> |
| 2430 | <row> |
| 2431 | <entry> |
| 2432 | <literal>ls -a</literal> |
| 2433 | </entry> |
| 2434 | <entry> |
| 2435 | List contents of directory. (all files and directories) |
| 2436 | </entry> |
| 2437 | </row> |
| 2438 | <row> |
| 2439 | <entry> |
| 2440 | <literal>ls -A</literal> |
| 2441 | </entry> |
| 2442 | <entry> |
| 2443 | List contents of directory. (almost all files and directories, i.e., skip "<literal>..</literal>" and "<literal>.</literal>") |
| 2444 | </entry> |
| 2445 | </row> |
| 2446 | <row> |
| 2447 | <entry> |
| 2448 | <literal>ls -la</literal> |
| 2449 | </entry> |
| 2450 | <entry> |
| 2451 | List all contents of directory with detail information. |
| 2452 | </entry> |
| 2453 | </row> |
| 2454 | <row> |
| 2455 | <entry> |
| 2456 | <literal>ls -lai</literal> |
| 2457 | </entry> |
| 2458 | <entry> |
| 2459 | List all contents of directory with inode number and detail information. |
| 2460 | </entry> |
| 2461 | </row> |
| 2462 | <row> |
| 2463 | <entry> |
| 2464 | <literal>ls -d</literal> |
| 2465 | </entry> |
| 2466 | <entry> |
| 2467 | List all directories under the current directory. |
| 2468 | </entry> |
| 2469 | </row> |
| 2470 | <row> |
| 2471 | <entry> |
| 2472 | <literal>tree</literal> |
| 2473 | </entry> |
| 2474 | <entry> |
| 2475 | Display file tree contents. |
| 2476 | </entry> |
| 2477 | </row> |
| 2478 | <row> |
| 2479 | <entry> |
| 2480 | <literal>lsof <foo></literal> |
| 2481 | </entry> |
| 2482 | <entry> |
| 2483 | List open status of file "<literal><foo></literal>". |
| 2484 | </entry> |
| 2485 | </row> |
| 2486 | <row> |
| 2487 | <entry> |
| 2488 | <literal>lsof -p <pid></literal> |
| 2489 | </entry> |
| 2490 | <entry> |
| 2491 | List files opened by the process ID: "<literal><pid></literal>". |
| 2492 | </entry> |
| 2493 | </row> |
| 2494 | <row> |
| 2495 | <entry> |
| 2496 | <literal>mkdir <foo></literal> |
| 2497 | </entry> |
| 2498 | <entry> |
| 2499 | Make a new directory "<literal><foo></literal>" in the current directory. |
| 2500 | </entry> |
| 2501 | </row> |
| 2502 | <row> |
| 2503 | <entry> |
| 2504 | <literal>rmdir <foo></literal> |
| 2505 | </entry> |
| 2506 | <entry> |
| 2507 | Remove a directory "<literal><foo></literal>" in the current directory. |
| 2508 | </entry> |
| 2509 | </row> |
| 2510 | <row> |
| 2511 | <entry> |
| 2512 | <literal>cd <foo></literal> |
| 2513 | </entry> |
| 2514 | <entry> |
| 2515 | Change directory to the directory "<literal><foo></literal>" in the current directory or in the directory listed in the variable "<literal>$CDPATH</literal>". |
| 2516 | </entry> |
| 2517 | </row> |
| 2518 | <row> |
| 2519 | <entry> |
| 2520 | <literal>cd /</literal> |
| 2521 | </entry> |
| 2522 | <entry> |
| 2523 | Change directory to the root directory. |
| 2524 | </entry> |
| 2525 | </row> |
| 2526 | <row> |
| 2527 | <entry> |
| 2528 | <literal>cd</literal> |
| 2529 | </entry> |
| 2530 | <entry> |
| 2531 | Change directory to the current user's home directory. |
| 2532 | </entry> |
| 2533 | </row> |
| 2534 | <row> |
| 2535 | <entry> |
| 2536 | <literal>cd /<foo></literal> |
| 2537 | </entry> |
| 2538 | <entry> |
| 2539 | Change directory to the absolute path directory "<literal>/<foo></literal>". |
| 2540 | </entry> |
| 2541 | </row> |
| 2542 | <row> |
| 2543 | <entry> |
| 2544 | <literal>cd ..</literal> |
| 2545 | </entry> |
| 2546 | <entry> |
| 2547 | Change directory to the parent directory. |
| 2548 | </entry> |
| 2549 | </row> |
| 2550 | <row> |
| 2551 | <entry> |
| 2552 | <literal>cd ~<foo></literal> |
| 2553 | </entry> |
| 2554 | <entry> |
| 2555 | Change directory to the home directory of the user "<literal><foo></literal>". |
| 2556 | </entry> |
| 2557 | </row> |
| 2558 | <row> |
| 2559 | <entry> |
| 2560 | <literal>cd -</literal> |
| 2561 | </entry> |
| 2562 | <entry> |
| 2563 | Change directory to the previous directory. |
| 2564 | </entry> |
| 2565 | </row> |
| 2566 | <row> |
| 2567 | <entry> |
| 2568 | <literal></etc/motd pager</literal> |
| 2569 | </entry> |
| 2570 | <entry> |
| 2571 | Display contents of "<literal>/etc/motd</literal>" using the default pager. |
| 2572 | </entry> |
| 2573 | </row> |
| 2574 | <row> |
| 2575 | <entry> |
| 2576 | <literal>touch <junkfile></literal> |
| 2577 | </entry> |
| 2578 | <entry> |
| 2579 | Create a empty file "<literal><junkfile></literal>". |
| 2580 | </entry> |
| 2581 | </row> |
| 2582 | <row> |
| 2583 | <entry> |
| 2584 | <literal>cp <foo> <bar></literal> |
| 2585 | </entry> |
| 2586 | <entry> |
| 2587 | Copy a existing file "<literal><foo></literal>" to a new file "<literal><bar></literal>". |
| 2588 | </entry> |
| 2589 | </row> |
| 2590 | <row> |
| 2591 | <entry> |
| 2592 | <literal>rm <junkfile></literal> |
| 2593 | </entry> |
| 2594 | <entry> |
| 2595 | Remove a file "<literal><junkfile></literal>". |
| 2596 | </entry> |
| 2597 | </row> |
| 2598 | <row> |
| 2599 | <entry> |
| 2600 | <literal>mv <foo> <bar></literal> |
| 2601 | </entry> |
| 2602 | <entry> |
| 2603 | Rename an existing file "<literal><foo></literal>" to a new name "<literal><bar></literal>". The directory "<literal><bar></literal>" must not exist. |
| 2604 | </entry> |
| 2605 | </row> |
| 2606 | <row> |
| 2607 | <entry> |
| 2608 | <literal>mv <foo> <bar></literal> |
| 2609 | </entry> |
| 2610 | <entry> |
| 2611 | Move an existing file "<literal><foo></literal>" to a new location "<literal><bar>/<foo></literal>". The directory "<literal><bar></literal>" must exist. |
| 2612 | </entry> |
| 2613 | </row> |
| 2614 | <row> |
| 2615 | <entry> |
| 2616 | <literal>mv <foo> <bar>/<baz></literal> |
| 2617 | </entry> |
| 2618 | <entry> |
| 2619 | Move an existing file "<literal><foo></literal>" to a new location with a new name "<literal><bar>/<baz></literal>". The directory "<literal><bar></literal>" must exist but the directory "<literal><bar>/<baz></literal>" must not exist. |
| 2620 | </entry> |
| 2621 | </row> |
| 2622 | <row> |
| 2623 | <entry> |
| 2624 | <literal>chmod 600 <foo></literal> |
| 2625 | </entry> |
| 2626 | <entry> |
| 2627 | Make an existing file "<literal><foo></literal>" to be non-readable and non-writable by the other people. (non-executable for all) |
| 2628 | </entry> |
| 2629 | </row> |
| 2630 | <row> |
| 2631 | <entry> |
| 2632 | <literal>chmod 644 <foo></literal> |
| 2633 | </entry> |
| 2634 | <entry> |
| 2635 | Make an existing file "<literal><foo></literal>" to be readable but non-writable by the other people. (non-executable for all) |
| 2636 | </entry> |
| 2637 | </row> |
| 2638 | <row> |
| 2639 | <entry> |
| 2640 | <literal>chmod 755 <foo></literal> |
| 2641 | </entry> |
| 2642 | <entry> |
| 2643 | Make an existing file "<literal><foo></literal>" to be readable but non-writable by the other people. (executable for all) |
| 2644 | </entry> |
| 2645 | </row> |
| 2646 | <row> |
| 2647 | <entry> |
| 2648 | <literal>find . -name <pattern></literal> |
| 2649 | </entry> |
| 2650 | <entry> |
| 2651 | find matching filenames using shell "<literal><pattern></literal>". (slower) |
| 2652 | </entry> |
| 2653 | </row> |
| 2654 | <row> |
| 2655 | <entry> |
| 2656 | <literal>locate -d . <pattern></literal> |
| 2657 | </entry> |
| 2658 | <entry> |
| 2659 | find matching filenames using shell "<literal><pattern></literal>". (quicker using regularly generated database) |
| 2660 | </entry> |
| 2661 | </row> |
| 2662 | <row> |
| 2663 | <entry> |
| 2664 | <literal>grep -e "<pattern>" *.html</literal> |
| 2665 | </entry> |
| 2666 | <entry> |
| 2667 | Find a "<pattern>" in all files ending with "<literal>.html</literal>" in current directory and display them all. |
| 2668 | </entry> |
| 2669 | </row> |
| 2670 | <row> |
| 2671 | <entry> |
| 2672 | <literal>top</literal> |
| 2673 | </entry> |
| 2674 | <entry> |
| 2675 | Display process information using full screen. Type "<literal>q</literal>" to quit. |
| 2676 | </entry> |
| 2677 | </row> |
| 2678 | <row> |
| 2679 | <entry> |
| 2680 | <literal>ps aux | pager</literal> |
| 2681 | </entry> |
| 2682 | <entry> |
| 2683 | Display information on all the running processes using BSD style output. |
| 2684 | </entry> |
| 2685 | </row> |
| 2686 | <row> |
| 2687 | <entry> |
| 2688 | <literal>ps -ef | pager</literal> |
| 2689 | </entry> |
| 2690 | <entry> |
| 2691 | Display information on all the running processes using Unix system-V style output. |
| 2692 | </entry> |
| 2693 | </row> |
| 2694 | <row> |
| 2695 | <entry> |
| 2696 | <literal>ps aux | grep -e "[e]xim4*"</literal> |
| 2697 | </entry> |
| 2698 | <entry> |
| 2699 | Display all processes running "<literal>exim</literal>" and "<literal>exim4</literal>". |
| 2700 | </entry> |
| 2701 | </row> |
| 2702 | <row> |
| 2703 | <entry> |
| 2704 | <literal>ps axf | pager</literal> |
| 2705 | </entry> |
| 2706 | <entry> |
| 2707 | Display information on all the running processes with ASCII art output. |
| 2708 | </entry> |
| 2709 | </row> |
| 2710 | <row> |
| 2711 | <entry> |
| 2712 | <literal>kill <1234></literal> |
| 2713 | </entry> |
| 2714 | <entry> |
| 2715 | Kill a process identified by the process ID: "<1234>". |
| 2716 | </entry> |
| 2717 | </row> |
| 2718 | <row> |
| 2719 | <entry> |
| 2720 | <literal>gzip <foo></literal> |
| 2721 | </entry> |
| 2722 | <entry> |
| 2723 | Compress "<literal><foo></literal>" to create "<literal><foo>.gz</literal>" using the Lempel-Ziv coding (LZ77). |
| 2724 | </entry> |
| 2725 | </row> |
| 2726 | <row> |
| 2727 | <entry> |
| 2728 | <literal>gunzip <foo>.gz</literal> |
| 2729 | </entry> |
| 2730 | <entry> |
| 2731 | Decompress "<literal><foo>.gz</literal>" to create "<literal><foo></literal>". |
| 2732 | </entry> |
| 2733 | </row> |
| 2734 | <row> |
| 2735 | <entry> |
| 2736 | <literal>bzip2 <foo></literal> |
| 2737 | </entry> |
| 2738 | <entry> |
| 2739 | Compress "<literal><foo></literal>" to create "<literal><foo>.bz2</literal>" using the Burrows-Wheeler block sorting text compression algorithm, and Huffman coding. (Better compression than <literal>gzip</literal>) |
| 2740 | </entry> |
| 2741 | </row> |
| 2742 | <row> |
| 2743 | <entry> |
| 2744 | <literal>bunzip2 <foo>.bz2</literal> |
| 2745 | </entry> |
| 2746 | <entry> |
| 2747 | Decompress "<literal><foo>.bz2</literal>" to create "<literal><foo></literal>". |
| 2748 | </entry> |
| 2749 | </row> |
| 2750 | <row> |
| 2751 | <entry> |
| 2752 | <literal>tar -xvf <foo>.tar</literal> |
| 2753 | </entry> |
| 2754 | <entry> |
| 2755 | Extract files from "<literal><foo>.tar</literal>" archive. |
| 2756 | </entry> |
| 2757 | </row> |
| 2758 | <row> |
| 2759 | <entry> |
| 2760 | <literal>tar -xvzf <foo>.tar.gz</literal> |
| 2761 | </entry> |
| 2762 | <entry> |
| 2763 | Extract files from gzipped "<literal><foo>.tar.gz</literal>" archive. |
| 2764 | </entry> |
| 2765 | </row> |
| 2766 | <row> |
| 2767 | <entry> |
| 2768 | <literal>tar -xvf -j <foo>.tar.bz2</literal> |
| 2769 | </entry> |
| 2770 | <entry> |
| 2771 | Extract files from "<literal><foo>.tar.bz2</literal>" archive. |
| 2772 | </entry> |
| 2773 | </row> |
| 2774 | <row> |
| 2775 | <entry> |
| 2776 | <literal>tar -cvf <foo>.tar <bar>/</literal> |
| 2777 | </entry> |
| 2778 | <entry> |
| 2779 | Archive contents of folder "<literal><bar>/</literal>" in "<literal><foo>.tar</literal>" archive. |
| 2780 | </entry> |
| 2781 | </row> |
| 2782 | <row> |
| 2783 | <entry> |
| 2784 | <literal>tar -cvzf <foo>.tar.gz <bar>/</literal> |
| 2785 | </entry> |
| 2786 | <entry> |
| 2787 | Archive contents of folder "<literal><bar>/</literal>" in compressed "<literal><foo>.tar.gz</literal>" archive. |
| 2788 | </entry> |
| 2789 | </row> |
| 2790 | <row> |
| 2791 | <entry> |
| 2792 | <literal>tar -cvjf <foo>.tar.bz2 <bar>/</literal> |
| 2793 | </entry> |
| 2794 | <entry> |
| 2795 | Archive contents of folder "<literal><bar>/</literal>" in "<literal><foo>.tar.bz2</literal>" archive. |
| 2796 | </entry> |
| 2797 | </row> |
| 2798 | <row> |
| 2799 | <entry> |
| 2800 | <literal>zcat README.gz | pager</literal> |
| 2801 | </entry> |
| 2802 | <entry> |
| 2803 | Display contents of compressed "<literal>README.gz</literal>" using the default pager. |
| 2804 | </entry> |
| 2805 | </row> |
| 2806 | <row> |
| 2807 | <entry> |
| 2808 | <literal>zcat README.gz > foo</literal> |
| 2809 | </entry> |
| 2810 | <entry> |
| 2811 | Create a file "<literal>foo</literal>" with the decompressed content of "<literal>README.gz</literal>". |
| 2812 | </entry> |
| 2813 | </row> |
| 2814 | <row> |
| 2815 | <entry> |
| 2816 | <literal>zcat README.gz >> foo</literal> |
| 2817 | </entry> |
| 2818 | <entry> |
| 2819 | 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.) |
| 2820 | </entry> |
| 2821 | </row> |
| 2822 | </tbody> |
| 2823 | </tgroup> |
| 2824 | </table> |
| 2825 | <note> |
| 2826 | <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> |
| 2827 | </note> |
| 2828 | <note> |
| 2829 | <simpara>For <literal>cd</literal> command, see <literal>builtins</literal>(7).</simpara> |
| 2830 | </note> |
| 2831 | <note> |
| 2832 | <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> |
| 2833 | </note> |
| 2834 | <note> |
| 2835 | <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> |
| 2836 | </note> |
| 2837 | <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> |
| 2838 | <screen>$ man man |
| 2839 | $ man bash |
| 2840 | $ man builtins |
| 2841 | $ man grep |
| 2842 | $ man ls</screen> |
| 2843 | <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> |
| 2844 | <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> |
| 2845 | <screen>$ <commandname> --help |
| 2846 | $ <commandname> -h</screen> |
| 2847 | </section> |
| 2848 | </section> |
| 2849 | <section id="_the_simple_shell_command"> |
| 2850 | <title>The simple shell command</title> |
| 2851 | <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> |
| 2852 | <simpara>A simple command is a sequence of:</simpara> |
| 2853 | <orderedlist> |
| 2854 | <listitem> |
| 2855 | <simpara> |
| 2856 | variable assignments (optional) |
| 2857 | </simpara> |
| 2858 | </listitem> |
| 2859 | <listitem> |
| 2860 | <simpara> |
| 2861 | command name |
| 2862 | </simpara> |
| 2863 | </listitem> |
| 2864 | <listitem> |
| 2865 | <simpara> |
| 2866 | arguments (optional) |
| 2867 | </simpara> |
| 2868 | </listitem> |
| 2869 | <listitem> |
| 2870 | <simpara> |
| 2871 | redirections (optional: <literal>></literal> , <literal>>></literal> , <literal><</literal> , <literal><<</literal> , etc.) |
| 2872 | </simpara> |
| 2873 | </listitem> |
| 2874 | <listitem> |
| 2875 | <simpara> |
| 2876 | control operator (optional: <literal>&&</literal> , <literal>||</literal> , <newline> , <literal>;</literal> , <literal>&</literal> , <literal>(</literal> , <literal>)</literal> ) |
| 2877 | </simpara> |
| 2878 | </listitem> |
| 2879 | </orderedlist> |
| 2880 | <section id="_command_execution_and_environment_variable"> |
| 2881 | <title>Command execution and environment variable</title> |
| 2882 | <simpara>Values of some <ulink url="&environmentvariables;">environment variables</ulink> change the behavior of some Unix commands.</simpara> |
| 2883 | <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> |
| 2884 | <itemizedlist> |
| 2885 | <listitem> |
| 2886 | <simpara> |
| 2887 | the display manager such as <literal>gdm</literal>, and |
| 2888 | </simpara> |
| 2889 | </listitem> |
| 2890 | <listitem> |
| 2891 | <simpara> |
| 2892 | the shell in its start up codes "<literal>~/bash_profile</literal>" and "<literal>~/.bashrc</literal>". |
| 2893 | </simpara> |
| 2894 | </listitem> |
| 2895 | </itemizedlist> |
| 2896 | <section id="_lang_variable"> |
| 2897 | <title>"$LANG" variable</title> |
| 2898 | <simpara>The full locale value given to "<literal>$LANG</literal>" variable consists of 3 parts: "<literal>xx_YY.ZZZZ</literal>".</simpara> |
| 2899 | <table id="dpartsoflocalevalue" pgwide="0" frame="topbot" rowsep="1" colsep="1"> |
| 2900 | <title>3 parts of locale value.</title> |
| 2901 | <tgroup cols="2"> |
| 2902 | <colspec colwidth="144" align="left"/> |
| 2903 | <colspec colwidth="360" align="left"/> |
| 2904 | <thead> |
| 2905 | <row> |
| 2906 | <entry> |
| 2907 | locale value |
| 2908 | </entry> |
| 2909 | <entry> |
| 2910 | meaning |
| 2911 | </entry> |
| 2912 | </row> |
| 2913 | </thead> |
| 2914 | <tbody> |
| 2915 | <row> |
| 2916 | <entry> |
| 2917 | <literal>xx</literal> |
| 2918 | </entry> |
| 2919 | <entry> |
| 2920 | <ulink url="&isogdjlanguagecoowercasesuchasen;">ISO 639 language codes (lower case) such as "en"</ulink> |
| 2921 | </entry> |
| 2922 | </row> |
| 2923 | <row> |
| 2924 | <entry> |
| 2925 | <literal>YY</literal> |
| 2926 | </entry> |
| 2927 | <entry> |
| 2928 | <ulink url="&isodbggcountrycoppercasesuchasus;">ISO 3166 country codes (upper case) such as "US"</ulink> |
| 2929 | </entry> |
| 2930 | </row> |
| 2931 | <row> |
| 2932 | <entry> |
| 2933 | <literal>ZZZZ</literal> |
| 2934 | </entry> |
| 2935 | <entry> |
| 2936 | <ulink url="&codesetalwayssettoutfi;">codeset, always set to "UTF-8"</ulink> |
| 2937 | </entry> |
| 2938 | </row> |
| 2939 | </tbody> |
| 2940 | </tgroup> |
| 2941 | </table> |
| 2942 | <simpara>For language codes and country codes, see pertinent description in the "<literal>info gettext</literal>".</simpara> |
| 2943 | <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> |
| 2944 | <simpara>For fine details of the locale configuration, see <xref linkend="_the_locale"/>.</simpara> |
| 2945 | <note> |
| 2946 | <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> |
| 2947 | </note> |
| 2948 | <table id="listoflocalerecommendations" pgwide="0" frame="topbot" rowsep="1" colsep="1"> |
| 2949 | <title>List of locale recommendations.</title> |
| 2950 | <tgroup cols="2"> |
| 2951 | <colspec colwidth="144" align="left"/> |
| 2952 | <colspec colwidth="360" align="left"/> |
| 2953 | <thead> |
| 2954 | <row> |
| 2955 | <entry> |
| 2956 | Language (area) |
| 2957 | </entry> |
| 2958 | <entry> |
| 2959 | locale recommendation |
| 2960 | </entry> |
| 2961 | </row> |
| 2962 | </thead> |
| 2963 | <tbody> |
| 2964 | <row> |
| 2965 | <entry> |
| 2966 | English(USA) |
| 2967 | </entry> |
| 2968 | <entry> |
| 2969 | <literal>en_US.UTF-8</literal> |
| 2970 | </entry> |
| 2971 | </row> |
| 2972 | <row> |
| 2973 | <entry> |
| 2974 | English(Great_Britain) |
| 2975 | </entry> |
| 2976 | <entry> |
| 2977 | <literal>en_GB.UTF-8</literal> |
| 2978 | </entry> |
| 2979 | </row> |
| 2980 | <row> |
| 2981 | <entry> |
| 2982 | French(France) |
| 2983 | </entry> |
| 2984 | <entry> |
| 2985 | <literal>fr_FR.UTF-8</literal> |
| 2986 | </entry> |
| 2987 | </row> |
| 2988 | <row> |
| 2989 | <entry> |
| 2990 | German(Germany) |
| 2991 | </entry> |
| 2992 | <entry> |
| 2993 | <literal>de_DE.UTF-8</literal> |
| 2994 | </entry> |
| 2995 | </row> |
| 2996 | <row> |
| 2997 | <entry> |
| 2998 | Italian(Italy) |
| 2999 | </entry> |
| 3000 | <entry> |
| 3001 | <literal>it_IT.UTF-8</literal> |
| 3002 | </entry> |
| 3003 | </row> |
| 3004 | <row> |
| 3005 | <entry> |
| 3006 | Spanish(Spain) |
| 3007 | </entry> |
| 3008 | <entry> |
| 3009 | <literal>es_ES.UTF-8</literal> |
| 3010 | </entry> |
| 3011 | </row> |
| 3012 | <row> |
| 3013 | <entry> |
| 3014 | Catalan(Spain) |
| 3015 | </entry> |
| 3016 | <entry> |
| 3017 | <literal>ca_ES.UTF-8</literal> |
| 3018 | </entry> |
| 3019 | </row> |
| 3020 | <row> |
| 3021 | <entry> |
| 3022 | Swedish(Sweden) |
| 3023 | </entry> |
| 3024 | <entry> |
| 3025 | <literal>sv_SE.UTF-8</literal> |
| 3026 | </entry> |
| 3027 | </row> |
| 3028 | <row> |
| 3029 | <entry> |
| 3030 | Portuguese(Brasil) |
| 3031 | </entry> |
| 3032 | <entry> |
| 3033 | <literal>pt_BR.UTF-8</literal> |
| 3034 | </entry> |
| 3035 | </row> |
| 3036 | <row> |
| 3037 | <entry> |
| 3038 | Russian(Russia) |
| 3039 | </entry> |
| 3040 | <entry> |
| 3041 | <literal>ru_RU.UTF-8</literal> |
| 3042 | </entry> |
| 3043 | </row> |
| 3044 | <row> |
| 3045 | <entry> |
| 3046 | Chinese(P.R._of_China) |
| 3047 | </entry> |
| 3048 | <entry> |
| 3049 | <literal>zh_CN.UTF-8</literal> |
| 3050 | </entry> |
| 3051 | </row> |
| 3052 | <row> |
| 3053 | <entry> |
| 3054 | Chinese(Taiwan_R.O.C.) |
| 3055 | </entry> |
| 3056 | <entry> |
| 3057 | <literal>zh_TW.UTF-8</literal> |
| 3058 | </entry> |
| 3059 | </row> |
| 3060 | <row> |
| 3061 | <entry> |
| 3062 | Japanese(Japan) |
| 3063 | </entry> |
| 3064 | <entry> |
| 3065 | <literal>ja_JP.UTF-8</literal> |
| 3066 | </entry> |
| 3067 | </row> |
| 3068 | <row> |
| 3069 | <entry> |
| 3070 | Korean(Republic_of_Korea) |
| 3071 | </entry> |
| 3072 | <entry> |
| 3073 | <literal>ko_KR.UTF-8</literal> |
| 3074 | </entry> |
| 3075 | </row> |
| 3076 | <row> |
| 3077 | <entry> |
| 3078 | Vietnamese(Vietnam) |
| 3079 |