-->

Table of Contents

developer.com - Reference Library

Page 611

APPENDIX B

Top 50 Linux
Commands and
Utilities

by David Pitts

IN THIS APPENDIX

Page 612

This appendix is not meant to replace the man pages; it does not go into anything resembling the detail available in the man pages. This appendix is designed to give you a feel for the commands and a brief description as to what they do. In most cases there are more parameters that can be used than are shown here.

Most of the descriptions also have examples with them. If these examples aren't self-evident, an explanation is provided. This is not an exhaustive list—there are many more commands that you could use—but these are the most common, and you will find yourself using them over and over again.

To keep things simple, the commands are listed in alphabetical order. I would have preferred to put them in order of how often I use them, but that would make locating them quite difficult. However, I do want to summarize by listing what are, at least for me, the ten most common commands—also alphabetically. This list of essential commands could be compared to a list of the top ten words spoken by the cavemen when searching for food and a mate:

  1. cat
  2. cd
  3. cp
  4. find
  5. grep
  6. ls
  7. more
  8. rm
  9. vi
  10. who

General Guidelines

In general, if you want to change something that already exists, the command to do that will begin with ch. If you want to do something for the first time, the command to do that will usually begin with mk. If you want to undo something completely, the command will usually begin with rm. For example, to make a new directory, you use the mkdir command. To remove a directory, you use the rmdir command.

The List

The commands listed in this appendix are some of the most common commands used in Red Hat Linux. In cases where the command seems ambiguous, an example is provided. With each of these commands, the man pages can provide additional information, as well as more examples.

Page 613

.

The . command tells the shell to execute all the commands in the file that are passed an argument to the command. This works in the bash or pdksh. The equivalent in the tcsh is the source command. The following example will execute the command adobe:


. adobe

&

The & after any other command tells the computer to run the command in the background. By placing a job in the background, the user can then continue using that shell to process other commands. If the command is run in the foreground, the user cannot continue using that shell until the process finishes.

adduser

The adduser command is used by root, or someone else who has the authority, to create a new user. The adduser command is followed by the account name to be created—for example,


adduser dpitts

alias

The alias command is used to make aliases or alternative names for commands. Typically, these aliases are abbreviations of the actual command. In the following example, the user (probably a DOS user) is adding an alias of dir for a directory listing:


alias dir=ls

Typing alias by itself will give you a list of all your current aliases. Such a list might look like this:


svr01:/home/dpitts$ alias

alias d='dir'

alias dir='/bin/ls $LS_OPTIONS --format=vertical'

alias ls='/bin/ls $LS_OPTIONS'

alias v='vdir'

alias vdir='/bin/ls $LS_OPTIONS --format=long'

apropos <parameter>

The apropos command literally means appropriate or regarding (others). When it is followed by a parameter, it will search the man pages for entries that include the parameter. Basically, this performs a keyword search on all the man pages. This is the equivalent of the man -k
<parameter> command.

Page 614

banner

banner prints a large, high-quality banner to standard output. If the message is omitted, it prompts for and reads one line from standard input. For example, enter $ banner hi to create the following banner:


 

                   ##                                                  ###

                   ##                                                  ###

                   #######################################################

                   #######################################################

                   #######################################################

                   #######################################################

                   #######################################################

                   ##                        ###

                                               ###

                                               ###

                                               ####

                                               ####

                                               ####

                   ##                       #######

                   ################################

                   ################################

                   ###############################

                   ############################

                   #########################

                   ##

                   ##                            ##

                   ##                            ##          ####

                   ################################        ########

                   ################################        ########

                   ################################        ########

                   ################################         ######

                   ################################          ####

                   ##

bg

The bg command is used to force a suspended process to run in the background. For example, you might have started a command in the foreground (without using & after the command), and realized that it was going to take a while, but that you still needed your shell. You could take that process that is currently running and hold down the Ctrl key, and, while it is held down, press the Z key. This places the current process on hold. You can either leave it on hold, just as if you called your telephone company, or you could place that process in the background by typing bg. This then frees up your shell to allow you to execute other commands.

bind

