1  Introduction

This is my own summary of useful Linux abbreviations, directories, files, and commands. I use my own annotations to recall useful options and arguments that are not necessarily documented in easy-to-find places. I quite often call up this file when I can't remember the syntax of a command that I use often (but not often enough to remember the syntax!). I also editorialize on the relative usefulness of different types of programs.

This document is work in progress.

2  Shorthand at the Command Prompt

Some of these are specific to the bash shell. I have not experimented enough with other shells to know which are common to all shells. See also the ``Bash Reference Card'', SSC (2000), available online.

3  Typical Dot Files

There is some redundancy across these programs. For example, the look and behavior of emacs can be customized by usinng the .emacs file, but also by adding the appropriate modifications to the .Xdefaults file. Default versions of these files are often installed in users' home directories when the software packages that use them are installed. If a program doesn't find its configuration file in the user's home directory, it will often fall back on a sytem-wide default configuration file installed in one of the subdirectories that the package lives in.

4  Useful Files

5  Important Directories

Different distributions have different directory structures, despite attempts at standardization such as the the Linux Filesystem Hierarchy Standard (FHS) organization.

6  Important Bash Shell Variables

These variables are most often inherited or declared when a shell is started. A great reference for bash shell variable, bash builtin commands, and bash in general is SSC (2000).

7  Important Daemons and Startup Services

These are programs or processes which are run at boot time. Some remain in memory to execute various tasks when required (daemons). Most are started and stopped with scripts in the /etc/rc.d/init.d directory (see above). The exact contents of this directory will depend on which packages from a particular distribution are installed. For example, installing the Apache package will cause an httpd script to be placed in /etc/rc.d/init.d.

There are man pages on most of these. The Red Hat program tksysv (ntsysv is the non graphical version) allows root to automatically configure which of these are started automatically at boot time. The linuxconf program does the same thing, although I haven't tried it. The utility chkconfig is also designed to query and configure runtime services for different runlevels. The www.mandrakeuser.org site has a good page on common services/daemons, especially those included in recent versions of the Mandrake distribution.

A good source of information on daemons and services is the ``Linux Devices, Daemons, Services'' chapter of the CTDP (2000a) document.

8  Window Managers

The ``Window Managers for X'' site is extremely useful for keeping track of new Linux window managers. See http://winman.org.

9  Alphabetical List of Principal Commands

In the following command list, the distinction between upper case and lower case letters is important. Most of the commands are utilities that are run by invoking their own executable files. In some cases, they are commands which are internal to a shell such as bash (shell builtins). The shell builtins are indicated. There are now many utilities that are included with either the Gnome or the KDE desktop environments, so many that it would be difficult to include them all here. In many cases, they duplicate the functionality of one or more of the programs listed below. I would suggest consulting the online documentation for these packages.

Another good source of information on commands is the CTDP (2000b) document. There are different chapters which group commands in different categories.

On rpm-based systems, to find out which package owns the command foo (where foo is a standalone executable), use the command rpm -q -f foo.

so that you can't recursively delete your /dev directory without telling the system you're sure you want to do it.

The syntax for the absolute version is

To set the uid to the owner's permissions, use

To set the uid to the group's permissions, use

There are lots of security issues related to allowing a program to have root's permissions when run by an ordinary user. I don't pretend to understand all of these issues.

To restore from diskettes, use:

The cpio command will prompt the user to insert more diskettes as they are needed. The command for mirroring a directory structure is the following:

This copies the working directory and its contents, including subdirectories, into /destinationdirectory. In order to copy an individual file which is larger than a floppy, use:

The ibs and bs options specify the block sizes for input and for both input and output. A boot disk image can be directly copied to a floppy using the second of the two dd commands above.

will display detailed disk usage for each subdirectory starting at root, giving files sizes in bytes.

where the filesystem is on /dev/devicename. The device should not be mounted, and this program must be run as root.

This is a shell builtin.

in order to find files matching a particular name on the working directory and all subdirectories. Find can be incredibly powerful, but it is incredibly obscure.

did work. The single quotes are necessary. The files necessary to run grub are normally located in /boot/grub. Once the file menu.lst has been edited and appropriated entries added to boot the different operating systems on one's hard disk(s), the following sequence of commands can be used to install grub in the master boot record (MBR) sector of the hard disk:

Here, the x should be replaced by the partition where the /boot/grub directory is located, which is probably the root partition of the Linux system. Note that grub has its own conventions for naming devices and numbering partitions, so that for example a partition which is called hda6 under Linux will be called (hd0,5) by grub.

The -C option to lilo has lilo use the lilo.flop file instead of the default lilo.conf.

To get this all the time, add

to .bashrc. The following command

will give directory listings in color, with file sizes in kilobytes, and append a character to the file to indicate its type.

