extra tags for update printed edition

This commit is contained in:
tille 2006-10-19 13:30:19 +00:00
parent a34df7d996
commit 52bd4b5287
2 changed files with 33 additions and 29 deletions

View File

@ -159,6 +159,7 @@
<authorinitials>MG</authorinitials>
<revremark>Split chap7: audio stuff is now in separate chapter, chap11.xml. Small revisions, updates for commands like aptitude, more on USB storage, Internet telephony, corrections from readers.</revremark>
</revision>
<!--
<revision>
<revnumber>1.19</revnumber>
<date>2005-09-07</date>
@ -195,12 +196,14 @@
<authorinitials>MG</authorinitials>
<revremark>Added tee command in chap5, corrected typos, acted upon remarks sent in by readers, added newgrp explanations, explained user private group scheme, added a remark on umask.</revremark>
</revision>
-->
<revision>
<revnumber>1.13</revnumber>
<date>2004-04-27</date>
<authorinitials>MG</authorinitials>
<revremark>Last read-through before sending everything to Fultus for printout. Added Fultus referrence in New Versions section, updated Conventions and Organization sections. Minor changes in chapters 4, 5, 6 and 8, added rdesktop info in chapter 10, updated glossary, replaced references to fileutils with coreutils, thankyou to Hindi translators.</revremark>
</revision>
<!--
<revision>
<revnumber>1.12</revnumber>
<date>2004-03-13</date>
@ -291,7 +294,7 @@
<revnumber>1.2</revnumber>
<date>2003-02-28</date>
<authorinitials>MG</authorinitials>
<revremark>ps a bit better explained; more in getting started: --help,
<revremark>ps a bit better explained; more in getting started: help,
whatis, apropos explained; more on find; chmod and umask still contained
a couple of errors and incompletenesses; resized images that were too
large to be printed; resized oversized text boxes for better print
@ -311,6 +314,7 @@
<authorinitials>MG</authorinitials>
<revremark>Initial release for TLDP</revremark>
</revision>
-->
</revhistory>
</para>
@ -333,7 +337,7 @@
<para>And thanks to all the readers who notified me about missing topics and who helped
to pick out the last errors, unclear definitions and typos by going through the
trouble of mailing me all their remarks. These are also the people who help me keep
this guide up to date, like Filipus Klutiero who did a complete review in 2005 and 2006, and Alexey Eremenko who sent me the foundation for chapter 11.</para>
this guide up to date, like Filipus Klutiero who did a complete review in 2005 and 2006 and helps me getting the guide into the Debian docs collection, and Alexey Eremenko who sent me the foundation for chapter 11.</para>
<para>Finally, a big thank you for the volunteers who are currently translating this
document in French, Swedish, German, Farsi, Hindi and more. It is a big work that should
not be underestimated; I admire your courage.</para>
@ -575,8 +579,8 @@
</section>
<section id="intro_10">
<title>Organization of this document</title>
<para>This guide aims to be the foundation for all other materials that you can get from
The Linux Documentation Project. As such, it provides you with the fundamental
<para>This guide is part of the Linux Documentation Project and aims to be the foundation for all other materials that you can get from
the Project. As such, it provides you with the fundamental
knowledge needed by anyone who wants to start working with a Linux system, while at
the same time it tries to consciously avoid re-inventing the hot water. Thus, you
can expect this book to be incomplete and full of links to sources of additional

View File