Used in pdksh, the bind command enables the user to change the behavior of key combinations for the purpose of command-line editing. Many times people bind the up, down, left, and right arrow keys so that they work the way they would in the Bourne Again Shell (bsh). The syntax used for the command is


bind <key  sequence>  <command>

Page 615

The following examples are the bind commands to create bindings for scrolling up and down the history list and for moving left and right along the command line:


bind `^[[`=prefix-2

bind `^XA`=up-history

bind `^XB`=down-history

bind `^XC`=forward-char

bind `^XD`=backward-char

cat

cat does not call your favorite feline; instead, it tells the contents of (typically) the file to scroll its contents across the screen. If that file happens to be binary, then the cat gets a hairball and shows it to you on the screen. Typically, this is a noisy process as well. What is actually happening is that the cat command is scrolling the characters of the file, and the terminal is doing all it can to interpret and display the data in the file. This interpretation can include the character used to create the bell signal, which is where the noise comes from. As you might have surmised, the cat command requires something to display and would have the following format:


cat <filename>

cd

cd stands for change directory. You will find this command extremely useful. There are three typical ways of using this command:


cd .. Moves one directory up the directory tree.
cd ~ Moves to your home directory from wherever you currently are. This is the same as issuing cd by itself.
cd directory name Changes to a specific directory. This can be a directory relative to your current location or can be based on the root directory by placing a forward slash (/) before the directory name. These examples can be combined. For example, suppose you were in the directory /home/dsp1234 and you wanted to go to tng4321's home account. You could perform the following command, which will move you back up the directory one level and then move you down into the tng4321 directory: cd ../tng4321

Page 616

chgrp

The chgrp command is used to change the group associated with the permissions of the file or directory. The owner of the file (and, of course, root) has the authority to change the group associated with the file. The format for the command is simply


chgrp <new group> <file>

chmod

The chmod command is used to change the permissions associated with the object (typically a file or directory). What you are really doing is changing the file mode. There are two ways of specifying the permissions of the object. You can use the numeric coding system or the letter coding system. If you recall, there are three sets of users associated with every object: the owner of the object, the group for the object, and everybody else. Using the letter coding system, they are referred to as u for user, g for group, o for other, and a for all. There are three basic types of permissions that you can change: r for read, w for write, and x for execute. These three permissions can be changed using the plus (+) and minus (-) signs. For example, to add read and execute to owner and group of the file test1, you would issue the following command:


chmod ug+rx test1

To remove the read and execute permissions from the user and group of the test1 file, you would change the plus (+) sign to a minus (-) sign:


chmod ug-rx test1

This is called making relative changes to the mode of the file.

Using the numeric coding system, you always have to give the absolute value of the permissions, regardless of their previous permissions. The numeric system is based upon three sets of base two numbers. There is one set for each category of user, group, and other. The values are 4, 2, and 1, where 4 equals read, 2 equals write, and 1 equals execute. These values are added together to give the set of permissions for that category. With the numeric coding you always specify all three categories. Therefore, to make the owner of the file test1 have read, write, and execute permissions, and no one else to have any permissions, you would use the value 700, like this:


chmod 700 test1

To make the same file readable and writable by the user, and readable by both the group and others, you would follow the following mathematical logic: For the first set of permissions, the user, the value for readable is 4, and the value for writable is 2. The sum of these two is 6. The next set of permissions, the group, only gets readable, so that is 4. The settings for others, like the group, are 4. Therefore, the command would be chmod 644 test1.

Page 617

The format for the command, using either method, is the same. You issue the chmod command followed by the permissions, either absolute or relative, followed by the objects for which you want the mode changed:


chmod <permissions> <file>

chown

This command is used to change the user ID (owner) associated with the permissions of the file or directory. The owner of the file (and, of course, root) has the authority to change the user associated with the file. The format for the command is simply


chown <new user id> <file>

chroot