The default device for execution of these commands is /dev/fd0 and can be referred to as ``a:''.

The user's home directory on the remote system must contain the file .rhosts with a list of users (preceded by the full domain name or exact IP address of their machine) with access privileges.

The remote computer must recognize the local user and the local machine. See the rcp command for how to set up the .rhosts file on the remote machine.

We need to find out about installing the rpm package on a Slackware box. It's probably better to use a package converter such as alien.

prints the current user environment, giving the values of currently defined variables.

To create a tarball from files in a given directory and its subdirectories, use

Sourcename can be the name of a single file, a wildcard such as *, or the name of a subdirectory. There seem to be two different conventions concerning gzipped tarballs. One often encounters .tar.gz. The other popular choice is .tgz. Slackware packages use the latter convention. The command can also be used to archive a file, a group of files, or a directory (with its subdirectories) on tape or onto floppies. If the material to be archived exceeds the capacity of the backup medium, the program will prompt the user to insert a new tape or diskette. Use the following command to back up to floppies:

The backup can be restored with

Tar can be used for other things. To mirror all the files and subdirectories in from-stuff to to-stuff, use the commands

No tar file is ever written to disk. The data is sent by pipe from one tar process to another. This example is taken from Running Linux, p.177. To list the table of contents of a tar archive, use

To extract individual files from a tar archive, use

where files is the list of files to extract. When extracting files, tar creates missing subdirectories underneath the current directory in which the cammand is invoked.

The system subtracts x, y and z from the owner, group and other file permissions that it would otherwise assign to new files. This is a shell builtin.

in order to get a graphical login screen on the remote machine. See the discussion in connection with xdm below.

See the man pages for X, xdm, and Xserver. As usual, the man pages are pretty obscure. The best single source seems to be the Xserver man pages. After X is configured, X needs to be started at bootup with the command (in /etc/rc.d/init.d/xterm):

If the address of a nameserver is not configured, then the numeric address of the remote machine rather than its name should be entered. If the machines are connected through ethernet cards and the net, then obviously basic networking has to be set up. Gnome and KDE come with their own versions of X display/login managers, called respectively gdm and kdm.

Then, log onto the remote machine using rlogin (see above) or telnet. Once logged in, use the following command to get the remote X server to open an X terminal on the local machine:

This is valid for csh, which is the default login shell on Nobel. For ksh, (and I think bash) replace with

Other X-based programs such as Netscape or Gauss (graphical version) can also be run on a remote machine with display on the local machine with little trouble. The local X server is the program that has all of the information concerning the properties of the graphics card and terminal, so it must be necessary to have X running on the local machine. The following should also work. After using xhost to give permission to the remote machine to display on the local machine, use

Question: can one start the X session on the local machine and then run a remote copy of a window manager?

into the .xession (with xdm) or the .xinitrc (with startx) file.

Eventually, we want to be able to distinguish between commands that are an intrinsic part of the kernel, commands that are executable binaries that come with every distribution of Linux, executable binaries that are not provided with all distributiions of Linux, and executable shell scripts. We also want to point out the typical location of these commands on different Linux distributions. Finally, we want to distinguish between shell commands and Linux commands.

10  Notes on Applications

10.1  Mail Transfer Agents (MTAs)

The Linux distributions I know come with sendmail, except for Mandrake, which as of version 7.1 uses Postfix as its default MTA. There are several competing programs available. Even the simplest don't seem to be that easy to configure.

Use the following to have fetchmail loaded as a daemon that will download mail at regular intervals:

The interval is specified in seconds. Fetchmail will poll all of the pop servers listed in  /.fetchmailrc.

The problem comes from the fact that, as a user on a local network, I don't have my own domain name. I want return mail to be routed to UQAM's mail server and I want the server to handle all my mail for me, even mail to other UQAM users. If I send mail to UQAM users using their normalized usernames, the net does not know who or where they are. I have managed to get a configuration that works by writing a sendmail.mc file and processing it with the m4 macro interpreter, following the Address-Rewriting mini-HOWTO. I now have something that works, but which mysteriously complains about ``dangerous write permissions'' every time the system boots up.

10.2  Mail User Agents (MUAs)

Pine can be used to download mail from one or more POP3 mail servers. See Tip of the Week (http://tipoftheweek.darkelf.net) for the fourth week of February 1999. First, set up multiple configuration files (pine -p localmail, pine -p popserver 1, pine -p popserver 2, etc.). Then, to configure Pine to use a POP3 server, use the Setup Config command. Set something like this in the inbox-path:

When Pine is restarted, it should ask for your password, connect to the remote server, and use it is if it were accessing local mail. The article is unclear on whether there is the option of leaving copies of the downloaded mail on the server.

10.3  Editors

10.4  Other