note about pagers, lots of clarifications, removed quite some RedHat-centric paragraphs, reviewed and updated lots in sound

and video, removed xmms-mp3 stuff, added time zone info because I was just dealing with date and time, contrary to the title of the section, removed Mandrake refs.
This commit is contained in:
tille 2005-05-24 21:17:28 +00:00
parent 2ac6c8d949
commit ddb1c3fcb4
10 changed files with 110 additions and 112 deletions

View File

@ -141,6 +141,12 @@
<title>Revision History</title>
<para>
<revhistory>
<revision>
<revnumber>1.18</revnumber>
<date>2005-05-23</date>
<authorinitials>MG</authorinitials>
<revremark>note about pagers, lots of clarifications, removed quite some RedHat-centric paragraphs, reviewed and updated lots in sound and video, removed xmms-mp3 stuff, added time zone info because I was just dealing with date and time, contrary to the title of the section, removed Mandrake refs.</revremark>
</revision>
<revision>
<revnumber>1.17</revnumber>
<date>2005-03-01</date>
@ -303,9 +309,9 @@
<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.</para>
this guide up to date, like Filipus Klutiero who did a complete review in 2005.</para>
<para>Finally, a big thank you for the volunteers who are currently translating this
document in French, Swedish, German, Hindi and more. It is a big work that should
document in French, Swedish, German, Farsi, Hindi and more. It is a big work that should
not be underestimated; I admire your courage.</para>
<informalfigure>

View File

@ -215,7 +215,7 @@
</listitem>
<listitem>
<para>
<ulink url="http://www.mandrake.com">Mandrake</ulink>
<ulink url="http://www.mandriva.com">Mandriva</ulink>
</para>
</listitem>
<listitem>

View File

@ -218,7 +218,7 @@ changes in the accessibility of the system.
<sect2 id="sect_01_02_02">
<title>Linux for non-experienced users</title>
<para>Companies such as RedHat, SuSE and Mandrake have sprung up, providing
<para>Companies such as RedHat, SuSE and Mandriva have sprung up, providing
packaged Linux distributions suitable for mass consumption. They integrated a
great deal of graphical user interfaces (GUIs), developed by the community, in
order to ease management of programs and services. As a Linux user today you
@ -592,7 +592,7 @@ are not as reliable, since they are tested by fewer people.
special packages containing optimized kernels for the x86 Intel based CPUs.
These distributions are well-tested and maintained on a regular basis, focusing
on reliant server implementation and easy installation and update procedures.
Examples are RedHat, SuSE and Mandrake, which are by far the most popular Linux
Examples are RedHat, SuSE and Mandriva, which are by far the most popular Linux
systems and generally considered easy to handle for the beginning user, while
not blocking professionals from getting the most out of their Linux machines.
Linux also runs decently on laptops and middle-range servers. Drivers for new
@ -616,7 +616,7 @@ default. The following are very good choices for novices:
</para></listitem>
<listitem><para><ulink url="http://www.suse.de">SuSE Linux</ulink>
</para></listitem>
<listitem><para><ulink url="http://www.mandrake.com">Mandrake</ulink>
<listitem><para><ulink url="http://www.mandrake.com">Mandriva (former MandrakeSoft)</ulink>
</para></listitem>
<listitem><para><ulink url="http://www.knoppix.com">Knoppix</ulink>: an
operating system that runs from your CD-ROM, you don't need to install anything.

View File

@ -82,7 +82,7 @@
<para>All the big, userfriendly Linux distributions come with various graphical tools, allowing for easy setup of the computer in a local network or for connecting it to an Internet Service Provider. These tools can be started up from the command line or from a menu:</para><itemizedlist>
<listitem><para>RedHat Linux comes with <command>redhat-config-network</command>, which has both a graphical and a text mode interface.</para></listitem>
<listitem><para>Suse's YAST or YAST2 is an all-in-one configuration tool.</para></listitem>
<listitem><para>Mandrake comes with a Network and Internet Configuration Wizard, which is preferably started up from Mandrake's Control Center.</para></listitem>
<listitem><para>Mandrake/Mandriva comes with a Network and Internet Configuration Wizard, which is preferably started up from Mandrake's Control Center.</para></listitem>
</itemizedlist>
<para>Your system documentation provides plenty of advice and information about availability and use of tools.</para>
<para>Information you'll need to provide:</para>

View File

@ -262,6 +262,9 @@ OPTIONS
lines 1-27
</screen>
<para>Browse to the next page using the space bar. You can go back to the previous page using the b-key. When you reach the end, <command>man</command> will usually quit and you get the prompt back. Type <keycap>q</keycap> if you want to leave the man page before reaching the end, or if the viewer does not quit automatically at the end of the page.</para>
<note><title>Pagers</title>
<para>The available key combinations for manipulating the man pages depend on the <emphasis>pager</emphasis> used in your distribution. Most distributions use <command>less</command> to view the man pages and to scroll around. See <xref linkend="sect_03_03_04_02" /> for more info on pagers.</para>
</note>
<para>Each man page usually contains a couple of standard sections, as we can see from the <command>man <option>man</option></command> example:</para>
<itemizedlist>
<listitem><para>The first line contains the name of the command you are reading about, and the id of the section in which this man page is located. The man pages are ordered in chapters. Commands are likely to have multiple man pages, for example the man page from the user section, the man page from the system admin section, and the man page from the programmer section.</para></listitem>

View File

@ -995,7 +995,7 @@ psychotic_chaos.mp3
<para>This command will call on <command>rm</command> as many times as a file answering the requirements is found. In the worst case, this might be thousands or millions of times. This is quite a load on your system.</para>
<para>A more realistic way of working would be the use of a pipe (|) and the <command>xargs</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</command> was developed. This program is easier 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 therefor shows the results nearly instantly.</para>
<para>Later on (in 1999 according to the man pages, after 20 years of <command>find</command>), <command>locate</command> was developed. This program is easier 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>
<screen>
<prompt>billy:~&gt;</prompt> <command>ls -l /usr/bin/locate</command>
@ -1101,6 +1101,7 @@ sent-mail: On Mon, 24 Dec 2001, Arno.Hintjens@celeb.com wrote:
<para>More information is located in the Info 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>
<para>These two commands display the n first/last lines of a file respectively. To see the last ten commands entered:</para>
@ -1145,7 +1146,7 @@ frm
</mediaobject>
</figure>
<para>Note that removing the target file for a symbolic link makes the link useless.</para>
<para>Each regular file is in principal a hardlink. Hardlinks can not span across partitions, since they refer to inodes, and inode numbers are only unique within a given partition.</para>
<para>Each regular file is in principle a hardlink. Hardlinks can not span across partitions, since they refer to inodes, and inode numbers are only unique within a given partition.</para>
<para>It may be argued that there is a third kind of link, the <emphasis>user-space</emphasis> link, which is similar to a shortcut in MS Windows. These are files containing meta-data which can only be interpreted by the graphical file manager. To the kernel and the shell these are just normal files. They may end in a <emphasis>.desktop</emphasis> or <emphasis>.lnk</emphasis> suffix; an example can be found in <filename>~/.gnome-desktop</filename>:</para>
<screen>
<prompt>[dupont@boulot .gnome-desktop]$</prompt> <command>cat La\ Maison\ Dupont</command>

View File