The chroot command makes the / directory (called the root directory) be something other than / on the filesystem. For example, when working with an Internet server, you can set the root directory to equal /usr/ftp. Then, when someone logs on using FTP (which goes to the root directory by default), he or she will actually go to the directory /usr/ftp. This protects the rest of your directory structure from being seen or even changed to by this anonymous guest to your machine. If the person were to enter cd /etc, the ftp program would try to put him or her in the root directory and then in the etc directory off of that. Because the root directory is /usr/ftp, the ftp program will actually put the user in the /usr/ftp/etc directory (assuming there is one).

The syntax for the command is


chroot <original filesystem location>

<new filesystem location>

cp

The cp command is an abbreviation for copy; therefore, this command enables you to copy objects. For example, to copy the file file1 to file2, issue the following command:


cp file1 file2

As the example shows, the syntax is very simple:


cp <original object name> <new object

name>

dd

The dd command converts file formats. For example, to copy a boot image to a disk (assuming the device name for the disk is /dev/fd0), you would issue the command


dd if=<filename> of-/dev/fd0 obs=18k

where filename would be something like BOOT0001.img, of is the object format (what you are copying to), and obs is the output block size.

Page 618

env

The env command is used to see the exported environment variables. The result of the command is a two-column list where the variable's name is on the left and the value associated with that variable is on the right. The command is issued without any parameters. Hence, typing env might get you a list similar to this one:


svr01:/home/dpitts$ env

HOSTNAME=svr01.mk.net

LOGNAME=dpitts

MAIL=/var/spool/mail/dpitts

TERM=vt100

HOSTTYPE=i386

PATH=/usr/local/bin:/usr/bin:/bin:.:/usr/local/java/bin

HOME=/home2/dpitts

SHELL=/bin/bash

LS_OPTIONS=--8bit --color=tty -F -b -T 0

PS1=\h:\w\$

PS2=>

MANPATH=/usr/local/man:/usr/man/preformat:/usr/man:/usr/lib/perl5/man

LESS=-MM

OSTYPE=Linux

SHLVL=1

fc

The fc command is used to edit the history file. The parameters passed to it, if there are any, can be used to select a range of commands from the history file. This list is then placed in an editing shell. The editor that it uses is based upon the value of the variable FCEDIT. If there is no value for this variable, the command looks at the EDITOR variable. If it is not there, the default is used, which is vi.

fg

Processes can be run in either the background or the foreground. The fg command enables you to take a suspended process and run it in the foreground. This is typically used when you have a process running in the foreground and for some reason, you need to suspend it (thus allowing you to run other commands). The process will continue until you either place it in the background or bring it to the foreground.

file

The file command tests each argument passed to it for one of three things: the filesystem test, the magic number test, or the language test. The first test to succeed causes the file type to be printed. If the file is text (it is an ASCII file), it then attempts to guess which language. The following example identifies the file nquota as a text file that contains Perl commands. A magic number file is a file that has data in particular fixed formats. Here is an example for checking the file nquota to see what kind of file it is:


file nquota

nquota: perl commands text

Page 619

find

Did you ever say to yourself, "Self, where did I put that file?" Well now, instead of talking to yourself and having those around you wonder about you, you can ask the computer. You can say, "Computer, where did I put that file?" Okay, it is not that simple, but it is close. All you have to do is ask the computer to find the file.

The find command will look in whatever directory you tell it to, as well as all subdirectories under that directory, for the file that you specified. After it has found this list, it will then do with the list as you have asked it to. Typically, you just want to know where it is, so you ask it, nicely, to print out the list. The syntax of the command is the command itself, followed by the directory you want to start searching in, followed by the filename (metacharacters are acceptable), and then what you want done with the list. In the following example, the find command searches for files ending with .pl in the current directory (and all subdirectories). It then prints the results to standard output.


find . -name *.pl -print

./public_html/scripts/gant.pl

./public_html/scripts/edit_gant.pl

./public_html/scripts/httools.pl

./public_html/scripts/chart.no.comments.pl

grep

The grep (global regular expression parse) command searches the object you specify for the text that you specify. The syntax of the command is grep <text> <file>. In the following example, I am searching for instances of the text httools in all files in the current directory:


grep httools *

edit_gant.cgi:require `httools.pl';

edit_gant.pl:require `httools.pl';

