Guide to Unix/Commands/Summary
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. Send suggested changes and corrections to email@example.com
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.
- / - root directory
- ./ - current directory
- ./command_name - run a command in the current directory when the current directory is not on the path
- ../ - parent directory
- ~ - home directory
- $ - typical prompt when logged in as ordinary user
- # - typical prompt when logged in as root or superuser
- ![string] - repeat command starting with [string]
- !?[string] - repeat command ending with [string]
- !?[string] - repeat command containing [string]
- ![number] - repeat specified command x
- !-[number] - repeat specified command x commands ago
- !! - repeat previous command
- ^[string]^[string2]^ - repeat previous command with [string2] substituted for [string] (equiv. to !!:s/string1/string2/)
- & - run a program in background mode
- [Tab][Tab] - prints a list of all available commands. This is just an example of autocomplete with no restriction on the first letter.
- x[Tab][Tab] - prints a list of all available completions for a command, where the beginning is ``x''
- [Alt][Ctrl][F1] - switch to the first virtual text console from X.
- [Alt][Ctrl][Fn] - switch to the nth virtual text console from X.
- [Alt][Ctrl][F7] - switch to the first GUI console, if there is one running, assuming that there are 6 virtual text consoles. If the graphical console freezes, one can switch to a nongraphical console, kill the process that is giving problems, and switch back to the graphical console using this shortcut.
- [ArrowUp] - scroll through the command history (in bash)
- [Shift][PageUp] - scroll terminal output up. This also works at the login prompt, so you can scroll through your boot messages.
- [Shift][PageDown] - scroll terminal output down
- [Ctrl][Alt][+] - switch to next X server resolution (if the server is set up for more than one resolution)
- [Ctrl][Alt][-] - change to previous X server resolution
- [Ctrl][Alt][BkSpc] - kill the current X server. Used when normal exit is not possible.
- [Ctrl][Alt][Del] - shut down the system and reboot
- [Ctrl]a - move cursor to beginning of line
- [Ctrl]c - kill the current process
- [Ctrl]d - logout from the current terminal
- [Ctrl]e - move cursor to end of line
- [Ctrl]l - clear screen
- [Ctrl]n - next in history (same as down arrow)
- [Ctrl]p - previous in history (same as up arrow)
- [Ctrl]q - resume transfer to current terminal. This should be tried if the terminal stops responding.
- [Ctrl]s - stop transfer to current terminal
- [Ctrl]u - clear from cursor to beginning of line
- [Ctrl]y - send current process to the background when it asks for input. (delayed background)
- [Ctrl]z - send current process to the background
- reset - restore a terminal to its default settings
- [Leftmousebutton] - Hold down left mouse button and drag to highlight text. Releasing the button copies the region to the text buffer under X and (if gpm is installed) in console mode.
- [Middlemousebutton] - Copies text from the text buffer and inserts it at the cursor location. With a two-button mouse, click on both buttons simultaneously. It is necessary for three-button emulation to be enabled, either under gpm or in XF86Config.
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.
- amd - runs the automount daemon for remote filesystem mounting such as nfs
- anacron - checks delayed `cron' tasks (see below) at boot time and executes them. Useful if you have cron jobs scheduled but don't run your machine all the time.
- apmd - Advanced Power Management BIOS daemon. For use on machines, especially laptops, that support apm. Monitors battery status and can shut down the system if power is too low.
- arpwatch - keeps watch for ethernet IP address pairings that are resolved using the ARP protocol.
- atd - runs jobs queued by `at'
- autofs - control the operation of automount daemons, used to mount and unmount devices on demand
- bootparamd - allows computers to boot from a Linux machine using the BOOTP network protocol. A server process that provides information to diskless clients necessary for booting
- crond - automatic task scheduler. Manages the execution of tasks that are executed at regular but infrequent intervals, such as rotating log files, cleaning up /tmp directories, etc.
- cups - daemon for print services under the Common Unix Printer System, a replacement for lpd
- dhcpd - implements the Dynamic Host Configuration Protocol (DHCP) and the Internet Bootstrap Protocol (BOOTP). Used to lease out IP addresses to remote machines.
- drakfont - font server in Mandrake
- fetchmail - daemon to fetch mail at regular intervals from mail servers
- ftpd - ftp server daemon
- gated - routing daemon that handles multiple routing protocols and replaces routed and egpup
- gpm - useful mouse server for applications running on the Linux console.
- httpd - the Apache webserver hypertext transfer protocol daemon
- identd - The identd server provides a means to determine the identity of a user of a particular TCP connection. Given a TCP port number pair, it returns a character string which identifies the owner of that connection on the server's system.
- inetd - listens for service requests on network connections, particularly dial-in services. This daemon can automatically load and unload other daemons (ftpd, telnetd, etc.), thereby economizing on system resources. In the latest version of Red Hat (7.0 at the time of writing), it has been replaced by xinetd. A partial list of services controlled by inetd is listed below. Under many distributions, inetd will execute scripts in the file /etc/inetd.conf.
- innd - Usenet news server daemon
- ipchains - daemon for packet forwarding. Used for configuring a gateway/firewall.
- isdn provides ISDN network interfacing services
- isdn4linux - for users of ISDN cards
- kerneld - automatically loads and unloads kernel modules
- keytable - loads the appropriate keyboard map from /etc/sysconfig/ keyboard
- kheader -
- kudzu - detects and configures new or changed hardware during boot
- linuxconf - ``startup hook'' needed for the linuxconf system configuration tool
- lpd - line printer and print spooler daemon
- mcserv - server program for the Midnight Commander networking file system. It provides access to the host file system to clients running the Midnight file system (currently, only the Midnight Commander file manager). If the program is run as root the program will try to get a reserved port otherwise it will use 9876 as the port. If the system has a portmapper running, then the port will be registered with the portmapper and thus clients will automatically connect to the right port. If the system does not have a portmapper, then a port should be manually specified with the -p option (see below).
- mysql - database server daemon
- named - provides DNS services
- netfs - network filesystem mounter. Used for mounting nfs, smb and ncp shares on boot.
- network -activates all network interfaces at boot time by calling scripts in /etc/sysconfig/network-scripts
- nfsd - used for exporting nfs shares when requested by remote systems
- nfslock - starts and stops nfs file locking service
- numlock - locks numlock key at init runlevel change
- pcmcia - generic services for pcmcia cards in laptops
- portmap - needed for Remote Procedure Calls
- postfix - mail transport agent which is a replacement for sendmail. Now the default on desktop installations of Mandrake.
- postgresql - database server daemon
- random - random number generating daemon, related to security and encryption
- routed - manages routing tables
- rstatd - kernel statistics server. Allows users on a network to get performance statistics for any connected machine.
- rusersd - provides services that allow users to find one another over the network
- rwalld - allows users to use rwall to write messages on remote terminals
- rwhod - server which maintains the database used by the rwho(1) and ruptime(1) programs. Its operation is predicated on the ability to broadcast messages on a network.
- sendmail - mail transfer agent. This is the agent that comes with Red Hat. Others, such as smtpd, are not included.
- smb - needed for running SAMBA
- snmpd - provides Simple Network Management Protocol support
- sound - daemon for managing sound
- squid - web page proxy server daemon
- syslogd - manages system log files
- smtpd - Simple Mail Transfer Protocol, designed for the exchange of electronic mail messages. Several daemons that support SMTP are available, including sendmail, smtpd, rsmtpd, qmail, zmail, etc.
- tcpd - from the tcp_wrappers package. Intercepts requests normally handled by inetd and filters them through the files hosts.allow and hosts.deny files, which can restrict access to services based on type of service, origin of request, destination, etc. Requests are intercepted because calls to particular services are replaced with calls to tcpd in /etc/inetd.conf.
- telnetd - telnet server daemon
- usb - daemon for devices on Universal Serial Bus
- xfs - X font server
- xinetd - more modern replacement for inetd. It apparently allows for similar kinds of access filters to the ones used by tcpd in conjunction with inetd. xinetd replaces inetd as the default network services daemon in Red Hat 7.0.
- xntpd - Network Time Protocol daemon. Provides a means to synchronize time over the network.
- webmin - daemon for webmin web-based system administration program
- ypbind - NIS binder. Needed if computer is part of Network Information Service domain.
Notes on Applications
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.
- Exim -
- Fetchmail - seemingly one of the few ways (Pine is able to do this as well) to download mail automatically from a POP or IMAP server and pass it to local mail handling agents. Use the following line in /.fetchmailrc:
- poll pop.uqam.ca proto pop3 user USERNAME pass PASSWORD
Use the following to have fetchmail loaded as a daemon that will download mail at regular intervals:
- fetchmail -d 6000
The interval is specified in seconds. Fetchmail will poll all of the pop servers listed in /.fetchmailrc.
- Getmail - Designed as a replacement for Fetchmail.
- MMDF -
- Postfix - a mail transport agent and potential replacement for sendmail. Mandrake 7.1 and up uses this as its default MTA.
- Qmail - a ``modern'' replacement for sendmail. It is reputed to be more secure than sendmail. Since it doesn't have a GPL license, it is not the default MTA of any Linux distributions that I know of.
- Sendmail - this one gets my vote for the most complicated and obscure configuration file, /etc/sendmail.cf. Most individual Linux users will be using machines connected to the Internet via an ISP or on networks (such as university networks) with centralized mail processing and access to the net. I have to change the following lines in sendmail.cf to be able to send mail with emacs.
- DMuqam.ca # masquerade the domain name
- DNambler.steven # masquerade username
- DSnobel.si.uqam.ca # relay all mail through nobel server
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.
- Smail - seems to be a popular choice on smaller systems. It would appear that at one point in its history, Red Hat shipped with smail, but this has been replaced with sendmail.
- Zmailer - apparently designed for mail servers with a large number of users.
Mail User Agents (MUAs)
- Acmemail - Web-based mail agent. Allows you to access your mail with any browser. Involves setting up a Perl CGI script on the server side.
- Archimedes - A successor program to XFmail (see below)
- Arrow -
- Balsa - the default Gnome mail program
- Blitzmail -
- Elm -
- Emumail - Web-based mail agent. Allows you to use any browser to check your POP mail account. The Web site of the company that makes this one can be used to check your mail on a Unix system without setting up any CGI script on the server side.
- Evolution - mail reader and contact manager/calendar designed for use under Gnome
- Exmh - graphical front end for Mh
- Kmail - mail reading program included with KDE
- M - for ``Mahogany''. Seems similar to XFmail (see below). I haven't been able to figure out from the description whether it runs independently of or in conjunction with sendmail and procmail.
- Mh -
- Mumail -
- Mutt - text based mail program, which is highly configurable.
- Nmh - mail handling system. This system includes a large number of binary commands that are kept in /usr/bin. See the man page for nmh for details. Red Hat 5.1 and 5.2 come with exmh and xmh, which are graphical front ends for nmh. The exmh front end is a separate package, while xmh is owned by XFree86.
- Pine - text based mail and news utility. Features now include:
- MIME support
- ability to read and post network news
- maintenance of an address book of mail recipients
- spell checking during message composition
- mouse support when using xterm on an X Window system
- a highly configurable environment
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.
- Sylpheed -
- XCmail -
- XFmail - This one seems very promising. It's a GUI-based mail tool that seems to offer most of the features of Netscape's mail module. It runs without using sendmail and procmail, which is a major advantage.
- cooledit - a pretty powerful GUI text editor
- emacs - powerful text editor that includes modules for reading and sending mail and postings to newsgroups, and a browser module. For editing TEX and LATEX files, the AucTEX addon package is invaluable, and makes emacs pretty hard to beat as an editor with LATEX.
- jed - has pretty good emacs emulation (it can even read mail like emacs!). It does simple syntax highlighting for TeX files, including giving positioning of parentheses. It would seem to be pretty configurable and takes up much less disk space than emacs, although more than joe and muemacs. It works well in console mode, and still manages to use colors for menu bars and syntax highlighting. The program xjed which comes with some versions starts up its own X terminal when invoked.
- joe - "Joe's Own Editor", a fairly powerful editor with a compact binary and an ability to emulate Wordstar, Emacs, Pico, and a few other editors.
- jove - "Joe's Own Version of Emacs". I tried this out a couple of times and managed to crash it when making some minor errors in command syntax.
- microemacs (JASSPA) - spinoff of muemacs. Pretty powerful and configurable, while not taking up too much disk space or memory.
- muemacs - a fairly powerful emacs clone whose binary is actually smaller than that of the Joe editor.
- nedit - an X Window based text editor. Of all text editors for Linux that I've seen, it has commands which are closest to Windows text editors, for cursor movement, highlighting, marking text, etc. It has very good syntax highlighting for both LATEX and HTML.
- pico - simple text editor. It often comes packaged with the Pine mail user agent.
- vi - included with most Linux distributions. If you're not used to the syntax, it can be pretty hard to understand.
- vim - improved version of vi
- xedit - simple text editor included with many Linux distributions
- dfm - Desktop File Manager. Allows the user to place program icons on the desktop.
- gmc - Gnome Midnight Commander. Gnome version of Midnight Commander. Includes a graphical interface and allows the user to place icons on the desktop.
- mc - Midnight Commander file manager. Runs in console mode and in an xterm.
- scilab - a free matrix programming language. May be a good substitute for GAUSS and/or MATLAB.
- Guide to Unix/Files
- Guide to Unix/Environment Variables
- Guide to X11/Window Managers
- Linux Guide/Linux commands
- Use the Source/Counter-Culture
- Guide to Unix
- Guide to X11
- Use the Source
- Rosetta Stone For *Nix - configurable list of equivalent programs for *nix and MAC systems.
Computer Technology Documentation Project (CTDP) (2000a), ``How Linux Works'', http://www.comptechdoc.org/os/linux/howlinuxworks/
Computer Technology Documentation Project (CTDP) (2000b), ``Linux Files and Command Reference'', http://www.comptechdoc.org/os/linux/commands/
Klimas, Piotr et. al. (1999), ``Linux Newbie Administrator Guide'', http://linux-newbie.sunsite.dk/
Siever, Ellen, Stephen Spainhour, Jessica P. Hekman, and Stephen Figgins (2000), Linux in a Nutshell. third edition, O'Reilly
Sobell, Mark G. (1998), A Practical Guide to Linux. Addison-Wesley
Welsh, Matt, Matthias Kalle Dalheimer and Lar Kaufman (1999), Running Linux. third edition, O'Reilly and Associates