@ -26,7 +26,7 @@
<para>A simple description<indexterm><primary>files</primary><secondary>concept</secondary></indexterm> of the UNIX system, also applicable to Linux, is this:</para>
<para><quote>On a UNIX system, everything is a file; if something is not a file, it is a process.</quote></para>
<para>This statement is true because there are special<indexterm><primary>files</primary><secondary>abstraction</secondary></indexterm> files that are more than just files (named pipes and sockets, for instance), but to keep things simple, saying that everything is a file is an acceptable generalization. A Linux system, just like UNIX, makes no difference between a file and a directory, since a directory is just a file containing names of other files. Programs, services, texts, images, and so forth, are all files. Input and output devices, and generally all devices, are considered to be files, according to the system.</para>
<para>In order to manage all those files in an orderly fashion, man likes to think of them in an ordered tree-like structure<indexterm><primary>files</primary><secondary>structure</secondary></indexterm> on the hard disk, as we know from MS-DOS (Disk Operating System) for instance. The large branches contain more branches, and the branches at the end contain the tree's leaves or normal files. For now we will use this image of the tree, but we will find out later why this is not a fully accurate image.</para>
<para>In order to manage all those files in an orderly fashion, man likes to think of them in an ordered tree-like structure<indexterm><primary>files</primary><secondary>structure</secondary></indexterm> on the hard disk, as we know from <application>MS-DOS</application> (Disk Operating System) for instance. The large branches contain more branches, and the branches at the end contain the tree's leaves or normal files. For now we will use this image of the tree, but we will find out later why this is not a fully accurate image.</para>
</sect3>
<sect3 id="sect_03_01_01_02"><title>Sorts of files</title>
<para>Most files<indexterm><primary>files</primary><secondary>types</secondary></indexterm> are just files, called <emphasis>regular<indexterm><primary>regular files</primary><secondary></secondary></indexterm></emphasis> files; they contain normal data, for example text files, executable files or programs, input for or output from a program and so on.</para>
@ -110,7 +110,7 @@ Now, before we look at the important files and directories, we need to know more
<para>The standard root partition<indexterm><primary>partitions</primary><secondary>root partition</secondary></indexterm> (indicated with a single forward slash<indexterm><primary>slash</primary><secondary>forward</secondary></indexterm>, <emphasis>/</emphasis>) is about 100-500 MB, and contains<indexterm><primary>root partition</primary></indexterm> the system configuration files, most basic commands and server programs, system libraries, some temporary space and the home directory of the administrative user. A standard installation requires about 250 MB for the root partition.</para>
<para>Swap<indexterm><primary>swap partition</primary></indexterm> space (indicated with <emphasis>swap<indexterm><primary>partitions</primary><secondary>swap</secondary></indexterm></emphasis>) is only accessible for the system itself, and is hidden from view during normal operation. Swap is the system that ensures, like on normal UNIX systems, that you can keep on working, whatever happens. On Linux, you will virtually never see irritating messages like <emphasis>Out of memory, please close some applications first and try again</emphasis>, because of this extra memory. The swap or virtual memory procedure has long been adopted by operating systems outside the UNIX world by now.</para>
<para>Using memory on a hard disk is naturally slower than using the real memory chips of a computer, but having this little extra is a great comfort. We will learn more about swap when we discuss Processes in <xref linkend="chap_04" />.</para>
<para>Using memory on a hard disk is naturally slower than using the real memory chips of a computer, but having this little extra is a great comfort. We will learn more about swap when we discuss processes in <xref linkend="chap_04" />.</para>
<para>Linux generally counts on having twice the amount of physical memory in the form of swap space on the hard disk. When installing a system, you have to know how you are going to do this. An example<indexterm><primary>swap partition</primary><secondary>example</secondary></indexterm> on a system with 512 MB of RAM:</para>
<itemizedlist>
<listitem><para>1st possibility: one swap partition of 1 GB</para></listitem>
@ -206,7 +206,7 @@ boot/ etc/ initrd/ lost+found/ mnt/ proc/ sbin/ usr/
<row>
<entry>/boot</entry>
<entry>The startup<indexterm><primary>boot</primary></indexterm> files and the kernel, <filename>vmlinuz</filename>. In some recent distributions also <filename>grub</filename> data. Grub is the GRand Unified Boot loader and is an attempt to get rid of the many different boot-loaders we know today.</entry>
<entry>The startup<indexterm><primary>boot</primary></indexterm> files and the kernel, <filename>vmlinuz</filename>. In some recent distributions also <filename>grub</filename> data. Grub is the <application>GRand Unified Boot</application> loader and is an attempt to get rid of the many different boot-loaders we know today.</entry>
</row>
<row><entry>/dev</entry>
<entry>Contains references<indexterm><primary>dev</primary></indexterm> to all the CPU peripheral hardware, which are represented as files with special properties.</entry>
@ -372,11 +372,11 @@ oriental/ pop/ sixties/
<sect4><title>Shell types</title>
<para>Just like people know different languages and dialects, the computer knows different shell<indexterm><primary>shell</primary><secondary>types</secondary></indexterm> types:</para>
<itemizedlist>
<listitem><para><command>sh<indexterm><primary>sh</primary></indexterm></command> or Bourne Shell<indexterm><primary>Bourne Shell</primary></indexterm>: the original shell still used on UNIX systems and in UNIX related environments. This is the basic shell, a small program with few features. When in POSIX-compatible mode, <command>bash</command> will emulate this shell.</para></listitem>
<listitem><para><command>bash<indexterm><primary>bash</primary></indexterm></command> or Bourne Again shell<indexterm><primary>Bourne Again SHell</primary></indexterm>: the standard GNU shell, intuitive and flexible. Probably most advisable for beginning users while being at the same time a powerful tool for the advanced and professional user. On Linux, <command>bash</command> is the standard shell for common users. This shell is a so-called <emphasis>superset</emphasis> of the Bourne shell, a set of add-ons and plug-ins. This means that the Bourne Again shell is compatible with the Bourne shell: commands that work in <command>sh</command>, also work in <command>bash</command>. However, the reverse is not always the case. All examples and exercises in this book use <command>bash</command>.</para></listitem>
<listitem><para><command>csh<indexterm><primary>csh</primary></indexterm></command> or C shell<indexterm><primary>C shell</primary></indexterm>: the syntax of this shell resembles that of the C programming language. Sometimes asked for by programmers.</para></listitem>
<listitem><para><command>tcsh<indexterm><primary>tcsh</primary></indexterm></command> or Turbo C shell: a superset of the common C shell, enhancing user-friendliness and speed.</para></listitem>
<listitem><para><command>ksh<indexterm><primary>ksh</primary></indexterm></command> or the Korn<indexterm><primary>Korn shell</primary></indexterm> shell: sometimes appreciated by people with a UNIX background. A superset of the Bourne shell; with standard configuration a nightmare for beginning users.</para></listitem>
<listitem><para><command>sh<indexterm><primary>sh</primary></indexterm></command> or <application>Bourne Shell<indexterm><primary>Bourne Shell</primary></indexterm></application>: the original shell still used on UNIX systems and in UNIX related environments. This is the basic shell, a small program with few features. When in POSIX-compatible mode, <command>bash</command> will emulate this shell.</para></listitem>
<listitem><para><command>bash<indexterm><primary>bash</primary></indexterm></command> or <application>Bourne Again SHell<indexterm><primary>Bourne Again SHell</primary></indexterm></application>: the standard GNU shell, intuitive and flexible. Probably most advisable for beginning users while being at the same time a powerful tool for the advanced and professional user. On Linux, <command>bash</command> is the standard shell for common users. This shell is a so-called <emphasis>superset</emphasis> of the <application>Bourne</application> shell, a set of add-ons and plug-ins. This means that the <application>Bourne Again SHell</application> is compatible with the <application>Bourne</application> shell: commands that work in <command>sh</command>, also work in <command>bash</command>. However, the reverse is not always the case. All examples and exercises in this book use <command>bash</command>.</para></listitem>
<listitem><para><command>csh<indexterm><primary>csh</primary></indexterm></command> or <application>C Shell<indexterm><primary>C shell</primary></indexterm></application>: the syntax of this shell resembles that of the C programming language. Sometimes asked for by programmers.</para></listitem>
<listitem><para><command>tcsh<indexterm><primary>tcsh</primary></indexterm></command> or <application>Turbo C Shell</application>: a superset of the common <application>C Shell</application>, enhancing user-friendliness and speed.</para></listitem>
<listitem><para><command>ksh<indexterm><primary>ksh</primary></indexterm></command> or the <application>Korn<indexterm><primary>Korn shell</primary></indexterm></application> shell: sometimes appreciated by people with a UNIX background. A superset of the <application>Bourne</application> shell; with standard configuration a nightmare for beginning users.</para></listitem>
</itemizedlist>
<para>The file <filename>/etc/shells<indexterm><primary>shells</primary></indexterm></filename> gives an overview of known shells on a Linux system:</para>
@ -388,7 +388,7 @@ oriental/ pop/ sixties/
/bin/csh
</screen>
<note><title>Fake Bourne shell</title>
<para>Note that <filename>/bin/sh</filename> is usually a link to Bash<indexterm><primary>sh</primary></indexterm>, which will execute in Bourne shell compatible mode when called on this way.</para>
<para>Note that <filename>/bin/sh</filename> is usually a link to <application>Bash<indexterm><primary>sh</primary></indexterm></application>, which will execute in <application>Bourne</application> shell compatible mode when called on this way.</para>
</note>
<para>Your default shell is set in the <filename>/etc/passwd<indexterm><primary>passwd</primary></indexterm></filename> file, like this line for user <emphasis>mia</emphasis>:</para>
<screen>
@ -714,7 +714,7 @@ Diskquotas for user pierre (uid 501): none
<sect2 id="sect_03_03_01"><title>Viewing file properties</title>
<sect3 id="sect_03_03_01_01"><title>More about ls</title>
<para>Besides the name of the file, <command>ls<indexterm><primary>ls</primary></indexterm></command> can give a lot of other information, such as the file type, as we already discussed. It can also show permissions<indexterm><primary>files</primary><secondary>properties</secondary></indexterm> on a file, file size, inode number, creation date and time, owners and amount of links to the file. With the <option>-a</option> option to <command>ls</command>, files that are normally hidden from view can be displayed as well. These are files that have a name starting with a dot. A couple of typical examples include the configuration files in your home directory. When you've worked with a certain system for a while, you will notice that tens of files and directories have been created that are not automatically listed in a directory index. Next to that, every directory contains a file named just dot (.) and one with two dots (..)<indexterm><primary>dots</primary></indexterm>, which are used in combination with their inode number to determine the directory's position in the file system's tree structure.</para>
<para>You should really read the Info pages about <command>ls</command>, since it is a very common command with a lot of useful options. Options can be combined, as is the case with most UNIX commands and their options. A common combination is <command>ls <option>-al</option></command>; it shows a long list of files and their properties as well as the destinations that any symbolic links point to. <command>ls <option>-latr</option></command> displays the same files, only now in reversed order of the last change, so that the file changed most recently occurs at the bottom of the list. Here are a couple of examples<indexterm><primary>ls</primary><secondary>example</secondary></indexterm>:</para>
<para>You should really read the <application>Info</application> pages about <command>ls</command>, since it is a very common command with a lot of useful options. Options can be combined, as is the case with most UNIX commands and their options. A common combination is <command>ls <option>-al</option></command>; it shows a long list of files and their properties as well as the destinations that any symbolic links point to. <command>ls <option>-latr</option></command> displays the same files, only now in reversed order of the last change, so that the file changed most recently occurs at the bottom of the list. Here are a couple of examples<indexterm><primary>ls</primary><secondary>example</secondary></indexterm>:</para>
<screen>
<prompt>krissie:~/mp3&gt;</prompt> <command>ls</command>
Albums/ Radio/ Singles/ gene/ index.html
@ -871,9 +871,9 @@ closed/ Emacs@ Mail/ office52/ Xrootenv.0
<para>Furthermore, new files are created seemingly continuously because users want to save files, keep different versions of their work, use Internet applications, and download files and attachments to their local machine. It doesn't stop. It is clear that one definitely needs a scheme to keep an overview on things.</para>
<para>In the next section, we will discuss our means of keeping order. We only discuss text tools available to the shell, since the graphical tools are very intuitive and have the same look and feel as the well known point-and-click MS Windows-style file managers, including graphical help functions and other features you expect from this kind of applications. The following list is an overview of the most popular file managers for GNU/Linux. Most file managers can be started from the menu of your desktop manager, or by clicking your home directory icon, or from the command line, issuing these<indexterm><primary>file managers</primary><secondary>overview</secondary></indexterm> commands:</para>
<itemizedlist>
<listitem><para><command>nautilus<indexterm><primary>nautilus</primary></indexterm></command>: The default file manager in Gnome, the GNU desktop. Excellent documentation about working with this tool can be found at <ulink url="http://www.gnome.org/learn/users-guide/latest/gosnautilus-1.html">http://www.gnome.org</ulink>.</para></listitem>
<listitem><para><command>konqueror<indexterm><primary>konqueror</primary></indexterm></command>: The file manager typically used on a KDE desktop. The handbook is at <ulink url="http://docs.kde.org/en/3.1/kdebase/konqueror/">http://docs.kde.org</ulink>.</para></listitem>
<listitem><para><command>mc<indexterm><primary>mc</primary></indexterm></command>: Midnight Commander, the Unix file manager after the fashion of Norton Commander. All documentation available from <ulink url="http://www.gnu.org/directory/midnightcommander.html">http://gnu.org/directory/</ulink> or a mirror, such as <ulink url="http://www.ibiblio.org" />.</para></listitem>
<listitem><para><command>nautilus<indexterm><primary>nautilus</primary></indexterm></command>: The default file manager in <application>Gnome</application>, the GNU desktop. Excellent documentation about working with this tool can be found at <ulink url="http://www.gnome.org/learn/users-guide/latest/gosnautilus-1.html">http://www.gnome.org</ulink>.</para></listitem>
<listitem><para><command>konqueror<indexterm><primary>konqueror</primary></indexterm></command>: The file manager typically used on a <application>KDE</application> desktop. The handbook is at <ulink url="http://docs.kde.org/en/3.1/kdebase/konqueror/">http://docs.kde.org</ulink>.</para></listitem>
<listitem><para><command>mc<indexterm><primary>mc</primary></indexterm></command>: <application>Midnight Commander</application>, the Unix file manager after the fashion of Norton Commander. All documentation available from <ulink url="http://www.gnu.org/directory/midnightcommander.html">http://gnu.org/directory/</ulink> or a mirror, such as <ulink url="http://www.ibiblio.org" />.</para></listitem>
</itemizedlist>
<para>These applications are certainly worth giving a try and usually impress newcomers to Linux, if only because there is such a wide variety: these are only the most popular tools for managing directories and files, and many other projects are being developed. Now let's find out about the internals and see how these graphical tools use common UNIX commands.</para>
@ -905,7 +905,7 @@ No such file or directory
<prompt>richard:~/archive&gt;</prompt> <command>ls 2001/reports/</command>
Restaurants-Michelin/
</screen>
<para>If the new file needs other permissions than the default file creation permissions, the new access rights can be set in one move, still using the <command>mkdir</command> command, see the Info pages for more. We are going to discuss access modes in the next section on File Security.</para>
<para>If the new file needs other permissions than the default file creation permissions, the new access rights can be set in one move, still using the <command>mkdir</command> command, see the <application>Info</application> pages for more. We are going to discuss access modes in the next section on file security.</para>
<para>The name of a directory has to comply with the same rules as those applied on regular file names<indexterm><primary>files</primary><secondary>naming conventions</secondary></indexterm>. One of the most important restrictions is that you can't have two files with the same name in one directory (but keep in mind that Linux is, like UNIX, a case sensitive operating system). There are virtually no limits on the length of a file name, but it is usually kept shorter than 80 characters, so it can fit on one line of a terminal. You can use any character you want in a file name, although it is advised to exclude characters that have a special meaning to the shell. When in doubt, check with <xref linkend="app3" />.</para>
</sect4>
<sect4><title>Moving files</title>
@ -958,8 +958,8 @@ rm: remove directory `archive'? <command>y</command>
<sect2 id="sect_03_03_03"><title>Finding files</title>
<sect3 id="sect_03_03_03_01"><title>Using shell features</title>
<para>In the example on moving files we already saw how the shell<indexterm><primary>finding files</primary><secondary>using the shell</secondary></indexterm> can manipulate multiple files at once. In that example, the shell finds out automatically what the user means by the requirements between the square<indexterm><primary>square braces</primary></indexterm> braces <quote>[</quote> and <quote>]</quote>. The shell can substitute ranges<indexterm><primary>ranges</primary><secondary>substitution</secondary></indexterm> of numbers and upper or lower case characters alike. It also substitutes as many characters as you want with an asterisk, and only one character with a question mark.</para>
<para>All sorts of substitutions can be used simultaneously; the shell is very logical about it. The Bash shell, for instance, has no problem with expressions like<indexterm><primary>shell</primary><secondary>substitution</secondary></indexterm> <command>ls <parameter>dirname/*/*/*[2-3]</parameter></command>.</para>
<para>In other shells, the asterisk is commonly used to minimize the efforts of typing: people would enter <command>cd <parameter>dir*</parameter></command> instead of <command>cd <filename>directory</filename></command>. In Bash however, this is not necessary because the GNU shell has a feature called file name completion. It means that you can type the first few characters of a command (anywhere) or a file (in the current directory) and if no confusion is possible, the shell will find out what you mean. For example in a directory containing many files, you can check if there are any files beginning with the letter A just by typing <command>ls <parameter>A</parameter></command> and pressing the <keycap>Tab</keycap> key twice, rather than pressing <keycap>Enter</keycap>. If there is only one file starting with <quote>A</quote>, this file will be shown as the argument to <command>ls</command> (or any shell command, for that matter) immediately.</para>
<para>All sorts of substitutions can be used simultaneously; the shell is very logical about it. The <application>Bash</application> shell, for instance, has no problem with expressions like<indexterm><primary>shell</primary><secondary>substitution</secondary></indexterm> <command>ls <parameter>dirname/*/*/*[2-3]</parameter></command>.</para>
<para>In other shells, the asterisk is commonly used to minimize the efforts of typing: people would enter <command>cd <parameter>dir*</parameter></command> instead of <command>cd <filename>directory</filename></command>. In <application>Bash</application> however, this is not necessary because the GNU shell has a feature called file name completion. It means that you can type the first few characters of a command (anywhere) or a file (in the current directory) and if no confusion is possible, the shell will find out what you mean. For example in a directory containing many files, you can check if there are any files beginning with the letter A just by typing <command>ls <parameter>A</parameter></command> and pressing the <keycap>Tab</keycap> key twice, rather than pressing <keycap>Enter</keycap>. If there is only one file starting with <quote>A</quote>, this file will be shown as the argument to <command>ls</command> (or any shell command, for that matter) immediately.</para>
</sect3>
<sect3 id="sect_03_03_03_02"><title>Which</title>
@ -1002,7 +1002,7 @@ psychotic_chaos.mp3
<para>A more realistic way of working would be the use of a pipe (|) and the <command>xargs<indexterm><primary>xargs</primary></indexterm></command> tool with <command>rm</command> as an argument. This way, the <command>rm</command> command is only called when the command line is full, instead of for every file. See <xref linkend="chap_05" /> for more on using I/O redirection to ease everyday tasks.</para>
</tip>
<para>Later on (in 1999 according to the man pages, after 20 years of <command>find</command>), <command>locate<indexterm><primary>locate</primary></indexterm></command> was developed. This program is easier<indexterm><primary>finding files</primary><secondary>locate</secondary></indexterm> to use, but more restricted than <command>find</command>, since its output is based on a file index database that is updated only once every day. On the other hand, a search in the <command>locate</command> database uses less resources than <command>find</command> and therefore shows the results nearly instantly.</para>
<para>Most Linux distributions use <command>slocate</command> these days, security enhanced locate, the modern version of <command>locate</command> that prevents users from getting output they have no right to read. The files in <emphasis>root</emphasis>'s home directory are such an example, these are not normally accessible to the public. A user who wants to find someone who knows about the C-shell may issue the command <command>locate <filename>.cshrc</filename></command>, to display all users who have a customized configuration file for the C shell. Supposing the users <emphasis>root</emphasis> and <emphasis>jenny</emphasis> are running C shell, then only the file <filename>/home/jenny/.cshrc</filename> will be displayed, and not the one in <emphasis>root</emphasis>'s home directory. On most systems, <command>locate</command> is a symbolic link to the <command>slocate</command> program:</para>
<para>Most Linux distributions use <command>slocate</command> these days, security enhanced locate, the modern version of <command>locate</command> that prevents users from getting output they have no right to read. The files in <emphasis>root</emphasis>'s home directory are such an example, these are not normally accessible to the public. A user who wants to find someone who knows about the <application>C shell</application> may issue the command <command>locate <filename>.cshrc</filename></command>, to display all users who have a customized configuration file for the <application>C shell</application>. Supposing the users <emphasis>root</emphasis> and <emphasis>jenny</emphasis> are running <application>C shell</application>, then only the file <filename>/home/jenny/.cshrc</filename> will be displayed, and not the one in <emphasis>root</emphasis>'s home directory. On most systems, <command>locate</command> is a symbolic link to the <command>slocate</command> program:</para>
<screen>
<prompt>billy:~&gt;</prompt> <command>ls -l /usr/bin/locate</command>
lrwxrwxrwx 1 root slocate 7 Oct 28 14:18 /usr/bin/locate -&gt; slocate*
@ -1032,7 +1032,7 @@ executable, Intel 80386, version 1, dynamically linked (uses
shared libs), not stripped
</screen>
<para>In order to keep the path as short as possible, so the system doesn't have to search too long every time a user wants to execute a command, we add <filename>/usr/local/bin</filename> to the path and not the other directories, which only contain the binary files of one specific program, while <filename>/usr/local/bin</filename> contains other useful programs as well.</para>
<para>Again, a description of the full features of <command>find</command> and <command>locate</command> can be found in the Info pages.</para>
<para>Again, a description of the full features of <command>find</command> and <command>locate</command> can be found in the <application>Info</application> pages.</para>
</sect3>
@ -1052,7 +1052,7 @@ find ../ -name common.cfg
(reverse-i-search)`find': find `/home/thomas` -name *.xml
</screen>
<para>Type your search string at the search prompt. The more characters you type, the more restricted the search gets. This reads the command history for this shell session (which is written to <filename>.bash_history</filename> in your home directory when you quit that session). The most recent occurrence of your search string is shown. If you want to see previous commands containing the same string, type <keycap>Ctrl</keycap>+<keycap>R</keycap> again.</para>
<para>See the Info pages on <command>bash</command> for more.</para></tip>
<para>See the <application>Info</application> pages on <command>bash</command> for more.</para></tip>
<para>All UNIXes with just a little bit of decency have an online dictionary. So does Linux. The dictionary is a list of known words in a file named <filename>words</filename>, located in <filename>/usr/share/dict</filename>. To quickly check the correct spelling of a word, no graphical application<indexterm><primary>grep</primary><secondary>example</secondary></indexterm> is needed:</para>
<screen>
<prompt>william:~&gt;</prompt> <command>grep pinguin /usr/share/dict/words</command>
@ -1078,7 +1078,7 @@ sent-mail: On Mon, 24 Dec 2001, Arno.Hintjens@celeb.com wrote:
<para><command>find</command> and <command>locate</command> are often used in combination with <command>grep</command> to define some serious queries. For more information, see <xref linkend="chap_05" /> on I/O redirection.</para>
</sect4>
<sect4 id="sect_03_03_03_04_02"><title>Special characters</title>
<para>Characters that have a special meaning to the shell have to be <emphasis>escaped<indexterm><primary>escape characters</primary></indexterm></emphasis>. The escape character in Bash is backslash<indexterm><primary>backslash</primary></indexterm>, as in most shells; this takes away the special<indexterm><primary>grep</primary><secondary>special characters</secondary></indexterm> meaning of the following character. The shell knows about quite some special characters, among the most common /, ., ? and *. A full list can be found in the Info pages and documentation for your shell.</para>
<para>Characters that have a special meaning to the shell have to be <emphasis>escaped<indexterm><primary>escape characters</primary></indexterm></emphasis>. The escape character in <application>Bash</application> is backslash<indexterm><primary>backslash</primary></indexterm>, as in most shells; this takes away the special<indexterm><primary>grep</primary><secondary>special characters</secondary></indexterm> meaning of the following character. The shell knows about quite some special characters, among the most common /, ., ? and *. A full list can be found in the Info pages and documentation for your shell.</para>
<para>For instance, say that you want to display the file <quote>*</quote> instead of all the files in a directory, you would have to use </para>
<cmdsynopsis><command>less <filename>\*</filename></command></cmdsynopsis>
<para>The same goes for filenames containing a space:</para>
@ -1090,7 +1090,7 @@ sent-mail: On Mon, 24 Dec 2001, Arno.Hintjens@celeb.com wrote:
<sect2 id="sect_03_03_04"><title>More ways to view file content</title>
<sect3 id="sect_03_03_04_01"><title>General</title>
<para>Apart from <command>cat</command>, which really doesn't do much more than sending files to the standard output, there are other tools to view file content.</para>
<para>The easiest way of course would be to use graphical tools instead of command line tools. In the introduction we already saw a glimpse of an office application, OpenOffice. Other examples are the GIMP (start up with <command>gimp<indexterm><primary>gimp</primary></indexterm></command> from the command line), the GNU Image Manipulation Program; <command>xpdf<indexterm><primary>xpdf</primary></indexterm></command> to view Portable Document Format files (PDF); GhostView (<command>gv<indexterm><primary>gv</primary></indexterm></command>) for viewing PostScript files; Mozilla/FireFox, <command>links</command> (a text mode browser), Konqueror, Opera and many others for web content; XMMS, CDplay and others for multimedia file content; AbiWord, Gnumeric, KOffice etc. for all kinds of office applications and so on. There are thousands of Linux applications; to list them all would take days.</para>
<para>The easiest way of course would be to use graphical tools instead of command line tools. In the introduction we already saw a glimpse of an office application, <application>OpenOffice.org</application>. Other examples are the <application>GIMP</application> (start up with <command>gimp<indexterm><primary>gimp</primary></indexterm></command> from the command line), the GNU Image Manipulation Program; <command>xpdf<indexterm><primary>xpdf</primary></indexterm></command> to view Portable Document Format files (PDF); <application>GhostView</application> (<command>gv<indexterm><primary>gv</primary></indexterm></command>) for viewing PostScript files; <application>Mozilla/FireFox</application>, <command>links</command> (a text mode browser), <application>Konqueror<application>, <application>Opera</application> and many others for web content; XMMS, <application>CDplay</application> and others for multimedia file content; <application>AbiWord</application>, <application>Gnumeric</application>, <application>KOffice</application> etc. for all kinds of office applications and so on. There are thousands of Linux applications; to list them all would take days.</para>
<para>Instead we keep concentrating on shell- or text-mode applications, which form the basics for all other applications. These commands work best in a text environment on files containing text. When in doubt, check first using the <command>file<indexterm><primary>file</primary></indexterm></command> command.</para>
<para>So let's see what text tools we have that are useful to look inside files.</para>
<note><title>Font problems</title>
@ -1107,12 +1107,12 @@ sent-mail: On Mon, 24 Dec 2001, Arno.Hintjens@celeb.com wrote:
<listitem><para>The <command>more<indexterm><primary>more</primary></indexterm></command> program was a revised version of <command>pg</command>. This command is still available on every Linux system.</para></listitem>
<listitem><para><command>less<indexterm><primary>less</primary></indexterm></command> is the GNU version of more and has extra features allowing highlighting of search strings, scrolling back etc. The syntax is very simple:</para>
<cmdsynopsis><command>less <filename>name_of_file</filename></command></cmdsynopsis>
<para>More information is located in the Info pages.</para>
<para>More information is located in the <application>Info</application> pages.</para>
</listitem>
</itemizedlist>
<para>You already know about pagers by now, because they are used for viewing the man pages.</para>
</sect3>
<sect3 id="sect_03_03_04_03"><title><command>Head</command> and <command>tail</command></title>
<sect3 id="sect_03_03_04_03"><title>The head and tail commands</title>
<para>These two commands display the n first/last lines of a file respectively. To see the last<indexterm><primary>tail</primary></indexterm> ten commands entered:</para>
<screen>
<prompt>tony:~&gt;</prompt> <command>tail -10 .bash_history </command>
@ -1166,7 +1166,7 @@ Type=X-nautilus-home
X-Nautilus-Icon=temp-home
URL=file:///home/dupont
</screen>
<para>This example is from a KDE desktop:</para>
<para>This example is from a <application>KDE</application> desktop:</para>
<screen>
<prompt>[lena@venus Desktop]$</prompt> <command>cat camera</command>
[Desktop Entry]
@ -1288,7 +1288,7 @@ Hello, World
<prompt>asim:~&gt;</prompt> <command>ls -l hello</command>
-rwxrw-r-- 1 asim asim 32 Jan 15 16:29 hello*
</screen>
<para>The + and - operators are used to grant or deny a given right to a given group. Combinations separated by commas are allowed. The Info and man pages contain useful examples. Here's another one, which makes the file from the previous example a private file to user <emphasis>asim</emphasis>:</para>
<para>The <command>+</command> and <command>-</command> operators are used to grant or deny a given right to a given group. Combinations separated by commas are allowed. The Info and man pages contain useful examples. Here's another one, which makes the file from the previous example a private file to user <emphasis>asim</emphasis>:</para>
<screen>
<prompt>asim:~&gt;</prompt> <command>chmod u+rwx,go-rwx hello</command>