gant.cgi:   require `httools.pl';  # Library containing reuseable code

gant.cgi:       &date;     # Calls the todays date subroutine from httools.pl

gant.cgi:        &date;   #  Calls the todays date subroutine from httools.pl

gant.cgi:   &header;  # from httools.pl

Although this is valuable, the grep command can also be used in conjunction with the results of other commands. For example, the following command


ps -ef |grep -v root

calls for the grep command to take the output of the ps command and take out all instances of the word root (the -v means everything but the text that follows). The same command without the -v (ps -ef |grep root) returns all of the instances that contain the word root from the process listing.

groff

groff is the front end to the groff document formatting program. This program, by default, calls the troff program.

Page 620

gzip

gzip is GNU's version of the zip compression software. The syntax can be as simple as


gzip <filename>

but many times also contains some parameters between the command and the filename to be compressed.

halt

The halt command tells the kernel to shut down. This is a superuser-only command (you must "be root").

hostname

hostname is used to either display the current host or domain name of the system or to set the hostname of the system—for example,


svr01:/home/dpitts$ hostname

svr01

kill

kill sends the specified signal to the specified process. If no signal is specified, the TERM signal is sent. The TERM signal will kill processes that do not process the TERM signal. For processes that do process the TERM signal, it might be necessary to use the KILL signal because this signal cannot be caught. The syntax for the kill command is kill <option> <pid>, and an example is as follows:


svr01:/home/dpitts$kill -9 1438

less

less is a program similar to more, but which allows backward movement in the file as well as forward movement. less also doesn't have to read the entire input file before starting, so with large input files it starts up faster than text editors such as vi.

login

login is used when signing on to a system. It can also be used to switch from one user to another at any time.

logout

logout is used to sign off a system as the current user. If it is the only user you are logged in as, then you are logged off the system.

Page 621

lpc

lpc is used by the system administrator to control the operation of the line printer system. lpc can be used to disable or enable a printer or a printer's spooling queue, to rearrange the order of jobs in a spooling queue, to find out the status of printers, to find out the status of the spooling queues, and to find out the status of the printer daemons. The command can be used for any of the printers configured in /etc/printcap.

lpd

lpd is the line printer daemon and is normally invoked at boot time from the rc file. It makes a single pass through the /etc/printcap file to find out about the existing printers and prints any files left after a crash. It then uses the system calls listen and accept to receive requests to print files in the queue, transfer files to the spooling area, display the queue, or remove jobs from the queue.

lpq

lpq examines the spooling area used by lpd for printing files on the line printer, and reports the status of the specified jobs or all jobs associated with a user. If the command is invoked without any arguments, the command reports on any jobs currently in the print queue.

lpr

The line printer command uses a spooling daemon to print the named files when facilities become available. If no names appear, the standard input is assumed. The following is an example of the lpr command:


lpr /etc/hosts

ls

The ls command lists the contents of a directory. The format of the output is manipulated with options. The ls command, with no options, lists all nonhidden files (a file that begins with a dot is a hidden file) in alphabetical order, filling as many columns as will fit in the window. Probably the most common set of options used with this command is the -la option. The a means list all (including hidden files) files, and the l means make the output a long listing. Here is an example of this command:


svr01:~$ ls -la

total 35

drwxr-xr-x   7 dpitts   users        1024 Jul 21 00:19 ./

drwxr-xr-x 140 root     root         3072 Jul 23 14:38 ../

-rw-r--r--   1 dpitts   users        4541 Jul 23 23:33 .bash_history

-rw-r--r--   1 dpitts   users          18 Sep 16  1996 .forward

-rw-r--r--   2 dpitts   users         136 May 10 01:46 .htaccess

-rw-r--r--   1 dpitts   users         164 Dec 30  1995 .kermrc

-rw-r--r--   1 dpitts   users          34 Jun  6  1993 .less

-rw-r--r--   1 dpitts   users         114 Nov 23  1993 .lessrc

Page 622


-rw-r--r--   1 dpitts   users          10 Jul 20 22:32 .profile

drwxr-xr-x   2 dpitts   users        1024 Dec 20  1995 .term/

drwx------   2 dpitts   users        1024 Jul 16 02:04 Mail/

drwxr-xr-x   2 dpitts   users        1024 Feb  1  1996 cgi-src/

-rw-r--r--   1 dpitts   users        1643 Jul 21 00:23 hi

-rwxr-xr-x   1 dpitts   users         496 Jan  3  1997 nquota*

drwxr-xr-x   2 dpitts   users        1024 Jan  3  1997 passwd/

drwxrwxrwx   5 dpitts   users        1024 May 14 20:29 public_html/

make

The purpose of the make utility is to automatically determine which pieces of a large program need to be recompiled and then to issue the commands necessary to recompile them.

man

The man command is used to format and display the online manual pages. The manual pages are the text that describes, in detail, how to use a specified command. In the following example, I have called the man page that describes the man pages:


svr01:~$ man man

man(1)                                                     man(1)





NAME

       man - format and display the on-line manual pages

       manpath - determine user's search path for man pages

SYNOPSIS

       man  [-adfhktwW]  [-m system] [-p string] [-C config_file]

       [-M path] [-P pager] [-S section_list] [section] name  ...



DESCRIPTION

       man  formats  and displays the on-line manual pages.  This

       version knows about  the  MANPATH  and  PAGER  environment

       variables, so you can have your own set(s) of personal man

       pages and choose whatever program you like to display  the

       formatted  pages.  If section is specified, man only looks

       in that section of the manual.  You may also  specify  the

       order to search the sections for entries and which prepro-

       cessors to run  on  the  source  files  via  command  line

       options  or  environment  variables.  If name contains a /

       then it is first tried as a filename, so that you  can  do

mesg

The mesg utility is run by a user to control write access others have to the terminal device associated with the standard error output. If write access is allowed, programs such as talk and write have permission to display messages on the terminal. Write access is allowed by default.

mkdir

The mkdir command is used to make a new directory.

Page 623

mkefs

The mkefs command is used to make an extended filesystem. This command does not format the new filesystem, just makes it available for use.

mkfs

mkfs is used to build a Linux filesystem on a device, usually a hard disk partition. The syntax for the command is mkfs <filesystem>, where <filesystem> is either the device name (such as /dev/hda1) or the mount point (for example, /, /usr, /home) for the filesystem.

mkswap

mkswap sets up a Linux swap area on a device (usually a disk partition).

The device is usually of the following form:


/dev/hda[1-8]

/dev/hdb[1-8]

/dev/sda[1-8]

/dev/sdb[1-8]

more

more is a filter for paging through text one screen at a time. This command can only page down through the text, as opposed to less, which can page both up and down though the text.

mount

mount attaches the filesystem specified by specialfile (which is often a device name) to the directory specified as the parameter. Only the superuser can mount files. If the mount command is run without parameters, it lists all the currently mounted filesystems. The following is an example of the mount command:


svr01:/home/dpitts$ mount

/dev/hda1 on / type ext2 (rw)

/dev/hda2 on /var/spool/mail type ext2 (rw,usrquota)

/dev/hda3 on /logs type ext2 (rw,usrquota)

/dev/hdc1 on /home type ext2 (rw,usrquota)

none on /proc type proc (rw)

mv

The mv command is used to move an object from one location to another location. If the last argument names an existing directory, the command moves the rest of the list into that directory. If two files are given, the command moves the first into the second. It is an error to have more than two arguments with this command unless the last argument is a directory.

Page 624

netstat

netstat displays the status of network connections on either TCP, UDP, RAW, or UNIX sockets to the system. The -r option is used to obtain information about the routing table. The following is an example of the netstat command:


svr01:/home/dpitts$ netstat

Active Internet connections

Proto Recv-Q Send-Q Local Address          Foreign Address        (State)

User

tcp        0  16501 www.mk.net:www         sdlb12119.sannet.:3148 FIN_WAIT1

root

tcp        0  16501 auth02.mk.net:www      sdlb12119.sannet.:3188 FIN_WAIT1

root

tcp        0      1 www.anglernet.com:www  ts88.cctrap.com:1070   SYN_RECV

root

tcp        0      1 www.anglernet.com:www  ts88.cctrap.com:1071   SYN_RECV

root

udp        0      0 localhost:domain       *:*

udp        0      0 svr01.mk.net:domain    *:*

udp        0      0 poto.mk.net:domain     *:*

udp        0      0 stats.mk.net:domain    *:*

udp        0      0 home.mk.net:domain     *:*

udp        0      0 www.cmf.net:domain     *:*

Active UNIX domain sockets

Proto RefCnt Flags      Type            State           Path

unix  2      [ ]        SOCK_STREAM     UNCONNECTED     1605182

unix  2      [ ]        SOCK_STREAM     UNCONNECTED     1627039

unix  2      [ ]        SOCK_STREAM     CONNECTED       1652605

passwd

For the normal user (non-superuser), no arguments are used with the passwd command. The command will ask the user for the old password. Following this, the command will ask for the new password twice, to make sure it was typed correctly. The new password must be at least six characters long and must contain at least one character that is either uppercase or a nonletter. Also, the new password cannot be the same password as the one being replaced, nor can it match the user's ID (account name).

If the command is run by the superuser, it can be followed by either one or two arguments. If the command is followed by a single user's ID, then the superuser can change that user's password. The superuser is not bound by any of the restrictions imposed on the user. If there is an argument after the single user's ID, then that argument becomes that user's new password.

ps

ps gives a snapshot of the current processes. An example is as follows:


svr01:/home/dpitts$ ps -ef



PID TTY STAT  TIME COMMAND

10916  p3 S     0:00 -bash TERM=vt100 HOME=/home2/dpitts PATH=/usr/local/bin:/us

10973  p3 R     0:00  \_ ps -ef LESSOPEN=|lesspipe.sh %s ignoreeof=10 HOSTNAME=s

10974  p3 S     0:00  \_ more LESSOPEN=|lesspipe.sh %s ignoreeof=10 HOSTNAME=svr

Page 625

pwd

pwd prints the current working directory. It tells you what directory you are currently in.

rm

rm is used to delete specified files. With the -r option (Warning: This can be dangerous!), rm will recursively remove files. Therefore if, as root, you type the command rm -r /, you had better have a good backup because all your files are now gone. This is a good command to use in conjunction with the find command to find files owned by a certain user or in a certain group, and delete them. By default, the rm command does not remove directories.

rmdir

rmdir removes a given empty directory; the word empty is the key word. The syntax is simply rmdir <directory name>.

set

The set command is used to temporarily change an environment variable. In some shells, the set -o vi command will allow you to bring back previous commands that you have in your history file. It is common to place the command in your .profile. Some environment variables require an equals sign, and some, as in the example set -o vi, do not.

shutdown

One time during Star Trek: The Next Generation, Data commands the computer to "Shut down the holodeck!" Unfortunately, most systems don't have voice controls, but systems can still be shut down. This command happens to be the one to do just that. Technically, the shutdown call


int shutdown(int s, int how));

causes all or part of a full-duplex connection on a socket associated with s to be shut down, but who's being technical? The shutdown command can also be used to issue a "Vulcan Neck Pinch" (Ctrl+Alt+Del) and restart the system.

su

su enables a user to temporarily become another user. If a user ID is not given, the computer thinks you want to be the superuser, or root. In either case, a shell is spawned that makes you the new user, complete with that user ID, group ID, and any supplemental groups of that new user. If you are not root and the user has a password (and the user should!), su prompts for a password. Root can become any user at any time without knowing passwords. Technically, the user just needs to have a user ID of 0 (which makes a user a superuser) to log on as anyone else without a password.

Page 626

swapoff

No, swapoff is not a move from Karate Kid. Instead, it is a command that stops swapping to a file or block device.

swapon

Also not from the movie Karate Kid, swapon sets the swap area to the file or block device by path. swapoff stops swapping to the file. This command is normally done during system boot.

tail

tail prints to standard output the last 10 lines of a given file. If no file is given, it reads from standard input. If more than one file is given, it prints a header consisting of the file's name enclosed in a left and right arrow (==> <==) before the output of each file. The default value of 10 lines can be changed by placing a -### in the command. The syntax for the command is


tail [-<# of lines to see>]

[<filename(s)>]

talk

The talk command is used to have a "visual" discussion with someone else over a terminal. The basic idea behind this visual discussion is that your input is copied to the other person's terminal, and the other person's input is copied to your terminal. Thus, both people involved in the discussion see the input for both themselves and the other person.

tar

tar is an archiving program designed to store and extract files from an archive file. This tarred file (called a tar file), can be archived to any media including a tape drive and a hard drive. The syntax of a tar command is tar <action> <optional functions> <file(s)/directory(ies)>. If the last parameter is a directory, all subdirectories under the directory are also tarred.

umount

Just as the cavalry unmounts from their horses, filesystems unmount from their locations as well. The umount command is used to perform this action. The syntax of the command is


umount <filesystem>

unalias

unalias is the command to undo an alias. In the alias command section, earlier in this appendix, I aliased dir to be the ls command. To unalias this command, you would simply type


unalias dir.

Page 627

unzip

The unzip command will list, test, or extract files from a zipped archive. The default is to extract files from the archive. The basic syntax is unzip <filename>.

wall

wall displays the contents of standard input on all terminals of all currently logged in users. Basically, the command writes to all terminals, hence its name. The contents of files can also be displayed. The superuser, or root, can write to the terminals of those who have chosen to deny messages or are using a program that automatically denies messages.

who

Either the who command calls an owl, which it doesn't, or it prints the login name, terminal type, login time, and remote hostname of each user currently logged on. The following is an example of the who command:


svr01:/home/dpitts$ who

root     ttyp0    Jul 27 11:44 (www01.mk.net)

dpitts   ttyp2    Jul 27 19:32 (d12.dialup.seane)

ehooban  ttyp3    Jul 27 11:47 (205.177.146.78)

dpitts   ttyp4    Jul 27 19:34 (d12.dialup.seane)

If two nonoption arguments are passed to the who command, the command prints the entry for the user running it. Typically, this is run with the command who am I, but any two arguments will work; for example, the following gives information on my session:


svr01:/home/dpitts$ who who who

svr01!dpitts   ttyp2    Jul 27 19:32 (d12.dialup.seane)

The -u option is nice if you want to see how long it has been since that session has been used, such as in the following:


svr01:/home/dpitts$ who -u

root     ttyp0    Jul 27 11:44 08:07 (www01.mk.net)

dpitts   ttyp2    Jul 27 19:32   .   (d12.dialup.seane)

ehooban  ttyp3    Jul 27 11:47 00:09 (205.177.146.78)

dpitts   ttyp4    Jul 27 19:34 00:06 (d12.dialup.seane)

xhost +

The xhost + command allows xterms to be displayed on a system. Probably the most common reason that a remote terminal cannot be opened is because the xhost + command has not been run. To turn off the capability to allow xterms, the xhost - command is used.

xmkmf

The xmkmf command is used to create the Imakefiles for X sources. It actually runs the imake command with a set of arguments.

Page 628

xset

The xset command sets some of the options in an X Window session. You can use this option to set your bell (xset b <volume> <frequency> <duration in milliseconds>), your mouse speed (xset m <acceleration> <threshold>), and many others.

zip

The zip command will list, test, or add files to a zipped archive. The default is to add files to an archive.

Summary

If you read this entire appendix, you will have noticed two things. First, I cannot count. There are about seventy commands here, not fifty as the title of the appendix states. Second, you have way too much time on your hands, and need to go out and program some drivers or something!

I hope this appendix has helped you gain an understanding of some of the commands available for your use, whether you are a user, a system administrator, or just someone who wants to learn more about Red Hat Linux. I encourage you to use the man pages to find out the many details left out of this appendix. Most of the commands have arguments that can be passed to them, and, although this appendix attempts to point out a few of them, it would have taken an entire book just to go into the detail that has been provided in the man pages.

Table of Contents