@ -29,7 +29,7 @@
</sect2>
<sect2 id="sect_04_01_02"><title>Process types</title>
<sect3 id="sect_04_01_02_01"><title>Interactive processes</title>
<para>Interactive processes are initialized and controlled through a terminal session. In other words, there has to be someone connected to the system to start these processes; they are not started automatically as part of the system functions. These processes can run in the foreground, occupying the terminal that started the program, and you can't start other applications as long as this process is running in the foreground. Alternatively, they can run in the background, so that the terminal in which you started the program can accept new commands while the program is running. Until now, we only used programs running in the foreground - the length of time taken to run them was too short to notice - but viewing a file with the <command>less</command> command is a good example of a command occupying the terminal session. In this case, the activated program is waiting for you to do something. The program is still connected to the terminal from where it was started, and the terminal is only useful for entering commands this program can understand. Other commands will just result in errors or unresponsiveness of the system.</para>
<para>Interactive processes are initialized and controlled through a terminal session. In other words, there has to be someone connected to the system to start these processes; they are not started automatically as part of the system functions. These processes can run in the foreground, occupying the terminal that started the program, and you can't start other applications as long as this process is running in the foreground. Alternatively, they can run in the background, so that the terminal in which you started the program can accept new commands while the program is running. Until now, we mainly focussed on programs running in the foreground - the length of time taken to run them was too short to notice - but viewing a file with the <command>less</command> command is a good example of a command occupying the terminal session. In this case, the activated program is waiting for you to do something. The program is still connected to the terminal from where it was started, and the terminal is only useful for entering commands this program can understand. Other commands will just result in errors or unresponsiveness of the system.</para>
<para>While a process runs in the background, however, the user is not prevented from doing other things in the terminal in which he started the program, while it is running.</para>
<para>The shell offers a feature called <emphasis>job control</emphasis> which allows easy handling of multiple processes. This mechanism switches processes between the foreground and the background. Using this system, programs can also be started in the background immediately.</para>
<para>Running a process in the background is only useful for programs that don't need user input (via the shell). Putting a job in the background is typically done when execution of a job is expected to take a long time. In order to free the issuing terminal after entering the command, a trailing ampersand is added. In the example, using graphical mode, we open an extra terminal window from the existing one:</para>
@ -83,7 +83,7 @@
<para>A process has a series of characteristics:</para>
<itemizedlist>
<listitem><para>The process ID or PID: a unique identification number used to refer to the process.</para></listitem>
<listitem><para>The parent process ID or PPID: the number of the process that started this process.</para></listitem>
<listitem><para>The parent process ID or PPID: the number of the process (PID) that started this process.</para></listitem>
<listitem><para>Nice number: the degree of friendliness of this process toward other processes (not to be confused with process priority, which is calculated based on this nice number and recent CPU usage of the process).</para></listitem>
<listitem><para>Terminal or TTY: terminal to which the process is connected.</para></listitem>
<listitem><para>User name of the real and effective user (RUID and EUID): the owner of the process. The real owner is the user issuing the command, the effective user is the one determining access to system resources. RUID and EUID are usually the same, and the process has the same access rights the issuing user would have. An example to clarify this: the browser <command>mozilla</command> in <filename>/usr/bin</filename> is owned by user <emphasis>root</emphasis>:</para>
@ -163,7 +163,7 @@ Swap: 1050176K av, 76428K used, 973748K free, 82756K cached
<prompt>jeff:~&gt;</prompt> <command>uptime</command>
3:30pm, up 12 days, 23:29, 6 users, load average: 0.01, 0.02, 0.00
</screen>
<para>The data for these programs is stored among others in <filename>/var/run/utmp</filename> (information about currently connected users) and in the virtual file system <filename>/proc</filename>, for example <filename>/proc/loadavg</filename> (average load information). There are all sorts of graphical applications to view this data, such as the <emphasis>Gnome System Monitor</emphasis> and <emphasis>lavaps</emphasis>. Open Source initiatives like Big Brother centralize this information along with other server data and logs from multiple servers on one web server, allowing monitoring of the entire IT infrastructure from one workstation.</para>
<para>The data for these programs is stored among others in <filename>/var/run/utmp</filename> (information about currently connected users) and in the virtual file system <filename>/proc</filename>, for example <filename>/proc/loadavg</filename> (average load information). There are all sorts of graphical applications to view this data, such as the <emphasis>Gnome System Monitor</emphasis> and <emphasis>lavaps</emphasis>. Over at <ulink url="http://www.freshmeat.net">FreshMeat</ulink> and <ulink url="http://www.sourceforge.org">SourceForge</ulink> you will find tens of applications that centralize this information along with other server data and logs from multiple servers on one (web) server, allowing monitoring of the entire IT infrastructure from one workstation.</para>
<para>The relations between processes can be visualized using the <command>pstree</command> command:</para>
<screen>
@ -221,7 +221,7 @@ init-+-amd
|-xfs
`-xinetd-ipv6
</screen>
<para>The <option>-u</option> and <option>-a</option> options give additional information, and for more, refer to the Info pages.</para>
<para>The <option>-u</option> and <option>-a</option> options give additional information. For more options and what they do, refer to the Info pages.</para>
<para>In the next section, we will see how one process can create another.</para>
</sect2>
@ -371,9 +371,9 @@ GRUB supports both boot methods, allowing you to use it with almost any operatin
<para>When <command>init</command> starts, it becomes the parent or grandparent of all of the processes that start up automatically on your Linux system. The first thing <command>init</command> does, is reading its initialization file, <filename>/etc/inittab</filename>. This instructs <command>init</command> to read an initial configuration script for the environment, which sets the path, starts swapping, checks the file systems, and so on. Basically, this step takes care of everything that your system needs to have done at system initialization: setting the clock, initializing serial ports and so forth.</para>
<para> Then <command>init</command> continues to read the <filename>/etc/inittab</filename> file, which describes how the system should be set up in each run level and sets the default <emphasis>run level</emphasis>. A run level is a configuration of processes. All UNIX-like systems can be run in different process configurations, such as the single user mode, which is referred to as run level 1 or run level S (or s). In this mode, only the system administrator can connect to the system. It is used to perform maintenance tasks without risks of damaging the system or user data. Naturally, in this configuration we don't need to offer user services, so they will all be disabled. Another run level is the reboot run level, or run level 6, which shuts down all running services according to the appropriate procedures and then restarts the system.</para>
<para>Commonly, run level 3 is configured to be text mode on a Linux machine, and run level 5 initializes the graphical login and environment. More about run levels in the next section, see <xref linkend="sect_04_02_05" />.</para>
<para>After having determined the default run level for your system, <command>init</command> starts all of the background processes necessary for the system to run by looking in the appropriate <filename>rc</filename> directory for that run level. <command>init</command> runs each of the kill scripts (their file names start with a K) with a stop parameter. It then runs all of the start scripts (their file names start with an S) in the appropriate run level directory so that all services and applications are started correctly. In fact, you can execute these same scripts manually after the system is finished booting with a command like <command>/etc/rc.d/init.d/httpd <parameter>stop</parameter></command> or <command>service <parameter>httpd</parameter> <parameter>stop</parameter></command> logged in as <emphasis>root</emphasis>, in this case stopping the web server.</para>
<para> None of the scripts that actually start and stop the services are located in <filename>/etc/rc.d/rc&lt;x&gt;.d</filename>. Rather, all of the files in <filename>/etc/rc.d/rc&lt;x&gt;.d</filename> are symbolic links that point to the actual scripts located in <filename>/etc/rc.d/init.d</filename>. A symbolic link is nothing more than a file that points to another file, and is used in this case because it can be created and deleted without affecting the actual scripts that kill or start the services. The symbolic links to the various scripts are numbered in a particular order so that they start in that order. You can change the order in which the services start up or are killed by changing the name of the symbolic link that refers to the script that actually controls the service. You can use the same number multiple times if you want a particular service started or stopped right before or after another service.</para>
<para>Below a sample of <filename>/etc/rc5.d</filename> content, which lists the services started up in run level 5:</para>
<para>After having determined the default run level for your system, <command>init</command> starts all of the background processes necessary for the system to run by looking in the appropriate <filename>rc</filename> directory for that run level. <command>init</command> runs each of the kill scripts (their file names start with a K) with a stop parameter. It then runs all of the start scripts (their file names start with an S) in the appropriate run level directory so that all services and applications are started correctly. In fact, you can execute these same scripts manually after the system is finished booting with a command like <command>/etc/init.d/httpd <parameter>stop</parameter></command> or <command>service <parameter>httpd</parameter> <parameter>stop</parameter></command> logged in as <emphasis>root</emphasis>, in this case stopping the web server.</para>
<para> None of the scripts that actually start and stop the services are located in <filename>/etc/rc&lt;x&gt;.d</filename>. Rather, all of the files in <filename>/etc/rc&lt;x&gt;.d</filename> are symbolic links that point to the actual scripts located in <filename>/etc/init.d</filename>. A symbolic link is nothing more than a file that points to another file, and is used in this case because it can be created and deleted without affecting the actual scripts that kill or start the services. The symbolic links to the various scripts are numbered in a particular order so that they start in that order. You can change the order in which the services start up or are killed by changing the name of the symbolic link that refers to the script that actually controls the service. You can use the same number multiple times if you want a particular service started or stopped right before or after another service, as in the example below, listing the content of <filename>/etc/rc5.d</filename>, where <command>crond</command> and <command>xfs</command> are both started from a linkname starting with <quote>S90</quote>. In this case, the scripts are started in alphabetical order.</para>
<screen>
<prompt>[jean@blub /etc/rc5.d]</prompt> <command>ls</command>
K15httpd@ K45named@ S08ipchains@ S25netfs@ S85gpm@
@ -390,13 +390,13 @@ K34yppasswdd@ S05kudzu@ S20random@ S80sendmail@
<para>
<filename>/etc/inittab</filename> can also tell <command>init</command> how it should handle a user pressing <keycap>Ctrl</keycap>+<keycap>Alt</keycap>+<keycap>Delete</keycap> at the console. As the system should be properly shut down and restarted rather than immediately power-cycled, <command>init</command> is told to execute the command <command>/sbin/shutdown <option>-t3 -r</option> <parameter>now</parameter></command>, for instance, when a user hits those keys. In addition, <filename>/etc/inittab</filename> states what <command>init</command> should do in case of power failures, if your system has a UPS unit attached to it.</para>
<para>
In run level 5, <filename>/etc/inittab</filename> runs a script called <filename>/etc/X11/prefdm</filename>. The <filename>prefdm</filename> script runs the preferred X display manager, based on the contents of the <filename>/etc/sysconfig/desktop</filename> directory. This is typically <command>gdm</command> if you run GNOME or <command>kdm</command> if you run KDE, but they can be mixed, and there's also the <command>xdm</command> that comes with a standard X installation.</para>
<para>The <filename>/etc/sysconfig</filename> directory contains entries for a range of functions and services, these are all read at boot time. This last part, however, might be somewhat different depending on your Linux distribution.</para>
On most RPM-based systems the graphical login screen is started in run level 5, where <filename>/etc/inittab</filename> runs a script called <filename>/etc/X11/prefdm</filename>. The <filename>prefdm</filename> script runs the preferred X display manager, based on the contents of the <filename>/etc/sysconfig/desktop</filename> directory. This is typically <command>gdm</command> if you run GNOME or <command>kdm</command> if you run KDE, but they can be mixed, and there's also the <command>xdm</command> that comes with a standard X installation.</para>
<para>But there are other possibilities as well. On Debian, for instance, There is an initscript for each of the display managers, and the content of the <filename>/etc/X11/default-display-manager</filename> is used to determine which one to start. More about the graphical interface can be read in <xref linkend="sect_07_03" />. Ultimately, your system documentation will explain the details about the higher level aspects of <command>init</command>.</para>
<para>The <filename>/etc/default</filename> and/or <filename>/etc/sysconfig</filename> directories contain entries for a range of functions and services, these are all read at boot time. The location of the directory containing system defaults might be somewhat different depending on your Linux distribution.</para>
<para>Besides the graphical user environment, a lot of other services may be started as well. But if all goes well, you should be looking at a login prompt or login screen when the boot process has finished.</para>
<note><title>Other procedures</title>
<para>We explained how SysV <command>init</command> works on x86 based machines. Startup procedures may vary on other architectures and distributions. Other systems may use the BSD-style <command>init</command>, where startup files are not split up into multiple <filename>/etc/rc.d/rc&lt;LEVEL&gt;.d</filename> directories. It might also be possible that your system uses <filename>/etc/init.d</filename> instead of <filename>/etc/rc.d/init.d</filename>.</para></note>
<para>We explained how SysV <command>init</command> works on x86 based machines. Startup procedures may vary on other architectures and distributions. Other systems may use the BSD-style <command>init</command>, where startup files are not split up into multiple <filename>/etc/rc&lt;LEVEL&gt;.d</filename> directories. It might also be possible that your system uses <filename>/etc/rc.d/init.d</filename> instead of <filename>/etc/init.d</filename>.</para></note>
</sect2>
<sect2 id="sect_04_02_05"><title>Init run levels</title>
<para> The idea behind operating different services at different run levels essentially revolves around the fact that different systems can be used in different ways. Some services cannot be used until the system is in a particular state, or <emphasis>mode</emphasis>, such as being ready for more than one user or having networking available.</para>
@ -431,9 +431,9 @@ id:5:initdefault:
<sect3 id="sect_04_02_05_01"><title>Tools</title>
<para>The <command>chkconfig</command> utility in <filename>/sbin</filename> provides a simple command-line tool for maintaining the <filename>/etc/rc.d/init.d</filename> directory hierarchy. It relieves system administrators from having to directly manipulate the numerous symbolic links in the directories under <filename>/etc/rc.d</filename>.</para>
<para>The <command>chkconfig</command> utility in <filename>/sbin</filename>, when installed on your system, provides a simple command-line tool for maintaining the <filename>/etc/init.d</filename> directory hierarchy. It relieves system administrators from having to directly manipulate the numerous symbolic links in the directories under <filename>/etc/rc[x].d</filename>.</para>
<para>
In addition, some systems offer the <command>ntsysv</command> tool, which provides a text-based interface; you may find this easier to use than <command>chkconfig</command>'s command-line interface. On SuSE Linux, you will find the <command>yast</command> and <command>insserv</command> tools. For Mandrake easy configuration, you may want to try <emphasis>DrakConf</emphasis>, which allows among other features switching between run levels 3 and 5.</para>
In addition, some systems offer the <command>ntsysv</command> tool, which provides a text-based interface; you may find this easier to use than <command>chkconfig</command>'s command-line interface. On SuSE Linux, you will find the <command>yast</command> and <command>insserv</command> tools. For Mandrake easy configuration, you may want to try <emphasis>DrakConf</emphasis>, which allows among other features switching between run levels 3 and 5. In Mandriva this became the <application>Mandriva Linux COntrol Center</application>.</para>
<para>
Most distributions provide a graphical user interface for configuring processes, check with your system documentation.</para>
<para>
@ -562,7 +562,7 @@ Command exited with non-zero status 2
<listitem><para>aggregate transfer rate too low:</para>
<para>The maximum total bandwidth that the system can provide to all programs that run is not enough.</para></listitem>
</itemizedlist>
<para>This kind of problem is more difficult to detect, and usually takes extra hardware in order to re-divide data streams over buses, controlers and disks, if overloaded hardware is cause of the problem. One solution to solve this is a RAID array configuration optimized for input and output actions. This way, you get to keep the same hardware. An upgrade to faster buses, controlers and disks is usually the other option.</para>
<para>This kind of problem is more difficult to detect, and usually takes extra hardware in order to re-divide data streams over buses, controllers and disks, if overloaded hardware is cause of the problem. One solution to solve this is a RAID array configuration optimized for input and output actions. This way, you get to keep the same hardware. An upgrade to faster buses, controlers and disks is usually the other option.</para>
<para>If overload is not the cause, maybe your hardware is gradually failing, or not well connected to the system. Check contacts, connectors and plugs to start with.</para>
</sect3>
<sect3 id="sect_04_03_05_05"><title>Users</title>
@ -600,7 +600,7 @@ Command exited with non-zero status 2
<para>Identify the process in the <quote>NI</quote> column, it will most likely have a negative priority. Type <command>r</command> and enter the process ID of the process that you want to renice. Then enter the nice value, for instance <quote>20</quote>. That means that from now on, this process will take 1/5 of the CPU cycles at the most.</para>
<para>Examples of processes that you want to keep on running are emulators, virtual machines, compilers and so on.</para>
<para>If you want to stop a process because it hangs or is going totally berserk in the way of I/O consumption, file creation or use of other system resources, use the <command>kill</command>. If you have the opportunity, first try to kill the process softly, sending it the <emphasis>SIGTERM</emphasis> signal. This is an instruction to terminate whatever it is doing, according to procedures as described in the code of the program:</para>
<para>If you want to stop a process because it hangs or is going totally berserk in the way of I/O consumption, file creation or use of other system resources, use the <command>kill</command> command. If you have the opportunity, first try to kill the process softly, sending it the <emphasis>SIGTERM</emphasis> signal. This is an instruction to terminate whatever it is doing, according to procedures as described in the code of the program:</para>
<screen>
<prompt>joe:~&gt;</prompt> <command>ps <option>-ef</option></command> | <command>grep <parameter>mozilla</parameter></command>
joe 25822 1 0 Mar11 ? 00:34:04 /usr/lib/mozilla-1.4.1/mozilla-

View File

@ -41,6 +41,11 @@ some other words
some words
some other words
</screen>
<warning><title>Don't overwrite!</title>
<para>Be careful not to overwrite existing (important) files when redirecting output. Many shells, including Bash, have a built-in feature to protect you from that risk: <command>noclobber</command>. See the Info pages for more information. In Bash, you would want to add the <command>set <option>-o</option> <parameter>noclobber</parameter></command> command to your <filename>.bashrc</filename> configuration file in order to prevent accidental overwriting of files.</para></warning>
<para>Redirecting <quote>nothing</quote> to an existing file is equal to emptying the file:</para>
<screen>
<prompt>nancy:~&gt;</prompt> <command>ls -l list</command>
@ -82,10 +87,7 @@ ls: newlist: No such file or directory
</sect3>
<sect3 id="sect_05_01_01_03"><title>Combining redirections</title>
<para>The following example combines input and output redirection. The file <filename>text.txt</filename> is first checked for spelling mistakes, and the output is redirected to an error log file:</para>
<para><command>aspell &lt; <filename>text.txt</filename> &gt; <filename>error.log</filename></command></para>
<para>It might be that you have to use the following syntax to spell a file (check with the man pages):</para>
<cmdsynopsis><command>aspell <option>-H</option> <parameter>list</parameter> &lt; <filename>file.txt</filename> | sort <option>-u</option></command></cmdsynopsis>
<para>This also uses input and output redirection.</para>
<para><command>spell &lt; <filename>text.txt</filename> &gt; <filename>error.log</filename></command></para>
<para>The following command lists all commands that you can issue to examine another file when using <command>less</command>:</para>
<screen>
<prompt>mike:~&gt;</prompt> <command>less --help | grep -i examine</command>
@ -106,9 +108,7 @@ ls: newlist: No such file or directory
:x * Examine the first (or N-th) file from the command line.
</screen>
<para>Output of one command can be piped into another command virtually as many times as you want, just as long as these commands would normally read input from standard input and write output to the standard output. Sometimes they don't, but then there may be special options that instruct these commands to behave according to the standard definitions; so read the documentation (man and info pages) of the commands you use if you should encounter errors.</para>
<warning><title>Don't overwrite!</title>
<para>Be careful not to overwrite existing (important) files when redirecting output. Many shells, including Bash, have a built-in feature to protect you from that risk: <command>noclobber</command>. See the Info pages for more information. In Bash, you would want to add the <command>set <option>-o</option> <parameter>noclobber</parameter></command> command to your <filename>.bashrc</filename> configuration file in order to prevent accidental overwriting of files.</para></warning>
<para>Again, make sure you don't use names of existing files that you still need. Redirecting output to existing files will replace the content of those files.</para>
</sect3>
@ -117,9 +117,13 @@ ls: newlist: No such file or directory
<para>Instead of overwriting file data, you can also append text to an existing file using two subsequent greater-than signs:</para>
<para>Example:</para>
<screen>
<prompt>mike:~&gt;</prompt> <command>date &gt;&gt; wishlist</command>
<prompt>mike:~&gt;</prompt> <command>cat <filename>wishlist</filename></command>
more money
less work
<prompt>mike:~&gt;</prompt> <command>cat wishlist</command>
<prompt>mike:~&gt;</prompt> <command>date &gt;&gt; <filename>wishlist</filename></command>
<prompt>mike:~&gt;</prompt> <command>cat <filename>wishlist</filename></command>
more money
less work
Thu Feb 28 20:23:07 CET 2002
@ -150,7 +154,7 @@ Thu Feb 28 20:23:07 CET 2002
<sect4><title>Analyzing errors</title>
<para>If your process generates a lot of errors, this is a way to thoroughly examine them:</para>
<cmdsynopsis><command>command 2&gt;&amp;1 | less</command></cmdsynopsis>
<para>This is often used when creating new software using the <command>make</command>, such as in:</para>
<para>This is often used when creating new software using the <command>make</command> command, such as in:</para>
<screen>
<prompt>andy:~/newsoft&gt;</prompt> <command>make all 2&gt;&amp;1 | less</command>
--output ommitted--
@ -166,7 +170,7 @@ Thu Feb 28 20:23:07 CET 2002
<sect3><title>Writing to output and files simultaneously</title>
<para>You can use the <command>tee</command> command to copy input to standard output and one or more output files in one move. Using the <option>-a</option> option to <command>tee</command> results in appending input to the file(s). This command is useful if you want to both see and save output. The <command>&gt;</command> and <command>&gt;&gt;</command> operators do not allow to perform both actions simultaneously.</para>
<para>This tool is usally called on through a pipe (<command>|</command>), as demonstrated in the example below:</para>
<para>This tool is usually called on through a pipe (<command>|</command>), as demonstrated in the example below:</para>
<screen>
<prompt>mireille ~/test&gt;</prompt> <command>date | tee <filename>file1 file2</filename></command>
Thu Jun 10 11:10:34 CEST 2004
@ -201,7 +205,7 @@ Thu Jun 10 11:10:34 CEST 2004
</screen>
<para>The <command>grep</command> command, like most commands, is case sensitive. Use the <option>-i</option> option to make no difference between upper and lower case. A lot of GNU extensions are available as well, such as <option>--colour</option>, which is helpful to highlight searchterms in long lines, and <option>--after-context</option>, which prints the number of lines after the last matching line. You can issue a recursive <command>grep</command> that searches all subdirectories of encountered directories using the <option>-r</option> option. As usual, options can be combined.</para>
<para>Regular expressions can be used to further detail the exact character matches you want to select out of all the input lines. The best way to start with regular expressions is indeed to read the <command>grep</command> documentation. An excellent chapter is included in the <command>info <parameter>grep</parameter></command> page. Since it would lead us too far discussing the ins and outs of regular expressions, it is strongly advised to start here if you want to know more about them.</para>
<para>Play around a bit with <command>grep</command>, it will be worth the trouble putting some time in this most basic but very powerful filtering command. The exercises at the end of this chapter will help you started, see <xref linkend="sect_05_03" />.</para>
<para>Play around a bit with <command>grep</command>, it will be worth the trouble putting some time in this most basic but very powerful filtering command. The exercises at the end of this chapter will help you to get started, see <xref linkend="sect_05_03" />.</para>
</sect3>
<sect3 id="sect_05_01_03_02"><title>Filtering output</title>
@ -236,7 +240,17 @@ My boss
<listitem><para>Use the <command>cut</command> command on the output of a long directory listing in order to display only the file permissions. Then pipe this output to <command>sort</command> and <command>uniq</command> to filter out any double lines. Then use the <command>wc</command> to count the different permission types in this directory.</para></listitem>
<listitem><para>Put the output of <command>date</command> in a file. Append the output of <command>ls</command> to this file. Send this file to your local mailbox (don't specify anything <email>@domain</email>, just the user name will do). When using Bash, you will see a new mail notice upon success.</para></listitem>
<listitem><para>List the devices in <filename>/dev</filename> which are currently used by your UID. Pipe through <command>less</command> to view them properly.</para></listitem>
<listitem><para>Use the command <command>bash <option>-x</option></command> to start up the HTTP daemon with the script in <filename>/etc/rc.d/init.d</filename>. Send standard error to a file. Do the same but now send standard output to the file. Note the difference.</para></listitem>
<listitem><para>Issue the following commands as a non-privileged user. Determine standard input, output and error for each command.</para>
<itemizedlist>
<listitem><para><cmdsynopsis><command>cat <filename>nonexistentfile</filename></command></cmdsynopsis></para></listitem>
<listitem><para><cmdsynopsis><command>file <filename>/sbin/ifconfig</filename></command></cmdsynopsis></para></listitem>
<listitem><para><cmdsynopsis><command>grep <parameter>root</parameter> <filename>/etc/passwd /etc/nofiles</filename> &gt; <filename>grepresults</filename></command></cmdsynopsis></para></listitem>
<listitem><para><cmdsynopsis><command>/etc/init.d/sshd <parameter>start</parameter> &gt; <filename>/var/tmp/output</filename></command></cmdsynopsis></para></listitem>
<listitem><para><cmdsynopsis><command>/etc/init.d/crond <parameter>start</parameter> &gt; <filename>/var/tmp/output</filename> 2&gt;&amp;1</command></cmdsynopsis></para></listitem>
<para>Now check your results by issuing the commands again, now redirecting standardoutput to the file <filename>/var/tmp/output</filename> and standard error to the file <filename>/var/tmp/error</filename>.</para>
</itemizedlist>
</listitem>
<listitem><para>How many processes are you currently running?</para></listitem>
<listitem><para>How many invisible files are in your home directory?</para></listitem>
<listitem><para>Use <command>locate</command> to find documentation about the kernel.</para></listitem>
@ -251,6 +265,7 @@ system: root
<listitem><para>See what happens upon issuing this command:</para>
<cmdsynopsis><command>&gt; time; date &gt;&gt; time; cat &lt; time</command></cmdsynopsis>
</listitem>
<listitem><para>What command would you use to check which script in <filename>/etc/init.d</filename> starts a given process?</para></listitem>
</itemizedlist>
</sect1>

View File

@ -39,7 +39,7 @@
<para>Vim stands for Vi IMproved. It used to be Vi IMitation, but there are so many improvements that a name change was appropriate. Vim is a text editor which includes almost all the commands from the UNIX program <command>vi</command> and a lot of new ones.</para>
<para>Commands in the <command>vi</command> editor are entered using only the keyboard, which has the advantage that you can keep your fingers on the keyboard and your eyes on the screen, rather than moving your arm repeatedly to the mouse. For those who want it, mouse support and a GUI version with scrollbars and menus can be activated.</para>
<para>We will refer to <command>vi</command> or <command>vim</command> throughout this book for editing files, while you are of course free to use the editor of your choice. However, we recommend to at least get the <command>vi</command> basics in the fingers, because it is the standard text editor on almost all UNIX systems, while <command>emacs</command> can be an optional package. There may be small differences between different computers and terminals, but the main point is that if you can work with <command>vi</command>, you can survive on any UNIX system.</para>
<para>Apart from the <command>vim</command> command, the <application>vIm</application> package also provides <command>gvim</command>, the Gnome version of <command>vim</command>. Beginning users might find this easier to use, because the menus offer help when you forgot or don't know how to perform a particular editing task using the standard <command>vim</command> commands.</para>
<para>Apart from the <command>vim</command> command, the <application>vIm</application> packages may also provide <command>gvim</command>, the Gnome version of <command>vim</command>. Beginning users might find this easier to use, because the menus offer help when you forgot or don't know how to perform a particular editing task using the standard <command>vim</command> commands.</para>
</sect3>
</sect2>
@ -130,7 +130,7 @@ Commands that switch the editor to insert mode</title>
<para>The default file format specification would made the program add several lines of code, defining the format of the file and the fonts used. These lines won't be interpreted in the correct way by the programs depending on them, resulting in errors or a crash of the program reading the file. In some cases, you can save the file as plain text, but you'll run into trouble when making this a habit.</para>
</sect3>
<sect3 id="sect_06_03_03_03"><title>But I want a graphical text editor!</title>
<para>If you really insist, try <command>gedit</command> or <command>xedit</command>; these programs only do text files, which is what we will be needing. If you plan on doing anything serious, though, stick to a real text mode editor such as <command>vim</command> or <command>emacs</command>.</para>
<para>If you really insist, try <command>gedit</command>, <command>kedit</command>, <command>kwrite</command> or <command>xedit</command>; these programs only do text files, which is what we will be needing. If you plan on doing anything serious, though, stick to a real text mode editor such as <command>vim</command> or <command>emacs</command>.</para>
<para>An acceptable alternative is <command>gvim</command>, the Gnome version of <command>vim</command>. You still need to use <command>vi</command> commands, but if you are stuck, you can look them up in the menus.</para>
</sect3>
</sect2>

View File

@ -78,7 +78,7 @@ mike@pandora.be
</sect3>
<sect3 id="sect_07_01_02_04"><title>Save space with a link</title>
<para>When several users need access to the same file or program, when the original file name is too long or too difficult to remember, use a symbolic link instead of a separate copy for each user or purpose.</para>
<para>Multiple symbolic links may have different names, e.g. a link may be called <filename>monficher</filename> in one user's directory, and <filename>mylink</filename> in another's. Multiple links (different names) to the same file may also occur in the same directory. This is often done in the <filename>/lib</filename> directory: when issuing the command</para>
<para>Multiple symbolic links may have different names, e.g. a link may be called <filename>monfichier</filename> in one user's directory, and <filename>mylink</filename> in another's. Multiple links (different names) to the same file may also occur in the same directory. This is often done in the <filename>/lib</filename> directory: when issuing the command</para>
<cmdsynopsis><command>ls <option>-l</option> <filename>/lib</filename></command></cmdsynopsis>
<para>you will see that this directory is plenty of links pointing to the same files. These are created so that programs searching for one name would not get stuck, so they are pointed to the correct/current name of the libraries they need.</para>
</sect3>
@ -102,7 +102,7 @@ virtual memory (kbytes) unlimited
</sect3>
<sect3 id="sect_07_01_02_06"><title>Compressed files</title>
<para>Compressed files are useful because they take less space on your hard disk. Another advantage is that it takes less bandwidth to send a compressed file over your network. A lot of files, such as the man pages, are stored in a compressed format on your system. Yet unpacking these to get a little bit of information and then having to compress them again is rather time-consuming. You don't want to unpack a man page, for instance, read about an option to a command and then compress the man page again. Most people will probably forget to clean up after they found the information they needed.</para>
<para>So we have tools that work on compressed files, by uncompressing them only in memory. The actual compressed file stays on your disk as it is. Most systems support <command>egrep</command>, <command>zgrep</command>, <command>zcat</command>, <command>zmore</command> and such to prevent unnecessary decompressing/compressing actions. See your system's binary directory and the Info pages.</para>
<para>So we have tools that work on compressed files, by uncompressing them only in memory. The actual compressed file stays on your disk as it is. Most systems support <command>zgrep</command>, <command>zcat</command>, <command>bzless</command> and such to prevent unnecessary decompressing/compressing actions. See your system's binary directory and the Info pages.</para>
<para>See <xref linkend="chap_09" /> for more on the actual compressing of files and examples on making archives.</para>
</sect3>
@ -407,18 +407,18 @@ echo "Hello $USER"
#!/bin/bash
who | cut -d " " -f 1 | sort -u
</screen>
<para>Here is a script consisting of some more lines, that I use to convert wav-files to mp3-format using the <command>lame</command> command. The script first makes a list of all wav-files in the current directory and puts it in the variable <varname>LIST</varname>. Then it sets the new name for each file, and converts the file format. After that, it cleans up the wav-files which are replaced by their mp3 counterparts:</para>
<para>Here is a script consisting of some more lines, that I use to make backup copies of all files in a directory.
The script first makes a list of all the files in the current directory and puts it in the variable <varname>LIST</varname>. Then it sets the name of the copy for each file, and then it copies the file. For each file, a message is printed:</para>
<screen>
<prompt>tille:~&gt;</prompt> <command>cat /usr/local/bin/wav2mp3 </command>
<prompt>tille:~&gt;</prompt> <command>cat <filename>bin/makebackupfiles.sh </command>
#!/bin/bash
# convert *.wav into *.mp3
LIST=$(ls *.wav)
# make copies of all files in a directory
LIST=`ls`
for i in $LIST; do
ORIG=$i
DEST=$(ls $i | cut -d "." -f 1).mp3
lame -h $ORIG $DEST
echo "done converting $i, removing.."
rm $i
DEST=$i.old
cp $ORIG $DEST
echo "copied $i"
done
</screen>
<para>The <command>cut</command> command is used in this example to separate the actual file name from the file name suffix. Just entering a line like <command>mv <parameter>*.wav</parameter> <parameter>*.mp3</parameter></command> won't work. An <command>echo</command> command was added in order to display some activity. <command>echo</command>'s are generally useful when a script won't work: insert one after each doubted step and you will find the error in no time.</para>
@ -524,23 +524,10 @@ This script is a fine example of using functions, which make the script easier t
</sect3>
</sect2>
<sect2 id="sect_07_03_03"><title>X server configuration</title>
<para>The X distribution that comes with Linux, <emphasis>XFree86</emphasis>, uses the configuration file <filename>XF86Config</filename> for its initial setup. This file configures your video card and is searched for in a number of locations, although it is usually in <filename>/etc/X11</filename>. This file is composed of a number of sections which may be present in any order:</para>
<itemizedlist>
<listitem><para><emphasis>Files</emphasis>: File pathnames</para></listitem>
<listitem><para><emphasis>ServerFlags</emphasis>: Server options</para></listitem>
<listitem><para><emphasis>Module</emphasis>: Dynamic module loading</para></listitem>
<listitem><para><emphasis>InputDevice</emphasis>: Input device description</para></listitem>
<listitem><para><emphasis>Device</emphasis>: Graphics device description</para></listitem>
<listitem><para><emphasis>VideoAdapter</emphasis>: Video adapter description</para></listitem>
<listitem><para><emphasis>Monitor</emphasis>: Monitor description</para></listitem>
<listitem><para><emphasis>Modes</emphasis>: Video modes (modlines) description</para></listitem>
<listitem><para><emphasis>Screen</emphasis>: Screen configuration</para></listitem>
<listitem><para><emphasis>ServerLayout</emphasis>: Overall layout</para></listitem>
<listitem><para><emphasis>DRI</emphasis>: DRI-specific configuration (3D settings)</para></listitem>
<listitem><para><emphasis>Vendor</emphasis>: Vendor-specific configuration</para></listitem>
</itemizedlist>
<para>A full description can be found in the Info or man pages about <filename>XF86Config</filename>. As a user, you needn't worry too much about what is in this file, since everything is normally determined at the time the system is installed.</para>
<para>Should you need to change graphical server settings, however, you can run the configuration tools or edit the configuration files that set up the infrastructure to use the XFree86 server. See the man pages for more information; your distribution might have its own tools. Since misconfiguration may result in unreadable garbage in graphical mode, you may want to make a backup copy of the <filename>XF86Config</filename> file before attempting to change it, just to be on the safe side.</para>
<para>The X distribution that used to come with Linux, <emphasis>XFree86</emphasis>, uses the configuration file <filename>XF86Config</filename> for its initial setup. This file configures your video card and is searched for in a number of locations, although it is usually in <filename>/etc/X11</filename>.</para>
<para>If you see that the file <filename>/etc/X11/XF86Config</filename> is present on your system, a full description can be found in the Info or man pages about <filename>XF86Config</filename>.</para>
<para>Because of licensing issues with XFree86, newer systems usually come with the <emphasis>X.Org</emphasis> distribution of the X server and tools. The main configuration file here is <filename>xorg.conf</filename>, usually also in <filename>/etc/X11</filename>. The file consists of a number of sections that may occur in any order. The sections contain information about your monitor, your video adaptor, the screen configuration, your keyboard etcetera. As a user, you needn't worry too much about what is in this file, since everything is normally determined at the time the system is installed.</para>
<para>Should you need to change graphical server settings, however, you can run the configuration tools or edit the configuration files that set up the infrastructure to use the XFree86 server. See the man pages for more information; your distribution might have its own tools. Since misconfiguration may result in unreadable garbage in graphical mode, you may want to make a backup copy of the configuration file before attempting to change it, just to be on the safe side.</para>
</sect2>
</sect1>
@ -564,65 +551,49 @@ If your soundcard is not supported by default, you will need to apply other tech
</sect3>
<sect3 id="sect_07_04_03_02"><title>Playing music files</title>
<sect4 id="sect_07_04_03_02_01"><title>mp3 files</title>
<para>The popular <filename>.mp3</filename> format is widely supported on Linux machines. Most distributions include multiple programs that can play these files; <command>xmms</command>, which is presented in the screenshot below, is probably the most wide-spread.</para>
<para>The popular <filename>.mp3</filename> format is widely supported on Linux machines. Most distributions include multiple programs that can play these files. Among many other applications, <application>XMMS</application>, which is presented in the screenshot below, is one of the most wide-spread, partially because it has the same look and feel as the Windows tool.</para>
<figure><title>Xmms mp3 player</title>
<figure><title>XMMS mp3 player</title>
<mediaobject>
<imageobject>
<imagedata fileref="images/xmms.eps" format="EPS"></imagedata></imageobject><imageobject>
<imagedata fileref="images/xmms.png" format="PNG"></imagedata>
</imageobject>
<textobject>
<phrase>Xmms looks very familiar to MS Windows users, showing a hi-fi installation frontpanel.</phrase>
<phrase>XMMS looks very familiar to MS Windows users, showing a hi-fi installation frontpanel.</phrase>
</textobject>
</mediaobject>
</figure>
<para>Some distributions don't allow you to play MP3's without modifying your configuration, this is due to license restrictions on the MP3 tools. With the <command>xmms</command> player, you now need the <quote>xmms-mp3</quote> plugin. If error messages indicate that licensing is the trouble, the following procedure describes the path of least resistance:</para>
<itemizedlist>
<listitem><para>Download and install <command>apt-get</command>, for instance from <ulink url="http://www.freshrpms.net" />:</para>
<cmdsynopsis><command>rpm <option>-Uvh</option> <filename>/var/tmp/xmms-mp3-1.2.7-21.p.fr1</filename></command></cmdsynopsis>
</listitem>
<listitem><para>Run the following commands to prepare your system for use with the <command>apt</command> package manager:</para>
<cmdsynopsis><command>apt-get <parameter>update</parameter></command></cmdsynopsis>
<cmdsynopsis><command>apt-get <parameter>upgrade</parameter></command></cmdsynopsis>
</listitem>
<listitem><para>Install the xmms-mp3 plugin:</para>
<cmdsynopsis><command>apt-get <parameter>install</parameter> <filename>xmms-mp3</filename></command></cmdsynopsis>
</listitem>
<listitem><para>(Don't forget to log out of the <emphasis>root</emphasis> account because you've finished modifying your system now) - Play your favorite music:</para>
<cmdsynopsis><command>xmms <filename>/my/music/dot.mp3</filename></command></cmdsynopsis>
</listitem>
</itemizedlist>
<para>Also very popular for playing music are <application>AmaroK</application>, a KDE application that is steadily gaining popularity, and <application>MPlayer</application>, which can also play movies.</para>
<para>See <xref linkend="sect_07_06" /> for more on the commands for managing packages.</para>
<para>Start <command>xmms</command> from a menu, or from the command line like this:</para>
<screen>
<prompt>debby:~/mp3&gt;</prompt> <command>xmms music.mp3</command>
</screen>
<para>Alternatively, enter the command <command>xmms <filename>*.mp3</filename></command> for playing all <filename>.mp3</filename> files in a directory.</para>
<para>Both Gnome and KDE incorporate other graphical mp3 players, look in your menus.</para>
<note><title>Restrictions</title>
<para>Some distributions don't allow you to play MP3's without modifying your configuration, this is due to license restrictions on the MP3 tools. You might need to install extra software to be able to play your music.</para>
<note>
</sect4>
<sect4 id="sect_07_04_03_02_02"><title>Other formats</title>
<para>An overview of other common sound playing and manipulating software:</para>
<para>An (incomplete) overview of other common sound playing and manipulating software:</para>
<itemizedlist>
<listitem><para>Ogg Vorbis: Free audio format: see <ulink url="http://www.gnu.org/directory/audio/ogg/">the GNU audio directory</ulink> for tools - they might be included in your distribution as well.</para></listitem>
<listitem><para>Real audio and video: <command>realplay</command> from <ulink url="http://real.com">RealNetworks</ulink>.</para></listitem>
<listitem><para>SoX or Sound eXchange: actually a sound converter, comes with the <command>play</command> program. Plays <filename>.wav</filename>, <filename>.ogg</filename> and various other formats, including raw binary formats.</para></listitem>
<listitem><para>Playmidi: a MIDI player, see the GNU directory.</para></listitem>
<listitem><para>AlsaPlayer: from the Advanced Linux Sound Architecture project, see the <ulink url="http://www.alsaplayer.org">AlsaPlayer web site</ulink>.</para></listitem>
<listitem><para>KMediaPlayer: base for the KDE multimedia tools.</para></listitem>
<listitem><para><command>mplayer</command>: plays just about anything, including mp3 files. More info on the <ulink url="http://www.mplayerhq.hu/">MPlayerHQ website</ulink>.</para></listitem>
<listitem><para><command>hxplay</command>: supports RealAudio and RealVideo, mp3, mp4 audio, Flash, wav and more, see <ulink url="http://www.helixdna.com" />HelixDNA</ulink>.</para></listitem>
<listitem><para><command>rhythmbox</command>: based on the <application>GStremaer</application> framework, can play everything supported in <application>GStreamner</application>, which claims to be able to play everything, see the <ulink url="http://www.rhythmbox.org">RhythmBox</ulink> and <ulink url="http://gstreamer.freedesktop.org">GStreamer</ulink> sites.</para></listitem>
</itemizedlist>
<para>Check your system documentation for particular tools!</para>
<para>Check your system documentation for particular tools.</para>
<note><title>I don't have these applications on my system!</title>
<para>A lot of the tools and applications discussed in the above sections are optional software. It is possible that such applications are not installed on your system by default, but that you can find them in your distribution as additional packages. It might also very well be that the application that you are looking for is not in your distribution at all. In that case, you need to download it from the application's web site.</para>
</note>
</sect4>
</sect3>
<sect3 id="sect_07_04_03_03"><title>Volume control</title>
<para><command>aumix</command> and <command>alsamixer</command> are two common text tools for adjusting audio controls. The <command>alsamixer</command> has a graphical interface when started from the menu or as <command>gnome-alsamixer</command> from the command line. The <command>kmix</command> tool does the same in KDE.</para>
<para><command>aumix</command> and <command>alsamixer</command> are two common text tools for adjusting audio controls. The <command>alsamixer</command> has a graphical interface when started from the Gnome menu or as <command>gnome-alsamixer</command> from the command line. The <command>kmix</command> tool does the same in KDE.</para>
<para>Regardless of how you choose to listen to music or other sounds, remember that there may be other people who may not be interested in hearing you or your computer. Try to be courteous, especially in office environments. And use a quality head-set.</para>
</sect3>
<sect3 id="sect_07_03_03_04"><title>Video playing, streams and television watching</title>
@ -630,11 +601,12 @@ If your soundcard is not supported by default, you will need to apply other tech
<itemizedlist>
<listitem><para><command>xine</command>: a free video player</para></listitem>
<listitem><para><command>ogle</command>: DVD player</para></listitem>
<listitem><para><command>okle</command>: KDE version of <command>ogle</command></para></listitem>
<listitem><para><command>mplayer</command>: Movie Player for Linux</para></listitem>
<listitem><para><command>gstreamer</command>: upcoming project developing the GStreamer library and accompanying tools for audio and video recording, editing and playing, to be included in Gnome. See <ulink url="http://www.gstreamer.net">http://www.gstreamer.net</ulink> for more.</para></listitem>
<listitem><para><command>gstreamer</command>: upcoming multimedia framework project developing the GStreamer library and accompanying tools for audio and video recording, editing and playing, to be included in Gnome. See <ulink url="http://www.gstreamer.net">http://www.gstreamer.net</ulink> for more.</para></listitem>
<listitem><para><command>totem</command>: plays both audio and video files, audio CDs, VCD and DVD.</para></listitem>
<listitem><para><command>realplay</command>: from RealNetworks.</para></listitem>
<listitem><para><command>helixplay</command>: a Real alternative, see <ulink url="http://www.helixdna.org">HelixDNA</ulink>.</para></listitem>
<listitem><para><command>hxplay</command>: a Real alternative, see <ulink url="http://www.helixdna.org">HelixDNA</ulink>.</para></listitem>
</itemizedlist>
<para>Most likely, you will find one of these in your graphical menus.</para>
<para><ulink url="http://www.tldp.org/">TLDP</ulink> released a new document recently that is very appropriate for this section. It is entitled <ulink url="http://www.ibiblio.org/mdw/HOWTO/DVD-Playback-HOWTO/index.html">DVD Playback HOWTO</ulink> and describes the different tools available for viewing movies on a system that has a DVD drive. It is a fine addition to the <ulink url="http://www.ibiblio.org/mdw/HOWTO/DVD-HOWTO.html">DVD HOWTO</ulink> that explains installation of the drive.</para>
@ -655,8 +627,8 @@ If your soundcard is not supported by default, you will need to apply other tech
<screen>
XkbLayout "us"
</screen>
<para>This is the default. Change it to your local settings by replacing the quoted value with any of the names listed in the subdirectories of <filename>/lib/kbd/keymaps/</filename>, leaving out the <filename>.map.gz</filename> extention. If you can't find the keymaps, try displaying their location on your system issuing the command</para>
<cmdsynopsis><command>locate <filename>.map.gz</filename></command></cmdsynopsis>
<para>This is the default. Change it to your local settings by replacing the quoted value with any of the names listed in the subdirectories of your <filename>keymaps</filename> directory. If you can't find the keymaps, try displaying their location on your system issuing the command</para>
<cmdsynopsis><command>locate <filename>keymaps</filename></command></cmdsynopsis>
<para>It is possible to combine layout settings, like in this example:</para>
<screen>
Xkblayout "us,ru"
@ -673,13 +645,14 @@ export INPUTRC="/etc/inputrc"
<para>to the <filename>/etc/bashrc</filename> file.</para>
</sect2>
<sect2 id="sect_07_05_03"><title>Time zone</title>
<sect2 id="sect_07_05_03"><title>Date and time zone</title>
<para>Setting time information is usually done at installation time. After that, it can be kept up to date using an <emphasis>NTP</emphasis> (Network Time Protocol) client. Most Linux systems run <command>ntpd</command> by default:</para>
<screen>
<prompt>debby:~&gt;</prompt> <command>ps -ef | grep ntpd</command>
ntp 24678 1 0 2002 ? 00:00:33 ntpd -U ntp
</screen>
<para>See your system manual and the documentation that comes with the NTP package. Most desktop managers include tools to set the system time, providing that you have access to the system administrator's account.</para>
<para>For setting the time zone correct, you can use <command>tzconfig</command> or <command>timezone</command> commands. Timezone information is usually set during the installation of your machine. Many systems have distribution-specific tools to configure it, see your system documentation.</para>
</sect2>
<sect2 id="sect_07_05_04"><title>Language</title>
<para>If you'd rather get your messages from the system in Dutch or French, you may want to set the <varname>LANG</varname> and <varname>LANGUAGE</varname> environment variables, thus enabling locale support for the desired language and eventually the fonts related to character conventions in that language.</para>
@ -720,7 +693,7 @@ LANG=en_US.UTF-8
<sect3 id="sect_07_06_02_01"><title>RPM packages</title>
<para>RPM, the RedHat Package Manager, is a powerful package manager that you can use to install, update and remove packages. It allows you to search for packages and keeps track of the files that come with each package. A system is built-in so that you can verify the authenticity of packages downloaded from the Internet. Advanced users can build their own packages with RPM.</para>
<para>An RPM package consists of an archive of files and meta-data used to install and erase the archive files. The meta-data includes helper scripts, file attributes, and descriptive information about the package. Packages come in two varieties: binary packages, used to encapsulate software to be installed, and source packages, containing the source code and recipe necessary to produce binary packages.</para>
<para>Many other distributions support RPM packages, among the popular ones Mandrake and SuSE Linux. Apart from the advice for your distribution, you will want to read <command>man <parameter>rpm</parameter></command>.</para>
<para>Many other distributions support RPM packages, among the popular ones RedHat Enterprise Linux, Mandriva (former Mandrake), Fedora Core and SuSE Linux. Apart from the advice for your distribution, you will want to read <command>man <parameter>rpm</parameter></command>.</para>
<para>Most packages are simply installed with the upgrade option, <option>-U</option>, whether the package is already installed or not. The RPM package contains a complete version of the program, which overwrites existing versions or installs as a new package. The typical usage is as follows:</para>
<cmdsynopsis><command>rpm <option>-Uvh</option> <filename>/path/to/rpm-package(s)</filename></command></cmdsynopsis>
<para>The <option>-v</option> option generates more verbose output, and <option>-h</option> makes <command>rpm</command> print a progress bar:</para>
@ -764,7 +737,7 @@ coreutils-4.5.3-19
<para>The <ulink url="http://debian.org">Debian web site</ulink> contains all information you need, including a <quote>dselect Documentation for Beginners</quote>.</para>
</sect3>
<sect3 id="sect_07_06_02_03"><title>Source packages</title>
<para>The largest part of Linux programs is Free/Open Source, so source packages are available for these programs. Source files are needed for compiling your own program version. Sources are provided when you install development packages or can be downloaded from the particular web site for a program, in the raw (<filename>program-version.tar.gz</filename> or similar) or packaged in an RPM or Debian package.</para>
<para>The largest part of Linux programs is Free/Open Source, so source packages are available for these programs. Source files are needed for compiling your own program version. Sources for a program can be downloaded from its web site, often as a compressed tarball (<filename>program-version.tar.gz</filename> or similar). For RPM-based distributions, the source is often provided in the <filename>program-version.src.rpm</filename>. Debian, and most distributions based on it, provide themselves the adapted source which can be obtained using <command>apt-get <parameter>source</parameter></command>.</para>
<para>Specific requirements, dependencies and installation instructions are provided in the <filename>README</filename> file. You will probably need a C compiler, <command>gcc</command>. This GNU C compiler is included in most Linux systems and is ported to many other platforms.</para>
</sect3>
</sect2>
@ -773,7 +746,7 @@ coreutils-4.5.3-19
<para>The first thing you do after installing a new system is applying updates;
this applies to all operating systems and Linux is not different.</para>
<para>The updates for most Linux systems can usually be found on a nearby site mirroring your distribution. Lists of sites offering this service can be found at your distribution's web site, see <xref linkend="app1" />.</para>
<para>Updates should be applied regularly, daily if possible - but every couple of weeks would be a reasonable start. You really should try to have the most recent versions of all packages, since Linux changes constantly. As we said before, new features, improvements and bug fixes are supplied at a steady rhythm, and sometimes important security problems are addressed. All this not because Linux is a sloppy system, but rather because the Linux user is not easily satisfied. We want our software to be the best, but getting there and staying there demands some flexibility.</para>
<para>Updates should be applied regularly, daily if possible - but every couple of weeks would be a reasonable start. You really should try to have the most recent version of your distribution, since Linux changes constantly. As we said before, new features, improvements and bug fixes are supplied at a steady rhythm, and sometimes important security problems are addressed.</para>
<para>The good news is that most Linux distributions provide tools so that you don't have to upgrade tens of packages daily by hand. The following sections give an overview of <quote>package manager managers.</quote> There is much more to this subject, even regular updates of source packages is manageable automatically; we only list the most commonly known systems. Always refer to the documentation for your specific distribution for advised procedures.</para>
</sect3>
<sect3 id="sect_07_06_03_02"><title>APT</title>
@ -804,13 +777,12 @@ Preparing... ########################################### [100%]
<para>If there are any dependencies on other packages, <command>apt-get</command> will download and install these supporting packages.</para>
<para>More information can be found in the <ulink url="http://www.debian.org/doc/user-manuals#apt-howto">APT HOWTO</ulink>.</para>
</sect3>
<sect3 id="sect_07_06_03_03"><title>Systems supporting RPM packages</title>
<para><application>Update Agent</application>, which originally only supported RedHat RPM packages, is now ported to a wider set of software, including non-RedHat repositories. This tool provides a complete system for updating the RPM packages on a RedHat or Fedora Linux system. On the command line, type <command>up2date</command> to update your system. On the desktop, by default a small icon is activated, telleng you whether or not there are updates available for your system.</para>
<sect3 id="sect_07_06_03_03"><title>Systems using RPM packages</title>
<para><application>Update Agent</application>, which originally only supported RedHat RPM packages, is now ported to a wider set of software, including non-RedHat repositories. This tool provides a complete system for updating the RPM packages on a RedHat or Fedora Core system. On the command line, type <command>up2date</command> to update your system. On the desktop, by default a small icon is activated, telleng you whether or not there are updates available for your system.</para>
<para><application>Yellowdog's Updater Modified</application> (<command>yum</command>) is another tool that recently became more popular. It is an interactive but automated update program for installing, updating or removing RPM packages on a system. It is the tool of choice on Fedora systems.</para>
<para>On SuSE Linux, everything is done with <application>YaST</application>, Yet another Setup Tool, which supports a wide variety of system administration tasks, among which updating RPM packages. Starting from SuSE Linux 7.1 you can also upgrade using a web interface and <application>YOU</application>, Yast Online Update.</para>
<para>Mandrake Linux provides so-called URPMI tools, a set of wrapper programs that make installing new software easier for the user. These tools combine with <application>RPMDrake</application> and <application>MandrakeUpdate</application> to provide everything needed for smooth install and uninstall of software packages. MandrakeOnline offers an extended range of services and can automatically notify administrators when updates are available for your particular Mandrake system. Also the KDE and Gnome desktop suites have their own (graphical) versions of package managers, such as <application>GnoRPM</application> and <application>KPackage</application>.</para>
<para><ulink url="http://www.ximian.com">Ximian</ulink>, a Linux desktop software vendor, has developed <application>RedCarpet</application>, a graphical tool that you can use to subscribe to different upgrade <quote>channels</quote>. Different channels are available for upgrading a series of Linux distributions and versions, and for upgrading individual Ximian products, such as the Ximian desktop, the E-mail client Evolution, the upgrade tool itself and much more.</para>
<para>Ximian currently supports RedHat, Debian, Mandrake, Solaris, SuSE and YellowDog systems.</para>
<para>Mandrake Linux and Mandriva provide so-called URPMI tools, a set of wrapper programs that make installing new software easier for the user. These tools combine with <application>RPMDrake</application> and <application>MandrakeUpdate</application> to provide everything needed for smooth install and uninstall of software packages. MandrakeOnline offers an extended range of services and can automatically notify administrators when updates are available for your particular Mandrake system. See <command>man <parameter>urpmi</parameter></command>, among others, for more info.</para>
<para>Also the KDE and Gnome desktop suites have their own (graphical) versions of package managers.</para>
</sect3>
</sect2>
@ -853,7 +825,7 @@ title old-kernel
<prompt>[david@jupiter ~]</prompt> <command>grep cdrom /etc/fstab</command>
/dev/cdrom /mnt/cdrom iso9660 noauto,owner,ro 0 0
</screen>
<para>This indicates that the system will understand the command <command>mount <filename>/mnt/cdrom</filename></command>. The <option>noauto</option> means that on this system, CDs are not mounted automatically.</para>
<para>This indicates that the system will understand the command <command>mount <filename>/mnt/cdrom</filename></command>. The <option>noauto</option> option means that on this system, CDs are not mounted at boot time.</para>
<para>You may even try to right click on the CD icon on your desktop to mount the CD if your file manager doesn't do it for you. You can check whether it worked issuing the <command>mount</command> command with no arguments:</para>
<screen>
<prompt>[david@jupiter ~]</prompt> <command>mount | grep cdrom</command>
@ -861,7 +833,7 @@ title old-kernel
</screen>
</sect3>
<sect3 id="sect_07_06_05_02"><title>Using the CD</title>
<para>After mounting the CD, you can change directories, usually to the mount point <filename>/mnt/cdrom</filename>, where you can access the content of the CD-ROM. Use <command>rpm</command> just like described in the above section to install additional packages.</para>
<para>After mounting the CD, you can change directories, usually to the mount point <filename>/mnt/cdrom</filename>, where you can access the content of the CD-ROM. Use the same commands for dealing with files and directories as you would use for files on the hard disk.</para>
</sect3>
<sect3 id="sect_07_06_05_03"><title>Ejecting the CD</title>
<para>In order to get the CD out of the drive after you've finished using it, the file system on the CD should be unused. Even being in one of the subdirectories of the mount point, <filename>/mnt/cdrom</filename> in our example, will be considered as <quote>using the file system</quote>, so you should get out of there. Do this for instance by typing <command>cd</command> with no arguments, which will put you back in your home directory. After that, you can either use the command</para>
@ -896,6 +868,7 @@ title old-kernel
<listitem><para>Make an alias <command>lll</command> which actually executes <command>ls <option>-la</option></command>.</para></listitem>
<listitem><para>Why does the command <command>tail <filename>testfile</filename> &gt; <filename>testfile</filename></command> not work?</para></listitem>
<listitem><para>Mount a data CD, such as your Linux installation CD, and have a look around. Don't forget to unmount when you don't need it anymore.</para></listitem>
<listitem><para>The script from <xref linkend="sect_07_02_07_02" /> is not perfect. It generates errors for files that are directories. Adapt the script so that it only selects plain files for copying. Use <command>find</command> to make the selection. Do not forget to make the script executable before you try to run it.</para></listitem>
</itemizedlist>
</sect2>
<sect2 id="sect_07_08_02"><title>Graphical environment</title>