home | O'Reilly's CD bookshelfs | FreeBSD | Linux | Cisco | Cisco Exam  


Linux in a NutshellLinux in a NutshellSearch this book

Chapter 3. Linux Commands

This chapter presents the Linux user, programmer, and system administration commands. These are entered into a shell at the console or on a virtual terminal on a graphical desktop.

Each entry is labeled with the command name on the outer edge of the page. The syntax line is followed by a brief description and a list of available options. Many commands come with examples at the end of the entry. If you need only a quick reminder or suggestion about a command, you can skip directly to the examples.

Typographic conventions for describing command syntax are listed in the Preface. For help in locating commands, see the index at the back of this book.

We've tried to be as thorough as possible in listing options. The basic command information and most options should be correct; however, there are many Linux distributions and many versions of commands. New options are added and sometimes old options are dropped. You may, therefore, find some differences between the options you find described here and the ones on your system. When there seems to be a discrepancy, check the manpage. For most commands you can also use the option --help to get a brief usage message. (Even when it isn't a valid option, it will usually result in an "invalid option" error along with the usage message.)

Traditionally, commands take single-letter options preceded by a single hyphen, like -d. A more recent convention allows long options preceded by two hyphens, like --debug. Often, a feature can be invoked through either the old style or the new style of options.

3.1. Alphabetical Summary of Commands

agetty

agetty [options] port baudrate [term]

System administration command. The Linux version of getty. Set terminal type, modes, speed, and line discipline. agetty is invoked by init. It is the second process in the series init-getty-login-shell, which ultimately connects a user with the Linux system. agetty reads the user's login name and invokes the login command with the user's name as an argument. While reading the name, agetty attempts to adapt the system to the speed and type of device being used.

You must specify a port, which agetty will search for in the /dev directory. You may use -, in which case agetty reads from standard input. You must also specify baudrate, which may be a comma-separated list of rates through which agetty will step. Optionally, you may specify the term, which is used to override the TERM environment variable.

Options

-f file
Specify the use of file instead of /etc/issue upon connection to terminal. It is overridden by -i.

-h
Specify hardware, not software, flow control.

-H hostname
Write login hostname into the utmp file. By default, no login host is specified.

-I string
Specify string to be sent to tty or modem.

-i
Suppress printing of /etc/issue before printing the login prompt.

-l program
Specify the use of program instead of /bin/login.

-m
Attempt to guess the appropriate baud rate.

-n
Don't prompt for a login name.

-t timeout
Specify that agetty should exit if the open on the line succeeds and there is no response to the login prompt in timeout seconds.

-L
Do not require carrier detect; operate locally only. Use this when connecting terminals.

-w
Wait for carriage return or linefeed before sending login prompt. Use when sending an initialization string.

anacron

anacron [options] [job]

System administration command. Normally started in a system startup file. Execute commands periodically. By default, the anacron command reads a list of jobs from a configuration file, /etc/anacrontab. The file consists of shell variables to use when running commands, followed by a list of tasks to run. Each task specifies how often in days it should be run, a delay in minutes to wait before running the task, a unique job identifier used to store a timestamp, and the shell command to execute. Timestamps for the last run of each task are stored in the /var/spool/anacron file. For each task, anacron compares the stored timestamp against the current time. If the command has not been executed within the specified frequency, the command is run. Upon completion anacron records the new date in the timestamp file. Limit anacron to a specified task by giving its unique job identifier on the command line.

The anacron command is often used to support the cron daemon on systems that are not run continuously.

Options

-d
Run in foreground rather than as a background process. Send messages to standard error.

-f
Run tasks ignoring timestamps.

-h
Print help message, then exit.

-n
Run tasks now, ignoring delay specifications.

-q
Suppress messages to standard error when using the -d option.

-s
Execute tasks serially. Do not start new task until previous task is completed.

-t file
Read tasks from file instead of from /etc/anacrontab.

-u
Update timestamps for tasks, but don't run them.

-V
Print version number, then exit.

apmd

apmd [options]

System administration command. apmd handles events reported by the Advanced Power Management BIOS driver. The driver reports on battery level and requests to enter sleep or suspend mode. apmd will log any reports it gets via syslogd and take steps to make sure that basic sleep and suspend requests are handled gracefully. You can fine-tune the behavior of apmd by specifying an apmd_proxy command to run when it receives an event.

Options

-c n, --check n
Set the number of seconds to wait for an event before rechecking the power level. Default is to wait indefinitely. Setting this causes the battery levels to be checked more frequently.

-P command, --apmd_proxy command
Specify the apmd_proxy command to run when APM driver events are reported. This is generally a shell script. The command will be invoked with parameters indicating what kind of event was received. The parameters are listed in the next section.

-p n, --percentage n
Log information whenever the power changes by n percent. The default is 5. Values greater than 100 will disable logging of power changes.

-V, --version
Print version and exit.

-v, --verbose
Verbose mode; all events are logged.

-W, --wall
Use wall to alert all users of a low battery status.

-w n, --warn n
Log a warning at ALERT level when the battery charge drops below n percent. The default is 10. Negative values disable low battery level warnings.

-q, --quiet
Disable low battery level warnings.

-?, --help
Print help summary and exit.

Parameters

The apmd proxy script will be invoked with the following parameters:

start
Invoked when the daemon starts.

stop
Invoked when the daemon stops.

suspend [ system | user ]
Invoked when a suspend request has been made. The second parameter indicates whether the request was made by the system or by the user.

standby [ system | user ]
Invoked when a standby request has been made. The second parameter indicates whether the request was made by the system or by the user.

resume [ suspend | standby | critical ]
Invoked when the system resumes normal operation. The second parameter indicates the mode the system was in before resuming. critical suspends indicate an emergency shutdown. After a critical suspend the system may be unstable, and you can use the resume command to help you recover from the suspension.

change power
Invoked when system power is changed from AC to battery or from battery to AC.

change battery
Invoked when the APM BIOS driver reports that the battery is low.

change capability
Invoked when the APM BIOS driver reports that some hardware that affects its capability has been added or removed.

ar

ar key [args] [posname] [count] archive [files]

Maintain a group of files that are combined into a file archive. Used most commonly to create and update static library files as used by the link editor (ld). Compiler frontends often call ar automatically. Only one key letter may be used, but each can be combined with additional args (with no separations between). posname is the name of a file in archive. When moving or replacing files, you can specify that they be placed before or after posname.

Keys

d
Delete files from archive.

m
Move files to end of archive.

p
Print files in archive.

q
Append files to archive.

r
Replace files in archive.

t
List the contents of archive or list the named files.

x
Extract contents from archive or only the named files.

Arguments

a
Use with r or m key to place files in the archive after posname.

b
Same as a, but before posname.

c
Create archive silently.

f
Truncate long filenames.

i
Same as b.

l
For backward compatibility; meaningless in Linux.

N
Use count parameter. Where multiple entries with the same name are found, use the count instance.

o
Preserve original timestamps.

P
Use full pathname. Useful for non-POSIX-compliant archives.

s
Force regeneration of archive symbol table (useful after running strip).

S
Do not regenerate symbol table.

u
Use with r to replace only files that have changed since being put in archive.

v
Verbose; print a description of actions taken.

V
Print version number.

Example

Replace mylib.a with object files from the current directory:

ar r mylib.a `ls *.o`
arp

arp [options]

TCP/IP command. Clear, add to, or dump the kernel's Address Resolution Protocol (ARP) cache (/proc/net/arp). ARP is used to translate protocol addresses to hardware interface addresses. Modifying your ARP cache can change which interfaces handle specific requests. ARP cache entries may be marked with the following flags: C (complete), M (permanent), and P (publish). In kernels before 2.2, a published entry was used for creating an ARP proxy, a technique by which one system can act as a gateway to another system on the same subnet. While arp can create a proxy for a single system, subnet proxies are now handled by the arp kernel module. See the Linux 2.4 Advanced Routing HOWTO for details. We have retained the subnet proxy information here for older kernels.

Options

host option arguments may be given as either a hostname or an IP address. When using the -D option, they may also be given as a hardware interface address (e.g., eth0, eth1).

-a [hosts], --display [hosts]
Display entries for hosts or, if none are specified, all entries.

-d host, --delete host
Remove the specified host's entry.

-D, --use-device
Use the hardware address associated with the specified interface. This may be used with -s when creating a proxy entry.

-d host [pub], --delete host [pub]
Remove host's entry. To delete a proxy entry, use the pub argument and specify the interface associated with the proxy using -i.

-f file, --file file
Read entries from file and add them.

-H type, --hw-type type, -t type
Search for type entries when examining the ARP cache. type is usually ether (Ethernet), which is the default, but may be ax25 (AX.25 packet radio), arcnet (ARCnet), pronet (PROnet), or netrom (NET/ROM).

-i interface, --device interface
Select an interface. If you are dumping the ARP cache, this option will cause the command to display only the entries using that interface. When setting entries, this will cause the interface to be associated with that entry. If you do not use this option when setting an entry, the kernel will guess.

-n, --numeric
Display host IP addresses instead of their domain names.

-s host hardware-address [netmask mask] [pub], --set host hardware-address [netmask mask] [pub]
Add a permanent entry for host at hardware-address. A hardware-address for type ether hardware is 6 hexadecimal bytes, colon-separated. The pub argument can be used to set the publish flag, creating a proxy entry. On kernels before 2.2x, you can specify a netmask on behalf of which the current system should handle requests.

-v, --verbose
Verbose mode.

Examples

Display entry for host eris:

arp -a eris

Set a permanent cache entry for host illuminati, whose hardware address you know:

arp -s illuminati 00:05:23:73:e6:cf

Set an ARP proxy for host fnord using the eth0 interface's hardware address:

arp -Ds fnord eth0 pub

Remove the fnord ARP proxy:

arp -i eth0 -d fnord pub
at

at [options] time

Execute commands at a specified time and optional date. The commands are read from standard input or from a file. (See also batch.) End input with EOF. time can be formed either as a numeric hour (with optional minutes and modifiers) or as a keyword. It can contain an optional date, formed as a month and date, a day of the week, or a special keyword (today or tomorrow). An increment can also be specified.

The at command can always be issued by a privileged user. Other users must be listed in the file /etc/at.allow if it exists; otherwise, they must not be listed in /etc/at.deny. If neither file exists, only a privileged user can issue the command.

Options

-c job [job...]
Display the specified jobs on the standard output. This option does not take a time specification.

-d job [job...]
Delete the specified jobs. Same as atrm.

-f file
Read job from file, not from standard input.

-l
Report all jobs that are scheduled for the invoking user. Same as atq.

-m
Mail user when job has completed, regardless of whether output was created.

-q letter
Place job in queue denoted by letter, where letter is any single letter from a-z or A-Z. Default queue is a. (The batch queue defaults to b.) Higher-lettered queues run at a lower priority.

-V
Display the version number.

Time

hh:mm [modifiers]
Hours can have one digit or two (a 24-hour clock is assumed by default); optional minutes can be given as one or two digits; the colon can be omitted if the format is h, hh, or hhmm (e.g., valid times are 5, 5:30, 0530, 19:45). If modifier am or pm is added, time is based on a 12-hour clock. If the keyword zulu is added, times correspond to Greenwich Mean Time.

midnight | noon | teatime | now
Use any one of these keywords in place of a numeric time. teatime translates to 4:00 p.m.; now must be followed by an increment (described in a moment).

Date

month num[, year]
month is one of the 12 months, spelled out or abbreviated to its first three letters; num is the calendar date of the month; year is the four-digit year. If the given month occurs before the current month, at schedules that month next year.

day
One of the seven days of the week, spelled out or abbreviated to its first three letters.

today | tomorrow
Indicate the current day or the next day. If date is omitted, at schedules today when the specified time occurs later than the current time; otherwise, at schedules tomorrow.

Increment

Supply a numeric increment if you want to specify an execution time or day relative to the current time. The number should precede any of the keywords minute, hour, day, week, month, or year (or their plural forms). The keyword next can be used as a synonym of + 1.

Examples

In typical usage, you run at and input commands that you want executed at a particular time, followed by EOF.

$ at 1:00 am tomorrow
at> ./total_up > output
at> mail joe < output
at> <EOT>            Entered by pressing Ctrl-D
job 1 at 2003-03-19 01:00

The two commands could also be placed in a file and submitted as follows:

$ at 1:00 am tomorrow < scriptfile

More examples of syntax follow. Note that the first two commands are equivalent.

$ at 1945 December 9
$ at 7:45pm Dec 9
$ at 3 am Saturday
$ at now + 5 hours
$ at noon next day
bc

bc [options] [files]

bc is a language (and compiler) whose syntax resembles that of C, but with unlimited-precision arithmetic. bc consists of identifiers, keywords, and symbols, which are briefly described in the following entries. Examples are given at the end.

Interactively perform arbitrary-precision arithmetic or convert numbers from one base to another. Input can be taken from files or read from the standard input. To exit, type quit or EOF.

Options

-h, --help
Print help message and exit.

-i, --interactive
Interactive mode.

-l, --mathlib
Make functions from the math library available.

-s, --standard
Ignore all extensions, and process exactly as in POSIX.

-w, --warn
When extensions to POSIX bc are used, print a warning.

-q, --quiet
Do not display welcome message.

-v, --version
Print version number.

Identifiers

An identifier is a series of one or more characters. It must begin with a lowercase letter but may also contain digits and underscores. No uppercase letters are allowed. Identifiers are used as names for variables, arrays, and functions. Variables normally store arbitrary-precision numbers. Within the same program you may name a variable, an array, and a function using the same letter. The following identifiers would not conflict:

x
Variable x.

x[i]
Element i of array x. i can range from 0 to 2047 and can also be an expression.

x(y,z)
Call function x with parameters y and z.

Input-output keywords

ibase, obase, scale, and last store a value. Typing them on a line by themselves displays their current value. You can also change their values through assignment. The letters A-F are treated as digits whose values are 10-15.

ibase = n
Numbers that are input (e.g., typed) are read as base n (default is 10).

obase = n
Numbers that are displayed are in base n (default is 10). Note: once ibase has been changed from 10, use A to restore ibase or obase to decimal.

scale = n
Display computations using n decimal places (default is 0, meaning that results are truncated to integers). scale is normally used only for base-10 computations.

last
Value of last printed number.

Statement keywords

A semicolon or a newline separates one statement from another. Curly braces are needed when grouping multiple statements.

if (rel-expr) {statements} [else {statements}]
Do one or more statements if relational expression rel-expr is true. Otherwise, do nothing, or if else (an extension) is specified, do alternative statements. For example:

if (x=  =y) {i = i + 1} else {i = i - 1}
while (rel-expr) {statements}
Repeat one or more statements while rel-expr is true; for example:

while (i>0) {p = p*n; q = a/b; i = i-1}
for (expr1; rel-expr; expr2) {statements}
Similar to while; for example, to print the first 10 multiples of 5, you could type:

for (i=1; i<=10; i++) i*5

GNU bc does not require three arguments to for. A missing argument 1 or 3 means that those expressions will never be evaluated. A missing argument 2 evaluates to the value 1.

break
Terminate a while or for statement.

print list
GNU extension. It provides an alternate means of output. list consists of a series of comma-separated strings and expressions; print displays these entities in the order of the list. It does not print a newline when it terminates. Expressions are evaluated, printed, and assigned to the special variable last. Strings (which may contain special characters, i.e., characters beginning with \) are simply printed. Special characters can be:

a
Alert or bell

b
Backspace

f
Form feed

n
Newline

r
Carriage return

q
Double quote

t
Tab

\
Backslash

continue
GNU extension. When within a for statement, jump to the next iteration.

halt
GNU extension. Cause the bc processor to quit when executed.

quit
GNU extension. Cause the bc processor to quit whether line is executed or not.

limits
GNU extension. Print the limits enforced by the local version of bc.

Function keywords

define f(args) {
Begin the definition of function f having the arguments args. The arguments are separated by commas. Statements follow on successive lines. End with }.

auto x, y
Set up x and y as variables local to a function definition, initialized to 0 and meaningless outside the function. Must appear first.

return(expr)
Pass the value of expression expr back to the program. Return 0 if (expr) is left off. Used in function definitions.

sqrt(expr)
Compute the square root of expression expr.

length(expr)
Compute how many significant digits are in expr.

scale(expr)
Same as length, but count only digits to the right of the decimal point.

read( )
GNU extension. Read a number from standard input. Return value is the number read, converted via the value of ibase.

Math library functions

These are available when bc is invoked with -l. Library functions set scale to 20.

s(angle)
Compute the sine of angle, a constant or expression in radians.

c(angle)
Compute the cosine of angle, a constant or expression in radians.

a(n)
Compute the arctangent of n, returning an angle in radians.

e(expr)
Compute e to the power of expr.

l(expr)
Compute the natural log of expr.

j(n, x)
Compute the Bessel function of integer order n.

Operators

These consist of operators and other symbols. Operators can be arithmetic, unary, assignment, or relational:

arithmetic
+ - * / % ^

unary
- ++ --

assignment
=+ =- =* =/ =% =^ =

relational
< <= > >= = = !=

Other symbols

/* */
Enclose comments.

( )
Control the evaluation of expressions (change precedence). Can also be used around assignment statements to force the result to print.

{ }
Use to group statements.

[ ]
Indicate array index.

"text"
Use as a statement to print text.

Examples

Note in these examples that when you type some quantity (a number or expression), it is evaluated and printed, but assignment statements produce no display.

ibase = 8       Octal input
20              Evaluate this octal number
16              Terminal displays decimal value
obase = 2       Display output in base 2 instead of base 10
20              Octal input
10000           Terminal now displays binary value
ibase = A       Restore base-10 input
scale = 3       Truncate results to 3 decimal places
8/7             Evaluate a division
1.001001000     Oops!  Forgot to reset output base to 10
obase=10        Input is decimal now, so A isn't needed
8/7
1.142           Terminal displays result (truncated)

The following lines show the use of functions:

define p(r,n){  Function p uses two arguments
auto v          v is a local variable
v = r^n         r raised to the n power
return(v)}      Value returned

scale=5
x=p(2.5,2)      x = 2.5 ^ 2
x               Print value of x
6.25
length(x)       Number of digits
3
scale(x)        Number of places right of decimal point
2
bootpd

bootpd [options] [configfile [dumpfile]]

TCP/IP command. Internet Boot Protocol server. bootpd normally is run by /etc/inetd by including the following line in the file /etc/inetd.conf:

bootps dgram udp wait root /etc/bootpd bootpd

This causes bootpd to be started only when a boot request arrives. It may also be started in standalone mode, from the command line. Upon startup, bootpd first reads its configuration file, /etc/bootptab (or the configfile listed on the command line), then begins listening for BOOTREQUEST packets.

bootpd looks in /etc/services to find the port numbers it should use. Two entries are extracted: bootps (the bootp server listening port) and bootpc (the destination port used to reply to clients).

If bootpd is compiled with the -DDEBUG option, receipt of a SIGUSR1 signal causes it to dump its memory-resident database to the file /etc/bootpd.dump or the dumpfile specified on the command line.

Options

-c directory
Force bootpd to work in directory.

-d level
Specify the debugging level. Omitting level will increment the level by 1.

-t timeout
Specify a timeout value in minutes. A timeout value of 0 means wait forever.

Configuration file

The bootpd configuration file has a format in which two-character, case-sensitive tag symbols are used to represent host parameters. These parameter declarations are separated by colons. The general format is:

hostname:tg=value:tg=value:tg=value

where hostname is the name of a bootp client and tg is a tag symbol. The currently recognized tags are listed in the following section.

Tags

Tag

Meaning

bf

Bootfile

bs

Bootfile size in 512-octet blocks

cs

Cookie server address list

ds

Domain name server address list

gw

Gateway address list

ha

Host hardware address

hd

Bootfile home directory

hn

Send hostname

ht

Host hardware type (see Assigned Numbers RFC)

im

Impress server address list

ip

Host IP address

lg

Log server address list

lp

lpr server address list

ns

IEN-116 name server address list

rl

Resource location protocol server address list

sm

Host subnet mask

tc

Table continuation

to

Time offset in seconds from UTC

ts

Time server address list

vm

Vendor magic cookie selector

There is also a generic tag, Tn, where n is an RFC 1048 vendor field tag number. Generic data may be represented as either a stream of hexadecimal numbers or as a quoted string of ASCII characters.

bzip2

bzip2 [options] filenames
bunzip2 [options] filenames
bzcat [option] filenames
bzip2recover filenames

File compression and decompression utility similar to gzip, but uses a different algorithm and encoding method to get better compression. bzip2 replaces each file in filenames with a compressed version of the file and with a .bz2 extension appended. bunzip2 decompresses each file compressed by bzip2 (ignoring other files, except to print a warning). bzcat decompresses all specified files to standard output, and bzip2recover is used to try to recover data from damaged files.

Additional related commands include bzcmp, which compares the contents of bzipped files; bzdiff, which creates diff (difference) files from a pair of bzip files; bzgrep, to search them; and the bzless and bzmore commands, which apply the more and less commands to bzip output as bzcat does with the cat command. See cat, cmp, diff, and grep for information on how to use those commands.

Options

--
End of options; treat all subsequent arguments as filenames.

-dig
Set block size to dig × 100KB when compressing, where dig is a single digit from 1 to 9.

-c, --stdout
Compress or decompress to standard output.

-d, --decompress
Force decompression.

-f, --force
Force overwrite of output files. Default is not to overwrite. Also forces breaking of hard links to files.

-k, --keep
Keep input files; don't delete them.

-L, --license, -V, --version
Print license and version information and exit.

-q, --quiet
Print only critical messages.

-s, --small
Use less memory, at the expense of speed.

-t, --test
Check the integrity of the files, but don't actually compress them.

-v, --verbose
Verbose mode. Show the compression ratio for each file processed. Add more -v's to increase the verbosity.

-z, --compress
Force compression, even if invoked as bunzip2 or bzcat.

--repetitive-fast, --repetitive-best
Sometimes useful in versions earlier than 0.9.5 (which has an improved sorting algorithm) for providing some control over the algorithm.

cdda2wav

cdda2wav [options] [output.wav]

Convert Compact Disc Digital Audio (CDDA) to the WAV format. This process is often called "ripping" a CD-ROM, and is generally performed before using an encoder to convert the file to a compressed music format such as OGG or MP3. By default, cdda2wav reads data from the /dev/cdrom device and outputs one WAV file per track.

Options

Some of the following options use sectors as a unit of measurement. Each sector of data on a CD represents approximately 1/75 second of play time.

-D, --device devicename
Specify the device. The device must work with the -i (--interface) settings.

-A , --auxdevice drivename
Specify a different drive for ioctl purposes.

-I, --interface ifname
Specify the type of interface. For Linux systems, the most appropriate value is usually cooked_ioctl.

-s, --stereo
Record in stereo. Use -m (--mono) to record in mono.

-x, --max
Set recording quality (and amount of hard disk usage) to maximum.

-b, --bits-per-sample n
Set the quality of samples to n bits per sample per channel. Possible values are 8, 12, and 16.

-r, --rate n
Set the sample rate in samples per second. To get a list of possible values, use the -R option.

-R, --dump-rates
Output a list of possible sample rates and dividers. This option is typically used alone.

-P, --set-overlap n
Use n sectors of overlap for jitter correction.

-n, --sectors-per-request n
Read n sectors in each request.

-t, --track tracknumber
Set start track and, optionally, end track. Separate the tracks with the + character.

-i, --index n
Set the start index to n when recording.

-o, --offset n
Start recording n sectors before the beginning of the first track.

-O, --output-format
Choose the output file format. Normal file options are wav, aiff, aifc, au, and sun. You can also use cdr and raw for headerless files dumped into recording devices.

-d, --duration
Set to a number followed by f for frames (sectors) or s for seconds. Set time to zero to record an entire track. For example, to copy two minutes, enter 120s.

-B, --bulk
Copy each track into its own file.

-w, --wait
Wait for a signal before recording anything.

-e, --echo
Copy audio data to a sound device rather than to a file.

-p, --set-pitch n
Adjust the pitch by n percent when copying data to an audio device.

-S, --speed-select n
Specify the speed at which your system will read the CD-ROM. Set the value to the multiple of normal playback speed given as your CD-ROM drive speed (4, 16, 32, and so forth). Setting the speed lower than the maximum can prevent errors in some cases.

-q, --quiet
Quiet mode; the program will not send any data to the screen.

-J, --version
Display version and quit.

Examples

For most systems, you should be able to copy a complete CD to a single WAV file with the following command:

cdda2wav

To copy a complete CD to a set of WAV files, one per track:

cdda2wav -B
cdparanoia

cdparanoia [options] span [outfile]

Like cdda2wav, cdparanoia records Compact Disc audio files as WAV, AIFF, AIFF-C, or raw format files. It uses additional data-verification and sound-improvement algorithms to make the process more reliable, and is used by a number of graphical recording programs as a backend.

Options

-v, --verbose
Verbose mode.

-q, --quiet
Quiet mode.

-e, --stderr-progress
Send all progress messages to stderr instead of stdout; used by wrapper scripts.

-V, --version
Print version information and quit.

-Q, --query
Display CD-ROM table of contents and quit.

-s, --search-for-drive
Search for a drive, even if /dev/cdrom exists.

-h, --help
Display options and syntax.

-p, --output-raw
Output headerless raw data.

-r, --output-raw-little-endian
Output raw data in little-endian byte order.

-R, --output-raw-big-endian
Output raw data in big-endian byte order.

-w, --output-wav
Output in WAV format. This is the default.

-f, --output-aiff
Output in AIFF format.

-a, --output-aifc
Output in AIFF-C format.

-c, --force-cdrom-little-endian
Force cdparanoia to treat the drive as a little-endian device.

-C, --force-cdrom-big-endian
Force cdparanoia to treat the drive as a big-endian device.

-d, --force-cdrom-device devicename
Specify a device name to use instead of the first readable CD-ROM available.

-S, --force-read-speed n
Set the read speed to n on drives that support it. This is useful if you have a slow drive or are low on memory.

-Z, --disable-paranoia
Disable data verification and correction. Causes cdparanoia to behave exactly as cdda2wav would.

-z, --never-skip[=retries]
If a read fails (for example, due to a scratch in the disc), try again and again. If you specify a number, cdparanoia will try that number of times. If you do not, cdparanoia will retry until it succeeds.

-Y, --disable-extra-paranoia
Use data verification and correction only at read boundaries. Not recommended.

-X, --abort-on-skip
If a read fails and must be skipped, skip the entire track and delete any partially completed output file.

Progress symbols

The output during operation cdparanoia includes both smiley faces and more standard progress symbols. They are:

:-)
Operation proceeding normally.

:-|
Operation proceeding normally, but with jitter during reads.

:-/
Read drift.

8-|
Repeated read problems in the same place.

:-O
SCSI/ATAPI transport error (hardware problem not related to the disc itself).

:-(
Scratch detected.

;-(
Unable to correct problem.

8-X
Unknown and uncorrectable error.

:^D
Finished.

Blank space in the progress indicator means that no corrections were necessary.

-
Jitter correction was required.

+
Read errors.

!
Errors even after correction; repeated read errors.

e
Corrected transport errors.

V
An uncorrected error or a skipped read.

The span argument

The cdparanoia command takes exactly one argument, which describes how much of the CD to record. It uses numbers followed by bracketed times to designate track numbers and time within them. For example, the string 1[2:23]-2[5] indicates a recording from the two-minute and twenty-three-second mark of the first track up to the fifth second of the second track. The time format is demarcated by colons, hours:minutes:seconds:.sectors, with the last item, sectors, preceded by a decimal point (a sector is 1/75 of a second). It's best to put this argument within quotes.

If you use the -B option, the span argument is not required.

cdrdao

cdrdao command [options] toc-file

Write all content specified in description file toc-file to a CD-R disk drive in one step. This is called disk-at-once (DAO) mode, as opposed to the more commonly used track-at-once (TAO) mode. DAO mode allows you to change the length of gaps between tracks and define data to be written in these gaps (like hidden bonus tracks or track intros). The toc file can be created by hand or generated from an existing CD using cdrdao's read-toc command. A cue file, as generated by other audio programs, can be used instead of a toc file. The file format for toc files is discussed at length in the cdrdao manpage.

Commands

The first argument must be a command. Note that not all options are available for all commands.

show-toc
Print a summary of the CD to be created.

read-toc
Read from a CD and create a disk image and toc file that will allow creation of duplicates.

read-cddb
Check a CDDB server for data about the CD represented by a given toc file, then write that data to the toc file as CD-TEXT data.

show-data
Print out the data that will be written to the CD-R. Useful for checking byte order.

read-test
Check the validity of the audio files described in the toc file.

disk-info
Display information about the CD-R currently in the drive.

msinfo
Display multisession information. Useful mostly for wrapper scripts.

scanbus
Scan the system bus for devices.

simulate
A dry run: do everything except write the CD.

unlock
Unlock the recorder after a failure. Run this command if you cannot eject the CD after using cdrdao.

write
Write the CD.

copy
Copy the CD. If you use a single drive, you will be prompted to insert the CD-R after reading. An image file will be created unless you use the --on-the-fly flag and two CD drives.

Options

--device bus,id,logicalunit
Set the SCSI address of the CD-R using the bus number, ID number, and logical unit number.

--source-device bus,id,logicalunit
Used only with the copy command. Set the SCSI address of the source device.

--driver driver-id:option-flags
Force cdrdao to use the driver you choose with the driver options named, instead of the driver it autodetects.

--source-driver driver-id:option-flags
Used only with the copy command. Set the source device driver and flags.

speed value
Set the write speed to value. The default is the highest available; use a lower value if higher values give poor results.

--datafile filename
When used with the read-toc command, specifies the data file placed in the toc file. When used with read-cd and copy, specifies the name of the image file created.

read-raw
Used only with the read-cd command. Write raw data to the image file.

--buffers n
Set the number of seconds of data to be buffered. Default is 32; set to a higher number if your read source is unreliable or is slower than the CD-R.

--multi
Record as a multisession disc.

--overburn
If you are using a disc with more storage space than cdrdao detects, use this option to keep writing even when cdrdao thinks you're out of space.

--eject
Eject the disc when done.

--swap
Swap byte order for all samples.

--session n
Used only with the read-toc and read-cd commands when working with multisession CDs. Specifies the number of the session to be processed.

--reload
Allow the drive to be opened before writing without interrupting the process. Used with simulation runs.

--force
Override warnings and perform the action anyway.

--paranoia-mode n
Specifies n, from 0 to 3, for the amount of error correction in the CD read. 0 is none, 3 is full (see cdparanoia for information about error correction). Set error correction to a lower number to increase read speed. The default is 3.

--keepimage
Used only with the copy command. Keeps the image file created during the copy process.

--on-the-fly
Do not create an image file: pipe data directly from source to CD-R.

--with-cddb
Use CDDB to fetch information about the disc and save it as CD-TEXT data. Used with the copy, read-toc, and read-cd commands.

cddb-servers server,server
Enter hosts for servers. Servers may include ports, paths, and proxies; you can list multiple servers separated by spaces or commas.

--cddb-timeout s
Set the timeout for CDDB server connections to s seconds.

--cddb-directory localpath
CDDB data that is fetched will be saved in the directory localpath.

--save
Save current options to the settings file $HOME/.cdrdao.

-n
Do not wait 10 seconds before writing the disc.

-v verbose-level
Set the amount of information printed to the screen. 0, 1, and 2 are fine for most users; greater numbers are useful for debugging.

cdrecord

cdrecord [general-options] dev=device [track-options] 
track1,track2...

Record data or audio compact discs. This program normally requires root access, and has a large number of options and settings. A number of useful examples can be found in the manpage, which is quite extensive.

General options

General option flags go directly after the cdrecord command. Options affecting the track arguments are placed after the device argument and before the track arguments themselves. The general options are:

--version
Print version information and exit.

-v
Verbose mode. Use one v for each level of verbosity: -vv would be very verbose, and -vvv would be even more so.

-V
As with the -v, a verbose mode counter. However, this applies only to SCSI transport messages. This will slow down the application.

--debug=n, -d
Set the debug level to an integer (greater numbers are more verbose), or use multiple -d flags as with the -v and -V flags.

--kdebug=n, --kd=n
Set the kernel's debug notification value to n during SCSI command execution. Works through the scg-driver.

-s, --silent
Silent mode. Do not print any SCSI error commands.

--force
Override errors if possible. May allow you to blank an otherwise broken CD-RW.

--dummy
Perform a dry run, doing all the steps of recording with the laser turned off. This will let you know whether the process is going to work.

--dao
Disk-at-once mode. Works only with MMC drives that support non-raw session-at-once modes.

--multi
Set to record in multisession mode. Must be present on all sessions but the last one for a multisession disc.

--msinfo
Get multisession information from the CD. Used only with multisession discs onto which you can still record more sessions.

--toc
Display the table of contents for the CD currently in the drive. Works for CD-ROM as well as CD-R and CD-RW drives.

--atip
Display the ATIP (Absolute Time In Pregroove) information for a disc. Only some drives allow you to read this information.

--fix
Close ("fixate") the session, preventing future multisession recordings and allowing the disc to be played in standard audio CD players (some can also play a disc that has not been closed).

--nofix
Do not close the disc after writing.

--load
Load media and exit. Works with tray-loading mechanisms only.

--eject
Eject disc after recording. Some hardware may need to eject a disc after a dummy recording and before the actual recording.

--speed=n
Set the speed to n, a multiple of the audio speed. Normally, cdrecord will get this from the CDR_SPEED environment variable. If your drive has trouble with higher numbers, try 0 as a value.

blank=type
Erase data from a CD-RW in one of the following ways:

help
Display a possible list of blanking methods.

all
Erase all information on the disc. May take a long time.

fast
Perform a quick erase of the disc, erasing only the PMA, TOC, and pregap.

track
Blank a track.

unreserve
Unreserve a track previously marked as reserved.

trtail
Blank the tail of a track only.

unclose
Unclose the last session.

session
Blank the last session.

fs=n
Set the fifo buffer size to n, in bytes. You may use k, m, s, or f to specify kilobytes, megabytes, or units of 2048 and 2352 bytes, respectively. The default is 4MB.

timeout=n
Set the timeout to n seconds. Defaults to 40.

driver=name
Lets you specify a driver for your system. Suggested for experts only. The special drivers cdr_simul and dvd_simul are used for simulation and profiling tests.

driveropts=optlist
Specify a comma-separated list of driver options. To get a list of valid options, use driveropts=help and --checkdrive.

--checkdrive
Check to see if there are valid drivers for the current drive. Returns 0 if the drive is valid.

--scanbus
Scan SCSI devices.

--reset
Attempt to reset the SCSI bus. Does not work on all systems.

--useinfo
Use .inf files to override audio options set elsewhere.

mcn=n
Set the Media Catalog Number to n.

The device argument

The device argument should be specified not as a file but as three integers representing the bus, target, and logical unit, as in the cdrdao command. To check the available options, use the --scanbus option.

Track options and arguments

Track options may be mixed with track arguments, and normally apply to the track immediately after them or to all tracks after them. The track arguments themselves should be the files that you will be writing to the CD. Options are:

isrc=n
Set the International Standard Recording Number for the track following this argument.

index=a,b,c
Set the index list for the next track. The values should be increasing comma-separated integers, starting with index 1 and counting in sectors (75ths of a second). For example, you could set three indices in a track with index=0,750,7500 and they would occur at the beginning of the track, after 10 seconds, and after 100 seconds.

--audio
Write all tracks after this track in digital audio format (playable by standard CD players). If you do not use this flag or the --data flag, cdrecord will assume that .au and .wav files are to be recorded as raw audio and that all other files are data.

--swab
Declare that your data is in byte-swapped (little-endian) byte order. This is not normally necessary.

--data
Record subsequent tracks as CD-ROM data. If you do not use this flag or the --audio flag, all files except for those ending in .wav or .au are assumed to be data.

--mode2
Write all subsequent tracks in CD-ROM mode 2 format.

--xa1, --xa2
Write subsequent tracks in CD-ROM XA mode 1 or CD-ROM XA mode 2 format.

--cdi
Write subsequent tracks in CDI format.

--isosize
The size of the next track should match the size of the ISO-9660 filesystem. This is used when duplicating CDs or copying from raw-data filesystems.

--pad
Insert 15 sectors of blank data padding between data tracks. Applies to all subsequent tracks or until you use the --nopad argument, and is overridden by the padsize=n argument.

padsize=n
Insert n sectors of blank data padding after the next track. Applies only to the track immediately after it.

--nopad
Do not insert blank data between data tracks following this flag. This is the default behavior.

tsize=n
Set the size of the next track. Useful only if you are recording from a raw disk for which cdrecord cannot determine the file size. If you are recording from an ISO 9660 filesystem, use the --isosize flag instead.

chat

chat [options] [script]

System administration command. Set up or initiate dial-up Internet connections; often used in conjunction with pppd, the PPP daemon. On some systems, chat takes the place of the dip program. A chat script is composed of a simple but expressive syntax of paired expect and send strings and sometimes substrings. A script string may contain either text expected from the modem or text to be sent, a chat directive, a substitution character, or a mixture of all three. When reading from a file, lines beginning with # are treated as comments.

Options

-e
Start script with the ECHO directive turned on.

-E
Allow script to read environment variables by using shell $VARIABLE syntax.

-f file
Read chat script from file instead of standard input.

-r file
Send the output of the REPORT directive to file. By default, they are sent to standard error.

-s
Send all error and log information to standard error, even when using the -v option.

-S
Silent mode; send neither error nor log messages to syslogd.

-t n
Set the default timeout value to n seconds. When not specified, the default timeout value is 45 seconds.

-T string
Set the string to be used instead of the \T substitution character. This is usually a phone number.

-U string
Set the string to be used instead of the \U substitution character. This is usually a second phone number.

-v
Verbose mode; log the chat script state and text sent to and received from the modem to syslogd.

-V
Standard error verbose mode; identical to -v, but send information to standard error instead of syslogd.

Chat directives

Scripts are built from paired strings, an expect string and a send string. A null string formed with two single quotes, '', tells chat to expect nothing and just send the send string. A hyphen, -, may be used in an expect string to specify an alternate expect and send in the event the first expect fails. chat will wait, expecting the first part of the string, and if it fails to receive it, it will perform the second part of the string, often a directive. For example:

ogin:-BREAK-ogin:

is interpreted by chat to mean expect the string "ogin:"; if it is not received before the timeout period, send a break signal to the modem, then expect "ogin:" again.

BREAK is an example of a chat directive, which is a special keyword that directs chat to take some action. Most directives are meant for use as expect strings. Some are meant to be special reply strings. BREAK can be used as a reply, or, as the above example shows, can be inserted into an expect substring. The following chat directives are recognized by chat:

ABORT string
If the modem returns the specified string, abort the script. This is often used to capture a modem status sent as a string, such as BUSY or NO CARRIER.

BREAK string
Reply string. Send a break signal to the modem. If the modem returns the specified string, abort the script. This is often used to capture a modem status sent as a string, such as BUSY or NO CARRIER.

CLR_ABORT string
Clear an ABORT string from memory.

CLR_ABORT string
Clear a REPORT string from memory.

ECHO status
Set ECHO to status ON or OFF. When on, chat will echo output from the modem to standard error.

EOT
Reply string. EOT is used as a send string. It instructs chat to send an end-of-file character. This can also be embedded in a string using the character sequence ^D.

REPORT string
When the script receives string, write it and any characters following it to standard error.

HANGUP status
Set HANGUP to status ON or OFF. When on, chat will treat a modem hanging up as an error. When off, it will continue to process the script. You usually want to set this to on after the modem has connected.

SAY string
Print the string to the standard error. This can be used to communicate with the script's user.

TIMEOUT n
Set the timeout value for subsequent expect strings to n seconds.

Substitution characters

''
The null string. When used in place of a send string, chat sends a return character. When used in an expect string, chat expects nothing and just sends the send string.

\b
Backspace character.

\c
Used at the end of a string. Suppresses the newline character automatically added to send strings. Not valid in expect strings.

\d
Pause one second. Not valid in expect strings.

\n
The newline character.

\N, \0
The null character.

\p
Pause one tenth of a second. Not valid in expect strings.

\xd5
Mask this string. Write the string ?????? instead when writing to the system log. Not valid in expect strings.

\r
The carriage return character.

\t
The tab character.

\T
The string specified with the -T option, usually a phone number. Not valid in expect strings.

\U
The string specified with the -U option, usually a second phone number. Not valid in expect strings.

\\
The backslash character.

\ddd
An ASCII character expressed in octal. Not valid in expect strings.

^char
Substitute a control character for char.

@file
Substitute the contents of file. Not valid in expect strings.

$NAME
When using the -E option, substitute the value of the specified environment variable NAME, or substitute nothing if the variable is not set.

Exit codes

0
Script terminated normally.

1
Invalid parameter or expect string. Script failed.

2
Error during execution. Script failed.

3
Expect string timeout with no further instructions. Script halted.

4 and up
Script exited on an ABORT condition. The exit code indicates the abort string--4 is the first, 5 the second, and so on.

chattr

chattr [options] mode files

Modify file attributes. Specific to Linux Second and Third Extended Filesystem (ext2 and ext3). Behaves similarly to symbolic chmod, using +, -, and =. mode is in the form opcode attribute. See also lsattr.

Options

-R
Modify directories and their contents recursively.

-V
Print modes of attributes after changing them.

-v version
Set the file's version.

Opcodes

+
Add attribute.

-
Remove attribute.

=
Assign attributes (removing unspecified attributes).

Attributes

A
Don't update access time on modify.

a
Append only for writing. Can be set or cleared only by a privileged user.

c
Compressed.

d
No dump.

i
Immutable. Can be set or cleared only by a privileged user.

j
Journalled file. This is useful only in cases where you are using an ext3 filesystem mounted with the data="ordered" or data="writeback" attributes. The data="journalled" option for the filesystem causes this operation to be performed for all files in the system and makes this option irrelevant.

S
Synchronous updates.

s
Secure deletion. The contents are zeroed on deletion, and the file cannot be undeleted or recovered in any way.

u
Undeletable. This causes a file to be saved even after it has been deleted, so that a user can undelete it later.

Example

chattr +a myfile     As superuser
chmod

chmod [options] mode files
chmod [options] --reference=filename files

Change the access mode (permissions) of one or more files. Only the owner of a file or a privileged user may change the mode. mode can be numeric or an expression in the form of who opcode permission. who is optional (if omitted, default is a); choose only one opcode. Multiple modes are separated by commas.

Options

-c, --changes
Print information about files that are changed.

-f, --silent, --quiet
Do not notify user of files that chmod cannot change.

--help
Print help message and then exit.

-R, --recursive
Traverse subdirectories recursively, applying changes.

--reference=filename
Change permissions to match those associated with filename.

-v, --verbose
Print information about each file, whether changed or not.

--version
Print version information and then exit.

Who

u
User.

g
Group.

o
Other.

a
All (default).

Opcode

+
Add permission.

-
Remove permission.

=
Assign permission (and remove permission of the unspecified fields).

Permissions

r
Read.

w
Write.

x
Execute.

s
Set user (or group) ID.

t
Sticky bit; used on directories to prevent removal of files by non-owners.

u
User's present permission.

g
Group's present permission.

o
Other's present permission.

Alternatively, specify permissions by a three-digit octal number. The first digit designates owner permission; the second, group permission; and the third, other's permission. Permissions are calculated by adding the following octal values:

4
Read.

2
Write.

1
Execute.

Note that a fourth digit may precede this sequence. This digit assigns the following modes:

4
Set user ID on execution to grant permissions to process based on the file's owner, not on permissions of the user who created the process.

2
Set group ID on execution to grant permissions to process based on the file's group, not on permissions of the user who created the process.

1
Set sticky bit.

Examples

Add execute-by-user permission to file:

chmod u+x file

Either of the following will assign read/write/execute permission by owner (7), read/execute permission by group (5), and execute-only permission by others (1) to file:

chmod 751 file
chmod u=rwx,g=rx,o=x file

Any one of the following will assign read-only permission to file for everyone:

chmod =r file
chmod 444 file
chmod a-wx,a+r file

The following makes the executable setuid, assigns read/write/execute permission by owner, and assigns read/execute permission by group and others:

chmod 4755 file
colrm

colrm [start [stop]]

Remove specified columns from a file, where a column is a single character in a line. Read from standard input and write to standard output. Columns are numbered starting with 1; begin deleting columns at (including) the start column, and stop at (including) the stop column. Entering a tab increments the column count to the next multiple of either the start or stop column; entering a backspace decrements it by 1.

Example

colrm 3 5 < test1 > test2
cp

cp [options] file1 file2
cp [options] files directory

Copy file1 to file2, or copy one or more files to the same names under directory. If the destination is an existing file, the file is overwritten; if the destination is an existing directory, the file is copied into the directory (the directory is not overwritten).

Options

-a, --archive
Preserve attributes of original files where possible. The same as -dpR.

-b, --backup
Back up files that would otherwise be overwritten.

-d, --no-dereference
Do not dereference symbolic links; preserve hard link relationships between source and copy.

-f, --force
Remove existing files in the destination.

-i, --interactive
Prompt before overwriting destination files.

-l, --link
Make hard links, not copies, of nondirectories.

-p, --preserve
Preserve all information, including owner, group, permissions, and timestamps.

-P, --parents
Preserve intermediate directories in source. The last argument must be the name of an existing directory. For example, the command:

cp --parents jphekman/book/ch1 newdir

copies the file jphekman/book/ch1 to the file newdir/jphekman/book/ch1, creating intermediate directories as necessary.

-r, -R, --recursive
Copy directories recursively.

-S backup-suffix, --suffix=backup-suffix
Set suffix to be appended to backup files. This may also be set with the SIMPLE_BACKUP_SUFFIX environment variable. The default is ~. You need to explicitly include a period if you want one before the suffix (for example, specify .bak, not bak).

-s, --symbolic-link
Make symbolic links instead of copying. Source filenames must be absolute.

-u, --update
Do not copy a file to an existing destination with the same or newer modification time.

-v, --verbose
Before copying, print the name of each file.

-V type, --version-control=type
Set the type of backups made. You may also use the VERSION_CONTROL environment variable. The default is existing. Valid arguments are:

t, numbered
Always make numbered backups.

nil, existing
Make numbered backups of files that already have them; otherwise, make simple backups.

never, simple
Always make simple backups.

-x, --one-file-system
Ignore subdirectories on other filesystems.

Example

Copy the contents of the guest directory recursively into the archives/guest/ directory, and display a message for each file copied:

cd /archives && cp -av /home/guest guest
cpio

cpio flags [options]

Copy file archives from or to tape or disk, or to another location on the local machine. Each of the three flags -i, -o, or -p accepts different options.

Flags

-i, --extract [options] [patterns]
Copy in (extract) from an archive files whose names match selected patterns. Each pattern can include Bourne shell filename metacharacters. (Patterns should be quoted or escaped so that they are interpreted by cpio, not by the shell.) If pattern is omitted, all files are copied in. Existing files are not overwritten by older versions from the archive unless -u is specified.

-o, --create [options]
Copy out to an archive a list of files whose names are given on the standard input.

-p, --pass-through [options] directory
Copy (pass) files to another directory on the same system. Destination pathnames are interpreted relative to the named directory.

Comparison of valid options

Options available to the -i, -o, and -p flags are shown here (the - is omitted for clarity):

i:   bcdf mnrtsuv B SVCEHMR IF
o: 0a c         vABL VC HM O F
p: 0a  d lm    uv  L V    R

Options

-0, --null
Expect list of filenames to be terminated with null, not newline. This allows files with a newline in their names to be included.

-a, --reset-access-time
Reset access times of input files after reading them.

-A, --append
Append files to an existing archive, which must be a disk file. Specify this archive with -O or -F.

-b, --swap
Swap bytes and half-words to convert between big-endian and little-endian 32-bit integers.

-B
Block input or output using 5120 bytes per record (default is 512 bytes per record).

--blocksize=size
Set input or output blocksize to size × 512 bytes.

-c
Read or write header information as ASCII characters; useful when source and destination machines are different types.

-C n, --io-size=n
Like -B, but blocksize can be any positive integer n.

-d, --make-directories
Create directories as needed.

-E file, --pattern-file=file
Extract from the archives filenames that match patterns in file.

-f, --nonmatching
Reverse the sense of copying; copy all files except those that match patterns.

-F file, --file=file
Use file as the archive, not stdin or stdout. file can reside on another machine, if given in the form user@hostname:file (where user@ is optional).

--force-local
Assume that file (provided by -F, -I, or -O) is a local file, even if it contains a colon (:) indicating a remote file.

-H type, --format=type
Use type format. Default for copy-out is bin; default for copy-in is autodetection of the format. Valid formats (all caps also accepted) are:

bin
Binary.

odc
Old (POSIX.1) portable format.

newc
New (SVR4) portable format.

crc
New (SVR4) portable format with checksum added.

tar
Tar.

ustar
POSIX.1 tar (also recognizes GNU tar archives).

hpbin
HP-UX's binary (obsolete).

hpodc
HP-UX's portable format.

-I file
Read file as an input archive. May be on a remote machine (see -F).

-k
Ignored. For backward compatibility.

-l, --link
Link files instead of copying.

-L, --dereference
Follow symbolic links.

-m, --preserve-modification-time
Retain previous file modification time.

-M msg, --message=msg
Print msg when switching media, as a prompt before switching to new media. Use variable %d in the message as a numeric ID for the next medium. -M is valid only with -I or -O.

-n, --numeric-uid-gid
When verbosely listing contents, show user ID and group ID numerically.

--no-absolute-filenames
Create all copied-in files relative to the current directory.

--no-preserve-owner
Make all copied files owned by yourself, instead of the owner of the original. Can be used only if you are a privileged user.

-O file
Archive the output to file, which may be a file on another machine (see -F).

--only-verify-crc
For a CRC-format archive, verify the CRC of each file; don't actually copy the files in.

--quiet
Don't print the number of blocks copied.

-r
Rename files interactively.

-R [user][:group], --owner [user][:group]
Reassign file ownership and group information to the user's login ID (privileged users only).

-s, --swap-bytes
Swap bytes of each two-byte half-word.

-S, --swap-half-words
Swap half-words of each four-byte word.

--sparse
For copy-out and copy-pass, write files that have large blocks of zeros as sparse files.

-t, --list
Print a table of contents of the input (create no files). When used with the -v option, resembles output of ls -l.

-u, --unconditional
Unconditional copy; old files can overwrite new ones.

-v, --verbose
Print a list of filenames processed.

-V, --dot
Print a dot for each file read or written (this shows cpio at work without cluttering the screen).

--version
Print version number and then exit.

Examples

Generate a list of files whose names end in .old using find; use the list as input to cpio:

find . -name "*.old" -print | cpio -ocBv > /dev/rst8

Restore from a tape drive all files whose names contain save (subdirectories are created if needed):

cpio -icdv "*save*" < /dev/rst8

Move a directory tree:

find . -depth -print | cpio -padm /mydir
cpp

cpp [options] [ ifile [ ofile ] ]

GNU C language preprocessor. cpp is normally invoked as the first pass of any C compilation by the gcc command. The output of cpp is a form acceptable as input to the next pass of the C compiler. The ifile and ofile options are, respectively, the input and output for the preprocessor; they default to standard input and standard output.

Options

-$
Do not allow $ in identifiers.

-ansi
Use 1990 ISO C standard. This is equivalent to -std=c89.

-dD
Similar to -dM, but exclude predefined macros and include results of preprocessing.

-dM
Suppress normal output. Print series of #defines that create the macros used in the source file.

-dN
Similar to -dD, but don't print macro expansions.

-dI
Print #include directives in addition to other output.

-fpreprocessed
Treat file as already preprocessed. Skip most processing directives, remove all comments, and tokenize file.

-ftabstop=width
Set distance between tabstops so columns will be reported correctly in warnings and errors. Default is 8.

-fno-show-column
Omit column numbers in warnings and errors.

-gcc
Define _ _GNUC_ _, _ _GNUC_MINOR_ _, and _ _GNUC_PATCHLEVEL_ _ macros.

--help
Print usage message and exit.

-idirafter dir
Search dir for header files when a header file is not found in any of the included directories.

-imacros file
Process macros in file before processing main files.

-include file
Process file before main file.

-iprefix prefix
When adding directories with -iwithprefix, prepend prefix to the directory's name.

-isystem dir
Search dir for header files after searching directories specified with -I but before searching standard system directories.

-iwithprefix dir
Append dir to the list of directories to be searched when a header file cannot be found in the main include path. If -iprefix has been set, prepend that prefix to the directory's name.

-iwithprefixbefore dir
Insert dir at the beginning of the list of directories to be searched when a header file cannot be found in the main include path. If -iprefix has been set, prepend that prefix to the directory's name.

-lang-c, -lang-c++, -lang-objc, -lang-objc++
Expect the source to be in C, C++, Objective C, or Objective C++, respectively.

-lint
Display all lint commands in comments as #pragma lint command.

-nostdinc
Search only specified, not standard, directories for header files.

-nostdinc++
Suppress searching of directories believed to contain C++-specific header files.

-o file
Write output to file. (Same as specifying a second filename in the command line.)

-pedantic
Warn verbosely.

-pedantic-errors
Produce a fatal error in every case in which -pedantic would have produced a warning.

-std=standard
Specify C standard of input file. Accepted values are:

iso9899:1990, c89
1990 ISO C standard.

iso9899:199409
1994 amendment to the 1990 ISO C standard.

iso9899:1999, c99, iso9899:199x, c9x
1999 revised ISO C standard.

gnu89
1990 C Standard with gnu extensions. The default value.

gnu99, gnu9x
1999 revised ISO C standard with gnu extensions.

-traditional
Behave like traditional C, not ANSI.

-trigraphs
Convert special three-letter sequences, meant to represent missing characters on some terminals, into the single character they represent.

-undef
Suppress definition of all nonstandard macros.

-v
Verbose mode.

-version
Print version number, then process file.

--version
Print version number then exit.

-w
Don't print warnings.

-x language
Specify the language of the input file. language may be c, c++, objective-c, or assembler-with-cpp. By default, language is deduced from the filename extension. If the extension is unrecognized, the default is c.

-A name[=def]
Assert name with value def as if defined by #assert. To turn off standard assertions, use -A-.

-A -name[=def]
Cancel assertion name with value def.

-C
Retain all comments except those found on cpp directive lines. By default, cpp strips C-style comments.

-Dname[=def]
Define name with value def as if by a #define. If no =def is given, name is defined with value 1. -D has lower precedence than -U.

-E
Preprocess the source files, but do not compile. Print result to standard output. This option is usually passed from gcc.

-H
Print pathnames of included files, one per line, on standard error.

-Idir
Search in directory dir for #include files whose names do not begin with / before looking in directories on standard list. #include files whose names are enclosed in double quotes and do not begin with / will be searched for first in the current directory, then in directories named on -I options, and last in directories on the standard list.

-I-
Split includes. Search directories specified by -I options preceding this one for header files included with quotes (#include "file.h") but not for header files included with angle brackets (#include <file.h>). Search directories specified by -I options following this one for all header files.

-M [-MG]
Suppress normal output. Print a rule for make that describes the main source file's dependencies. If -MG is specified, assume that missing header files are actually generated files, and look for them in the source file's directory.

-MF file
Print rules generated by -M or -MM to file.

-MD file
Similar to -M, but output to file; also compile the source.

-MM
Similar to -M, but describe only those files included as a result of #include "file".

-MMD file
Similar to -MD, but describe only the user's header files.

-MQ target
Similar to -MT, but quote any characters that are special to make.

-MT target
Specify the target to use when generating a rule for make. By default the target is based on the name of the main input file.

-P
Preprocess input without producing line-control information used by next pass of the C compiler.

-Uname
Remove any initial definition of name, where name is a reserved symbol predefined by the preprocessor or a name defined on a -D option. Names predefined by cpp are unix and i386 (for Intel systems).

-Wall
Warn both on nested comments and trigraphs.

-Wcomment, -Wcomments
Warn when encountering the beginning of a nested comment.

-Wtraditional
Warn when encountering constructs that are interpreted differently in ANSI than in traditional C.

-Wtrigraph, -Wcomments
Warn when encountering trigraphs, three-letter sequences meant to represent missing characters on some terminals.

Special names

cpp understands various special names, some of which are:

_ _DATE_ _
Current date (e.g., Jan 10 2003).

_ _FILE_ _
Current filename (as a C string).

_ _LINE_ _
Current source line number (as a decimal integer).

_ _TIME_ _
Current time (e.g., 12:00:00).

These special names can be used anywhere, including in macros, just like any other defined names. cpp's understanding of the line number and filename may be changed using a #line directive.

Directives

All cpp directive lines start with # in column 1. Any number of blanks and tabs is allowed between the # and the directive. The directives are:

#assert name (string)
Define a question called name, with an answer of string. Assertions can be tested with #if directives. The predefined assertions for #system, #cpu, and #machine can be used for architecture-dependent changes.

#unassert name
Remove assertion for question name.

#define name token-string
Define a macro called name, with a value of token-string. Subsequent instances of name are replaced with token-string.

#define name( arg, ... , arg ) token-string
This allows substitution of a macro with arguments. token-string will be substituted for name in the input file. Each call to name in the source file includes arguments that are plugged into the corresponding args in token-string.

#undef name
Remove definition of the macro name. No additional tokens are permitted on the directive line after name.

#ident string
Put string into the comment section of an object file.

#include "filename", #include<filename>
Include contents of filename at this point in the program. No additional tokens are permitted on the directive line after the final " or >.

#line integer-constant "filename"
Cause cpp to generate line-control information for the next pass of the C compiler. The compiler behaves as if integer-constant is the line number of the next line of source code and filename (if present) is the name of the input file. No additional tokens are permitted on the directive line after the optional filename.

#endif
End a section of lines begun by a test directive (#if, #ifdef, or #ifndef). No additional tokens are permitted on the directive line.

#ifdef name
Lines following this directive and up to matching #endif or next #else or #elif will appear in the output if name is currently defined. No additional tokens are permitted on the directive line after name.

#ifndef name
Lines following this directive and up to matching #endif or next #else or #elif will appear in the output if name is not currently defined. No additional tokens are permitted on the directive line after name.

#if constant-expression
Lines following this directive and up to matching #endif or next #else or #elif will appear in the output if constant-expression evaluates to nonzero.

#elif constant-expression
An arbitrary number of #elif directives are allowed between an #if, #ifdef, or #ifndef directive and an #else or #endif directive. The lines following the #elif and up to the next #else, #elif, or #endif directive will appear in the output if the preceding test directive and all intervening #elif directives evaluate to zero, and the constant-expression evaluates to nonzero. If constant-expression evaluates to nonzero, all succeeding #elif and #else directives will be ignored.

#else
Lines following this directive and up to the matching #endif will appear in the output if the preceding test directive evaluates to zero, and all intervening #elif directives evaluate to zero. No additional tokens are permitted on the directive line.

#error
Report fatal errors.

#warning
Report warnings, but then continue processing.

csplit

csplit [options] file arguments

Separate file into context-based sections and place sections in files named xx00 through xxn (n < 100), breaking file at each pattern specified in arguments. See also split.

Options

-
Read from standard input.

-b suffix, --suffix-format=suffix
Append suffix to output filename. This option causes -n to be ignored. suffix must specify how to convert the binary integer to readable form by including one of the following: %d, %i, %u, %o, %x, or %X. The value of suffix determines the format for numbers as follows:

%d
Signed decimal.

%i
Same as %d.

%u
Unsigned decimal.

%o
Octal.

%x
Hexadecimal.

%X
Same as %x.

-f prefix, --prefix=prefix
Name new files prefix00 through prefixn (default is xx00 through xxn).

-k, --keep-files
Keep newly created files even when an error occurs (which would normally remove these files). This is useful when you need to specify an arbitrarily large repeat argument, {n}, and you don't want an out-of-range error to cause removal of the new files.

-n num, --digits=num
Use output filenames with numbers num digits long. The default is 2.

-s, -q, --silent, --quiet
Suppress all character counts.

-z, --elide-empty-files
Do not create empty output files. However, number as if those files had been created.

Arguments

Any one or a combination of the following expressions may be specified as arguments. Arguments containing blanks or other special characters should be surrounded by single quotes.

/expr/[offset]
Create file from the current line up to the line containing the regular expression expr. offset should be of the form +n or -n, where n is the number of lines below or above expr.

%expr%[offset]
Same as /expr/, except no file is created for lines previous to line containing expr.

num
Create file from current line up to (but not including) line number num. When followed by a repeat count (number inside { }), put the next num lines of input into another output file.

{n}
Repeat argument n times. May follow any of the preceding arguments. Files will split at instances of expr or in blocks of num lines. If * is given instead of n, repeat argument until input is exhausted.

Examples

Create up to 20 chapter files from the file novel:

csplit -k -f chap. novel '/CHAPTER/' '{20}'

Create up to 100 address files (xx00 through xx99), each four lines long, from a database named address_list:

csplit -k address_list 4 {99}
ctags

ctags [options] files

Create a list of function and macro names defined in a programming source file. More than one file may be specified. ctags understands many programming languages, including C, C++, FORTRAN, Java, Perl, Python, flex, yacc, and bison. The output list (named tags by default) contains lines of the form:

name     file     context

where name is the function or macro name, file is the source file in which name is defined, and context is a search pattern that shows the line of code containing name. After the list of tags is created, you can invoke vi on any file and type:

:set tags=tagsfile
:tag name

This switches the vi editor to the source file associated with the name listed in tagsfile (which you specify with -t).

etags produces an equivalent file for tags to be used with Emacs.

Options

-a
Append tag output to existing list of tags.

-e
Create tag files for use with emacs.

-h extensionlist
Interpret files with filename extensions specified in extensionlist as header files. The default list is ".h.H.hh.hpp.hxx.h++.inc.def". To indicate that files without extensions should be treated as header files, insert an additional period in the list before another period or at the end of the list, or use just a period by itself. To use this option multiple times and have the specified lists ANDed together, use a plus sign as the first character in the list. To restore the default, use the word "default".

-n
Use numeric ex commands to locate tags. Same as --excmd= number.

-o file, -f file, --output=file
Write to file.

--packages-only
Include tag entries for members of structure-like constructs.

-R
Recursively read files in subdirectories of the directory given on the command line.

-u
Don't sort tag entries.

-x
Produce a tabular listing of each function, and its line number, source file, and context.

-B
Search for tags backward through files.

-I tokenlist
Specify a list of tokens to be specially handled. If given as a file, use ex pattern commands to locate tags. Same as --excmd= pattern.

-N
Use ex pattern commands to locate tags. Same as --excmd= pattern.

-S, --ignore-indentation
Normally ctags uses indentation to parse the tag file; this option tells ctags to rely on indentation less.

-T, --typedefs-and-c++
Include tag entries for typedefs, structs, enums, unions, and C++ member functions.

-V, --version
Print the version number and exit.

date

date [options] [+format] [date]

Print the current date and time. You may specify a display format. format can consist of literal text strings (blanks must be quoted) as well as field descriptors, whose values will appear as described in the following entries (the listing shows some logical groupings). A privileged user can change the system's date and time.

Options

+format
Display current date in a nonstandard format. For example:

$ date +"%A %j %n%k %p"
Tuesday 248
15 PM

The default is %a %b %e %T %Z %Y (e.g., Tue Sep 5 14:59:37 EDT 2000).

-d date, --date date
Display date, which should be in quotes and may be in the format d days or m months d days to print a date in the future. Specify ago to print a date in the past. You may include formatting (see the following section).

-f datefile, --file=datefile
Like -d, but printed once for each line of datefile.

-I [timespec], --iso-8601[=timespec]
Display in ISO-8601 format. If specified, timespec can have one of the values date (for date only), hours, minutes, or seconds to get the indicated precision.

-r file, --reference=file
Display the time file was last modified.

-R, --rfc-822
Display the date in RFC 822 format.

--help
Print help message and exit.

--version
Print version information and exit.

-s date, --set date
Set the date.

-u, --universal
Set the date to Greenwich Mean Time, not local time.

Format

The exact result of many of these codes is locale-specific and depend upon your language setting, particularly the LANG environment variable. See locale.

%
Literal %.

- (hyphen)
Do not pad fields (default: pad fields with zeros).

_ (underscore)
Pad fields with space (default: zeros).

%a
Abbreviated weekday.

%b
Abbreviated month name.

%c
Country-specific date and time format.

%d
Day of month (01-31).

%h
Same as %b.

%j
Julian day of year (001-366).

%k
Hour in 24-hour format, without leading zeros (0-23).

%l
Hour in 12-hour format, without leading zeros (1-12).

%m
Month of year (01-12).

%n
Insert a new line.

%p
String to indicate AM or PM.

%r
Time in %I:%M:%S %p (12-hour) format.

%s
Seconds since "the epoch," which is 1970-01-01 00:00:00 UTC (a nonstandard extension).

%t
Insert a tab.

%w
Day of week (Sunday = 0).

%x
Country-specific date format based on locale.

%y
Last two digits of year (00-99).

%z
RFC 822-style numeric time zone.

%A
Full weekday.

%B
Full month name.

%D
Date in %m/%d/%y format.

%H
Hour in 24-hour format (00-23).

%I
Hour in 12-hour format (01-12).

%M
Minutes (00-59).

%S
Seconds (00-59).

%T
Time in %H:%M:%S format.

%U
Week number in year (00-53); start week on Sunday.

%V
Week number in year (01-52); start week on Monday.

%W
Week number in year (00-53); start week on Monday.

%X
Country-specific time format based on locale.

%Y
Four-digit year (e.g., 1996).

%Z
Time zone name.

Strings for setting date

Strings for setting the date may be numeric or nonnumeric. Numeric strings consist of time, day, and year in the format MMDDhhmm[[CC]YY][.ss]. Nonnumeric strings may include month strings, time zones, a.m., and p.m.

time
A two-digit hour and two-digit minute (hhmm); hh uses 24-hour format.

day
A two-digit month and two-digit day of month (MMDD); default is current day and month.

year
The year specified as either the full four-digit century and year or just the two-digit year; the default is the current year.

Examples

Set the date to July 1 (0701), 4 a.m. (0400), 1995 (95):

date 0701040095

The command:

date +"Hello%t Date is %D %n%t Time is %T"

produces a formatted date as follows:

Hello     Date is 05/09/93
     Time is 17:53:39
dd

dd options

Make a copy of an input file (if) using the specified conditions, and send the results to the output file (or standard output if of is not specified). Any number of options can be supplied, although if and of are the most common and are usually specified first. Because dd can handle arbitrary blocksizes, it is useful when converting between raw physical devices.

Options

bs=n
Set input and output blocksize to n bytes; this option overrides ibs and obs.

cbs=n
Set the size of the conversion buffer (logical record length) to n bytes. Use only if the conversion flag is ascii, ebcdic, ibm, block, or unblock.

conv=flags
Convert the input according to one or more (comma-separated) flags listed next. The first five flags are mutually exclusive.

ascii
EBCDIC to ASCII.

ebcdic
ASCII to EBCDIC.

ibm
ASCII to EBCDIC with IBM conventions.

block
Variable-length records (i.e., those terminated by a newline) to fixed-length records.

unblock
Fixed-length records to variable-length records.

lcase
Uppercase to lowercase.

ucase
Lowercase to uppercase.

noerror
Continue processing after read errors.

notrunc
Don't truncate output file.

swab
Swap each pair of input bytes.

sync
Pad input blocks to ibs with trailing zeros.

count=n
Copy only n input blocks.

ibs=n
Set input blocksize to n bytes (default is 512).

if=file
Read input from file (default is standard input).

obs=n
Set output blocksize to n bytes (default is 512).

of=file
Write output to file (default is standard output).

seek=n
Skip n output-sized blocks from start of output file.

skip=n
Skip n input-sized blocks from start of input file.

--help
Print help message and then exit.

--version
Print the version number and then exit.

You can multiply size values (n) by a factor of 1024, 512, or 2 by appending the letter k, b, or w, respectively. You can use the letter x as a multiplication operator between two numbers.

Examples

Convert an input file to all lowercase:

dd if=caps_file of=small_file conv=lcase

Retrieve variable-length data and write it as fixed-length to out:

data_retrieval_cmd | dd of=out conv=sync,block
debugfs

debugfs [[option] device]

System administration command. Provide direct access to data structure of an ext2 filesystem in order to debug problems with the device. device is the special file corresponding to the device containing the ext2 filesystem (e.g., /dev/hda3). debugfs may be used on a mounted filesystem device.

Option

-b blocksize
Use the specified blocksize for the filesystem.

-c
Catastrophic mode. Open the filesystem in read-only mode, do not read the inode and group bitmaps initially.

-f file
Read commands from file. Exit when done executing commands.

-i
Specify file system device is an ext2 image file created by e2image.

-s block
Read the superblock from the specified block.

-w
Open the filesystem in read-write mode.

-R command
Execute the given command (see list below) then exit.

-V
Print version number, then exit.

Commands

cat file
Dump the contents of an inode to standard output.

cd directory
Change the current working directory to directory.

chroot directory
Change the root directory to be the specified inode.

close
Close the currently open filesystem.

clri file
Clear the contents of the inode corresponding to file.

dump file out_file
Dump the contents of an inode to out_file.

expand_dir directory
Expand directory.

feature [[-]feature]
Set filesystem feature listed on the command line, then print current feature settings. Use - to clear a feature.

find_free_block [goal]
Find first free block starting from goal (if specified) and allocate it.

find_free_inode [dir [mode]]
Find a free inode and allocate it.

freeb block
Mark block as not allocated.

freei file
Free the inode corresponding to file.

help
Print a list of commands understood by debugfs.

icheck block
Do block-to-inode translation.

initialize device blocksize
Create an ext2 filesystem on device.

kill_file file
Remove file and deallocate its blocks.

lcd directory
Change current working directory on native filesystem.

ln source_file dest_file
Create a link.

logdump [-ac] [-bblock] [-iinode] [-fjournal_file] [out_file]
Print the ext3 journal for the filesytem. Use options to specify the location of the journal by block, inode, or filename, or to specify a file to which the journal should be printed.

ls [-l] [-d] [pathname]
Emulate the ls command. Use -l for verbose format and -d to list deleted entries.

modify_inode file
Modify the contents of the inode corresponding to file.

mkdir directory
Make directory.

mknod file [p|[[c|b] major minor]]
Create a special device file.

ncheck inode
Do inode-to-name translation.

open [-b blocksize] [-c] [-f] [-i] [-w] [-s block] device
Open a filesystem.

pwd
Print the current working directory.

quit
Quit debugfs.

rdump directory dest_directory
Recursively dump directory and its contents to dest_directory on the native filesystem.

rm file
Remove file.

rmdir directory
Remove directory.

setb block
Mark block as allocated.

seti file
Mark in use the inode corresponding to file.

set_super_value [-l] field value
Set superblock field to value. Use -l to print a list of valid fields.

show_super_stats [-h]
List the contents of the superblock and block group descriptors. Use -h to list only the superblock contents.

stat file
Dump the contents of the inode corresponding to file.

testb block
Test whether block is marked as allocated.

testi file
Test whether the inode corresponding to file is marked as allocated.

unlink file
Remove a link.

write source_file file
Create a file in the filesystem named file, and copy the contents of source_file into the destination file.

depmod

depmod [options] modules

System administration command. Create a dependency file for the modules given on the command line. This dependency file can be used by modprobe to automatically load the relevant modules. The normal use of depmod is to include the line /sbin/depmod -a in one of the files in /etc/rc.d so that the correct module dependencies will be available after booting the system.

Options

-a, --all
Create dependencies for all modules listed in /etc/modules.conf.

-b dir, --basedir dir
Specify a base directory to use instead of /lib/modules.

-e, --errsyms
Print a list of all unresolved symbols.

-d
Debug mode. Show all commands being issued.

-h, --help
Print help message, then exit.

-n, --show
Write dependency file to standard output.

-q, --quiet
Don't display error messages about missing symbols.

-r, --root
Allow root to load modules not owned by root.

-s, --syslog
Write error messages to the syslog daemon instead of to standard error.

-v
Print a list of all processed modules.

-A, --quick
Check timestamps and update the dependency file if anything has changed.

-C file, --config file
Use the specified configuration file instead of /etc/modules.conf. May also be set using the MODULECONF environment variable.

-F file, --kernelsyms file
Use the specified kernel symbol file to build dependencies. Usually this is either a copy of a system's System.map file or the output of /proc/ksyms.

-V, --version
Print version number.

Files

/etc/modules.conf
Information about modules: which ones depend on others, and which directories correspond to particular types of modules.

/sbin/insmod, /sbin/rmmod
Programs that depmod relies on.

df

df [options] [name]

Report the amount of free disk space available on all mounted filesystems or on the given name. (df cannot report on unmounted filesystems.) Disk space is shown in 1KB blocks (default) or 512-byte blocks (if the environment variable POSIXLY_CORRECT is set). name can be a device name (e.g., /dev/hd*), the directory name of a mounting point (e.g., /usr), or a directory name (in which case df reports on the entire filesystem in which that directory is mounted).

Options

-a, --all
Include empty filesystems (those with 0 blocks).

--block-size=n
Show space as n-byte blocks.

-h, --human-readable
Print sizes in a format friendly to human readers (e.g., 1.9G instead of 1967156).

-H, --si
Like -h, but show as power of 1000 rather than 1024.

-i, --inodes
Report free, used, and percent-used inodes.

-k, --kilobytes
Print sizes in kilobytes.

-l, --local
Show local filesystems only.

-m, --megabytes
Print sizes in megabytes.

--no-sync
Show results without invoking sync first (i.e., without flushing the buffers). This is the default.

-P, --portability
Use POSIX output format (i.e., print information about each filesystem on exactly one line).

--sync
Invoke sync (flush buffers) before getting and showing sizes.

-t type, --type=type
Show only type filesystems.

-T, --print-type
Print the type of each filesystem in addition to the sizes.

-x type, --exclude-type=type
Show only filesystems that are not of type type.

--help
Print help message and then exit.

--version
Print the version and then exit.

diff

diff [options] [diroptions] file1 file2

Compare two text files. diff reports lines that differ between file1 and file2. Output consists of lines of context from each file, with file1 text flagged by a < symbol and file2 text by a > symbol. Context lines are preceded by the ed command (a, c, or d) that would be used to convert file1 to file2. If one of the files is -, standard input is read. If one of the files is a directory, diff locates the filename in that directory corresponding to the other argument (e.g., diff my_dir junk is the same as diff my_dir/junk junk). If both arguments are directories, diff reports lines that differ between all pairs of files having equivalent names (e.g., olddir/program and newdir/program); in addition, diff lists filenames unique to one directory, as well as subdirectories common to both. See also cmp.

Options

-a, --text
Treat all files as text files. Useful for checking to see if binary files are identical.

-b, --ignore-space-change
Ignore repeating blanks and end-of-line blanks; treat successive blanks as one.

-B, --ignore-blank-lines
Ignore blank lines in files.

-c
Context diff: print 3 lines surrounding each changed line.

-C n, --context[=n]
Context diff: print n lines surrounding each changed line. The default context is 3 lines.

-d, --minimal
To speed up comparison, ignore segments of numerous changes and output a smaller set of changes.

-D symbol, --ifdef=symbol
When handling C files, create an output file that contains all the contents of both input files, including #ifdef and #ifndef directives that reflect the directives in both files.

-e, --ed
Produce a script of commands (a, c, d) to re-create file2 from file1 using the ed editor.

-F regexp, --show-function-line[=regexp]
For context and unified diff, show the most recent line containing regexp before each block of changed lines.

-H
Speed output of large files by scanning for scattered small changes; long stretches with many changes may not show up.

--help
Print brief usage message.

--horizon-lines=n
In an attempt to find a more compact listing, keep n lines on both sides of the changed lines when performing the comparison.

-i, --ignore-case
Ignore case in text comparison. Uppercase and lowercase are considered the same.

-I regexp, --ignore-matching-lines=regexp
Ignore lines in files that match the regular expression regexp.

-l, --paginate
Paginate output by passing it to pr.

-L label, --label label, --label=label
For context and unified diff, print label in place of the filename being compared. The first such option applies to the first filename and the second option to the second filename.

--left-column
For two-column output (-y), show only left column of common lines.

-n, --rcs
Produce output in RCS diff format.

-N, --new-file
Treat nonexistent files as empty.

-p, --show-c-function
When handling files in C or C-like languages such as Java, show the function containing each block of changed lines. Assumes -c, but can also be used with a unified diff.

-P, --unidirectional-new-file
If two directories are being compared and the first lacks a file that is in the second, pretend that an empty file of that name exists in the first directory.

-q, --brief
Output only whether files differ.

-r, --recursive
Compare subdirectories recursively.

-s, --report-identical-files
Indicate when files do not differ.

-S filename, --starting-file=filename
For directory comparisons, begin with the file filename, skipping files that come earlier in the standard list order.

--suppress-common-lines
For two-column output (-y), do not show common lines.

-t, --expand-tabs
Produce output with tabs expanded to spaces.

-T, --initial-tab
Insert initial tabs into output to line up tabs properly.

-u
Unified diff: print old and new versions of lines in a single block, with 3 lines surrounding each block of changed lines.

-U n, --unified[=n]
Unified diff: print old and new versions of lines in a single block, with n lines surrounding each block of changed lines. The default context is 3 lines.

-v, --version
Print version number of this version of diff.

-w, --ignore-all-space
Ignore all whitespace in files for comparisons.

-W n, --width=n
For two-column output (-y), produce columns with a maximum width of n characters. Default is 130.

-x regexp, --exclude=regexp
Do not compare files in a directory whose names match regexp.

-X filename, --exclude-from=filename
Do not compare files in a directory whose names match patterns described in the file filename.

-y, --side-by-side
Produce two-column output.

-n
For context and unified diff, print n lines of context. Same as specifying a number with -C or -U.

diff3

diff3 [options] file1 file2 file3

Compare three files and report the differences. No more than one of the files may be given as - (indicating that it is to be read from standard input). The output is displayed with the following codes:

= = = =
All three files differ.

= = = =1
file1 is different.

= = = =2
file2 is different.

= = = =3
file3 is different.

diff3 is also designed to merge changes in two differing files based on a common ancestor file (i.e., when two people have made their own set of changes to the same file). diff3 can find changes between the ancestor and one of the newer files and generate output that adds those differences to the other new file. Unmerged changes occur where both of the newer files differ from each other and at least one of them differs from the ancestor. Changes from the ancestor that are the same in both of the newer files are called merged changes. If all three files differ in the same place, it is called an overlapping change.

This scheme is used on the command line with the ancestor being file2, the second filename. Comparison is made between file2 and file3, with those differences then applied to file1.

Options

-3, --easy-only
Create an ed script to incorporate into file1 unmerged, nonoverlapping differences between file1 and file3.

-a, --text
Treat files as text.

-A, --show-all
Create an ed script to incorporate all changes, showing conflicts in bracketed format.

-e, --ed
Create an ed script to incorporate into file1 all unmerged differences between file2 and file3.

-E, --show-overlap
Create an ed script to incorporate unmerged changes, showing conflicts in bracketed format.

-x, --overlap-only
Create an ed script to incorporate into file1 all differences where all three files differ (overlapping changes).

-X
Same as -x, but show only overlapping changes, in bracketed format.

-m, --merge
Create file with changes merged (not an ed script).

-L label, --label=label
Use label to replace filename in output.

-i
Append the w (save) and q (quit) commands to ed script output.

-T, --initial-tab
To line tabs up properly in output, begin lines with a tab instead of two spaces.

-v, --version
Print version information and then exit.

dig

dig [@server] [options] [name] [type] [class] [query-options]
dig @server name type
dig -h

The dig command is used to query DNS servers; it is more flexible than the deprecated nslookup command. If you use it without any options or arguments, it will search for the root server. The standard arguments are:

server
The server to query. If no server is supplied, dig will check the name servers listed in /etc/resolv.conf. The address may be an IPv4 dotted address or an IPv6 colon-delimited address. It may also be a hostname, which dig will resolve (through the name servers in /etc/resolv.conf).

name
The domain name to look up.

type
The type of query to perform, such as A, ANY, MX, SIG, and so forth. The default is A, but you may use any valid BIND9 query type.

Options

You may use the following option flags with dig:

-b address
Set the source IP address for the query.

-c class
Set the class of query. The default value is IN (internet), but you can choose HS for Hesiod or CH for CHAOSNET.

-f filename
Operate in batch mode, performing the queries in the file you specify.

-p portnumber
Choose the port number for the query. The default value is the standard DNS port, 53.

-t type
Set the type of query, as with the query argument. The default value is A, but you may use any valid BIND9 query.

-x addr
Use the -x flag for reverse lookups, specifying an IPv4 or IPv6 address. You do not need the name, class, or type arguments if you use the -x flag.

-k filename
Specify a TSIG key file; used for signed transactions. You can also use the -y key, although this is less secure.

-y keyname:keyvalue
Enter the actual key name and value when conducting a signed transaction. Because the key and value can be seen in the output of ps, this is not recommended for use on multiuser systems; use -k instead.

Query options

There are a large number of query options for dig. Each query option is preceded by +, and many have an opposite version beginning with no. For example, the tcp flag is passed as +tcp, and negated with +notcp. Because there are so many options, only a few are discussed here. For greater detail, see the dig manpage.

+tcp, +notcp
Use (or do not use) the TCP protocol instead of the default UDP.

+domain=searchdomain
Perform a search in the domain specified; this is equivalent to using the +search option and having "searchdomain" as the sole entry in the search list or domain directive of /etc/resolv.conf.

+search, +nosearch
Use (or do not use) the search list provided in /etc/resolv.conf. The default is not to use the search list.

+time=T
Timeout for queries, in seconds. The default is 5, and the minimum is 1.

+tries=N
The number of times to retry UDP queries. The default is 3, and the minimum is 1.

dip

dip [options] [chat scriptfile]

System administration command. Set up or initiate dial-up Internet connections. dip can be used to establish connections for users dialing out or dialing in. Commands can be used in interactive mode or placed in a script file for use in dial-out connections. To establish dial-in connections, dip is often used as a shell, and may be executed using the commands diplogin or diplogini.

Options

-a
In dial-in mode, prompt for username and password. Same as the diplogini command.

-i
Initiate a login shell for a dial-in connection. Same as the diplogin command.

-k
Kill the most recent dip process or the process running on the device specified by the -l option.

-l device
Used with the -k option. Specifies a tty device.

-m mtu
Maximum Transfer Unit. The default is 296.

-p protocol
The protocol to use: SLIP, CSLIP, PPP, or TERM.

-t
Command mode. This is usually done for testing.

-v
Verbose mode.

Commands

Most of these commands can be used either in interactive mode or in a script file.

beep times
Beep the terminal the specified number of times.

bootp
Retrieve local and remote IP addresses using the BOOTP protocol.

break
Send a BREAK.

chatkey keyword code
Map a modem response keyword to a numeric code.

config [interface|routing] [pre|up|down|post] arguments
Modify interface characteristics or the routing table before the link comes up, when it is up, when it goes down, or after it is down. The syntax for arguments is the same as for arguments for the ifconfig or route commands.

databits 7|8
Set the number of data bits.

dec $variable [value]
Decrement $variable by value. The default is 1.

default
Set default route to the IP address of the host connected to.

dial phonenumber [timeout]
Dial phonenumber. Abort if remote modem doesn't answer within timeout seconds. Set $errlvl according to the modem response.

echo on|off
Enable or disable the display of modem commands.

exit [n]
Exit the script. Optionally return the number n as the exit status.

flush
Clear the input buffer.

get $variable [ask|remote [timeout]] value
Set $variable to value. If ask is specified, prompt the user for a value. If remote is specified, retrieve the value from the remote system. Abort after timeout seconds.

goto label
Jump to the section identified by label.

help
List available commands.

if expr goto label
Jump to the section identified by label if the expression evaluates to true. An expression compares a variable to a constant using one of these operators: =, !=, <, >, <=, or >=.

inc $variable [value]
Increment $variable by value. The default is 1.

init string
Set the string used to initialize the modem. The default is ATE0 Q0 V1 X1.

mode protocol
Set the connection protocol. Valid values are SLIP, CSLIP, PPP, and TERM. The default is SLIP.

netmask mask
Set the subnet mask.

parity E|O|N
Set the line parity to even, odd, or none.

password
Prompt user for password.

proxyarp
Install a proxy ARP entry in the local ARP table.

print $variable
Display the content of $variable.

psend command
Execute command in a shell, and send output to the serial device. Commands are executed using the user's real UID.

port device
Specify the serial device the modem is attached to.

quit
Exit with a nonzero exit status. Abort the connection.

reset
Reset the modem.

securid
Prompt user for the variable part of an ACE System SecureID password, and send it together with the stored prefix to the remote system.

securidf prefix
Store the fixed part of an ACE System SecureID password.

send string
Send string to the serial device.

shell command
Execute command in a shell using the user's real UID.

skey [timeout]
Wait for an S/Key challenge, then prompt user for the secret key. Generate and send the response. Abort if challenge is not received within timeout seconds. S/Key support must be compiled into dip.

sleep time
Wait time seconds.

speed bits-per-second
Set the port speed. Default is 38400.

stopbits 1|2
Set the number of stop bits.

term
Enable terminal mode. Pass keyboard input directly to the serial device.

timeout time
Set the number of seconds the line can be inactive before the link is closed.

wait text [timeout]
Wait timeout seconds for text to arrive from the remote system. If timeout is not specified, wait forever.

dnssec-keygen

dnssec-keygen [options] domain-name

System administration command. Generate encrypted Secure DNS (DNSSEC) or Transaction Signatures (TSIG) keys for domain-name. When the key is completed, dnssec-keygen prints the key identifier to standard output and creates public and private key files whose names are based on the key identifier and the filename extensions .key and .private. It creates both files even when using an asymmetric algorithm like HMAC-MD5. For more information on Secure DNS, see DNS and BIND (O'Reilly), or read RFC 2535.

Options

-a algorithm
Specify the cryptographic algorithm to use. Accepted values are RSAMD5, RSA, DSA, DH, or HMAC-MD5.

-b bitsize
Specify the key bitsize. Accepted values depend on the encryption algorithm used.

-c class
The domain record for which the key is being generated should contain class. When this option is not given, a class of IN is assumed.

-e
Use a large exponent when generating an RSA key.

-g generator
Specified the number to use as a generator when creating a DH (Diffie Hellman) key. Accepted values are 2 and 5.

-h
Print a help message, then exit.

-n type
The owner of the key must be of the specified type. Accepted values are ZONE, HOST, ENTITY, or USER.

-p protocol
Specify the protocol value for the generated key. Accepted values are given in RFC 2535 and other DNS Security RFCs. By default the value is either 2 (email) or 3 (DNSSEC).

-r device
Specify the device to use as a source of randomness when creating keys. This can be a device file, a file containing random data, or the string keyboard to specify keyboard input. By default, /dev/random will be used when available, and keyboard input will be used when it is not.

-s type
Specify whether the key can be used for authentication, confirmation, both, or neither. Accepted values for type are AUTHCONF, NOAUTHCONF, NOAUTH, or NOCONF.

dnssec-signzone

dnssec-signzone [options] zonefile [key-identifiers]

System administration command. Sign a secure DNS zonefile with the signatures in the specified list of key-identifiers. If signed keysets associated with the zone are found in the current directory, include their signatures in the signed zone file. The dnssec-signzone command writes the signed zone information to a file named db-domainname.signed. This file should be referenced in a zone statement in a named.conf file. For more information on Secure DNS, see DNS and BIND (O'Reilly), or read RFC 2535.

Options

-a
Verify generated signatures.

-c class
Specify the DNS class of the keyset.

-d directory
Search directory for signed key files.

-e end-time
Specify the date and time the records will expire. The end-time may be specified in yyyymmddhhmmss notation, or given as +N seconds from the start-time. The default is 30 days from start-time.

-h
Print help message, then exit.

-i days
When signing a previously signed zone, replace any records due to expire within the specified number of days. The default is one quarter of the number of days between the signature's start-time and end-time.

-n threads
Specify the number of threads to use when signing the zone file. The default is one for each detected CPU.

-o origin
Specify the zone origin. The name of the zone file is the default origin.

-p
Use pseudo-random data to sign the zone key.

-r device
Specify the device to use as a source of randomness when creating keys. This can be a device file, a file containing random data, or the string keyboard to specify keyboard input. By default, /dev/random will be used when available, and keyboard input will be used when it is not.

-s start-time
Specify the date and time the records become valid. The end-time may be specified in yyyymmddhhmmss notation, or given as +N seconds from the current time. The default is the current time.

-t
Print statistics when complete.

dosfsck

dosfsck [options] device
fsck.msdos [options] device

System administration command. Similar to fsck, but specifically intended for MS-DOS filesystems. When checking an MS-DOS filesystem, fsck calls this command. Normally dosfsck stores all changes in memory, then writes them when checks are complete.

Options

-a
Automatically repair the system; do not prompt the user.

-d file
Drop the named file from the file allocation table. Force checking, even if kernel has already marked the filesystem as valid. dosfsck will normally exit without checking if the system appears to be clean.

-f
Save unused cluster chains to files.

-l
List pathnames of files being processed.

-r
Repair the system, prompting user for advice.

-t
Mark unreadable clusters as bad.

-u file
Attempt to undelete the named file.

-v
Verbose mode.

-w
Write changes to disk immediately.

-y
When queried, answer "yes."

-A
Filesystem is an Atari version of MS-DOS.

-F
Flush buffer caches before checking.

-V
Repeat test to verify all errors have been corrected.

dumpkeys

dumpkeys [options]

Print information about the keyboard driver's translation tables to standard output. Further information is available in the manual pages under keytables.

Options

-1, --separate-lines
Print one line for each modifier/keycode pair and prefix plain to each unmodified keycode.

-ccharset, --charset=charset
Specify character set with which to interpret character code values. The default character set is iso-8859-1. The full list of valid character sets is available with the --help option.

--compose-only
Print compose key combinations only. Requires compose key support in the kernel.

-f, --full-table
Output in canonical, not short, form: for each key, print a row with modifier combinations divided into columns.

--funcs-only
Print function key string definitions only; do not print key bindings or string definitions.

-h, --help
Print help message and the version.

-i, --short-info
Print in short-info format, including information about acceptable keycode keywords in the keytable files; the number of actions that can be bound to a key; a list of the ranges of action codes (the values to the right of a key definition); and the number of function keys that the kernel supports.

--keys-only
Print key bindings only; do not print string definitions.

-l, --long-info
Print the same information as in --short-info, plus a list of the supported action symbols and their numeric values.

-n, --numeric
Print action code values in hexadecimal notation; do not attempt to convert them to symbolic notation.

-S num, --shape=num
Print using num to determine table shape. Values of num are:

0
Default.

1
Same as --full-table.

2
Same as --separate-lines.

3
One line for each keycode up to the first hole, then one line per modifier/keycode pair.

egrep

egrep [options] [regexp] [files]

Search one or more files for lines that match an extended regular expression regexp. egrep doesn't support the regular expressions \(, \), \n, \<, \>, \{, or \}, but does support the other expressions, as well as the extended set +, ?, |, and ( ). Remember to enclose these characters in quotes. Regular expressions are described in Chapter 9. Exit status is 0 if any lines match, 1 if none match, and 2 for errors.

See grep for the list of available options. Also see fgrep.

Examples

Search for occurrences of Victor or Victoria in file:

egrep 'Victor(ia)*' file
egrep '(Victor|Victoria)' file

Find and print strings such as old.doc1 or new.doc2 in files, and include their line numbers:

egrep -n '(old|new)\.doc?' files
eject

eject [options] [device]

Eject removable media such as a CD-ROM, floppy, tape, or JAZ or ZIP disk. You may name the device by /dev or /mnt filename. The /dev and /mnt prefixes are optional for any items in the /dev and /mnt directories. If no device is named, it is assumed that "cdrom" should be ejected.

Options

The eject command takes the following option flags:

-h
Display help information.

-v, --verbose
Verbose mode: display additional information about actions.

-d, --default
List the default device name rather than doing anything.

-a, --auto on|1|off|0
Set the auto-eject mode to on or off (equivalent to 1 or 0). If auto-eject mode is on, the device is ejected when closed or unmounted.

-c, --changerslot slotnumber
If using a CD-ROM changer, select a CD from one of the slots. Slots are enumerated starting with 0, and the CD-ROM drive must not be playing music or mounted to read data.

-t, --trayclose
Close the CD-ROM drive. Not all drives will respond to this command.

-x, --cdspeed speed
Set the speed multiplier for the CD-ROM to an integer, usually a power of 2. Not all devices support this command. Setting the speed to 0 indicates that the drive should operate at its maximum speed.

-n, --noop
Do not perform any actions; merely display the actions that would be performed.

-r, --cdrom
Use CD-ROM commands to eject the drive. Normally, the system will try all methods (CD-ROM, SCSI, floppy, tape) to eject.

-s, --scsi
Use SCSI commands to eject the drive. Normally, the system will try all methods (CD-ROM, SCSI, floppy, tape) to eject.

-f, --floppy
Use floppy commands to eject the drive. Normally, the system will try all methods (CD-ROM, SCSI, floppy, tape) to eject.

-q, --tape
Use tape commands to eject the drive. Normally, the system will try all methods (CD-ROM, SCSI, floppy, tape) to eject.

-p, --proc
Use the mounted files listed in /proc/mounts rather than in /etc/mtab.

-V, --version
Display version information, then quit.

etags

etags [options] files

Create a list of function and macro names defined in a programming source file. etags generates tags for use by emacs. (ctags produces an equivalent tags file for use with vi.) More than one file may be specified. etags understands many programming languages, including C, C++, FORTRAN, Java, Perl, Python, flex, yacc, and bison. The output list (named TAGS by default) contains lines of the form:

name     file     context

where name is the function or macro name, file is the source file in which name is defined, and context is a search pattern that shows the line of code containing name. After the list of tags is created, you can invoke Emacs on any file and type:

M-x visit-tags-table

You will be prompted for the name of the tag table; the default is TAGS. To switch to the source file associated with the name listed in tagsfile, type:

M-x find-tag

You will be prompted for the tag you would like Emacs to search for.

Options

-a, --append
Append tag output to existing list of tags.

-d, --defines
Include tag entries for C preprocessor definitions.

-i file, --include=file
Add a note to the tags file that file should be consulted in addition to the normal input file.

-l language, --language=language
Consider the files that follow this option to be written in language. Use the -h option for a list of languages and their default filename extensions.

-o file, --output=file
Write to file.

-r regexp, --regex=regexp
Include a tag for each line that matches regexp in the files following this option.

-C, --c++
Expect .c and .h files to contain C++, not C, code.

-D, --no-defines
Do not include tag entries for C preprocessor definitions.

-H, -h, --help
Print usage information.

-R, --noregex
Don't include tags based on regular-expression matching for the files that follow this option.

-S, --ignore-indentation
Normally etags uses indentation to parse the tag file; this option tells it to rely on it less.

-V, --version
Print the version number.

expr

expr arg1 operator arg2 [ operator arg3 ... ]

Evaluate arguments as expressions and print the results. Arguments and operators must be separated by spaces. In most cases, an argument is an integer, typed literally or represented by a shell variable. There are three types of operators: arithmetic, relational, and logical, as well as keyword expressions. Exit status for expr is 0 (expression is nonzero and nonnull), 1 (expression is 0 or null), or 2 (expression is invalid).

Arithmetic operators

Use these to produce mathematical expressions whose results are printed:

+
Add arg2 to arg1.

-
Subtract arg2 from arg1.

*
Multiply the arguments.

/
Divide arg1 by arg2.

%
Take the remainder when arg1 is divided by arg2.

Addition and subtraction are evaluated last, unless they are grouped inside parentheses. The symbols *, (, and ) have meaning to the shell, so they must be escaped (preceded by a backslash or enclosed in single quotes).

Relational operators

Use these to compare two arguments. Arguments can also be words, in which case comparisons are defined by the locale. If the comparison statement is true, the result is 1; if false, the result is 0. Symbols > and < must be escaped.

=, = =
Are the arguments equal?

!=
Are the arguments different?

>
Is arg1 greater than arg2?

>=
Is arg1 greater than or equal to arg2?

<
Is arg1 less than arg2?

<=
Is arg1 less than or equal to arg2?

Logical operators

Use these to compare two arguments. Depending on the values, the result can be arg1 (or some portion of it), arg2, or 0. Symbols | and & must be escaped.

|
Logical OR; if arg1 has a nonzero (and nonnull) value, the result is arg1; otherwise, the result is arg2.

&
Logical AND; if both arg1 and arg2 have a nonzero (and nonnull) value, the result is arg1; otherwise, the result is 0.

:
Like grep; arg2 is a pattern to search for in arg1. arg2 must be a regular expression. If part of the arg2 pattern is enclosed in \( \) (escaped parentheses), the result is the portion of arg1 that matches; otherwise, the result is simply the number of characters that match. By default, a pattern match always applies to the beginning of the first argument (the search string implicitly begins with a ^). Start the search string with .* to match other parts of the string.

Keywords

index string character-list
Return the first position in string that matches the first possible character in character-list. Continue through character-list until a match is found, or return 0.

length string
Return the length of string.

match string regex
Same as string : regex.

quote token
Treat token as a string, even if it would normally be a keyword or an operator.

substr string start length
Return a section of string, beginning with start, with a maximum length of length characters. Return null when given a negative or nonnumeric start or length.

Examples

Division happens first; result is 10:

expr 5 + 10 / 2

Addition happens first; result is 7 (truncated from 7.5):

expr \( 5 + 10 \) / 2

Add 1 to variable i. This is how variables are incremented in shell scripts:

i=`expr $i + 1`

Print 1 (true) if variable a is the string "hello":

expr $a = hello

Print 1 (true) if b plus 5 equals 10 or more:

expr $b + 5 \>= 10

Find the 5th, 6th, and 7th letters of the word character:

expr substr character 5 3

In the examples that follow, variable p is the string "version.100". This command prints the number of characters in p:

expr $p : '.*'           Result is 11

Match all characters and print them:

expr $p : '\(.*\)'       Result is "version.100"

Print the number of lowercase letters at the beginning of p:

expr $p : '[a-z]*'       Result is 7

Match the lowercase letters at the beginning of p:

expr $p : '\([a-z]*\)'   Result is "version"

Truncate $x if it contains five or more characters; if not, just print $x. (Logical OR uses the second argument when the first one is 0 or null, i.e., when the match fails.)

expr $x : '\(.....\)' \| $x

In a shell script, rename files to their first five letters:

mv $x `expr $x : '\(.....\)' \| $x`

(To avoid overwriting files with similar names, use mv -i.)

fdisk

fdisk [options] [device]

System administration command. Maintain disk partitions via a menu. fdisk displays information about disk partitions, creates and deletes disk partitions, and changes the active partition. It is possible to assign a different operating system to each of the four possible primary partitions, though only one partition is active at any given time. You can also divide a physical partition into several logical partitions. The minimum recommended size for a Linux system partition is 40MB. Normally, device will be /dev/hda, /dev/hdb, /dev/sda, /dev/sdb, /dev/hdc, /dev/hdd, and so on. See also cfdisk.

Options

-b sectorsize
Set the size of individual disk sectors. May be 512, 1024, or 2048. Most systems now recognize sector sizes, so this is not necessary.

-l
List partition tables and exit.

-u
Report partition sizes in sectors instead of cylinders.

-s partition
Display the size of partition, unless it is a DOS partition.

-v
Print version number, then exit.

Commands

a
Toggle a bootable flag on current partition.

b
Edit disklabel of a BSD partition.

c
Toggle DOS compatibility flag.

d
Delete current partition.

l
List all partition types.

m
Main menu.

n
Create a new partition; prompt for more information.

o
Create an empty DOS partition table.

p
Print a list of all partitions and information about each.

q
Quit; do not save.

t
Replace the type of the current partition.

u
Modify the display/entry units, which must be cylinders or sectors.

v
Verify: check for errors, and display a summary of the number of unallocated sectors.

w
Save changes and exit.

x
Switch to expert commands.

fetchmail

fetchmail [options] [servers...]

System administration command. Retrieve mail from mail servers and forward it to the local mail delivery system. fetchmail retrieves mail from servers that support the common mail protocols POP2, POP3, IMAP2bis, and IMAP4. Messages are delivered via SMTP through port 25 on the local host and through your system's mail delivery agent (such as sendmail), where they can be read through the user's mail client. fetchmail settings are stored in the ~/.fetchmailrc file. Parameters and servers can also be set on the command line, which will override settings in the .fetchmailrc file. fetchmail is compatible with the popclient program, and users can use both without having to adjust file settings.

Options

-a, --all
Retrieve all messages from server, even ones that have already been seen but are left on the server. The default is to retrieve only new messages.

-auth type
Specify an authentication type. type can be: password, kerberos_v5, kerberos, gssapi, cram-md5, otp, ntlm, ssh, or any. When using the default value, any, fetchmail will use the highest authentication available. In decreasing order of security: gssapi, kerberos, cram, x-otp, ntlm, then login. Using ssh suppresses authentication. Use ssh when using an end-to-end secure connection.

-B n, --fetchlimit n
Set the maximum number of messages (n) accepted from a server per query.

-b n, --batchlimit n
Set the maximum number of messages sent to an SMTP listener per connection. When this limit is reached, the connection will be broken and reestablished. The default of 0 means no limit.

-bsmtp file
Append fetched mail to the specified batched sendmail (BSMTP) file. If file is -, send to standard output.

-c, --check
Check for mail on a single server without retrieving or deleting messages. Works with IMAP, but not well (if at all) with other protocols.

-D [domain], --smtpaddress [domain]
Specify the domain name placed in RCPT TO lines sent to SMTP. The default is the local host.

-d n, --daemon n
Detach from current process and run as a daemon, fetching mail every n seconds. A user may run only one fetchmail daemon process. See option --quit.

-E header, --envelope header
Change the header assumed to contain the mail's envelope address (usually "X-Envelope-to:") to header.

-e n, --expunge n
Tell an IMAP server to EXPUNGE (i.e., purge messages marked for deletion) after n deletes. A setting of 0 indicates expunging only at the end of the session. Normally, an expunge occurs after each delete.

-F, --flush
For POP3 and IMAP servers, remove previously retrieved messages from the server before retrieving new ones.

-f file, --fetchmailrc file
Specify a nondefault name for the fetchmail configuration file.

--fetchdomains hosts
Specify the domains to which mail should be sent when operating in ETRN or ODMR mode.

-I specification, --interface specification
Require that the mail server machine is up and running at a specified IP address (or range) before polling. The specification is given as interface/ipaddress/mask. The first part indicates the type of TCP connection expected (sl0, ppp0, etc.), the second is the IP address, and the third is the bit mask for the IP, assumed to be 255.255.255.255.

-i file, --idfile file
Store POP3 UIDs in file instead of the default .fetchids file.

--invisible
Supress Received header and and spoof the MTA so it looks like mail comes directly from the mailserver host.

-K, --nokeep
Delete all retrieved messages from the mail server.

-k, --keep
Keep copies of all retrieved messages on the mail server.

-L file, --logfile file
Redirect status messages to the specified file. This option is primarily for use in debugging. See the --syslog option.

-l size, --limit size
Set the maximum message size that will be retrieved from a server. Messages larger than this size will be left on the server and marked unread.

-lmtp
Deliver fetched mail via LMTP instead of SMTP. The server, specified with the -S option, must explicitly include the port to be used.

-M interface, --monitor interface
In daemon mode, monitor the specified TCP/IP interface for any activity besides itself, and skip the poll if there is no other activity. Useful for PPP connections that automatically time out with no activity.

-m command, --mda command
Pass mail directly to mail delivery agent instead of sending to port 25. The command is the path and options for the mailer, such as /usr/lib/sendmail -oem. A %T in the command will be replaced with the local delivery address, and an %F will be replaced with the message's From address.

-N, --nodetach
Run command in the foreground. Useful for debugging a configuration file that normally would run fetchmail as a daemon. Also causes fetchmail to ignore -L or --syslog options.

-n, --norewrite
Do not expand local mail IDs to full addresses. This option will disable expected addressing and should be used only to find problems.

--nobounce
Do not bounce error messages back to the sender; send them to the postmaster instead.

--nosyslog
Turn off logging to syslogd. This option overrides resource file settings and the -L option.

-P n, --port n
Specify a port to connect to on the mail server. The default port numbers for supported protocols are usually sufficient.

-p proto, --protocol proto
Specify the protocol to use when polling a mail server. proto can be:

AUTO
Attempt IMAP, POP3, then POP2.

POP2
Post Office Protocol 2.

POP3
Post Office Protocol 3.

APOP
POP3 with MD5 authentication.

KPOP
POP3 with Kerberos v4 authentication on port 1109.

RPOP
POP3 with RPOP authentication.

SDPS
Demon Internet's Standard Dial-up POP3 Service.

IMAP
IMAP2bis, IMAP4, or IMAP4rev1. fetchmail autodetects their capabilities.

ETRN
Extended SMTP with Extended TURN command.

ODMR
On Demand Mail Relaying.

--plugin command
Use external program to establish the TCP connection. The command is the path and options for the external program. Use escape codes %h and %p in command to pass the hostname and port as arguments to the external program. When using this command, fetchmail will write to the program's standard input and read from its standard output.

--plugout command
Same as the --plugin option, but used to establish SMTP connections.

--plugout principal
Authenticate using the specified service principal. Used with POP3 or IMAP with Kerberos authentication.

--postmaster name
If unable to deliver mail, deliver it to name. Set name to "" to have undeliverable mail discarded.

-Q string, --qvirtual string
Remove the prefix string, which is the local user's hostid, from the address in the envelope header (such as "Delivered-To:").

-q, --quit
Kill a running daemon process before performing any other commands.

-r folder, --folder folder
Retrieve the specified mail folder from the mail server.

-S hostlist, -smtphost hostlist
Attempt to forward mail to one of the SMTP hosts listed in the comma-separated hostlist. The hosts are tried in the order they are given. The host may be a domain name, IP address, or the directory path to an LMTP socket. Port numbers can be appended to domain names and IP addresses using /port notation.

-s, --silent
Suppress status messages during a fetch.

--showdots
Always print progress dots. By default fetchmail prints progress dots only when the current tty is standard output.

--smtpname user
Specify the user and domain name to use in RCPT TO lines sent to SMTP. user should be in the form user@domain. By default, fetchmail uses the local user and domain.

-syslog
Redirect status and error messages to the syslog daemon.

--ssl
Encrypt connection to mail server using Secure Socket Layer.

--sslcert file
Specify the file containing the client-side public SSL certificate.

--sslkey file
Specify the file containing the client-side private SSL key.

--sslproto proto
Specify a specific SSL protocol to use. proto may be ssl2, ssl3, or tls1.

--sslcertck
Fail unless the server's certificate has been signed by a local list of trusted certificates. proto may be ssl2, ssl3, or tls1.

--sslcertpath directory
Specify the directory containing trusted certificates to be used with --sslcertck.

--sslfingerprint hash
Fail unless the server's key fingerprint matches the specified fingerprint hash. hash is an MD5 hash of the server's key given in hexadecimal notation, using colons to separate groups of two digits. Letter hex digits must be in uppercase.

-t n, --timeout n
Set the non-response timeout to n seconds.

--tracepolls
Add information about the account and server being polled to the Received header of each message received.

-U, --uidl
For POP3, track the age of kept messages via unique ID listing.

-u name, --username name
Specify the user name to use when logging into the mail server.

-V, --version
Print the version information for fetchmail and display the options set for each mail server. Perform no fetch.

-v, --verbose
Display all status messages during a fetch.

-w n, --warnings n
When issuing warnings about oversized messages, wait n seconds after each warning before sending another warning.

-Z nnn, --antispam nnn
Specify the SMTP error nnn to signal a spam block from the client. If nnn is -1, this option is disabled. Multiple SMTP codes may be given as a comma-separated list. By default fetchmail discards messages with error codes 571, 550, 501, and 554.

find

find [pathnames] [conditions]

An extremely useful command for finding particular groups of files (numerous examples follow this description). find descends the directory tree beginning at each pathname and locates files that meet the specified conditions. The default pathname is the current directory. The most useful conditions include -print (which is the default if no other expression is given), -name and -type (for general use), -exec and -size (for advanced use), and -mtime and -user (for administrators).

Conditions may be grouped by enclosing them in \( \) (escaped parentheses), negated with ! (use \! in tcsh), given as alternatives by separating them with -o, or repeated (adding restrictions to the match; usually only for -name, -type, or -perm). Note that "modification" refers to editing of a file's contents, whereas "change" means a modification, or permission or ownership changes. In other words, -ctime is more inclusive than -atime or -mtime.

Conditions and actions

-atime +n | -n | n
Find files that were last accessed more than n (+n), less than n (-n), or exactly n days ago. Note that find changes the access time of directories supplied as pathnames.

-ctime +n | -n | n
Find files that were changed more than n (+n), less than n (-n), or exactly n days ago. A change is anything that changes the directory entry for the file, such as a chmod.

-depth
Descend the directory tree, skipping directories and working on actual files first, and then the parent directories. Useful when files reside in unwritable directories (e.g., when using find with cpio).

-exec command { } \;
Run the Linux command, from the starting directory on each file matched by find (provided command executes successfully on that file, i.e., returns a 0 exit status). When command runs, the argument { } substitutes the current file. Follow the entire sequence with an escaped semicolon (\;). In some shells, the braces may need to be escaped as well.

-follow
Follow symbolic links and track the directories visited (don't use with -type l).

-group gname
Find files belonging to group gname. gname can be a group name or a group ID number.

-inum n
Find files whose inode number is n.

-links n
Find files having n links.

-mount, -xdev
Search only for files that reside on the same filesystem as pathname.

-mtime +n | -n | n
Find files that were last modified more than n (+n), less than n (-n), or exactly n days ago. A modification is a change to a file's data.

-name pattern
Find files whose names match pattern. Filename metacharacters may be used but should be escaped or quoted.

-newer file
Find files that were modified more recently than file; similar to -mtime. Affected by -follow only if it occurs after -follow on the command line.

-ok command { }\;
Same as -exec, but prompts user to respond with y before command is executed.

-perm nnn
Find files whose permission flags (e.g., rwx) match octal number nnn exactly (e.g., 664 matches -rw-rw-r--). Use a minus sign before nnn to make a "wildcard" match of any unspecified octal digit (e.g., -perm -600 matches -rw-******, where * can be any mode).

-print
Print the matching files and directories, using their full pathnames. Return true.

-regex pattern
Like -path, but uses grep-style regular expressions instead of the shell-like globbing used in -name and -path.

-size n[c]
Find files containing n blocks, or if c is specified, n characters long.

-type c
Find files whose type is c. c can be b (block special file), c (character special file), d (directory), p (fifo or named pipe), l (symbolic link), s (socket), or f (plain file).

-user user
Find files belonging to user (name or ID).

-daystart
Calculate times from the start of the day today, not 24 hours ago.

-maxdepth num
Do not descend more than num levels of directories.

-mindepth num
Begin applying tests and actions only at levels deeper than num levels.

-noleaf
Normally, find assumes that each directory has at least two hard links that should be ignored (a hard link for its name and one for "."; i.e., two fewer "real" directories than its hard link count indicates). -noleaf turns off this assumption, a useful practice when find runs on non-Unix-style filesystems. This forces find to examine all entries, assuming that some might prove to be directories into which it must descend (a time-waster on Unix).

-amin +n | -n | n
Find files last accessed more than n (+n), less than n (-n), or exactly n minutes ago.

-anewer file
Find files that were accessed after file was last modified. Affected by -follow when after -follow on the command line.

-cmin +n | -n | n
Find files last changed more than n (+n), less than n (-n), or exactly n minutes ago.

-cnewer file
Find files that were changed after they were last modified. Affected by -follow when after -follow on the command line.

-empty
Continue if file is empty. Applies to regular files and directories.

-false
Return false value for each file encountered.

-fstype type
Match files only on type filesystems. Acceptable types include minix, ext, ext2, xia, msdos, umsdos, vfat, proc, nfs, iso9660, hpfs, sysv, smb, and ncpfs.

-gid num
Find files with numeric group ID of num.

-ilname pattern
A case-insensitive version of -lname.

-iname pattern
A case-insensitive version of -name.

-ipath pattern
A case-insensitive version of -path.

-iregex pattern
A case-insensitive version of -regex.

-lname pattern
Search for files that are symbolic links, pointing to files named pattern. pattern can include shell metacharacters and does not treat / or . specially. The match is case-insensitive.

-mmin +n | -n | n
Find files last modified more than n (+n), less than n (-n), or exactly n minutes ago.

-nouser
The file's user ID does not correspond to any user.

-nogroup
The file's group ID does not correspond to any group.

-path pattern
Find files whose names match pattern. Expect full pathnames relative to the starting pathname (i.e., do not treat / or . specially).

Examples

List all files (and subdirectories) in your home directory:

find $HOME -print

List all files named chapter1 in the /work directory:

find /work -name chapter1

List all files beginning with memo owned by ann:

find /work -name 'memo*' -user ann -print

Search the filesystem (begin at root) for manpage directories:

find / -type d -name 'man*' -print

Search the current directory, look for filenames that don't begin with a capital letter, and send them to the printer:

find . \! -name '[A-Z]*' -exec lpr {  }\;

Find and compress files whose names don't end with .gz:

gzip `find . \! -name '*.gz' -print`

Remove all empty files on the system (prompting first):

find / -size 0 -ok rm {  } \;

Search the system for files that were modified within the last two days (good candidates for backing up):

find / -mtime -2 -print

Recursively grep for a pattern down a directory tree:

find /book -print | xargs grep '[Nn]utshell'

If the files kt1 and kt2 exist in the current directory, their names can be printed with the command:

$ find . -name 'kt[0-9]'
./kt1
./kt2

Since the command prints these names with an initial ./ path, you need to specify the ./ when using the -path option:

$ find . -path './kt[0-9]'
./kt1
./kt2

The -regex option uses a complete pathname, like -path, but treats the following argument as a regular expression rather than a glob pattern (although in this case the result is the same):

$ find . -regex './kt[0-9]'
./kt1
./kt2
finger

finger [options] users

Display data about one or more users, including information listed in the files .plan and .project in each user's home directory. You can specify each user either as a login name (exact match) or as a first or last name (display information on all matching names). Networked environments recognize arguments of the form user@host and @host.

Options

-l
Force long format (default): everything included by the -s option and home directory, home phone, login shell, mail status, .plan, .project, and .forward.

-m
Suppress matching of users' "real" names.

-p
Omit .plan and .project files from display.

-s
Show short format: login name, real name, terminal name, write status, idle time, office location, and office phone number.

flex

flex [options] [file]

flex (Fast Lexical Analyzer Generator) is a faster variant of lex. It generates a lexical analysis program (named lex.yy.c) based on the regular expressions and C statements contained in one or more input files. See also bison, yacc, and the O'Reilly book lex & yacc.

Options

-b
Generate backup information to lex.backup.

-d
Debug mode.

-f
Use faster compilation (limited to small programs).

-h
Help summary.

-i
Scan case-insensitively.

-l
Maximum lex compatibility.

-o file
Write output to file instead of lex.yy.c.

-p
Print performance report.

-s
Exit if the scanner encounters input that does not match any of its rules.

-t
Print to standard output. (By default, flex prints to lex.yy.c.)

-v
Print a summary of statistics.

-w
Suppress warning messages.

-B
Generate batch (noninteractive) scanner.

-F
Use the fast scanner table representation.

-I
Generate an interactive scanner (default).

-L
Suppress #line directives in lex.yy.c.

-P prefix
Change default yy prefix to prefix for all globally visible variable and function names.

-V
Print version number.

-7
Generate a 7-bit scanner.

-8
Generate an 8-bit scanner (default).

-+
Generate a C++ scanner class.

-C
Compress scanner tables but do not use equivalence classes.

-Ca
Align tables for memory access and computation. This creates larger tables but gives faster performance.

-Ce
Construct equivalence classes. This creates smaller tables and sacrifices little performance (default).

-Cf
Generate full scanner tables, not compressed.

-CF
Generate faster scanner tables, like -F.

-Cm
Construct metaequivalence classes (default).

-Cr
Bypass use of the standard I/O library; use read( ) system calls instead.

formail

formail [options]

Filter standard input into mailbox format. Useful for splitting mail digests or passing the contents of a mail file to another program such as a spam filter for additional processing. If no sender is apparent, provide the sender foo@bar. By default, escape bogus From lines with >.

Options

+skip
Do not split first skip messages.

-total
Stop after splitting total messages.

-a headerfield
Append headerfield to header, unless it already exists. If headerfield is Message-ID or Resent-Message-ID with no contents, generate a unique message ID.

-b
Do not escape bogus From lines.

-c
When header fields are more than one line long, concatenate the lines.

-d
Do not assume that input must be in strict mailbox format. This option disables recognition of the Content-Length field so you can split digests or use nonstandard mailbox formats

-e
Allow messages to begin one immediately after the other; do not require empty space between them.

-f
Do not edit non-mailbox-format lines. By default, formail prepends From to such lines.

-i headerfield
Append headerfield whether or not it already exists. Rename each existing headerfield to Old-headerfield, unless it is empty.

-k
For use only with -r. Keep the body as well as the fields specified by -r.

-m minfields
Require at least minfields before recognizing the beginning of a new message. Default is 2.

-n
Allow simultaneous formail processes to run.

-p prefix
Escape lines with prefix instead of >.

-q
Do not display write errors, duplicate messages, and mismatched Content-Length fields. This is the default; use -q- to turn it off.

-r
Throw away all existing fields, retaining only X-Loop, and generate autoreply header instead. You can preserve particular fields with the -i option.

-s
Must be the last option; everything following it will be assumed to be its arguments. Divide input to separate mail messages, and pipe them to the program specified or concatenate them to standard output (by default).

-t
Assume sender's return address to be valid. (By default, formail favors machine-generated addresses.)

-u headerfield
Delete all but the first occurrence of headerfield.

-x headerfield
Display the contents of headerfield on a single line.

-z
When necessary, add a space between field names and contents. Remove ("zap") empty fields.

-A headerfield
Append headerfield whether or not it already exists.

-B
Assume that input is in BABYL rmail format.

-D maxlen idcache
Remember old message IDs (in idcache, which will grow no larger than approximately maxlen). When splitting, refuse to output duplicate messages. Otherwise, return true on discovering a duplicate. With -r, look at the sender's mail address instead of the message ID.

-I headerfield
Append headerfield whether or not it already exists. Remove existing fields.

-R oldfield newfield
Change all fields named oldfield to newfield.

-U headerfield
Delete all but the last occurrence of headerfield.

-Y
Format in traditional Berkeley style (i.e., ignore Content-Length fields).

-X headerfield
Display the field name and contents of headerfield on a single line.

ftp

ftp [options] [hostname]

Transfer files to and from remote network site hostname. ftp prompts the user for a command. The commands are listed after the options. Some of the commands are toggles, meaning they turn on a feature when it is off and vice versa. Note that versions may have different options.

Options

-d
Enable debugging.

-g
Disable filename globbing.

-i
Turn off interactive prompting.

-n
No autologin upon initial connection.

-v
Verbose. Show all responses from remote server.

Commands

![command [args]]
Invoke an interactive shell on the local machine. If arguments are given, the first is taken as a command to execute directly, with the rest of the arguments as that command's arguments.

$macro-name [args]
Execute the macro macro-name that was defined with the macdef command. Arguments are passed to the macro unglobbed.

account [passwd]
Supply a supplemental password that will be required by a remote system for access to resources once a login has been successfully completed. If no argument is given, the user will be prompted for an account password in a non-echoing mode.

append local-file [remote-file]
Append a local file to a file on the remote machine. If remote-file is not given, the local filename is used after being altered by any ntrans or nmap setting. File transfer uses the current settings for type, format, mode, and structure.

ascii
Set the file transfer type to network ASCII (default).

bell
Sound a bell after each file transfer command is completed.

binary
Set file transfer type to support binary image transfer.

bye
Terminate FTP session and then exit ftp.

case
Toggle remote computer filename case mapping during mget. The default is off. When case is on, files on the remote machine with all-uppercase names will be copied to the local machine with all-lowercase names.

cd remote-directory
Change working directory on remote machine to remote-directory.

cdup
Change working directory of remote machine to its parent directory.

chmod [mode] [remote-file]
Change file permissions of remote-file. If options are omitted, the command prompts for them.

close
Terminate FTP session and return to command interpreter.

cr
Toggle carriage return stripping during ASCII-type file retrieval.

delete remote-file
Delete file remote-file on remote machine.

debug [debug-value]
Toggle debugging mode. If debug-value is specified, it is used to set the debugging level.

dir [remote-directory] [local-file]
Print a listing of the contents in the directory remote-directory and, optionally, place the output in local-file. If no directory is specified, the current working directory on the remote machine is used. If no local file is specified or - is given instead of the filename, output comes to the terminal.

disconnect
Synonym for close.

form format
Set the file transfer form to format. Default format is file.

get remote-file [local-file]
Retrieve the remote-file and store it on the local machine. If the local filename is not specified, it is given the same name it has on the remote machine, subject to alteration by the current case, ntrans, and nmap settings. If local file is -, output comes to the terminal.

glob
Toggle filename expansion for mdelete, mget, and mput. If globbing is turned off, the filename arguments are taken literally and not expanded.

hash
Toggle hash sign (#) printing for each data block transferred.

help [command]
Print help information for command. With no argument, ftp prints a list of commands.

idle [seconds]
Get/set idle timer on remote machine. seconds specifies the length of the idle timer; if omitted, the current idle timer is displayed.

image
Same as binary.

lcd [directory]
Change working directory on local machine. If directory is not specified, the user's home directory is used.

ls [remote-directory] [local-file]
Print listing of contents of directory on remote machine, in a format chosen by the remote machine. If remote-directory is not specified, current working directory is used.

macdef macro-name
Define a macro. Subsequent lines are stored as the macro macro-name; a null line terminates macro input mode. When $i is included in the macro, loop through arguments, substituting the current argument for $i on each pass. Escape $ with \.

mdelete remote-files
Delete the remote-files on the remote machine.

mdir remote-files local-file
Like dir, except multiple remote files may be specified.

mget remote-files
Expand the wildcard expression remote-files on the remote machine and do a get for each filename thus produced.

mkdir directory-name
Make a directory on the remote machine.

mls remote-files local-file
Like nlist, except multiple remote files may be specified, and the local file must be specified.

mode [mode-name]
Set file transfer mode to mode-name. Default mode is stream mode.

modtime [file-name]
Show last modification time of the file on the remote machine.

mput [local-files]
Expand wildcards in local-files given as arguments and do a put for each file in the resulting list.

newer remote-file [local-file]
Get file if remote file is newer than local file.

nlist [remote-directory] [local-file]
Print list of files in a directory on the remote machine to local-file (or to the screen if local-file is not specified). If remote-directory is unspecified, the current working directory is used.

nmap [inpattern outpattern]
Set or unset the filename mapping mechanism. The mapping follows the pattern set by inpattern, a template for incoming filenames, and outpattern, which determines the resulting mapped filename. The sequences $1 through $9 are treated as variables; for example, the inpattern $1.$2, along with the input file readme.txt, would set $1 to readme and $2 to txt. An outpattern of $1.data would result in an output file of readme.data. $0 corresponds to the complete filename. [string1, string2] is replaced by string1 unless that string is null, in which case it's replaced by string2.

ntrans [inchars [outchars ]]
Set or unset the filename character translation mechanism. Characters in a filename matching a character in inchars are replaced with the corresponding character in outchars. If no arguments are specified, the filename mapping mechanism is unset. If arguments are specified:

  • Characters in remote filenames are translated during mput and put commands issued without a specified remote target filename.

  • Characters in local filenames are translated during mget and get commands issued without a specified local target filename.

open host [port]
Establish a connection to the specified host FTP server. An optional port number may be supplied, in which case ftp will attempt to contact an FTP server at that port.

prompt
Toggle interactive prompting.

proxy ftp-command
Execute an FTP command on a secondary control connection (i.e., send commands to two separate remote hosts simultaneously).

put local-file [remote-file]
Store a local file on the remote machine. If remote-file is left unspecified, the local filename is used after processing according to any ntrans or nmap settings in naming the remote file. File transfer uses the current settings for type, file, structure, and transfer mode.

pwd
Print name of the current working directory on the remote machine.

quit
Synonym for bye.

quote arg1 arg2...
Send the arguments specified, verbatim, to the remote FTP server.

recv remote-file [local-file]
Synonym for get.

reget remote-file [local-file]
Retrieve a file (like get), but restart at the end of local-file. Useful for restarting a dropped transfer.

remotehelp [command-name]
Request help from the remote FTP server. If command-name is specified, remote help for that command is returned.

remotestatus [filename]
Show status of the remote machine or, if filename is specified, of filename on remote machine.

rename [from] [to]
Rename file from on remote machine to to.

reset
Clear reply queue.

restart marker
Restart the transfer of a file from a particular byte count.

rmdir [directory-name]
Delete a directory on the remote machine.

runique
Toggle storing of files on the local system with unique filenames. When this option is on, rename files as .1 or .2, and so on, as appropriate, to preserve unique filenames, and report each such action. Default value is off.

send local-file [remote-file]
Synonym for put.

sendport
Toggle the use of PORT commands.

site [command]
Get/set site-specific information from/on remote machine.

size filename
Return size of filename on remote machine.

status
Show current status of ftp.

struct [struct-name]
Set the file transfer structure to struct-name. By default, stream structure is used.

sunique
Toggle storing of files on remote machine under unique filenames.

system
Show type of operating system running on remote machine.

tenex
Set file transfer type to that needed to talk to TENEX machines.

trace
Toggle packet tracing.

type [type-name]
Set file transfer type to type-name. If no type is specified, the current type is printed. The default type is network ASCII.

umask [mask]
Set user file-creation mode mask on the remote site. If mask is omitted, the current value of the mask is printed.

user username [password] [account]
Identify yourself to the remote FTP server. ftp will prompt the user for the password (if not specified and the server requires it) and the account field.

verbose
Toggle verbose mode.

? [command]
Same as help.

ftpd

in.ftpd [options]

TCP/IP command. Internet File Transfer Protocol server. The server uses the TCP protocol and listens at the port specified in the ftp service specification. ftpd is started by inetd and must have an entry in inetd's configuration file, /etc/inetd.conf. There are several FTP daemons available. On many Linux distributions the default is wu-ftpd, which we document here.

Options

-a
Read access information from configuration file /etc/ftpaccess.

-d, -v
Write debugging information to syslogd.

-i
Log all files received in the transfer log /var/log/xferlog.

-l
Log each FTP session in syslogd.

-o
Log all files sent in the transfer log /var/log/xferlog.

-pport
Use port as the FTP control port instead of reading the appropriate port from /etc/services. Works only in standalone mode.

-q
Use PID files to record the process IDs of running daemons. This is the default. These files are needed to determine the current number of users.

-rdir
Change system root (chroot) to specified directory when loaded.

-s
Run ftpd standalone in the foreground.

-ttimeout
Set default timeout period to timeout seconds.

-uumask
Set default umask to umask.

-w
Record user logins in the wtmp file. This is the default.

-x
Used with options -i and -o. Log file transfers to syslogd as well as the tranfer log.

-z option
Set Transport Security Layer (TSL) option for Secure Socket Layers. See wu-ftpd documentation for more details.

-A
Do not read access information from configuration file /etc/ftpaccess. This is the default.

-I
Do not use ident to determine client's remote username.

-L
Log all commands sent to ftpd in syslogd. This option is overriden by option -a.

-Pport
Use port as the FTP data port instead of reading the appropriate port from /etc/services.

-Q
Do not use PID files to record the process IDs of running daemons. Without PID files, there is no imposed limit to the number of concurrent users.

-S
Run ftpd standalone in the background.

-Tmaxtimeout
Set maximum timeout period in seconds. Default limit is 15 minutes.

-U
Record user logins in the utmp file. By default, logins are not recorded.

-V
Print version, then exit.

-W
Do not record user logins in the wtmp file.

-X
Used with options -i and -o. Log file transfers to syslogd instead of the tranfer log.

fuser

fuser [options] [files | filesystems]

Identifies and outputs the process IDs of processes that are using the files or local filesystems. Each process ID is followed by a letter code: c if process is using file as the current directory; e if executable; f if an open file; m if a shared library; and r if the root directory. Any user with permission to read /dev/kmem and /dev/mem can use fuser, but only a privileged user can terminate another user's process. fuser does not work on remote (NFS) files.

If more than one group of files is specified, the options may be respecified for each additional group of files. A lone dash (-) cancels the options currently in force, and the new set of options applies to the next group of files. Like a number of other administrator commands, fuser is usually installed to the /sbin directory. You may need to add that directory to your path or execute the command as /sbin/fuser.

Options

-
Return all options to defaults.

-signal
Send signal instead of SIGKILL.

-a
Display information on all specified files, even if they are not being accessed by any processes.

-i
Request user confirmation to kill a process. Ignored if -k is not also specified.

-k
Send SIGKILL signal to each process.

-l
List signal names.

-m
Expect files to exist on a mounted filesystem; include all files accessing that filesystem.

-n space
Set the namespace checked for usage. Acceptable values are file for files, udp for local UPD ports, and tcp for local TCP ports.

-s
Silent.

-u
User login name, in parentheses, also follows process ID.

-v
Verbose.

-V
Display version information.

gcc

gcc [options] files

GNU Compiler Collection. gcc, formerly known as the GNU C Compiler, compiles multiple languages (C, C++, Objective-C, Ada, FORTRAN, and Java) to machine code. Here we document its use to compile C, C++, or Objective-C code. gcc compiles one or more programming source files; for example, C source files (file.c), assembler source files (file.s), or preprocessed C source files (file.i). If the file suffix is not recognizable, assume that the file is an object file or library. gcc normally invokes the C preprocessor, compiles the process code to assemble language code, assembles it, and then links it with the link editor. This process can be stopped at one of these stages using the -c, -S, or -E option. The steps may also differ depending on the language being compiled. By default, output is placed in a.out. In some cases, gcc generates an object file having a .o suffix and a corresponding root name.

Preprocessor and linker options given on the gcc command line are passed on to these tools when they are run. These options are briefly described here, but some are more fully described under entries for cpp, as, and ld. The options that follow are divided into general, preprocessor, linker, and warning options. gcc accepts many system-specific options not covered here.

Note: gcc is the GNU form of cc; on most Linux systems, the command cc will invoke gcc. The command g++ will invoke gcc with the appropriate options for interpreting C++.

General options

-a
Provide profile information for basic blocks.

-aux-info file
Print prototyped declarations and information on their origins to file.

-ansi
Enforce full ANSI conformance.

-b machine
Compile for use on machine type.

-c
Create linkable object file for each source file, but do not call linker.

-dumpmachine
Print compiler's default target machine, then exit.

-dumpspecs
Print built-in specification strings, then exit.

-dumpversion
Print version number, then exit.

-foption
Set the specified compiler option. Many of these control debugging, optimization of code, and special language options. Use the --help -v options for a full listing.

-g
Include debugging information for use with gdb.

-glevel
Provide level amount of debugging information. level must be 1, 2, or 3, with 1 providing the least amount of information. The default is 2.

--help
Print most common basic options, then exit. When used with option -v, print options for all of gcc's subprocesses. For options specific to a target, use --target-help.

-moption
Set the specified machine specific option. Use the --target-help option for a full listing.

-o file
Specify output file as file. Default is a.out.

-p
Provide profile information for use with prof.

-pass-exit-codes
On error, return highest error code as the exit code instead of 1.

-pedantic
Warn verbosely.

-pedantic-errors
Generate an error in every case in which -pedantic would have produced a warning.

-pg
Provide profile information for use with gprof.

-print-file-name=file
Print the full path to the library specified by filename file, then exit. This is the library gcc would use for linking.

-print-search-dirs
Print installation directory and the default list of directories gcc will search to find programs and libraries, then exit.

-pipe
Transfer information between stages of compiler by pipes instead of temporary files.

-save-temps
Save temporary files in the current directory when compiling.

-std=standard
Specify C standard of input file. Accepted values are:

iso9899:1990, c89
1990 ISO C standard.

iso9899:199409
1994 amendment to the 1990 ISO C standard.

iso9899:1999, c99, iso9899:199x, c9x
1999 revised ISO C standard.

gnu89
1990 C Standard with GNU extensions (the default value).

gnu99, gnu9x
1999 revised ISO C standard with GNU extensions.

-time
Print statistics on the execution of each subprocess.

-v
Verbose mode. Print subprocess commands to standard error as they are executed. Include gcc version number and preprocessor version number. To generate the same output without executing commands, use the option -###.

-w
Suppress warnings.

-x language
Expect input file to be written in language, which may be c, objective-c, c-header, c++, ada, f77, ratfor, assembler, java, cpp-output, c++-cpp-output, objc-cpp-output, f77-cpp-output, assembler-with-cpp, or ada. If none is specified as language, guess the language by filename extension.

-Bpath
Specify the path directory in which the compiler files are located.

-E
Preprocess the source files, but do not compile. Print result to standard output. This option is useful to meaningfully pass some cpp options that would otherwise break gcc, such as -C, -M, or -P.

-Idir
Include dir in list of directories to search for include files. If dir is -, search those directories specified by -I before the -I- only when #include "file" is specified, not #include <file>.

-Ldir
Search dir in addition to standard directories.

-O[level]
Optimize. level should be 1, 2, 3, or 0 (the default is 1). 0 turns off optimization; 3 optimizes the most.

-S
Compile source files into assembler code, but do not assemble.

-V version
Attempt to run gcc version version.

-Wa,options
Pass options to the assembler. Multiple options are separated by commas.

-Wl,options
Pass options to the linker. Multiple options are separated by commas.

-Wp,options
Pass options to the preprocessor. Multiple options are separated by commas.

-Xlinker options
Pass options to the linker. A linker option with an argument requires two -Xlinkers, the first specifying the option and the second specifying the argument. Similar to -Wl.

Preprocessor options

gcc will pass the following options to the preprocessor:

-$
Do not allow $ in identifiers.

-dD, -dI, -dM, -dN
Suppress normal output; print preprocessor instructions instead. See cpp for details.

-idirafter dir
Search dir for header files when a header file is not found in any of the included directories.

-imacros file
Process macros in file before processing main files.

-include file
Process file before main file.

-iprefix prefix
When adding directories with -iwithprefix, prepend prefix to the directory's name.

-isystem dir
Search dir for header files after searching directories specified with -I but before searching standard system directories.

-iwithprefix dir
Append dir to the list of directories to be searched when a header file cannot be found in the main include path. If -iprefix has been set, prepend that prefix to the directory's name.

-iwithprefixbefore dir
Insert dir at the beginning of the list of directories to be searched when a header file cannot be found in the main include path. If -iprefix has been set, prepend that prefix to the directory's name.

-nostdinc
Search only specified, not standard, directories for header files.

-nostdinc++
Suppress searching of directories believed to contain C++-specific header files.

-trigraphs
Convert special three-letter sequences, meant to represent missing characters on some terminals, into the single character they represent.

-undef
Suppress definition of all nonstandard macros.

-A name[=def]
Assert name with value def as if defined by #assert. To turn off standard assertions, use -A-.

-A -name[=def]
Cancel assertion name with value def.

-C
Retain all comments except those found on cpp directive lines. By default, the preprocessor strips C-style comments.

-Dname[=def]
Define name with value def as if by #define. If no =def is given, name is defined with value 1. -D has lower precedence than -U.

-H
Print pathnames of included files, one per line, on standard error.

-M, -MG, -MF, -MD, -MMD, -MQ, -MT
Suppress normal output and print Makefile rules describing file dependencies. Print a rule for make that describes the main source file's dependencies. If -MG is specified, assume that missing header files are actually generated files, and look for them in the source file's directory. Most of these options imply -E. See cpp for further details.

-Uname
Remove definition of symbol name.

Linker options

gcc will pass the following options to the linker:

-llib
Link to lib.

-nostartfiles
Force linker to ignore standard system startup files.

-nostdlib
Suppress linking to standard library files.

-s
Remove all symbol table and relocation information from the executable.

-shared
Create a shareable object.

-shared-libgcc
Link to a shared version of libgcc if available.

-static
Suppress linking to shared libraries.

-static-libgcc
Link to a static version of libgcc if available.

-u symbol
Force the linker to search libraries for a definition of symbol, and to link to the libraries found.

Warning options

-pedantic
Warn verbosely.

-pedantic-errors
Produce a fatal error in every case in which -pedantic would have produced a warning.

-w
Don't print warnings.

-W
Warn more verbosely than normal.

-Waggregate-return
Warn if any functions that return structures or unions are defined or called.

-Wall
Enable -W, -Wchar-subscripts, -Wcomment, -Wformat, -Wimplicit, -Wmain, -Wmissing-braces, -Wparentheses, -Wreturn-type, -Wsequence-point, -Wswitch, -Wtemplate-debugging, -Wtrigraphs, -Wuninitialized, -Wunknown-pragmas, and -Wunused.

-Wcast-align
Warn when encountering instances in which pointers are cast to types that increase the required alignment of the target from its original definition.

-Wcast-qual
Warn when encountering instances in which pointers are cast to types that lack the type qualifier with which the pointer was originally defined.

-Wchar-subscripts
Warn when encountering arrays with subscripts of type char.

-Wcomment
Warn when encountering the beginning of a nested comment.

-Wconversion
Warn in particular cases of type conversions.

-Werror
Exit at the first error.

-Wformat
Warn about inappropriately formatted printfs and scanfs.

-Wimplicit
Warn when encountering implicit function or parameter declarations.

-Winline
Warn about illegal inline functions.

-Wmain
Warn about malformed main functions.

-Wmissing-braces
Enable more verbose warnings about omitted braces.

-Wmissing-declarations
Warn if a global function is defined without a previous declaration.

-Wmissing-prototypes
Warn when encountering global function definitions without previous prototype declarations.

-Wnested-externs
Warn if an extern declaration is encountered within a function.

-Wno-import
Don't warn about use of #import.

-Wparentheses
Enable more verbose warnings about omitted parentheses.

-Wpointer-arith
Warn when encountering code that attempts to determine the size of a function or void.

-Wredundant-decls
Warn if anything is declared more than once in the same scope.

-Wreturn-type
Warn about violations of sequence point rules defined in the C standard.

-Wreturn-type
Warn about functions defined without return types or with improper return types.

-Wshadow
Warn when a local variable shadows another local variable.

-Wstrict-prototypes
Insist that argument types be specified in function declarations and definitions.

-Wswitch
Warn about switches that skip the index for one of their enumerated types.

-Wtraditional
Warn when encountering code that produces different results in ANSI C and traditional C.

-Wtrigraphs
Warn when encountering trigraphs.

-Wuninitialized
Warn when encountering uninitialized automatic variables.

-Wundef
Warn when encountering a non-macro identifier in an #if directive.

-Wunknown-pragmas
Warn when encountering a #pragma directive not understood by gcc.

-Wunused
Warn about unused variables, functions, labels, and paramaters.

Pragma directives

#pragma interface [header-file]
Used in header files to force object files to provide definition information via references instead of including it locally in each file. C++-specific.

#pragma implementation [header-file]
Used in main input files to force generation of full output from header-file (or, if it is not specified, from the header file with the same base name as the file containing the pragma directive). This information will be globally visible. Normally the specified header file contains a #pragma interface directive.

gdb

gdb [options] [program [core|pid]]

GDB (GNU DeBugger) allows you to step through the execution of a program in order to find the point at which it breaks. It fully supports C and C++, and provides partial support for FORTRAN, Java, Chill, assembly, and Modula-2. The program to be debugged is normally specified on the command line; you can also specify a core or, if you want to investigate a running program, a process ID.

Options

-b bps
Set line speed of serial device used by GDB to bps.

-batch
Exit after executing all the commands specified in .gdbinit and -x files. Print no startup messages.

-c file, -core=file
Consult file for information provided by a core dump.

-cd=directory
Use directory as gdb's working directory.

-d directory, -directory=directory
Include directory in path that is searched for source files.

-e file, -exec=file
Use file as an executable to be read in conjunction with source code. May be used in conjunction with -s to read the symbol table from the executable.

-f, -fullname
Show full filename and line number for each stack frame.

-h, -help
Print help message, then exit.

-n, -nx
Ignore .gdbinit file.

-q, -quiet
Suppress introductory and copyright messages.

-s file, -symbols=file
Consult file for symbol table. With -e, also uses file as the executable.

-tty=device
Set standard in and standard out to device.

-write
Allow gdb to write into executables and core files.

-x file, -command=file
Read gdb commands from file.

Common commands

These are just some of the more common gdb commands; there are too many to list them all.

bt
Print the current location within the program and a stack trace showing how the current location was reached. (where does the same thing.)

break
Set a breakpoint in the program.

cd
Change the current working directory.

clear
Delete the breakpoint where you just stopped.

commands
List commands to be executed when a breakpoint is hit.

c
Continue execution from a breakpoint.

delete
Delete a breakpoint or a watchpoint; also used in conjunction with other commands.

display
Cause variables or expressions to be displayed when program stops.

down
Move down one stack frame to make another function the current one.

frame
Select a frame for the next continue command.

info
Show a variety of information about the program. For instance, info breakpoints shows all outstanding breakpoints and watchpoints.

jump
Start execution at another point in the source file.

kill
Abort the process running under gdb's control.

list
List the contents of the source file corresponding to the program being executed.

next
Execute the next source line, executing a function in its entirety.

print
Print the value of a variable or expression.

ptype
Show the contents of a datatype, such as a structure or C++ class.

pwd
Show the current working directory.

quit
Exit gdb.

reverse-search
Search backward for a regular expression in the source file.

run
Execute the program.

search
Search for a regular expression in the source file.

set variable
Assign a value to a variable.

signal
Send a signal to the running process.

step
Execute the next source line, stepping into a function if necessary.

undisplay
Reverse the effect of the display command; keep expressions from being displayed.

until
Finish the current loop.

up
Move up one stack frame to make another function the current one.

watch
Set a watchpoint (i.e., a data breakpoint) in the program.

whatis
Print the type of a variable or function.

gpm

gpm [options]

System administration command. Provide a mouse server and cut-and-paste utility for use on the Linux console. gpm acts like a daemon, responding to both mouse events and client input. If no clients are connected to the active console, gpm provides cut-and-paste services.

Options

-2
Force two buttons. If there is a middle button, it is treated as the right button.

-3
Force three buttons. With a three-button mouse, the left button makes a selection, the right button extends the selection, and the middle button pastes it. Using this option with a two-button mouse results in being unable to paste.

-a accel
Set the acceleration for a single motion longer than the delta specified with the -d option.

-A [limit]
Start up with pasting disabled for security. If specified, limit gives the time in seconds during which a selection can be pasted. If too much time has passed, the paste is not allowed.

-b baud
Specify the baud rate.

-B seq
Set a three-digit button sequence, mapping the left, middle, and right buttons to buttons 1, 2, and 3. The default is 123. The sequence 321 is useful if you are left-handed, or 132 for a two-button mouse.

-d delta
Set the delta value for use with -a. When a mouse motion event is longer than the specified delta, use accel as a multiplier. delta must be 2 or greater.

-D
Debugging mode. When set, gpm does not put itself into the background, and it logs messages to standard error instead of syslog.

-g num
For a glidepoint device, specify the button to be emulated by a tap. num must be 1, 2, or 3 and refers to the button number before any remapping is done by the -B option. Applies to mman and ps2 protocol decoding.

-h
Print a help message and exit.

-i interval
Specify the upper time limit, in milliseconds, between mouse clicks for the clicks to be considered a double or triple click.

-k
Kill a running gpm. For use with a bus mouse to kill gpm before running X. See also -R.

-l charset
Specify the inword( ) lookup table, which determines what characters can appear in a word. charset is a list of characters. The list can include only printable characters. Specify a range with -, and use \ to escape the following character or to specify an octal character.

-m filename
Specify the mouse file to open. The default is /dev/mouse.

-M
Enable the use of more than one mouse. Options appearing before -M apply to the first mouse; those appearing after it apply to the second mouse. Forces the use of -R.

-o extra-options
Specify a comma-separated list of additional mouse-specific options. See the gpm info page for a description of the mouse types and the possible options.

-p
Keep the pointer visible while text is being selected. The default is not to show the pointer.

-r num
Specify the responsiveness. A higher number causes the cursor to move faster.

-R name
Act as a repeater and pass any mouse data received while in graphical mode to the fifo /dev/gpmdata in the protocol specified by name (default is msc). In addition to certain of the protocol types available with -t, you can specify raw to repeat the data with no protocol translation.

-s num
Specify the sample rate for the mouse device.

-S [commands]
Enable special-command processing (see the next section). Custom commands can be specified as a colon-separated list to associate commands with the left button, middle button, and right button. If a command is omitted, it defaults to sending a signal to init.

-t type
Specify the mouse protocol type. Use -t help for a list of types; those marked with an asterisk (*) can be used with -R.

-v
Print version information and exit.

-V [increment]
Make gpm more or less verbose by the specified increment. The default verbosity level is 5 and the default increment is 1. A larger value of increment causes more messages to be logged. The increment can be negative, but must be specified with no space (e.g., -V-3).

Special commands

Special commands, activated with the -S option, are associated with each mouse button. You can also use -S to customize the commands. To execute a special command, triple-click the left and right buttons (hold down one of the buttons and triple-click the other). A message appears on the console and the speaker beeps twice. At that point, release the buttons and press the desired button within three seconds to activate the associated special command. The default special commands are:

Left button
Reboot by signalling init.

Middle button
Shut down the system with /sbin/shutdown -h now.

Right button
Reboot with /sbin/shutdown -r now.

gprof

gprof [options] [object_file]

Display the profile data for an object file. The file's symbol table is compared with the call graph profile file gmon.out (previously created by compiling with gcc -pg). Many of gprof's options take a symbol specification argument, or symspec, to limit the option to specified files or functions. The symspec may be a filename, a function, or a line number. It can also be given as filename:function or filename:linenumber to specify a function or line number in a specific file. gprof expects filenames to contain a period and functions to not contain a period.

Options

-a, --no-static
Do not display statically declared functions. Since their information might still be relevant, append it to the information about the functions loaded immediately before.

-b, --brief
Do not display information about each field in the profile.

-c, --static-call-graph
Consult the object file's text area to attempt to determine the program's static call graph. Display static-only parents and children with call counts of 0.

--demangle[=style], --no-demangle
Specify whether C++ symbols should be demangled or not. They are demangled by default. If profiling a program built by a different compiler, you may need to specify the mangling style.

--function-ordering
Print suggested function order based on profiling data.

--file-ordering file
Print suggested link line order for .o files based on profiling data. Read function name to object file mappings from file. This file can be created using the nm command.

-i, --file-info
Print summary information on data files, then exit.

-k from to
Remove arcs between the routines from and to.

-m n, --min-count[=n]
Don't print count statistics for symbols executed less than n times.

-n[symspec], --time[=symspec]
Propogate time statistics in call graph analysis.

-p[symspec], --flat-profile[=symspec]
Print profile statistics.

-q[symspec], --graph[=symspec]
Print call graph analysis.

-s, --sum
Summarize profile information in the file gmon.sum.

-v, --version
Print version and exit.

-w n, --width=n
Print function index formatted to width n.

-x, --all-lines
When printing annotated source, annotate every line in a basic block, not just the beginning.

-y, --separate-files
Print annotated-source output to separate files instead of standard output. The annotated source for each source file is printed to filename-ann.

-z, --display-unused-functions
Include zero-usage calls.

-A[symspec], --annotated-source[=symspec]
Print annotated source code.

-C[symspec], --exec-counts[=symspec]
Print statistics on the number of times each function is called. When used with option -l, count basic-block execution.

-F routine
Print only information about routine. Do not include time spent in other routines.

-I dirs, --directory-path=dirs
Set directory path to search for source files. The dirs argument may be given as a colon-separated list of directories.

-J[symspec], --no-annotated-source[=symspec]
Don't print annotated source code.

-L, --print-path
Print the path information when printing filenames.

-N[symspec], --no-time[=symspec]
Don't propogate time statistics in call graph analysis.

-P[symspec], --no-flat-profile[=symspec]
Don't print profile statistics

-Q[symspec], --no-graph[=symspec]
Don't print call graph analysis.

-T, --traditional
Print output in BSD style.

-Z[symspec], --no-exec-counts[=symspec]
Don't print statistics on the number of times each function is called.

grep

grep [options] pattern [files]

Search one or more files for lines that match a regular expression pattern. Regular expressions are described in Chapter 9. Exit status is 0 if any lines match, 1 if none match, and 2 for errors. See also egrep and fgrep.

Options

-a, --text
Don't suppress output lines with binary data; treat as text.

-b, --byte-offset
Print the byte offset within the input file before each line of output.

-c, --count
Print only a count of matched lines. With -v or --revert-match option, count nonmatching lines.

-d action, --directories=action
Define an action for processing directories. Possible actions are:

read
Read directories like ordinary files (default).

skip
Skip directories.

recurse
Recursively read all files under each directory. Same as -r.

-e pattern, --regexp=pattern
Search for pattern. Same as specifying a pattern as an argument, but useful in protecting patterns beginning with -.

-f file, --file=file
Take a list of patterns from file, one per line.

-h, --no-filename
Print matched lines but not filenames (inverse of -l).

-i, --ignore-case
Ignore uppercase and lowercase distinctions.

-l, --files-with-matches
List the names of files with matches but not individual matched lines; scanning per file stops on the first match.

--mmap
Try to use memory mapping (mmap) to read input in order to save time.

-n, --line-number
Print lines and their line numbers.

-q, --quiet, --silent
Suppress normal output in favor of quiet mode; scanning stops on the first match.

-r, --recursive
Recursively read all files under each directory. Same as -d recurse.

-s, --no-messages
Suppress error messages about nonexistent or unreadable files.

-v, --invert-match
Print all lines that don't match pattern.

-w, --word-regexp
Match on whole words only. Words are divided by characters that are not letters, digits, or underscores.

-x, --line-regexp
Print lines only if pattern matches the entire line.

-A num, --after-context=num
Print num lines of text that occur after the matching line.

-B num, --before-context=num
Print num lines of text that occur before the matching line.

-C[num], --context[=num], -num
Print num lines of leading and trailing context. Default context is 2 lines.

-E, -extended-regexp
Act like egrep, recognizing extended regular expressions such as (UN|POS)IX to find UNIX and POSIX.

-F, --fixed-strings
Act like fgrep, recognizing only fixed strings instead of regular expressions. Useful when searching for characters that grep normally recognizes as metacharacters.

-G, --basic-regexp
Expect the regular expressions traditionally recognized by grep (the default).

-H, --with-filename
Display, before each line found, the name of the file containing the line. This is done by default if multiple files are submitted to a single grep command.

-V, --version
Print the version number and then exit.

-Z, --null
When displaying filenames, follow each with a zero byte instead of a colon.

Examples

List the number of users who use tcsh:

grep -c /bin/tcsh /etc/passwd

List header files that have at least one #include directive:

grep -l '^#include' /usr/include/*

List files that don't contain pattern:

grep -c pattern files | grep :0
groff

groff [options] [files]
troff [options] [files]

Frontend to the groff document-formatting system, which normally runs troff along with a postprocessor appropriate for the selected output device. Options without arguments can be grouped after a single dash (-). A filename of - denotes standard input.

Options

-a
Generate an ASCII approximation of the typeset output.

-b
Print a backtrace.

-C
Enable compatibility mode.

-dcs, -dname=s
Define the character c or string name to be the string s.

-e
Preprocess with eqn, the equation formatter.

-E
Don't print any error messages.

-ffam
Use fam as the default font family.

-Fdir
Search dir for subdirectories with DESC and font files before the default /usr/lib/groff/font.

-h
Print a help message.

-i
Read standard input after all files have been processed.

-l
Send the output to a print spooler (as specified by the print command in the device description file).

-Larg
Pass arg to the spooler. Each argument should be passed with a separate -L option.

-mname
Read the macro file tmac.name.

-Mdir
Search directory dir for macro files before the default directory /usr/lib/groff/tmac.

-nnum
Set the first page number to num.

-N
Don't allow newlines with eqn delimiters; equivalent to eqn's -N option.

-olist
Output only pages specified in list, a comma-separated list of page ranges.

-p
Preprocess with pic.

-Parg
Pass arg to the postprocessor. Each argument should be passed with a separate -P option.

-rcn, -name=n
Set the number register c or name to n. c is a single character and n is any troff numeric expression.

-R
Preprocess with refer.

-s
Preprocess with soelim.

-S
Use safer mode (i.e., pass the -S option to pic and use the -msafer macros with troff).

-t
Preprocess with tbl.

-Tdev
Prepare output for device dev; the default is ps.

-v
Make programs run by groff print out their version number.

-V
Print the pipeline on stdout instead of executing it.

-wname
Enable warning name. You can specify multiple -w options. See the troff manpage for a list of warnings.

-Wname
Disable warning name. You can specify multiple -W options. See the troff manpage for a list of warnings.

-z
Suppress troff output (except error messages).

-Z
Do not postprocess troff output. Normally groff automatically runs the appropriate postprocessor.

Devices

ascii
Typewriter-like device.

dvi
TEX dvi format.

latin1
Typewriter-like devices using the ISO Latin-1 character set.

ps
PostScript.

X75
75-dpi X11 previewer.

X100
100-dpi X11 previewer.

lj4
HP LaserJet4-compatible (or other PCL5-compatible) printer.

Environment variables

GROFF_COMMAND_PREFIX
If set to be X, groff will run Xtroff instead of troff.

GROFF_FONT_PATH
Colon-separated list of directories in which to search for the devname directory.

GROFF_TMAC_PATH
Colon-separated list of directories in which to search for the macro files.

GROFF_TMPDIR
If set, temporary files will be created in this directory; otherwise, they will be created in TMPDIR (if set) or /tmp (if TMPDIR is not set).

GROFF_TYPESETTER
Default device.

PATH
Search path for commands that groff executes.

groffer

groffer [viewing_options] [man_options] [groff_options] 
[file-spec...]
groffer filespec

Groffer displays manpages and groff documents. It accepts the option flags from both man and groff. The filespec argument can be a filename or a manpage or section specified in the format man:page or man:section. For more information, see groff and man.

gs

gs [options] [files]

GhostScript, an interpreter for Adobe Systems' PostScript and PDF (Portable Document Format) languages. Used for document processing. With - in place of files, standard input is used.

Options

-- filename arg1 ...
Take the next argument as a filename, but use all remaining arguments to define ARGUMENTS in userdict (not systemdict) as an array of those strings before running the file.

-gnumber1xnumber2
Specify width and height of device; intended for systems like the X Window System.

-q
Quiet startup.

-rnumber, -rnumber1xnumber2
Specify X and Y resolutions (for the benefit of devices, such as printers, that support multiple X and Y resolutions). If only one number is given, it is used for both X and Y resolutions.

-Dname=token, -dname=token
Define a name in systemdict with the given definition. The token must be exactly one token (as defined by the token operator) and must not contain any whitespace.

-Dname, -dname
Define a name in systemdict with a null value.

-Idirectories
Add the designated list of directories at the head of the search path for library files.

-Sname=string, -sname=string
Define a name in systemdict with a given string as value.

Special names

-dDISKFONTS
Causes individual character outlines to be loaded from the disk the first time they are encountered.

-dNOBIND
Disables the bind operator. Useful only for debugging.

-dNOCACHE
Disables character caching. Useful only for debugging.

-dNODISPLAY
Suppresses the normal initialization of the output device. May be useful when debugging.

-dNOPAUSE
Disables the prompt and pause at the end of each page.

-dNOPLATFONTS
Disables the use of fonts supplied by the underlying platform (e.g., the X Window System).

-dSAFER
Disables the deletefile and renamefile operators and the ability to open files in any mode other than read-only.

-dWRITESYSTEMDICT
Leaves systemdict writable.

-sDEVICE=device
Selects an alternate initial output device.

-sOUTPUTFILE=filename
Selects an alternate output file (or pipe) for the initial output device.

gzip

gzip [options] [files]
gunzip [options] [files]
zcat [options] [files]

Compress specified files (or read from standard input) with Lempel-Ziv coding (LZ77). Rename compressed file to filename.gz; keep ownership modes and access/modification times. Ignore symbolic links. Uncompress with gunzip, which takes all of gzip's options except those specified. zcat is identical to gunzip -c and takes the options -fhLV, described here. Files compressed with the compress command can be decompressed using these commands.

Options

-n, --fast, --best
Regulate the speed of compression using the specified digit n, where -1 or --fast indicates the fastest compression method (less compression) and -9 or --best indicates the slowest compression method (most compression). The default compression level is -6.

-a, --ascii
ASCII text mode: convert end-of-lines using local conventions. This option is supported only on some non-Unix systems.

-c, --stdout, --to-stdout
Print output to standard output, and do not change input files.

-d, --decompress, --uncompress
Same as gunzip.

-f, --force
Force compression. gzip would normally prompt for permission to continue when the file has multiple links, its .gz version already exists, or it is reading compressed data to or from a terminal.

-h, --help
Display a help screen and then exit.

-l, --list
Expects to be given compressed files as arguments. Files may be compressed by any of the following methods: gzip, deflate, compress, lzh, or pack. For each file, list uncompressed and compressed sizes (the latter being always -1 for files compressed by programs other than gzip), compression ratio, and uncompressed name. With -v, also print compression method, the 32-bit CRC of the uncompressed data, and the timestamp. With -N, look inside the file for the uncompressed name and timestamp.

-L, --license
Display the gzip license and quit.

-n, --no-name
When compressing, do not save the original filename and timestamp by default. When decompressing, do not restore the original filename if present, and do not restore the original timestamp if present. This option is the default when decompressing.

-N, --name
Default. Save original name and timestamp. When decompressing, restore original name and timestamp.

-q, --quiet
Print no warnings.

-r, --recursive
When given a directory as an argument, recursively compress or decompress files within it.

-S suffix, --suffix suffix
Append .suffix. Default is gz. A null suffix while decompressing causes gunzip to attempt to decompress all specified files, regardless of suffix.

-t, --test
Test compressed file integrity.

-v, --verbose
Print name and percent size reduction for each file.

-V, --version
Display the version number and compilation options.

hdparm

hdparm [options] [device]

Read or set the hard drive parameters. This command can be used to tune hard drive performance; it is mostly used with IDE drives, but can also be used with SCSI drives.

Options

The hdparm command accepts many option flags, including some that can result in filesystem corruption if misused. Flags can be used to set or get a parameter. To get a parameter, just pass the flag without a value. To set a parameter, follow the flag with a space and the appropriate value.

-a [n]
Get or set the number of sectors to read ahead in the disk. The default is 8 sectors (4KB); a larger value is more efficient for large, sequential reads, and a smaller value is better for small, random reads. Many IDE drives include this functionality in the drive itself, so this feature is not always necessary.

-A
Enable or disable the IDE read-ahead feature. Usually on by default.

-b [n]
Get or set the bus state for the drive.

-B
Get the Advanced Power Management (APM) data if the drive supports it.

-c [n]
Get or set 32-bit I/O values for IDE drives. Acceptable values are 0 (32-bit support off), 1 (32-bit support on), and 3 (on, but only with a sync sequence).

-C
Check the power status of the drive. This will tell you unknown, active/idle, standby, or sleeping. Use -S, -y, -Y, and -Z to set the power status.

-d [n]
Get or set the using_dma flag for the drive, which may be 0 or 1.

-D
Enable or disable defect handling features that are controlled by the hard drive itself.

-E n
Set CD-ROM read speed to n times normal audio playback speed. Not normally necessary.

-f
Flush and sync the buffer cache on exit.

-g
Query and display drive size and geometry information, such as number of cylinders, heads, and sectors.

-h
Display a short help message.

-i
Display the drive identification information obtained at boot time. If the drive has changed since boot, this information may not be current.

-I
Display more detailed identification information for the drive.

-k [n]
Get or set the keep_settings_over_reset variable. Valid settings are 0 and 1, and a value of 1 will keep the -dmu options when rebooting (soft reset only).

-K [n]
Get or set the keep_features_over_reset variable. Valid settings are 0 and 1, and a value of 1 will keep settings for the flags -APSWXZ over a soft reset.

-L n
Set the door lock flag for the drive. Used for Syquest, ZIP, and JAZ drives.

-m [n]
Get or set the number of sectors used for multiple sector count reading. A value of 0 disables the feature, and values of 2, 4, 8, 16, and 32 are common. Drives that try to support this feature and fail may suffer corruption and data loss.

-n [n]
Set to 0 or 1 to disable or enable the "ignore write errors" flag. This can cause massive data loss if used incorrectly, and is for development purposes only.

-p n
Tune the IDE interface to use PIO mode n, usually an integer between 0 and 5. Incorrect values can result in massive data loss. Support for the PIO mode setting feature varies between IDE chips, so tuning it is not for the faint of heart.

-P n
Set the internal prefetch sector count. Not all drives support the feature.

-q
Suppress output for the flag after this one, unless it is the -i, -v, -t, or -T flag.

-r [n]
Get or set the flag for read-only on the device. A value of 1 marks the device as read-only.

-R
This option should be used by experts only. It registers an IDE interface. See the -U option for further details.

-S n
Set the amount of time a disk is inactive before it spins down and goes into standby mode. Settings from 1 to 240 represent chunks of five seconds (for timeout values between 5 seconds and 20 minutes); values from 241 to 251 are increments of 30 minutes (for 30 minutes to 5.5 hours). A value of 252 sets the timeout to 21 minutes, 253 to the vendor default, and 255 to 20 minutes and 15 seconds.

-T
Time cache reads to determine performance.

-t
Time device reads to determine performance.

-u [n]
Get or set the interrupt-unmask value for the drive. A value of 1 lets the drive unmask other interrupts and can improve performance; used with older kernels and hardware it can cause data loss.

-U
Unregister an IDE interface. Use this feature and the -R feature only with hot-swappable hardware, such as very high-end servers and some laptops. It can damage or hang other systems and should be used with caution.

-v
Display all appropriate settings for device except -i.

-W
Enable or disable the write-cache feature for the drive. The default varies between drive manufacturers.

-X n
Set the IDE transfer mode. Possible values include 34 (multiword DMA mode2 transfers) and 66 (UltraDMA mode2 transfers), or any PIO mode number plus 8. This option is suggested for experts only, and is useful only with newer EIDE/IDE/ATA2 drives. Often used in combination with -d.

-y
Put the IDE drive into standby (spin-down) mode, saving power.

-Y
Put the IDE drive into sleep mode.

-z
Force kernel to reread the partition table.

-Z
Disable automatic powersaving on some drives, which can prevent them from idling or spinning down at inconvenient moments. This will increase the electrical power consumption of your system.

hexdump

hexdump [options] file

Display specified file or input in hexadecimal, octal, decimal, or ASCII format. Option flags are used to specify the display format.

Options

-b
Use a one-byte octal display, meaning the input offset is in hexadecimal and followed by sixteen three-column octal data bytes, filled in with zeroes and separated by spaces.

-c
Use a one-byte character display, meaning the input offset is in hexadecimal and followed by sixteen three-column entries, filled in with zeroes and separated with spaces.

-C
Canonical mode. Display hexadecimal offset, two sets of eight columns of hexadecimal bytes, then a | followed by the ASCII representation of those same bytes.

-d
Use a two-byte decimal display. The input offset is again in hexadecimal, but the display has only eight entries per line, of five columns each, containing two bytes of unsigned decimal format.

-e format_string
Choose a format string to be used to transform the output data. Format strings consist of:

Iteration count
The iteration count is optional. It determines the number of times to use the transformation string. The number should be followed by a slash character (/) to distinguish it from the byte count.

Byte count
The number of bytes to be interpreted by the conversion string. It should be preceded by a slash character to distinguish it from the iteration count.

Format characters
The actual format characters should be surrounded by quotation marks and are interpreted as fprintf (see printf) formatting strings, although the *, h, l, n, p, and q options will not work as expected. Format string usage is discussed at greater length in the hexdump manpage.

-f filename
Choose a file that contains several format strings. The strings should be separated by newlines; the # character marks a line as a comment.

-n length
Limit the number of bytes of input to be interpreted.

-o
Two-byte octal display, meaning a hexadecimal offset followed by eight five-column data entries of two bytes each, in octal format.

-s offset
Skip to specified offset. The offset number is assumed to be decimal unless it starts with 0x or 0X (hexadecimal), or O (octal). Numbers may also be designated in megabytes, kilobytes, or half-kilobytes with the addition of m, k, or b at the end of the number.

-v
Display all input data, even if it is the same as the previous line. Normally, a duplicate line is replaced by an asterisk (*).

-x
Display data in a two-byte hexadecimal format. The offset is, as usual, in hexadecimal, and is followed by eight space-separated entries, each of which contains four-column, two-byte chunks of data in hexadecimal format.

host

host [options] name [server]

System administration command. Print information about hosts or zones in DNS. Hosts may be IP addresses or hostnames; host converts IP addresses to hostnames by default and appends the local domain to hosts without a trailing dot. Default servers are determined in /etc/resolv.conf. For more information about hosts and zones, read Chapters 1 and 2 of DNS and BIND (O'Reilly).

Options

-a
Same as -t ANY.

-c class
Search for specified resource record class (IN, CH, CHAOS, HS, HESIOD, or ANY). Default is IN.

-d
Verbose output. Same as -v.

-l
Perform reverse lookups for IPv6 addresses using IP6.INT domain and "nibble" labels instead of IP6.ARPA and binary labels.

-n
Perform zone transfer. Same as -t AXFR.

-r
Do not ask contacted server to query other servers, but require only the information that it has cached.

-t type
Look for type entries in the resource record. type may be any recognized query type, such as A, AXFR, CNAME, NS, SOA, SIG, or ANY. If name is a hostname, host will look for A records by default. If name is an IPv4 or IPv6 address, it will look for PTR records.

-v
Verbose. Include all fields from resource record, even time-to-live and class, as well as "additional information" and "authoritative nameservers" (provided by the remote nameserver).

-w
Never give up on queried server.

-C
Display SOA records from all authoritative name servers for the specified zone.

-N n
Consider names with fewer than n dots in them to be relative. Search for them in the domains listed in the search and domain directives of /etc/resolv.conf. The default is usually 1.

-R n
Retry query a maximum of n times. The defalt is 1.

-T
Use TCP instead of UDP to query name server. This is implied in queries that require TCP, such as AXFR requests.

-W n
Wait a maximum of n seconds for reply.

ifconfig

ifconfig [interface]
ifconfig [interface address_family parameters addresses]

TCP/IP command. Assign an address to a network interface and/or configure network interface parameters. ifconfig is typically used at boot time to define the network address of each interface on a machine. It may be used at a later time to redefine an interface's address or other parameters. Without arguments, ifconfig displays the current configuration for a network interface. Used with a single interface argument, ifconfig displays that particular interface's current configuration.

Arguments

interface
String of the form name unit, for example, en0.

address_family
Since an interface may receive transmissions in differing protocols, each of which may require separate naming schemes, you can specify the address_family to change the interpretation of the remaining parameters. You may specify inet (for TCP/IP, the default), ax25 (AX.25 Packet Radio), ddp (Appletalk Phase 2), or ipx (Novell).

parameters
The following parameters may be set with ifconfig:

add address/prefixlength
Add an IPv6 address and prefix length.

allmulti/-allmulti
Enable/disable sending of incoming frames to the kernel's network layer.

arp/-arp
Enable/disable use of the Address Resolution Protocol in mapping between network-level addresses and link-level addresses.

broadcast [address]
(inet only) Specify address to use to represent broadcasts to the network. Default is the address with a host part of all 1s (i.e., x.y.z.255 for a class C network).

debug/-debug
Enable/disable driver-dependent debugging code.

del address/prefixlength
Delete an IPv6 address and prefix length.

down
Mark an interface "down" (unresponsive).

hw class address
Set the interface's hardware class and address. class may be ether (Ethernet), ax25 (AX.25 Packet Radio), or ARCnet.

io_addr addr
I/O memory start address for device.

irq addr
Set the device's interrupt line.

metric n
Set routing metric of the interface to n. Default is 0.

mem_start addr
Shared memory start address for device.

media type
Set media type. Common values are 10base2, 10baseT, and AUI. If auto is specified, ifconfig will attempt to autosense the media type.

mtu n
Set the interface's Maximum Transfer Unit (MTU).

multicast
Set the multicast flag.

netmask mask
(inet only) Specify how much of the address to reserve for subdividing networks into subnetworks. mask can be specified as a single hexadecimal number with a leading 0x, with a dot notation Internet address, or with a pseudo-network name listed in the network table /etc/networks.

pointopoint/-pointopoint [address]
Enable/disable point-to-point interfacing, so that the connection between the two machines is dedicated.

promisc/-promisc
Enable/disable promiscuous mode. Promiscuous mode allows the device to receive all packets on the network.

txqueuelen n
Specify the transmit queue length.

tunnel addr
Create an IPv6-in-IPv4 (SIT) device, tunneling to IPv4 address addr.

up
Mark an interface "up" (ready to send and receive).

addresses
Each address is either a hostname present in the hostname database (/etc/hosts), or an Internet address expressed in the Internet standard dot notation.

imake

imake options

C preprocessor (cpp) interface to the make utility. imake ("include make") solves the portability problem of make by allowing machine dependencies to be kept in a central set of configuration files, separate from the descriptions of the various items to be built. The targets are contained in the Imakefile, a machine-independent description of the targets to be built, written as cpp macros. imake uses cpp to process the configuration files and the Imakefile, and to generate machine-specific Makefiles, which can then be used by make.

One of the configuration files is a template file, a master file for imake. This template file (default is Imake.tmpl) #includes the other configuration files that contain machine dependencies such as variable assignments, site definitions, and cpp macros, and directs the order in which the files are processed. Each file affects the interpretation of later files and sections of Imake.tmpl. Comments may be included in imake configuration files, but the initial # needs to be preceded with an empty C comment:

/**/#

For more information, see cpp and make. Also check out the Nutshell Handbook Software Portability with imake (O'Reilly).

Options

-e
Execute the generated Makefile. Default is to leave this to the user.

-f filename
Name of per-directory input file. Default is Imakefile.

-s filename
Name of make description file to be generated. If filename is a -, the output is written to stdout. The default is to generate, but not execute, a Makefile.

-v
Print the cpp command line used to generate the Makefile.

-C filename
Use the specified name for the temporary input file for cpp instead of the default Imakefile.c.

-Ddefine
Set directory-specific variables. This option is passed directly to cpp.

-Idirectory
Directory in which imake template and configuration files may be found. This option is passed directly to cpp.

-Ttemplate
Name of master template file used by cpp. This file is usually located in the directory specified with the -I option. The default file is Imake.tmpl.

-Udefine
Unset directory-specific variables. This option is passed directly to cpp.

Tools

Following is a list of tools used with imake:

makedepend [options] files
Create header file dependencies in Makefiles. make depend reads the named input source files in sequence and parses them to process #include, #define, #undef, #ifdef, #ifndef, #endif, #if, and #else directives so that it can tell which #include directives would be used in a compilation. makedepend determines the dependencies and writes them to the Makefile. make then knows which object files must be recompiled when a dependency has changed. makedepend has the following options:

-- options --
Ignore any unrecognized options following a double hyphen. A second double hyphen terminates this action. Recognized options between the hyphens are processed normally.

-a
Append dependencies to any existing ones instead of replacing existing ones.

-ffilename
Write dependencies to filename instead of to Makefile.

-m
Print a warning when encountering a multiple inclusion.

-o suffix
Specify an object file suffix to use instead of the default .o.

-p prefix
Specify a prefix to prepend to object names. The prefix may be a directory.

-sstring
Use string as delimiter in file, instead of # DO NOT DELETE THIS LINE -- make depend depends on it.

-v
Verbose. List all files included by main source file.

-w n
Format output no wider than n characters. Default is 78.

-Dname
Define name with the given value (first form) or with value 1 (second form).

-Idir
Add directory dir to the list of directories searched.

-Ydir
Search only dir for include files. Ignore standard include directories.

mkdirhier dir...
Create directory dir and all missing parent directories during file installation operations.

xmkmf [option] [topdir] [curdir]
Bootstrap a Makefile from an Imakefile. topdir specifies the location of the project root directory. curdir (usually omitted) is specified as a relative pathname from the top of the build tree to the current directory. The -a option is equivalent to the following command sequence:

% xmkmf
% make Makefiles
% make includes
% make depend

Configuration files

Following is a list of the imake configuration files:

Imake.tmpl
Master template for imake. Imake.tmpl includes all the other configuration files, plus the Imakefile in the current directory.

Imake.params
Contains definitions that apply across sites and vendors.

Imake.rules
Contains cpp macro definitions that are configured for the current platform. The macro definitions are fed into imake, which runs cpp to process the macros. Newlines (line continuations) are indicated by the string @@\ (double at sign, backslash).

site.def
Contains site-specific (as opposed to vendor-specific) information, such as installation directories, what set of programs to build, and any special versions of programs to use during the build. The site.def file changes from machine to machine.

Project.tmpl
File containing X-specific variables.

Library.tmpl
File containing library rules.

Server.tmpl
File containing server-specific rules.

.cf
The .cf files are the vendor-specific VendorFiles that live in Imake.vb. A .cf file contains platform-specific definitions, such as version numbers of the operating system and the compiler and workarounds for missing commands. The definitions in .cf files override the defaults, defined in Imake.params.

The Imakefile

The Imakefile is a per-directory file that indicates targets to be built and installed and rules to be applied. imake reads the Imakefile and expands the rules into Makefile target entries. An Imakefile may also include definitions of make variables and list the dependencies of the targets. The dependencies are expressed as cpp macros, defined in Imake.rules. Whenever you change an Imakefile, you need to rebuild the Makefile and regenerate header file dependencies. For more information on imake, see Software Portability with imake (O'Reilly).

inetd

inetd [options] [configuration_file]

TCP/IP command. The internet services daemon. (On some systems this command is replaced by xinetd.) Initialized at bootup, inetd creates sockets on behalf of other services and listens to them simultaneously. When it receives an incoming connection request, it spawns the appropriate server and passes it the connection.

The following servers are commonly started by inetd: bootpd, bootpgw, fingerd, ftpd, imapd, rexecd, rlogind, rshd, talkd, telnetd, and tftpd. In addition to launching other services, inetd runs a few basic services of its own, including daytime, which returns the system's time of day, and chargen, which generates a string of characters.

Configuration file

inetd reads information on the services it should support from the specified configuration_file, or from the default configuration file /etc/inetd.conf. inetd rereads its configuration file when it receives a hangup signal, SIGHUP. Services may be added, deleted, or modified when the configuration file is reread. Lines beginning with # are treated as comments. Each entry in the configuration file is a single line composed of the following fields:

service
The service name as found in /etc/services.

type
Socket type, either stream for TCP-based services or dgram for UDP-based services.

protocol
The transport protocol used by the service. This must be a protocol found in /etc/protocols. It's usually either tcp or udp.

wait
For dgram sockets, this field specifies whether inetd should wait until the service is done to listen on the socket again, or should resume listening right away. The value can be either wait or nowait. Single-threaded servers like most RPC servers should use wait. Multithreaded servers should use nowait.

user
The user ID the process should run under. May be given a name or number. To specify a group name as well, append a dot (.) to the user ID, followed by the group ID.

server
The full path to the server program to be executed. For inetd's own services, the value of this field is internal. Many entries specify the TCP logging tool tcpd in this field to wrap the server whose command is given in the next field.

cmdline
The command-line arguments to be passed to the server, beginning with the name of the server program itself (argv[0]). inetd's internal services have no command lines.

Options

-d
Turn on socket-level debugging and print debugging information to stdout.

-q length
Specify the maximum number of pending connections to allow in a socket queue. The default is 128. The minimum value is 8.

Files

/etc/inetd.conf
Default configuration file.

/var/run/inetd.pid
inetd's process ID.

insmod

insmod [options] file [symbol=value ...]

System administration command. Load the module file into the kernel, changing any symbols that are defined on the command line. If the module file is named file.o or file.mod, the module will be named file.

Options

-e file, --persist=file
Read persistent data from file. If module has no persistent data, this option is ignored. If the file parameter is the null string "", use default file location.

-f, --force
Force loading of module, even if problems are encountered.

-h, --help
Print help message, then exit.

-k, --autoclean
Mark module to be removed when inactive.

-m, --map
Print a load map to standard output.

-n, --noload
Do everything needed to load file, but do not load it. Used to debug command line.

-o name, --name=name
Name module name instead of using the object file's name.

-p, --probe
Check to see that the module can be successfully loaded.

-q, --quiet
Don't print warnings or error messages.

-r, --root
Load modules not owned by the root account. By default these are rejected. This is a security risk.

-s, --syslog
Send messages to syslog instead of standard output.

-v, --verbose
Print additional information about progress of insmod.

-x, --noexport
If module does not explicitly export its own symbol table, do not export modules' external symbols.

-y, --noksymoops
Do not add symbols used for debugging Oops to ksyms. These are required if the module has persistent data.

-L, --lock
Set a file lock on the module.

-N, --numeric-only
When checking the module version against the kernel version, only check the numeric part. This is the default for kernel version 2.5 or later.

-O file, --blob=file
Save binary blob of what is loaded into the kernel to file.

-P prefix, --prefix=prefix
Specify symbol versions to prefix to module names.

-S, --Kallsyms
Always load modules with kallsyms data, even when the kernel does not support it.

-X, --export
If module does not explicitly export its own symbol table, export all modules' external symbols. This is the default behavior.

-V, --version
Print version, then exit.

-Y, --ksymoops
Add symbols used for debugging Oops to ksyms. These are required if the module has persistent data.

install

install [options] [source] destination

System administration command. Used primarily in Makefiles to update files. install copies files into user-specified directories. Similar to cp, but attempts to set permission modes, owner, and group. The source may be a file or directory, or a list of files and directories. The destination should be a single file or directory.

Options

-b, --backup[=control]
Back up any existing files. When using the long version of the command, the optional control parameter controls the kind of backup. When no control is specified, install will attempt to read the control value from the VERSION_CONTROL environment variable. Accepted values are:

none, off
Never make backups.

numbered, t
Make numbered backups.

existing, nil
Match existing backups, numbered or simple.

simple, never
Always make simple backups.

-d, --directory
Create any missing directories.

-g group, --group group
Set group ID of new file to group (privileged users only).

--help
Print help message, then exit.

-m mode, --mode mode
Set permissions of new file to mode (octal or symbolic). By default, the mode is 0755.

-o [owner], --owner[=owner]
Set ownership to owner or, if unspecified, to root (privileged users only).

-p, --preserve-timestamps
Preserve access and modification times on source files and directories.

-s, --strip
Strip symbol tables.

-v, --verbose
Print name of each directory as it is created.

--version
Print version, then exit.

-C
Do not overwrite file when the target exists and is identical to the new file. Preserve original timestamp.

-D
Create leading components of destination except the last, then copy source to destination.

-S suffix, --suffix=suffix
Use suffix instead of the default backup suffix, usually ~.

ipchains

ipchains command [options]

System administration command. Edit IP firewall rules in the 2.2 Linux kernel. A 2.2 Linux kernel compiled with firewall support will examine the headers of all network packets and compare them to matching rules to see what it should do with the packet. A firewall rule consists of some matching criteria and a target, which is a result to be applied if the packet matches the criteria. The rules are organized into chains. You can use these rules to build a firewall or just reject certain kinds of network connections.

Firewall rules are organized into chains, ordered checklists that the kernel works through looking for matches. There are three built-in chains: input, output, and forward. Packets entering the system are tested against the input chain; those exiting the system are checked against the output chain. If an incoming packet is destined for some other system, it is checked against the forward chain. Each of these chains has a default target (a policy) in case no match is found. User-defined chains can be created and used as targets for packets, but they have no default policies. If no match can be found in a user-defined chain, the packet is returned to the chain from which it was called and tested against the next rule in that chain.

ipchains changes only the rules in the running kernel. When the system is powered off, all those changes are lost. You can use the ipchains-save command to make a script you can later run with ipchains-restore to restore your firewall settings. Such a script is often called at bootup, and many distributions have an ipchains initialization script that uses the output from ipchains-save.

Commands

ipchains is always invoked with one of the following commands:

-A chain rules, --append chain rules
Append new rules to chain.

-I chain number rules, --insert chain number rules
Insert rules into chain at the ordinal position given by number.

-D chain rules, --delete chain rules
Delete rules from chain. Rules can be specified by their ordinal number in the chain as well as by a general rule description.

-R chain number rule, --replace chain number rule
Replace a rule in chain. The rule to be replaced is specified by its ordinal number.

-C chain rule, --check chain rules
Construct a network packet that matches the given rule and check how chain will handle it. The rule must describe the source, destination, protocol, and interface of the packet to be constructed.

-L [chain], --list $PARAMETER
List the rules in chain. If no chain is specified, list the rules in all chains.

-ML, --masquerading --list
List masquerading connections.

-MS tcp tcpfin udp, --masquerading --set tcp tcpfin udp
Set timeout value in seconds for masquerading connections. -MS always takes three parameters, specifying the timeout values for TCP sessions, for TCP sessions that have received a FIN packet, and for UDP packets.

-F chain, --flush chain
Remove all rules from chain.

-Z [chain], --zero [chain]
Reset the packet and byte counters in chain. If no chain is specified, all chains will be reset. When used without specifying a chain and combined with the -L command, lists the current counter values before they are reset.

-N chain, --new-chain chain
Create a new chain. The chain's name must be unique.

-X [chain], --delete-chain chain
Delete chain. Only user-defined chains can be deleted, and there can be no references to the chain to be deleted. If no argument is given, all user-defined chains will be deleted.

-P chain target, --policy chain target
Set the policy for a built-in chain; the target itself cannot be a chain.

-S tcp tcpfin udp, --set tcp tcpfin udp
Set masquerade timeout values for TCP sessions, TCP sessions after receiving a FIN packet, and UDP sessions. Timeout values of 0 preserve the previous setting. This option valid only when used with -M.

-h [icmp]
Print a brief help message. If the option icmp is given, print a list of valid ICMP types.

-V, --version
Print version number, then exit.

Targets

A target can be the name of a chain or one of the following special values:

ACCEPT
Let the packet through.

DENY
Drop the packet.

MASQ
Masquerade the packet so it appears that it originated from the current system. Reverse packets from masqueraded connections are unmasqueraded automatically. This is a legal target only for the forward chain, or user-defined chains used in forwarding packets. To use this target, the kernel must be compiled with support for IP masquerading.

REDIRECT [port]
Redirect incoming packets to a local port on which you are running a transparent proxy program. If the specified port is 0 or is not given, the destination port of the packet is used as the redirection port. REDIRECT is a legal target only for the input chain or for user-defined chains used in handling incoming packets. The kernel must be compiled with support for transparent proxies.

REJECT
Drop the packet and send an ICMP message back to the sender indicating that the packet was dropped.

RETURN
Return to the chain from which this chain was called and check the next rule. If RETURN is the target of a rule in a built-in chain, then the built-in chain's default policy is applied.

Rule specification parameters

These options are used to create rules for use with the preceding commands. Rules consist of some matching criteria and usually a target to jump to (-j) if the match is made. Many of the parameters for these matching rules can be expressed as a negative with an exclamation point (!) meaning "not." Those rules will match everything except the given parameter.

-p [!] name, --protocol [!]$PARAMETER
Match packets of protocol name. The value of name can be given as a name or number as found in the file /etc/protocols. The most common values are tcp, udp, icmp, or the special value all. The number 0 is equivalent to all, and this is the default value when this option is not used.

-s [!] address[/mask] [!] [port], --source [!] address[/mask] [!] [port]
Specifies the source address and port of the packet that will match this rule. The address may be supplied as a hostname, a network name, or an IP address. The optional mask is the netmask to use and may be supplied either in the traditional form (e.g., /255.255.255.0) or in the modern form (e.g., /24). The optional port specifies the TCP, UDP, or ICMP type that will match. You may supply a port specification only if you've supplied the -p parameter with one of the tcp, udp or icmp protocols. A colon can be used to indicate an inclusive range of ports or ICMP values to be used (e.g., 20:25 for ports 20 through 25). If the first port parameter is missing, the default value is 0. If the second is omitted, the default value is 65535.

-d [!] address[/mask] [!] [port], --destination [!] address[/mask] [port]
Match packets with the destination address. The syntax for this command's parameters is the same as for the -s option.

-j target, --jump target
Jump to a special target or a user-defined chain. If this option is not specified for a rule, matching the rule only increases the rule's counters and the packet is tested against the next rule.

-i [!] name, --interface name
Match packets from interface name[+]. name is the network interface used by your system (e.g., eth0 or ppp0). A + can be used as a wildcard, so ppp+ would match any interface name beginning with ppp.

[!] -f, [!]--fragment $PARAMETER
The rule applies to everything but the first fragment of a fragmented packet.

--source-port [!] port
Match packets from the source port. The syntax for specifying ports can be found in the preceding description of the -s option.

--destination-port [!] port
Match packets with the destination port. The syntax for specifying ports can be found in the preceding description of the -s option.

--icmp-type [!] type
Match packets with ICMP type name or number of type.

Options

-b, --bidirectional
Put rule in both the input and output chain so that packets will be matched in both directions.

-v, --verbose
Verbose mode.

-n, --numeric
Print all IP address and port numbers in numeric form. By default, names are displayed when possible.

-l, --log
Log information for the matching packet to the system log.

-t andmask xormask, --TOS andmask xormask
Change the Type Of Service field in the packet's header. The TOS field is first ANDed with the 8-bit hexadecimal mask andmask, then XORed with the 8-bit hexadecimal mask xormask. Rules that would affect the least significant bit (LSB) portion of the TOS field are rejected.

-x, --exact
Expand all numbers in a listing (-L). Display the exact values of the packet and byte counters instead of rounded figures.

[!] -y, --syn
Match only incoming TCP connection requests, those with the SYN bit set and the ACK and FIN bits cleared. This blocks incoming TCP connections but leaves outgoing connections unaffected.

--line-numbers
Used with the -L command. Add the line number to the beginning of each rule in a listing indicating its position in the chain.

--no-warnings
Disable all warnings.

iptables

iptables command [options]

System administration command. Configure netfilter filtering rules. In the 2.4 kernel, the ipchains firewall capabilities are replaced with the netfilter kernel module. netfilter can be configured to work just like ipchains, but it also comes with the module iptables, which is similar to ipchains but extensible. iptables rules consist of some matching criteria and a target, a result to be applied if the packet matches the criteria. The rules are organized into chains. You can use these rules to build a firewall, masquerade your local area network, or just reject certain kinds of network connections.

There are three built-in tables for iptables: one for network filtering (filter), one for Network Address Translation (nat), and the last for specialized packet alterations (mangle). Firewall rules are organized into chains, ordered checklists of rules that the kernel works through looking for matches. The filter table has three built-in chains: INPUT, OUTPUT, and FORWARD. The INPUT and OUTPUT chains handle packets originating from or destined for the host system. The FORWARD chain handles packets just passing through the host system. The nat table also has three built-in chains: PREROUTING, POSTROUTING, and OUTPUT. mangle has only two chains: PREROUTING and OUTPUT.

netfilter checks packets entering the system. After applying any PREROUTING rules, it passes them to the INPUT chain, or to the FORWARD chain if the packet is just passing through. Upon leaving, the system packets are passed to the OUTPUT chain and then on to any POSTROUTING rules. Each of these chains has a default target (a policy) in case no match is found. User-defined chains can also be created and used as targets for packets but do not have default policies. If no match can be found in a user-defined chain, the packet is returned to the chain from which it was called and tested against the next rule in that chain.

iptables changes only the rules in the running kernel. When the system is powered off, all changes are lost. You can use the iptables-save command to make a script you can run with iptables-restore to restore your firewall settings. Such a script is often called at bootup. Many distributions have an iptables initialization script that uses the output from iptables-save.

Commands

iptables is always invoked with one of the following commands:

-A chain rules, --append chain rules
Append new rules to chain.

-I chain number rules, --insert chain number rules
Insert rules into chain at the ordinal position given by number.

-D chain rules, --delete chain rules
Delete rules from chain. Rules can be specified by their ordinal number in the chain as well as by a general rule description.

-R chain number rule, --replace chain number rule
Replace a rule in chain. The rule to be replaced is specified by its ordinal number.

-C chain rule, --check chain rules
Check how chain will handle a network packet that matches the given rule. The rule must describe the source, destination, protocol, and interface of the packet to be constructed.

-L [chain], --list $PARAMETER
List the rules in chain, or all chains if chain is not specified.

-F [chain], --flush chain
Remove all rules from chain, or from all chains if chain is not specified.

-Z [chain], --zero [chain]
Zero the packet and byte counters in chain. If no chain is specified, all chains will be reset. When used without specifying a chain and combined with the -L command, list the current counter values before they are reset.

-N chain, --new-chain chain
Create a new chain. The chain's name must be unique. This is how user-defined chains are created.

-X [chain], --delete-chain [chain]
Delete the specified user-defined chain, or all user-defined chains if chain is not specified.

-P chain target, --policy chain target
Set the default policy for a built-in chain; the target itself cannot be a chain.

-E old-chain new-chain, --rename-chain old-chain new-chain
Rename old-chain to new-chain.

-h [icmp]
Print a brief help message. If the option icmp is given, print a list of valid ICMP types.

Targets

A target may be the name of a chain or one of the following special values:

ACCEPT
Let the packet through.

DROP
Drop the packet.

QUEUE
Send packets to the user space for processing.

RETURN
Stop traversing the current chain and return to the point in the previous chain from which this one was called. If RETURN is the target of a rule in a built-in chain, the built-in chain's default policy is applied.

Rule specification parameters

These options are used to create rules for use with the preceding commands. Rules consist of some matching criteria and usually a target to jump to (-j) if the match is made. Many of the parameters for these matching rules can be expressed as a negative with an exclamation point (!) meaning "not." Those rules will match everything except the given parameter.

-p [!] name, --protocol [!]$PARAMETER
Match packets of protocol name. The value of name can be given as a name or number as found in the file /etc/protocols. The most common values are tcp, udp, icmp, or the special value all. The number 0 is equivalent to all, and this is the default value when this option is not used. If there are extended matching rules associated with the specified protocol, they will be loaded automatically. You need not use the -m option to load them.

-s [!] address[/mask] [!] [port], --source [!] address[/mask] [!] [port]
Match packets with the source address. The address may be supplied as a hostname, a network name, or an IP address. The optional mask is the netmask to use and may be supplied either in the traditional form (e.g., /255.255.255.0) or in the modern form (e.g., /24).

-d [!] address[/mask] [!] [port], --destination [!] address[/mask] [port]
Match packets from the destination address. See the description of -s for the syntax of this option.

-j target, --jump target
Jump to a special target or a user-defined chain. If this option is not specified for a rule, matching the rule only increases the rule's counters, and the packet is tested against the next rule.

-i [!] name[+], --in-interface name[+]
Match packets being received from interface name. name is the network interface used by your system (e.g., eth0 or ppp0). A + can be used as a wildcard, so ppp+ would match any interface name beginning with ppp.

-o [!] name[+], --out-interface name[+]
Match packets being sent from interface name. See the description of -i for the syntax for name.

[!] -f, [!]--fragment $PARAMETER
The rule applies only to the second or further fragments of a fragmented packet.

-c packets bytes, --set-counters packets bytes
Initialize packet and byte counters to the specified values.

Options

-v, --verbose
Verbose mode.

-n, --numeric
Print all IP address and port numbers in numeric form. By default, text names are displayed when possible.

-x, --exact
Expand all numbers in a listing (-L). Display the exact value of the packet and byte counters instead of rounded figures.

-m module, --match module
Explicitly load matching rule extensions associated with module. See the next section.

-h [icmp], --help [icmp]
Print help message. If icmp is specified, a list of valid ICMP type names will be printed. -h can also be used with the -m option to get help on an extension module.

--line-numbers
Used with the -L command. Add the line number to the beginning of each rule in a listing, indicating its position in the chain.

--modprobe=command
Use specified command to load any necessary kernel modules while adding or inserting rules into a chain.

Match extensions

Several kernel modules come with netfilter to extend matching capabilities of rules. Those associated with particular protocols are loaded automatically when the -p option is used to specify the protocol. Others need to be loaded explicitly with the -m option.

tcp
Loaded when -p tcp is the only protocol specified.

--source-port [!] [port][:port], --sport [!] [port][:port]
Match the specified source ports. Using the colon specifies an inclusive range of services to match. If the first port is omitted, 0 is the default. If the second port is omitted, 65535 is the default. You can also use a dash instead of a colon to specify the range.

--destination-port [!] [port][:port], --dport [!] [port][:port]
Match the specified destination ports. The syntax is the same as for --source-port.

--tcp-flags [!] mask comp
Match the packets with the TCP flags specified by mask and comp. mask is a comma-separated list of flags that should be examined. comp is a comma-separated list of flags that must be set for the rule to match. Valid flags are SYN, ACK, FIN, RST, URG, PSH, ALL, and NONE.

--tcp-option [!] n
Match if TCP option is set.

--mss n[:n]
Match if TCP SYN or SYN/ACK packets have the specified MSS value or fall within the specified range. Use this to control the maximum packet size for a connection.

[!] --syn
Match packets with the SYN bit set and the ACK and FIN bits cleared. These are packets that request TCP connections; blocking them prevents incoming connections. Shorthand for --tcp-flags SYN,RST,ACK SYN.

udp
Loaded when -p udp is the only protocol specified.

--source-port [!] [port][:port], --sport [!] [port][:port]
Match the specified source ports. The syntax is the same as for the --source-port option of the TCP extension.

--destination-port [!] [port][:port], --dport [!] [port][:port]
Match the specified destination ports. The syntax is the same as for the --source-port option of the TCP extension.

icmp
Loaded when -p icmp is the only protocol specified.

--icmp-type [!] type
Match the specified ICMP type. type may be a numeric ICMP type or one of the ICMP type names shown by the command iptables -p icmp -h.

mac
Loaded explicitly with the -m option.

--mac-source [!] address
Match the source address that transmitted the packet. address must be given in colon-separated hexbyte notation (for example, --mac-source 00:60:08:91:CC:B7).

limit
Loaded explicitly with the -m option. The limit extensions are used to limit the number of packets matched. This is useful when combined with the LOG target. Rules using this extension match until the specified limit is reached.

--limit rate
Match addresses at the given rate. rate is specified as a number with an optional /second, /minute, hour, or /day suffix. When this option is not set, the default is 3/hour.

--limit-burst [number]
Set the maximum number of packets to match in a burst. Once the number has been reached, no more packets are matched for this rule until the number has recharged. It recharges at the rate set by the --limit option. When not specified, the default is 5.

multiport
Loaded explicitly with the -m option. The multiport extensions match sets of source or destination ports. These rules can be used only in conjunction with -p tcp and -p udp. Up to 15 ports can be specified in a comma-separated list.

--source-port [ports]
Match the given source ports.

--destination-port [ports]
Match the given destination ports.

--port [ports]
Match if the packet has the same source and destination port and that port is one of the given ports.

mark
Loaded explicitly with the -m option. This module works with the MARK extension target.

--mark value[/mask]
Match the given unsigned mark value. If a mask is specified, it is logically ANDed with the mark before comparison.

owner
Loaded explicitly with the -m option. The owner extensions match the user, group, process, and session IDs of a local packet's creator. This makes sense only as a part of the OUTPUT chain.

--uid-owner userid
Match packets created by a process owned by userid.

--gid-owner groupid
Match packets created by a process owned by groupid.

--pid-owner processid
Match packets created by process ID processid.

--sid-owner sessionid
Match packets created by a process in the session sessionid.

--cmd-owner command
Match if packet was created by a process with the name command.

state
Loaded explicitly with the -m option. This module matches the connection state of a packet.

--state states
Match the packet if it has one of the states in the comma-separated list states. Valid states are INVALID, ESTABLISHED, NEW, and RELATED.

tos
Loaded explicitly with the -m option. This module matches the Type of Service field in a packet's header.

--tos value
Match the packet if it has a TOS of value. value can be a numeric value or a Type of Service name. iptables -m tos -h will give you a list of valid TOS values.

tostate
Loaded explicitly with the -m option. This module matches the connection state of a packet.

--state states
Match the packet if it has one of the states in the comma-separated list states. Valid states are INVALID, ESTABLISHED, NEW, and RELATED.

ah
Loaded explicitly with the -m option. This module matches the SPIs in the AH header of IPSec packets.

--ahspi [!] n[:n]
Match the SPIs in the AH header against the specified value or range of values.

esp
Loaded explicitly with the -m option. This module matches the SPIs in the ESP header of IPSec packets.

--ahspi [!] n[:n]
Match the SPIs in the ESP header against the specified value or range of values.

length
Loaded explicitly with the -m option. This module matches the length of a packet.

--length n[:n]
Match if the length of the packet is the same as the specified value or is within the range of values.

ttl
Loaded explicitly with the -m option. This module matches the time-to-live (TTL) field in the IP header.

--ttl n
Match if the TTL is the same as the specified value.

Target extensions

Extension targets are optional additional targets supported by separate kernel modules. They have their own associated options.

LOG
Log the packet's information in the system log.

--log-level level
Set the syslog level by name or number (as defined by syslog.conf).

--log-prefix prefix
Begin each log entry with the string prefix. The prefix string may be up to 30 characters long.

--log-tcp-sequence
Log the TCP sequence numbers. This is a security risk if your log is readable by users.

--log-tcp-options
Log options from the TCP packet header.

--log-ip-options
Log options from the IP packet header.

MARK
Used to mark packets with an unsigned integer value you can use later with the mark matching extension. Valid only with the mangle table.

--set-mark value
Mark the packet with value.

REJECT
Drop the packet and, if appropriate, send an ICMP message back to the sender indicating the packet was dropped. If the packet was an ICMP error message, an unknown ICMP type, or a nonhead fragment, or if too many ICMP messages have already been sent to this address, no message is sent.

--reject-with type
Send specified ICMP message type. Valid values are icmp-net-unreachable, icmp-host-unreachable, icmp-port-unreachable, or icmp-proto-unreachable. If the packet was an ICMP ping packet, type may also be echo-reply.

TOS
Set the Type of Service field in the IP header. TOS is a valid target only for rules in the mangle table.

--set-tos value
Set the TOS field to value. You can specify this as an 8-bit value or as a TOS name. You can get a list of valid names using iptables -j TOS -h.

SNAT
Modify the source address of the packet and all future packets in the current connection. SNAT is valid only as a part of the POSTROUTING chain in the nat table.

--to-source address[-address][port-port]
Specify the new source address or range of addresses. If a tcp or udp protocol has been specified with the -p option, source ports may also be specified. If none is specified, map the new source to the same port if possible. If not, map ports below 512 to other ports below 512, those between 512 and 1024 to other ports below 1024, and ports above 1024 to other ports above 1024.

DNAT
Modify the destination address of the packet and all future packets in the current connection. DNAT is valid only as a part of the POSTROUTING chain in the nat table.

--to-destination address[-address][port-port]
Specify the new destination address or range of addresses. The arguments for this option are the same as the --to-source argument for the SNAT extension target.

MASQUERADE
Masquerade the packet so it appears that it originated from the current system. Reverse packets from masqueraded connections are unmasqueraded automatically. This is a legal target only for chains in the nat table that handle incoming packets and should be used only with dynamic IP addresses (like dial-up.) For static addresses use DNAT.

--to-ports port[-port]
Specify the port or range of ports to use when masquerading. This option is valid only if a tcp or udp protocol has been specified with the -p option. If this option is not used, the masqueraded packet's port will not be changed.

REDIRECT
Redirect the packet to a local port. This is useful for creating transparent proxies.

--to-ports port[-port]
Specify the port or range of ports on the local system to which the packet should be redirected. This option is valid only if a tcp or udp protocol has been specified with the -p option. If this option is not used, the redirected packet's port will not be changed.

ULOG
Userspace logging. Multicast matching packets though a netlink socket, which is a socket linking kernel space and userspace. One or more userspace processes can subscribe to the multicast groups and receive the packets.

--ulog-nlgroup n
Send packet to the specified netlink group (1-32). The default group is 1.

--ulog-prefix prefix
Prefix packet messages with the specified prefix of 32 characters or less.

--ulog-cprange n
Copy up to n bytes of the packet to the netlink socket. The default value, 0, copies an entire packet, regardless of size.

--ulog-qthreshold n
Transmit packets when n packets have been queued. Default value is 1.

TCPMSS
Alter the MSS value of TCP SYN packets.

--set-mss n
Set the MSS value to n.

--clamp-mss-to-pmtu
Set the MSS value to the outgoing interface's MTU (maximum transmission unit) minus 40.

ispell

ispell [options] [files]

Compare the words of one or more named files with the system dictionary. Display unrecognized words at the top of the screen, accompanied by possible correct spellings, and allow editing via a series of commands.

Options

-b
Back up original file in filename.bak.

-d file
Search file instead of standard dictionary file.

-m
Suggest different root/affix combinations.

-n
Expect nroff or troff input file.

-p file
Search file instead of personal dictionary file.

-t
Expect TEX or LATEX input file.

-w chars
Consider chars to be legal, in addition to a-z and A-Z.

-x
Do not back up original file.

-B
Search for missing blanks (resulting in concatenated words) in addition to ordinary misspellings.

-C
Do not produce error messages in response to concatenated words.

-L number
Show number lines of context.

-M
List interactive commands at bottom of screen.

-N
Suppress printing of interactive commands.

-P
Do not attempt to suggest more root/affix combinations.

-S
Sort suggested replacements by likelihood that they are correct.

-T type
Expect all files to be formatted by type.

-W n
Never consider words that are n characters or fewer to be misspelled.

-V
Use hat notation (^L) to display control characters, and M- to display characters with the high bit set.

Interactive commands

?
Display help screen.

space
Accept the word in this instance.

number
Replace with suggested word that corresponds to number.

!command
Invoke shell and execute command in it. Prompt before exiting.

a
Accept word as correctly spelled, but do not add it to personal dictionary.

i
Accept word and add it (with any current capitalization) to personal dictionary.

l
Search system dictionary for words.

q
Exit without saving.

r
Replace word.

u
Accept word and add lowercase version of it to personal dictionary.

x
Skip to the next file, saving changes.

^L
Redraw screen.

^Z
Suspend ispell.

kill

kill [options] [pids | commands]

Send a signal to terminate one or more process IDs. You must own the process or be a privileged user. If no signal is specified, TERM is sent.

This entry describes the /bin/kill command, which offers several powerful features. There are also built-in shell commands of the same name; the bash version is described in Chapter 7 and the tcsh version in Chapter 8.

In particular, /bin/kill allows you to specify a command name, such as gcc or xpdf, instead of a process ID (PID). All processes running that command with the same UID as the process issuing /bin/kill will be sent the signal.

If /bin/kill is issued with a pid of 0, it sends the signal to all processes of its own process group. If /bin/kill is issued with a pid of -1, it sends the signal to all processes except process 1 (the system's init process).

Options

-a
Kill all processes of the given name (if privileges allow), not just processes with the same UID. To use this option, specify the full path (e.g., /bin/kill -a gcc).

-l
List all signals.

-p
Print the process ID of the named process, but don't send it a signal. To use this option, specify the full path (e.g., /bin/kill -p).

-signal
The signal number (from /usr/include/sys/signal.h) or name (from kill -l). With a signal number of 9 (HUP), the kill cannot be caught by the process; use this to kill a process that a plain kill doesn't terminate. The default is TERM.

klogd

klogd [options]

System administration command. Control which kernel messages are displayed on the console, prioritize all messages, and log them through syslogd. On many operating systems, syslogd performs all the work of klogd, but on Linux the features are separated. Kernel messages are gleaned from the /proc filesystem and from system calls to syslogd. By default, no messages appear on the console. Messages are sorted into eight levels, 0-7, and the level number is prepended to each message.

Priority levels

0
Emergency situation (KERN_EMERG).

1
A crucial error has occurred (KERN_ALERT).

2
A serious error has occurred (KERN_CRIT).

3
An error has occurred (KERN_ERR).

4
A warning message (KERN_WARNING).

5
The situation is normal but should be checked (KERN_NOTICE).

6
Information only (KERN_INFO).

7
Debugging messages (KERN_DEBUG).

Options

-c level
Print all messages of a higher priority (lower number) than level to the console.

-d
Debugging mode.

-f file
Print all messages to file; suppress normal logging.

-i
Signal executing daemon to reload kernel module symbols.

-k file
Use file as source of kernel symbols.

-n
Avoid auto-backgrounding. This is needed when klogd is started from init.

-o
One-shot mode. Prioritize and log all current messages, then immediately exit.

-p
Reload kernel module symbol information whenever an Oops string is detected.

-s
Suppress reading of messages from the /proc filesystem. Read from kernel message buffers instead.

-v
Print version, then exit.

-x
Don't translate instruction pointers (EIP). klogd will not read the System.map file.

-I
Signal executing daemon to reload both static kernel symbols and kernel module symbols.

-2
Print two lines for each symbol, one showing the symbol and the other showing its numerical value (address).

Files

/usr/include/linux/kernel.h, /usr/include/sys/syslog.h
Sources for definitions of each logging level.

/proc/kmsg
A file examined by klogd for messages.

/var/run/klogd.pid
klogd's process ID.

ld

ld [options] objfiles

Combine several objfiles, in the specified order, into a single executable object module (a.out by default). ld is the link editor and is often invoked automatically by compiler commands. ld accepts many options, the most common of which are listed here.

Options

-b format, --format=format
If ld is configured to accept more than one kind of object file, this command can be used to specify the input format. format should be a GNU Binary File Descriptor (BFD) as described in the BFD library. Use objdump -i to list available formats.

-call_shared
Link with dynamic libraries.

-d, -dc, -dp
Force the assignment of space to common symbols.

-defsym symbol=expression
Create the global symbol with the value expression.

-demangle[=style]
Force demangling of symbol names. Optionally set the demangling style. Turn off demangling with -nodemangle.

-e symbol
Set symbol as the address of the output file's entry point.

-f name
Set the DT_AUXILIARY field of ELF shared object to name.

-fini name
Set the DT_FINI field of ELF shared object to the address of function name. The default function is _fini.

-h name
Set the DT_SONAME field of ELF shared object to name.

--help
Print help message, then exit.

-i
Produce a linkable output file; attempt to set its magic number to OMAGIC.

-init name
Set the DT_INIT field of ELF shared object to the address of function name. The default function is _init.

-larch, --library=archive
Include the archive file arch in the list of files to link.

-m linker
Emulate linker. List supported emulations with the -V option.

-n
Make text read-only; attempt to set NMAGIC.

-o output
Place output in output, instead of a.out.

-oformat format
Specify output format.

-q
Retain relocation sections and contents in linked executables.

-r
Produce a linkable output file; attempt to set its magic number to OMAGIC.

-rpath dir
Add directory dir to the runtime library search path. Ignore additional paths normally read from the LD_RUN_PATH environment variable.

-rpath-link dirs
Specify path to search for shared libraries required by another shared library. The dirs argument can be a single directory, or multiple directories separated by colons. This overrides search paths specified in shared libraries themselves.

-s
Do not include any symbol information in output.

-shared
Create a shared library.

-static
Do not link with shared libraries.

-sort-common
Do not sort global common symbols by size.

-t
Print each input file's name as it is processed.

--target-help
Print target-specific options, then exit.

-u symbol
Force symbol to be undefined.

-v, --version
Show version number.

--verbose
Print information about ld; print the names of input files while attempting to open them.

-warn-common
Warn when encountering common symbols combined with other constructs.

-warn-once
Provide only one warning per undefined symbol.

-x
With -s or -S, delete all local symbols. These generally begin with L.

-z keyword
Mark the object for special behavior specified by keyword. ld recognizes the following keywords:

combreloc
Object combines and sorts multiple relocation sections for dynamic symbol lookup caching.

defs
Disallow undefined symbols.

initfirst
Initialize object first at runtime.

interpose
Interpose object's symbol table before all but the primary executable's symbol table.

loadfltr
Process object's filter immediately at runtime.

multidefs
Allow multiple definitions of a single symbol. Use the first definition.

nocombreloc
Disable combining multiple relocation sections.

nocopyreloc
Disable copy relocation.

nodefaultlib
Ignore default library search path when seeking dependencies for object.

nodelete
Do not unload object at runtime.

nodlopen
Object is not available to dlopen.

nodump
Object cannot be dumped by dldump.

now
Non-lazy runtime binding.

origin
Object may contain $ORIGIN.

-E, --export-dynamic
Add all symbols to dynamic symbol table, not just those referenced by linked objects.

-EB
Link big-endian objects.

-EL
Link little-endian objects.

-F name
Set DT_FILTER field of ELF shared object to name.

-Ldir, --library-path=dir
Search directory dir before standard search directories (this option must precede the -l option that searches that directory).

-M
Display a link map on standard output.

-Map file
Print a link map to file.

-N
Allow reading of and writing to both data and text. Mark ouput if it supports Unix magic numbers. Do not page-align data.

-O level
Optimize. level should be 1, 2, 3, or 0. The default is 1. 0 turns off optimization; 3 optimizes the most.

-R file
Obtain symbol names and addresses from file, but suppress relocation of file and its inclusion in output.

-S
Do not include debugger symbol information in output.

-T file
Execute script file instead of the default linker script.

-Tbss address
Begin bss segment of output at address.

-Tdata address
Begin data segment of output at address.

-Ttext address
Begin text segment of output at address.

-Ur
Synonymous with -r except when linking C++ programs, where it resolves constructor references.

-X
With -s or -S, delete local symbols beginning with L.

-V
Show version number and emulation linkers for -m option.

less

less [options] [filename]

less is a program for paging through files or other output. It was written in reaction to the perceived primitiveness of more (hence its name). Some commands may be preceded by a number.

Options

-[z]num, --window=num
Set number of lines to scroll to num. Default is one screenful. A negative num sets the number to num lines less than the current number.

+[+]command
Run command on startup. If command is a number, jump to that line. The option ++ applies this command to each file in the command-line list.

-?, --help
Print help screen. Ignore all other options; do not page through file.

-a, --search-screen
When searching, begin after last line displayed. (Default is to search from second line displayed.)

-bbuffers, -buffers=buffers
Use buffers buffers for each file (default is 10). Buffers are 1 KB in size.

-c, --clear-screen
Redraw screen from top, not bottom.

-d, --dumb
Suppress dumb-terminal error messages.

-e, --quit-at-eof
Automatically exit after reaching EOF twice.

-f, --force
Force opening of directories and devices; do not print warning when opening binaries.

-g, --hilite-search
Highlight only string found by past search command, not all matching strings.

-hnum, --max-back-scroll=num
Never scroll backward more than num lines at once.

-i, --ignore-case
Make searches case-insensitive, unless the search string contains uppercase letters.

-jnum, --jump-target=num
Position target line on line num of screen. Target line can be the result of a search or a jump. Count lines beginning from 1 (top line). A negative num is counted back from bottom of screen.

-kfile, --lesskey-file=file
Read file to define special key bindings.

-m, --long-prompt
Display more-like prompt, including percent of file read.

-n, --line-numbers
Do not calculate line numbers. Affects -m and -M options and = and v commands (disables passing of line number to editor).

-ofile, --log-file=file
When input is from a pipe, copy output to file as well as to screen. (Prompt for overwrite authority if file exists.)

-ppattern, --pattern=pattern
At startup, search for first occurrence of pattern.

-q, --quiet, --silent
Disable ringing of bell on attempts to scroll past EOF or before beginning of file. Attempt to use visual bell instead.

-r, --raw-control-chars
Display "raw" control characters instead of using ^x notation. This sometimes leads to display problems, which might be fixed by using -R instead.

-s, --squeeze-blank-lines
Print successive blank lines as one line.

-ttag, --tag=tag
Edit file containing tag. Consult ./tags (constructed by ctags).

-u, --underline-special
Treat backspaces and carriage returns as printable input.

-w, --hilite-unread
Show the line to which a movement command has skipped, phrases displayed by a search command, or the first unread line during a normal scroll by highlighting text in reverse video.

-xn, --tabs=n
Set tab stops to every n characters. Default is 8.

-yn, --max-forw-scroll=n
Never scroll forward more than n lines at once.

-B, --auto-buffers
Do not automatically allocate buffers for data read from a pipe. If -b specifies a number of buffers, allocate that many. If necessary, allow information from previous screens to be lost.

-C, -CLEAR-SCREEN
Redraw screen by clearing it and then redrawing from top.

-E, --QUIT-AT-EOF
Automatically exit after reaching EOF once.

-F, --quit-if-one-screen
Exit without displaying anything if first file can fit on a single screen.

-G, --HILITE-SEARCH
Never highlight matching search strings.

-I, --IGNORE-CASE
Make searches case-insensitive, even when the search string contains uppercase letters.

-J, --status-column
Used with -w or -W, highlight a single column on the left edge of the screen instead of the whole text of an unread line.

-Kcharset
Use the specified charset.

-M
Prompt more verbosely than with -m, including percentage, line number, and total lines.

-N, --LINE-NUMBERS
Print line number before each line.

-Ofile, --LOG-FILE=file
Similar to -o, but do not prompt when overwriting file.

-P[mM=]prompt
Set the prompt displayed by less at the bottom of each screen to prompt. The m sets the prompt invoked by the -m option, the M sets the prompt invoked by the -M option, and the = sets the prompt invoked by the = command. Special characters (described in the manpage for less), can be used to print statistics and other information in these prompts.

-Q, --QUIET, --SILENT
Never ring terminal bell.

-R, --RAW-CONTROL-CHARS
Like r, but adjust screen to account for presence of control characters.

-S, --chop-long-lines
Cut, do not fold, long lines.

-Tfile, --tag-file=file
With the -t option or :t command, read file instead of ./tags.

-U, --UNDERLINE-SPECIAL
Treat backspaces and carriage returns as control characters.

-V, --version
Display version and exit.

-W, --HILITE-UNREAD
Show phrases displayed by a search command, or the first unread line of any forward movement that is more than one line, by highlighting text in reverse video.

-X, --no-init
Do not send initialization and deinitialization strings from termcap to terminal.

Commands

Many commands can be preceded by a numeric argument, referred to as number in the command descriptions.

SPACE, ^V, f, ^F
Scroll forward the default number of lines (usually one windowful).

z
Similar to SPACE, but allows the number of lines to be specified, in which case it resets the default to that number.

RETURN, ^N, e, ^E, j, ^J
Scroll forward. Default is one line. Display all lines, even if the default is more lines than the screen size.

d, ^D
Scroll forward. Default is one-half the screen size. The number of lines may be specified, in which case the default is reset.

b, ^B, ESC-v
Scroll backward. Default is one windowful.

w
Like b, but allows the number of lines to be specified, in which case it resets the default to that number.

y, ^Y, ^P, k, ^K
Scroll backward. Default is one line. Display all lines, even if the default is more lines than the screen size.

u, ^U
Scroll backward. Default is one-half the screen size. The number of lines may be specified, in which case the default is reset.

r, ^R, ^L
Redraw screen.

R
Like r, but discard buffered input.

F
Scroll forward. When an EOF is reached, continue trying to find more output, behaving similarly to tail -f.

g, <, ESC-<
Skip to a line. Default is 1.

G, >, ESC->
Skip to a line. Default is the last one.

p, %
Skip to a position number percent of the way into the file.

{
If the top line on the screen includes a {, find its matching }. If the top line contains multiple {s, use number to determine which one to use in finding a match.

}
If the bottom line on the screen includes a }, find its matching {. If the bottom line contains multiple }s, use number to determine which one to use in finding a match.

(
If the top line on the screen includes a (, find its matching ). If the top line contains multiple (s, use number to determine which one to use in finding a match.

)
If the bottom line on the screen includes a ), find its matching (. If the bottom line contains multiple )s, use number to determine which one to use in finding a match.

[
If the top line on the screen includes a [, find its matching ]. If the top line contains multiple [s, use number to determine which one to use in finding a match.

]
If the bottom line on the screen includes a ], find its matching [. If the bottom line contains multiple ]s, use number to determine which one to use in finding a match.

ESC-^F
Behave like { but prompt for two characters, which it substitutes for { and } in its search.

ESC-^B
Behave like } but prompt for two characters, which it substitutes for { and } in its search.

m
Prompt for a lowercase letter and then use that letter to mark the current position.

'
Prompt for a lowercase letter and then go to the position marked by that letter. There are some special characters:

^
Beginning of file.

$
End of file.

^X^X
Same as '.

/pattern
Find next occurrence of pattern, starting at second line displayed. Some special characters can be entered before pattern:

!
Find lines that do not contain pattern.

*
If current file does not contain pattern, continue through the rest of the files in the command-line list.

@
Search from the first line in the first file specified on the command line, no matter what the screen currently displays.

?pattern
Search backward, beginning at the line before the top line. Treats !, *, and @ as special characters when they begin pattern, as / does.

ESC-/pattern
Same as /*.

ESC-?pattern
Same as ?*.

n
Repeat last pattern search.

N
Repeat last pattern search in the reverse direction.

ESC-n
Repeat previous search command but as though it were prefaced by *.

ESC-N
Repeat previous search command but as though it were prefaced by * and in the reverse direction.

ESC-u
Toggle search highlighting.

:e [filename]
Read in filename and insert it into the command-line list of filenames. Without filename, reread the current file. filename may contain special characters:

%
Name of current file

#
Name of previous file

^X^V, E
Same as :e.

:n
Read in next file in command-line list.

:p
Read in previous file in command-line list.

:x
Read in first file in command-line list.

:f, =, ^G
Print filename, position in command-line list, line number on top of window, total lines, byte number, and total bytes.

-
Expects to be followed by a command-line option letter. Toggle the value of that option or, if appropriate, prompt for its new value.

-+
Expects to be followed by a command-line option letter. Reset that option to its default.

--
Expects to be followed by a command-line option letter. Reset that option to the opposite of its default, where the opposite can be determined.

_
Expects to be followed by a command-line option letter. Display that option's current setting.

+command
Execute command each time a new file is read in.

q, :q, :Q, ZZ
Exit.

v
Not valid for all versions. Invoke editor specified by $VISUAL or $EDITOR, or vi if neither is set.

! [command]
Not valid for all versions. Invoke $SHELL or sh. If command is given, run it and then exit. Special characters:

%
Name of current file.

#
Name of previous file.

!!
Last shell command.

| mark-letter command
Not valid for all versions. Pipe fragment of file (from first line on screen to mark-letter) to command. mark-letter may also be:

^
Beginning of file.

$
End of file.

., newline
Current screen is piped.

Prompts

The prompt interprets certain sequences specially. Those beginning with % are always evaluated. Those beginning with ? are evaluated if certain conditions are true. Some prompts determine the position of particular lines on the screen. These sequences require that a method of determining that line be specified. See the -P option and the manpage for more information.

lesskey

lesskey [-o output-file | --output=output-file] [input-file]

Configure keybindings for the less command using a configuration file. The input file defaults to ~/.lesskey and the output file to ~/.less unless you specify otherwise.

Configuration file format

The configuration file for lesskey has one to three sections. These are marked by a line containing a # symbol and the name of the section: #command, #line-edit, and #env.

The #command section
The command section determines the keys used for actions within less. Each line should contain the key or key combination you wish to define, a space or tab, and the name of the action to perform. You may also add an extra string at the end, which will be performed at the end of the first action.

Keys you define should be entered as you plan to type them, with the exception of the caret (^), space, tab, and backslash (\) characters, which should be preceded by a backslash. In addition, the following special keys are represented by escape sequences that begin with a backslash:

Backspace: \b
Escape: \e
Newline: \n
Return: \r
Tab: \t
Up arrow: \ku
Down arrow: \kd
Right arrow: \kr
Left arrow: \kl
Page up: \kU
Page down: \kD
Home: \kh
End: \ke
Delete: \kx

The actions that can be defined are:

invalid (creates error)
noaction
forw-line
back-line
forw-line-force
forw-scroll
back-scroll
forw-screen
back-screen
forw-window
back-window
forw-screen-force
forw-forever
repaint-flush
repaint
undo-hilite
goto-line
percent
left-scroll
right-scroll
forw-bracket
back-bracket
goto-end
status
forw-search
back-search
repeat-search
repeat-search-all
set-mark
goto-mark
examine
next-file
index-file
prev-file
toggle-option
display-option
pipe
visual
shell
firstcmd
help
version (display version)
digit (display number)
quit
The #line-edit section
The line editing section lets you choose keys for the line-editing capabilities of less in a similar manner to the #command section, although without the "extra" string after the command. The line editing actions that can be defined are:

forw-complete
back-complete
expand
literal
right
left
word-left
word-right
insert
delete
word-delete
word-backspace
home
end
up
down
The #env section
The third section, like the second, is optional, and you can use it to override environment variables that affect less. Each line consists of a variable, the equals sign (=), and the value to which you wish to set the variable. The most important ones are LESS, which allows you to select additional flags to pass to less when you run it, and LESSCHARSET, which lets you choose a character set. Check the less manpage for a complete list of environment variables that affect the program.

lftp

lftp [options] [url]

File transfer program with more features than ftp. The lftp command allows FTP and HTTP protocol transfers, plus other protocols including FISH (SSH based), FTPS, and HTTPS. It uses a shell-like command interface and offers job control in a manner similar to bash. lftp has two important reliability features: it resumes failed or interrupted transactions, and it goes into the background automatically if it is quit in the middle of a file transfer.

Options

-d
Run in debug mode.

-e commands
Start, execute the specified commands, and then wait for further instructions.

-p portnumber
Connect to the specified port number.

-u user[,pass]
Login to the server with the username (and, optionally, password) you specify.

-f scriptfile
Run the specified script file of lftp commands, then exit.

-c commands
Run the commands specified, then exit.

Commands

The lftp commands are similar to those for ftp. However, lftp lacks or uses different mechanisms for a number of commands, including $, ascii, binary, case, and macdef. It also adds the following:

alias [name [value]]
Create an alias for a command. For example, you could set dir to be an alias for ls -lf.

anon
Set the username to anonymous. This is the default username.

at
Execute a command at a given time, as with the at command in an actual shell.

bookmark [arguments]
The lftp bookmark command used with the following arguments will add, delete, edit, import, or list bookmarks, respectively:

  • add name url

  • del name

  • edit

  • import type

  • list

cache
Work with the local memory cache. This command should be followed by the arguments:

stat
Display the status for the cache.

on|off
Turn caching on or off.

flush
Empty the cache.

size n
Set the maximum size for the cache. Setting it to -1 means unlimited.

expire nu
Set the cache to expire after n units of time. You can set the unit to seconds (s), minutes (m), hours (h), or days (d). For example, for a cache that expires after an hour, use the syntax cache expire 1h.

close
Where the ftp version of this command just stops all sessions, this version closes idle connections with the current server. If you have connections to multiple servers and wish to close all idle connections, add the -a flag.

command cmd args
Execute the specified lftp command, with the specified arguments, ignoring any aliases created with the alias command.

mirror [options] [remotedir [localdir]]
Copy a directory exactly. The mirror command accepts the following arguments:

-c, --continue
If mirroring was interrupted, resume it.

-e, --delete
Delete local files that are not present at the remote site.

-s, --allow-suid
Keep the suid/sgid bits as set on the remote site.

-n, --only-newer
Get only those files from the remote site that have more recent dates than the files on the local system. Cannot be used with the -c argument.

-r, --no-recursion
Do not get any subdirectories.

--no-umask
Do not use umask when getting file modes. See umask for more information about file modes.

-R, --reverse
Mirror files from the local system to the remote system. With this argument, make sure that you specify the local directory first and the remote directory second. If you do not specify both directories, the second is assumed to be the same as the first. If you choose neither, the operation occurs in the current working directories.

-L, --dereference
When mirroring a link, download the file the link points to rather than just the link.

-N, --newer-than filename
Get all files newer than the file filename.

-P, --parallel[=n]
Download n files in parallel.

-i, --include regex
Get only the files whose names match the regular expression regex. See grep for more information about regular expressions.

-x, --exclude regex
Do not get the files whose names match regex. See grep for more information about regular expressions.

-t, time-prec n
Set the precision of time measurement for file comparison; if file dates differ by amounts less than n, they are assumed to be the same. You can specify n in seconds (s), minutes (m), hours (h), or days (d).

-T, --loose-time-prec n
Set the precision for loose time comparisons. You can specify n in seconds (s), minutes (m), hours (h), or days (d).

-v, --verbose=n
Set the verbose level. You can set n from 0 (no output) to 3 (full output) using a number or by repeating the v. For example, -vvv is level 3 verbose mode.

--use-cache
Use the cache to get directory listings.

--remove-source-files
Move, rather than copy, files when mirroring.

set [setting | value]
Set one of the preference variables for lftp. If run without arguments, list the variables that have been changed; without arguments and with the -a or -d flags, list all values or default values, respectively.

See the lftp manpage for a complete list of preference variables that can be set.

wait [n | all]
Wait for the job or jobs you specify by number, or all jobs, to terminate.

ln

ln [options] sourcename [destname]
ln [options] sourcenames destdirectory

Create pseudonyms (links) for files, allowing them to be accessed by different names. The first form links sourcename to destname, where destname is usually either a new filename or (by default) a file in the current directory with the same name as sourcename. If destname is an existing file, it is overwritten; if destname is an existing directory, a link named sourcename is created in that directory. The second form creates links in destdirectory, each link having the same name as the file specified.

Options

-b, --backup=[control]
Back up any existing files. When using the long version of the command, the optional control parameter controls the kind of backup. When no control is specified, ln will attempt to read the control value from the VERSION_CONTROL environment variable. Accepted values are:

none, off
Never make backups.

numbered, t
Make numbered backups.

existing, nil
Match existing backups, numbered or simple.

simple, never
Always make simple backups.

-d, -F, --directory
Allow hard links to directories. Available to privileged users.

-f, --force
Force the link (don't prompt for overwrite permission).

--help
Print a help message and then exit.

-i, --interactive
Prompt for permission before removing files.

-n, --no-dereference
Replace symbolic links to directories instead of dereferencing them. --force is useful with this option.

-s, --symbolic
Create a symbolic link. This lets you link across filesystems, and also see the name of the link when you run ls -l (otherwise, there's no way to know the name that a file is linked to).

-S suffix, --suffix=suffix
Append suffix to files when making backups, instead of the default ~.

--target-directory= diectory
Create links in the specified diectory.

-v, --verbose
Verbose mode.

--version
Print version information and then exit.

locale

locale [options] [name]

Print report on current locale settings. Locales determine the country-specific settings for a system, including character encodings, the formatting of dates, honorifics, diagnostic messages, currency, printer paper sizes, and default measurements. Locale settings are essentially a dictionary of settings specified by keyword. The keywords are grouped together into related categories whose names begin with LC_. Each category has a related environment variable of the same name from which it will read its locale setting. Supply keyword or category names as name to examine their values. Multiple names may be given. You can also use the special keyword charmap to see the current character mapping. When executed with no arguments, locale prints the value of all locale-related environment variables.

Options

-a
Print all available locale settings installed on the system.

-c
Print the category related to each name argument.

-k
Print keywords along with their settings for each name argument.

-m
Print all available character maps.

Environment variables

LANG
The default value for unset internationalization variables. If not set, the system's default value is used.

LC_ADDRESS
Postal settings, country, and language names and abbreviation.

LC_COLLATE
String and character sorting and comparison settings.

LC_CTYPE
Character attributes, including case conversion mappings, and categories of characters (whitespace, digit, lower, upper, punctuation, etc.).

LC_IDENTIFICATION
Information related to the current locale definition, including its title, source, revision, and contact information for its author.

LC_MEASUREMENT
Measurement units, metric or other.

LC_MESSAGES
Settings for yes/no prompts and other informative and diagnostic messages.

LC_MONETARY
Currency formats and symbols.

LC_NAME
Formats for names and honorifics.

LC_NUMERIC
Non-monetary number formats.

LC_PAPER
Default paper sizes for printing and pagination.

LC_TELEPHONE
Telephone number formats.

LC_TIME
Date and time formats.

LC_ALL
When set, overrides the values of all other internationalization variables.

NLSPATH
The path for finding message catalogues used in processing messages.

Examples

Print the category name and all keywords for date and time settings:

locale -ck LC_TIME

Print the strings used for days of the week and months of the year:

locale day mon
logrotate

logrotate [options] config_files

System administration command. Manipulate log files according to commands given in config_files.

Options

-d, --debug
Debug mode. No changes will be made to log files.

-f, --force
Force rotation of log files.

-h, --help
Describe options.

-m command, --mail command
Use the specified command to mail log files. The default is /bin/mail -s.

-s file, --state file
Save state information in file. The default is /var/lib/logrotate.status.

--usage
Show syntax and options.

-v, --verbose
Describe what is being done and what log files are affected.

Commands

compress
Compress old versions of log files with gzip.

compresscmd command
Use command to compress log files. Default is gzip.

compressext extension
Append filename extension to compressed files instead of the compress command's default.

compressoptions options
Specify options to pass to the compress command. Default for gzip is -9 for maximum compression.

copy
Copy log file, but do not change the original.

copytruncate
Copy log file, then truncate it in place. For use with programs whose logging cannot be temporarily halted.

create [permissions] [owner] [group]
After rotation, re-create log file with the specified permissions, owner, and group. permissions must be in octal. If any of these parameters is missing, the log file's original attributes will be used.

daily
Rotate log files every day.

delaycompress
Don't compress log file until the next rotation.

endscript
End a postrotate or prerotate script.

extension extension
Give rotated log files the specified extension. Any compression extension will be appended to this.

ifempty
Rotate log file even if it is empty. Overrides the default notifempty option.

include file
Read the file into current file. If file is a directory, read all files in that directory into the current file.

mail address
Mail any deleted logs to address.

mailfirst
When using the mail command, mail the newly rotated log instead of the one being deleted.

maillast
When using the mail command, mail the log that is about to expire. This is the default behavior.

missingok
Skip missing log files. Do not generate an error.

monthly
Rotate log files only the first time logrotate is run in a month.

nocompress
Override compress.

nocopy
Override copy.

nocopytruncate
Override copytruncate.

nocreate
Override create.

nodelaycompress
Override delaycompress.

nomail
Override mail.

nomissingok
Override missingok.

noolddir
Override olddir.

nosharedscipts
Override sharedscripts. Run prerotate and postrotate scripts for each log rotated. This is the default.

notifempty
Override ifempty.

olddir directory
Move logs into directory for rotation. directory must be on the same physical device as the original log files.

postrotate
Begin a script of directives to apply after the log file is rotated. The script ends when the endscript directive is read.

prerotate
Begin a script of directives to apply before a log file is rotated. The script ends when the endscript directive is read.

rotate number
The number of times to rotate a log file before removing it.

size n[k|M]
Rotate log file when it is greater than n bytes. n can optionally be followed by k for kilobytes or M for megabytes.

sharedscripts
Run prescript and postscript only once for the session.

start n
Use n as the starting number for rotated logs. Default is 0.

tabooext [+] extlist
Replace taboo extension list with the given extlist. If + is specified, add to existing list. The default list is .rpmorig .rpmsave ,v .swp .rpmnew ~.

weekly
Rotate log files if more than a week has passed since their last rotation.

uncompresscmd command
Use command to uncompress log files. Default is gunzip.

lpc

lpc [options] [command]

System administration command. LPRng line printer control program. If executed without a command, lpc accepts commands from standard input. Some of the commands accept a jobid parameter. A jobid can be one or more job numbers, user names, lpd key characters, or key character and glob patterns of the form X=pattern. It can also be the keyword all, which matches all jobs.

Options

-a
Alias for the -Pall command. Operate on all printer spool queues listed in the printcap all field.

-A
Use authentication as specified in the AUTH environment variable.

-Pprinter
Specify the print spool queue to operate on. A printer may also specify a host (e.g., printer@host). The default queue is the queue for whatever printer is listed in the PRINTER environment variable, or the first entry in the /etc/printcap file. If the keyword all is given instead of a printer name, lpc will operate on printers specified in the all field of the /etc/printcap file on the appropriate host. If no all field is specified, then lpc will use lpd on the appropriate host to find all available printers.

-Sserver
Send commands to the specified server instead of whatever server is listed in /etc/printcap or set using the -P option.

-Uuser
Execute commands as if they were made by user.

-V
Print version number, then exit.

Commands

?, help [commands]
Get a list of commands or help on specific commands.

active [printer@host]
Report whether lpd server is active.

abort all|printer
Terminate current printer daemon and disable printing for the specified printer.

class all|printer restriction
Restrict class of jobs being printed. restriction may be a class, a glob match on a particular control file entry of the form X=globmatch, or the word off to remove any existing restrictions.

clean all|printer
Remove files that cannot be printed from the specified printer queues.

client all|printer
Show LPRng client configuration and printcap information.

defaultq
List the default lpc queue.

defaults
List lpc's default configuration information.

disable all|printer
Disable specified printer queues.

down all|printer message
Disable specified printer queues and put message in the printer status file.

enable all|printer
Enable the specified printer queues.

exit, quit
Exit lpc.

help
Print help message.

hold printer [jobid]
Hold jobs in the queue. Release with the release command.

holdall all|printer
Automatically hold all new jobs until they are released with the release command.

kill all|printer
The same as performing abort followed by start. Although it is a convenient shorthand, sometimes the start command will not work due to race conditions.

lpd [printer@host]
Determine if lpd process is running. Report PID if it is.

lpq printer [options]
Run lpq command from inside lpc.

lprm printer jobid
Run lprm command from inside lpc to remove one or more print jobs.

move source jobid destination
Move specified jobs from source printer to destination printer.

msg printer message
Change printer status message to message. An empty message removes the current status message.

noholdall all|printer
Cancel holdall command.

quit, exit
Exit lpc program.

redirect source destination
Redirect all jobs sent to source printer to destination printer. If destination is off, turn off redirection.

redo printer jobid
Reprint jobs.

release printer [jobid]
Release held jobs for printing.

reread [printer@host]
Request lpd server to reread configuration and printcap information.

server all|printer
Show printcap entries as used by lpd.

start all|printer
Enable the printer queues and start printing daemons for the specified printers.

status all|printer
Return the status of the specified printers.

stop all|printer
Disable the specified printer daemons after any current jobs are completed.

topq printer [jobid] [users]
Put the specifed jobs at the top of the printer's queue in the order the jobs are listed.

up all|printer
Enable print queues and restart daemons for the specified printers.

lpd

lpd [options]

TCP/IP command. LPRng line printer daemon. lpd is usually invoked at boot time from the rc2 file. It makes a single pass through the printer configuration file (traditionally /etc/printcap) to find out about the existing printers, and prints any files left after a crash. It then accepts requests to print files in a queue, transfer files to a spooling area, display a queue's status, or remove jobs from a queue. In each case, it forks a child process for each request, then continues to listen for subsequent requests.

A file lock in each spool directory prevents multiple daemons from becoming active simultaneously. After the daemon has set the lock, it scans the directory for files beginning wth cf. Lines in each cf file specify files to be printed or nonprinting actions to be performed. Each line begins with a key character, which specifies information about the print job or what to do with the remainder of the line. Key characters are:

c
cifplot file.

d
DVI file.

f
Formatted file--name of a file to print that is already formatted.

g
Graph file.

l
Formatted file, but suppress pagebreaks and printing of control characters.

n
ditroff file.

p
File filtered using pr.

t
troff file.

v
File containing raster image.

C
Classification--string to be used for the classification line on the burst page.

H
Hostname--name of machine where lpd was invoked.

I
Indentation--number of characters to indent output.

J
Job name--string to be used for the jobname on the burst page.

L
Literal--contains identification information from the password file and causes the banner page to be printed.

M
Mail--send mail to the specified user when the current print job completes.

N
Filename--original name of data file to be printed.

P
Person--login name of person who invoked lpd.

T
Title--string to be used as the title for pr.

U
Unlink--name of file to remove upon completion of printing.

W
Width--page width in number of characters.

Options

-p port
Bind lpd to port instead of the default determined by getservbyname, usually port 515.

-F
Run lpd in foreground instead of as a daemon.

-L file
Log error and debugging messages to file instead of syslogd.

-V
Print version, then exit.

Files

/etc/lpd.conf
LPRng configuration file.

/etc/printcap
Printer description file.

/etc/lpd.perms
Printer permissions.

/var/spool/*
Spool directories.

/var/spool/*/printcap
Printer-specific description file.

/var/spool/*/printer
Queue lock file.

/var/spool/*/control.printer
Queue control.

/var/spool/*/active.printer
Active job.

/dev/lp*
Printer devices.

lpr

lpr [options] [files]

The LPRng print spooler. Send files to the printer spool queue. If no files are given, accept standard input. On most Linux distributions, the LPRng print spooler replaces the BSD print spooler. Some systems use the alternative CUPS printing system. Both printing systems have lpr commands with options that are mostly compatible with BSD's lpr. We document LPRng's lpr command here.

Options

-b, -l
Expect a binary or literal file on which minimial processing should be done. The file is assigned filter f, which passes it through the default input filter (:if or :filter in the printcap file).

-f
Use a filter that interprets the first character of each line as a standard carriage control character.

-h
Do not print the burst page.

-i [cols]
Indent the output. Default is 8 columns. Specify number of columns to indent with the cols argument.

-k
Send data directly to the remote printer instead of creating a temporary file. This may cause problems if the job is killed when transferring the file, but can speed up large jobs.

-l
Use a filter that allows control characters to be printed and suppresses pagebreaks.

-m address
Send mail to address if print job is unsuccessful.

-w n
Set page width to n characters.

-A
Use authentication.

-B
Filter all job files as specified in the printcap database, then combine them into a single job file to be sent to the spooler.

-C class
Set the job classification used on the burst page and to assign priorities. class should be a letter from A to Z, A being the lowest priority and Z the highest.

-F filter
Set the print filter to use when printing files. filter should be a lowercase letter. The default is f. The command used for each filter is defined in the printer's printcap file.

-G
Filter individual jobs before sending them to the spooler.

-J name
Replace the job name on the burst page with name. If omitted, use the first file's name or STDIN.

-K n, #n
Print n copies of each listed file.

-Pprinter
Output to printer instead of the printer specified in the PRINTER environment variable or the system default.

-R name
Place additional accounting information in the R field of the control file.

-T title
Use title as the title when using pr.

-U user
Specify a username for the job. Available only for privileged users.

-V
Verbose mode. Print additional information about progress of the print job. Additional -V options may be given to increase the level of information printed.

-X command
Use the specified external command to filter files.

-Y host%port
Bypass the print spooler. Connect directly to the specified host and port and send the filtered file.

-Z options
Pass additional options through to the print spooler.

Obsolete options

The following options are all obsolete, though still functional. They may be removed in later versions of lpr. We include them here for those working with older systems or updating legacy shell scripts.

-c
Expect data produced by cifplot. Use filter c.

-d
Expect data produced by TEX in the DVI (device-independent) format. Use filter d.

-g
Expect standard plot data produced by the plot routines. Use filter g.

-n
Expect data from ditroff (device-independent troff). Use filter n.

-p
Expect data preprocessed by the pr command. Use default filter f. This function may not be supported on some systems.

-r
Remove files upon completion of spooling. Mostly for compatibility with Berkeley lpr.

-t
Expect data from troff (phototypesetter commands). Use filter t.

-v
Expect a raster image for devices like the Benson Varian. Use filter v.

ls

ls [options] [names]

List contents of directories. If no names are given, list the files in the current directory. With one or more names, list files contained in a directory name or that match a file name. names can include filename metacharacters. The options let you display a variety of information in different formats. The most useful options include -F, -R, -l, and -s. Some options don't make sense together (e.g., -u and -c).

Options

-1, --format=single-column
Print one entry per line of output.

-a, --all
List all files, including the normally hidden files whose names begin with a period.

-b, --escape
Display nonprinting characters in octal and alphabetic format.

-c, --time-ctime, --time=status
List files by status change time (not creation/modification time).

--color =when
Colorize the names of files depending on the type of file. Accepted values for when are never, always, or auto.

-d, --directory
Report only on the directory, not its contents.

-f
Print directory contents in exactly the order in which they are stored, without attempting to sort them.

--full-time
List times in full, rather than use the standard abbreviations.

-g
Long listing like -l, but don't show file owners.

-h
Print sizes in kilobytes and megabytes.

--help
Print a help message and then exit.

-i, --inode
List the inode for each file.

--indicator-style=none
Display filenames without the flags assigned by -p or -f (default).

-k, --kilobytes
If file sizes are being listed, print them in kilobytes. This option overrides the environment variable POSIXLY_CORRECT.

-l, --format=long, --format=verbose
Long format listing (includes permissions, owner, size, modification time, etc.).

-m, --format=commas
Merge the list into a comma-separated series of names.

-n, --numeric-uid-gid
Like -l, but use group ID and user ID numbers instead of owner and group names.

-o
Long listing like -l, but don't show group information.

-p, --filetype, --indicator-style=file-type
Mark directories by appending / to them.

-q, --hide-control-chars
Show nonprinting characters as ? (default for display to a terminal).

-r, --reverse
List files in reverse order (by name or by time).

-s, --size
Print file size in blocks.

--show-control-chars
Show nonprinting characters verbatim (default for printing to a file).

--si
Similar to -h, but uses powers of 1000 instead of 1024.

-t, --sort=time
Sort files according to modification time (newest first).

-u, --time=atime, --time=access, --time=use
Sort files according to file access time.

--version
Print version information on standard output, then exit.

-x, --format=across, --format=horizontal
List files in rows going across the screen.

-v, --sort=version
Interpret the digits in names such as file.6 and file.6.1 as versions, and order filenames by version.

-w, --width=n
Format output to fit n columns.

-A, --almost-all
List all files, including the normally hidden files whose names begin with a period. Does not include the . and .. directories.

-B, --ignore-backups
Do not list files ending in ~ unless given as arguments.

-C, --format=vertical
List files in columns (the default format).

-D, --dired
List in a format suitable for Emacs dired mode.

-F, --classify, --indicator-style=classify
Flag filenames by appending / to directories, * to executable files, @ to symbolic links, | to FIFOs, and = to sockets.

-G, --no-group
In long format, do not display group name.

-H, --dereference-command-line
When symbolic links are given on the command line, follow the link and list information from the actual file.

-I, --ignore pattern
Do not list files whose names match the shell pattern pattern unless they are given on the command line.

-L, --dereference
List the file or directory referenced by a symbolic link rather than the link itself.

-N, --literal
Display special graphic characters that appear in filenames.

-Q, --quote-name
Quote filenames with "; quote nongraphic characters.

-R, --recursive
List directories and their contents recursively.

-S, --sort=size
Sort by file size, largest to smallest.

-Rfile, --reload-state file
Load state from file before starting execution.

-U, sort=none
Do not sort files.

-X, sort=extension
Sort by file extension, then by filename.

mail

mail [options] [users]

Read mail or send mail to other users. The mail utility allows you to compose, send, receive, forward, and reply to mail. mail has two main modes: compose mode, in which you create a message, and command mode, in which you manage your mail.

While mail is a powerful utility, it can be tricky for a novice user. It is most commonly seen nowadays in scripts. Most Linux distributions include several utilities that are richer in features and much easier to use: mailers built in to browsers such as Netscape and Mozilla, graphical mail programs distributed with GNOME (Evolution) and KDE (Kmail), and the terminal-based, full-screen utilities pine and elm. The GNU Emacs editor can also send and receive mail.

This section presents mail commands, options, and files. To get you started, here are two of the most basic commands.

To enter interactive mail-reading mode, type:

mail

To begin writing a message to user, type:

mail user

Enter the text of the message, one line at a time, pressing Enter at the end of each line. To end the message, enter a single period (.) in the first column of a new line and press Enter.

Command-line options

-b list
Set blind carbon copy field to comma-separated list.

-c list
Set carbon copy field to comma-separated list.

-d
Print debugging information.

-f [file]
Process contents of file instead of /var/spool/mail/$user. If file is omitted, process mbox in the user's home directory.

-i
Do not respond to tty interrupt signals.

-n
Do not consult /etc/mail.rc when starting up.

-p
Read mail in POP mode.

-s subject
Set subject to subject.

-u
Process contents of /var/spool/mail/$user (the default).

-v
Verbose; print information about mail delivery to standard output.

-N
When printing a mail message or entering a mail folder, do not display message headers.

-P
Disable POP mode.

Compose-mode commands

~!
Execute a shell escape from compose mode.

~?
List compose-mode escapes.

~b names
Add names to or edit the Bcc: header.

~c names
Add names to or edit the Cc: header.

~d
Read in the dead.letter file.

~e
Invoke text editor.

~f messages
Insert messages into message being composed.

~F messages
Similar to ~f, but include message headers.

~h
Add to or change all headers interactively.

~m messages
Similar to ~f, but indent with a tab.

~M messages
Similar to ~m, but include message headers.

~p
Print message header fields and message being sent.

~q
Abort current message composition.

~r filename
Append file to current message.

~s string
Change Subject: header to string.

~t names
Add names to or edit the To: list.

~v
Invoke editor specified with the VISUAL environment variable.

~| command
Pipe message through command.

~: mail-command
Execute mail-command.

~~string
Insert string in text of message, prefaced by a single tilde (~). If string contains a ~, it must be escaped with a \.

Command-mode commands

?
List summary of commands (help screen).

!
Execute a shell command.

- num
Print numth previous message; defaults to immediately previous.

alias (a)
Print or create alias lists.

alternates (alt)
Specify remote accounts on remote machines that are yours. Tell mail not to reply to them.

chdir (c)
cd to home or specified directory.

copy (co)
Similar to save, but do not mark message for deletion.

delete (d)
Delete message.

dp
Delete current message and display next one.

edit (e)
Edit message.

exit (ex, x)
Exit mail without updating folder.

file (fi)
Switch folders.

folder (fold)
Read messages saved in a file. Files can be:

#
Previous

%
System mailbox

%user
user's system mailbox

&
mbox

+folder
File in folder directory.

folders
List folders.

headers (h)
List message headers at current prompt.

headers+ (h+)
Move forward one window of headers.

headers- (h-)
Move back one window of headers.

help
Same as ?.

hold (ho)
Hold messages in system mailbox.

ignore
Append list of fields to ignored fields.

mail user (m)
Compose message to user.

mbox
Move specified messages to mbox on exiting (the default).

next (n)
Type next message or next message that matches argument.

preserve (pr)
Synonym for hold.

print [list] (p)
Display each message in list.

Print [list] (P)
Similar to print, but include header fields.

quit (q)
Exit mail and update folder.

reply (r)
Send mail to all on distribution list.

Reply (R)
Send mail to author only.

respond
Same as reply.

retain
Always include this list of header fields when printing messages. With no arguments, list retained fields.

save (s)
Save message to folder.

saveignore
Remove ignored fields when saving.

saveretain
Override saveignore to retain specified fields.

set (se)
Set or print mail options.

shell (sh)
Enter a new shell.

size
Print size of each specified message.

source
Read commands from specified file.

top
Print first few lines of each specified message.

type (t)
Same as print.

Type (T)
Same as Print.

unalias
Discard previously defined aliases.

undelete (u)
Restore deleted message.

unread (U)
Mark specified messages as unread.

unset (uns)
Unset mail options.

visual (v)
Edit message with editor specified by the VISUAL environment variable.

write (w)
Write message, without header, to file.

xit (x)
Same as exit.

z
Move mail's attention to next windowful of text. Use z- to move it back.

Options

These options are used inside the .mailrc file. The syntax is set option or unset option.

append
Append (do not prepend) messages to mbox.

ask
Prompt for subject.

askbcc
Prompt for blind carbon copy recipients.

askcc
Prompt for carbon copy recipients.

asksub
Prompt for Subject line.

autoprint
Print next message after a delete.

chron
Display messages in chronological order, most recent last.

debug
Same as -d on command line.

dot
Interpret a solitary . as an EOF.

folder
Define directory to hold mail folders.

hold
Keep message in system mailbox upon quitting.

ignore
Ignore interrupt signals from terminal. Print them as @.

ignoreeof
Do not treat ^D as an EOF.

metoo
Do not remove sender from groups when mailing to them.

noheader
Same as -N on command line.

nokerberos
Retrieve POP mail via POP3, not KPOP, protocol.

nosave
Do not save aborted letters to dead.letter.

pop-mail
Retrieve mail with POP3 protocol, and save it in mbox.pop.

prompt
Set prompt to a different string.

Replyall
Switch roles of Reply and reply.

quiet
Do not print version at startup.

searchheaders
When given the specifier /x:y, expand all messages that contain the string y in the x header field.

verbose
Same as -v on command line.

verbose-pop
Display status while retrieving POP mail.

Special files

calendar
Contains reminders that the operating system mails to you.

.maildelivery
Mail delivery configuration file.

.mailrc
Mail configuration file.

triplog
Keeps track of your automatic response recipients.

tripnote
Contains automatic message.

make

make [options] [targets] [macro definitions]

Update one or more targets according to dependency instructions in a description file in the current directory. By default, this file is called makefile or Makefile. Options, targets, and macro definitions can be in any order. Macro definitions are typed as:

name=string

For more information on make, see Managing Projects with make (O'Reilly).

Options

-d, --debug
Print detailed debugging information.

-e, --environment-overrides
Override makefile macro definitions with environment variables.

-f makefile, --file=makefile, --makefile=makefile
Use makefile as the description file; a filename of - denotes standard input.

-h, --help
Print options to make command.

-i, --ignore-errors
Ignore command error codes (same as .IGNORE).

-j [jobs], --jobs [=jobs]
Attempt to execute jobs jobs simultaneously or, if no number is specified, as many jobs as possible.

-k, --keep-going
Abandon the current target when it fails, but keep working with unrelated targets.

-l [load], --load-average [=load], --max-load [=load]
Attempt to keep load below load, which should be a floating-point number. Used with -j.

-n, --just-print, --dry-run, --recon
Print commands but don't execute (used for testing).

-o file, --old-file=file, --assume-old=file
Never remake file or cause other files to be remade on account of it.

-p, --print-data-base
Print rules and variables in addition to normal execution.

-q, --question
Query; return 0 if file is up to date; nonzero otherwise.

-r, --no-built-in-rules
Do not use default rules.

-s, --silent, --quiet
Do not display command lines (same as .SILENT).

-t, --touch
Touch the target files without remaking them.

-v, --version
Show version of make.

-w, --print-directory
Display the current working directory before and after execution.

--warn-undefined-variables
Print warning if a macro is used without being defined.

-C directory, --directory directory
cd to directory before beginning make operations. A subsequent -C directive will cause make to attempt to cd into a directory relative to the current working directory.

-I directory, --include-dir directory
Include directory in list of directories containing included files.

-S, --no-keep-going, --stop
Cancel previous -k options. Useful in recursive makes.

-W file, --what-if file, --new-file file, --assume-new file
Behave as though file has been recently updated.

Description file lines

Instructions in the description file are interpreted as single lines. If an instruction must span more than one input line, use a backslash (\) at the end of the line so that the next line is considered a continuation. The description file may contain any of the following types of lines:

Blank lines
Blank lines are ignored.

Comment lines
A pound sign (#) can be used at the beginning of a line or anywhere in the middle. make ignores everything after the #.

Dependency lines
Depending on one or more targets, certain commands that follow will be executed. Possible formats include:

targets : dependencies
targets : dependencies ; command

Subsequent commands are executed if dependency files (the names of which may contain wildcards) do not exist or are newer than a target. If no prerequisites are supplied, then subsequent commands are always executed (whenever any of the targets are specified). No tab should precede any targets.

Conditionals
Conditionals are evaluated when the makefile is first read and determine what make sees, i.e., which parts of the makefile are obeyed and which parts are ignored. The general syntax for a conditional is:

conditional
Text if true
else
Text if false
endif
ifeq (arg1, arg2), ifeq "arg1" "arg2"
True if the two arguments are identical. The arguments should either be placed in parentheses and separated by a comma--(arg1, arg2)--or individually quoted with either single or double quotes.

ifneq (arg1, arg2), ifneq "arg1" "arg2"
True if the two arguments are not identical. The arguments should either be placed in parentheses and separated by a comma or individually quoted with either single or double quotes.

ifdef variable
True if variable has a nonempty value.

ifndef variable
True if variable has an empty value.

Suffix rules
These specify that files ending with the first suffix can be prerequisites for files ending with the second suffix (assuming the root filenames are the same). Either of these formats can be used:

.suffix.suffix:
.suffix:

The second form means that the root filename depends on the filename with the corresponding suffix.

Commands
Commands are grouped below the dependency line and are typed on lines that begin with a tab. If a command is preceded by a hyphen (-), make ignores any error returned. If a command is preceded by an at sign (@), the command line won't echo on the display (unless make is called with -n).

Macro definitions
These have the following form:

name = string

or:

define name
string
endef

Blank space is optional around the =.

Include statements
Similar to the C include directive, these have the form:

include files

Internal macros

$?
The list of prerequisites that have been changed more recently than the current target. Can be used only in normal description file entries, not in suffix rules.

$@
The name of the current target, except in description file entries for making libraries, where it becomes the library name. Can be used both in normal description file entries and in suffix rules.

$<
The name of the current prerequisite that has been modified more recently than the current target.

$*
The name (without the suffix) of the current prerequisite that has been modified more recently than the current target. Can be used only in suffix rules.

$%
The name of the corresponding .o file when the current target is a library module. Can be used both in normal description file entries and in suffix rules.

$^
A space-separated list of all dependencies with no duplications.

$+
A space-separated list of all dependencies, including duplications.

Pattern rules

These are a more general application of the idea behind suffix rules. If a target and a dependency both contain %, GNU make will substitute any part of an existing filename. For instance, the standard suffix rule:

$(cc) -o $@ $<

can be written as the following pattern rule:

%.o : %.c
$(cc) -o $@ $<

Macro modifiers

D
The directory portion of any internal macro name except $?. Valid uses are:

$(*D)   $$(@D)   $(?D)   $(<D)
$(%D)   $(@D)    $(^D)
F
The file portion of any internal macro name except $?. Valid uses are:

$(*F)   $$(@F)   $(?F)   $(<F)
$(%F)   $(@F)    $(^F)

Functions

$(subst from,to,string)
Replace all occurrences of from with to in string.

$(patsubst pattern,to,string)
Similar to subst, but treat % as a wildcard within pattern. Substitute to for any word in string that matches pattern.

$(strip string)
Remove all extraneous whitespace.

$(findstring substring,mainstring)
Return substring if it exists within mainstring; otherwise, return null.

$(filter pattern,string)
Return those words in string that match at least one word in pattern. pattern may include the wildcard %.

$(filter-out pattern,string)
Remove those words in string that match at least one word in pattern. pattern may include the wildcard %.

$(sort list)
Return list, sorted in lexical order.

$(dir list)
Return the directory part (everything up to the last slash) of each filename in list.

$(notdir list)
Return the nondirectory part (everything after the last slash) of each filename in list.

$(suffix list)
Return the suffix part (everything after the last period) of each filename in list.

$(basename list)
Return everything but the suffix part (everything up to the last period) of each filename in list.

$(addsuffix suffix,list)
Return each filename given in list with suffix appended.

$(addprefix prefix,list)
Return each filename given in list with prefix prepended.

$(join list1,list2)
Return a list formed by concatenating the two arguments word by word (e.g., $(join a b,.c .o) becomes a.c b.o).

$(word n,string)
Return the nth word of string.

$(wordlist start,end,string)
Return words in string between word start and word end, inclusive.

$(words string)
Return the number of words in string.

$(firstword list)
Return the first word in the list list.

$(wildcard pattern)
Return a list of existing files in the current directory that match pattern.

$(foreach variable,list,string)
For each whitespace-separated word in list, expand its value and assign it to variable; then expand string, which usually contains a function referencing variable. Return the list of results.

$(if condition,then-string[,else-string])
Expand string condition if it expands to a nonempty string, then expand the then-string. If condition expands to an empty string, return the empty string, or if specified, expand and return the else-string.

$(call variable,parameters)
Expand each item in comma-separated list parameters and assign it to a temporary variable, $(n), where n is an incremented number beginning with 0. Then expand variable, a string referencing these temporary variables, and return the result.

$(origin variable)
Return one of the following strings that describes how variable was defined: undefined, default, environment, environment override, file, command line, override, or automatic.

$(shell command)
Return the results of command. Any newlines in the result are converted to spaces. This function works similarly to backquotes in most shells.

$(error string)
When evaluated, generate a fatal error with the message string.

$(warning string)
When evaluated, generate a warning with the message string.

Macro string substitution

$(macro:s1=s2)
Evaluates to the current definition of $(macro), after substituting the string s2 for every occurrence of s1 that occurs either immediately before a blank or tab or at the end of the macro definition.

Special target names

.DEFAULT:
Commands associated with this target are executed if make can't find any description file entries or suffix rules with which to build a requested target.

.DELETE_ON_ERROR:
If this target exists in a makefile, delete the target of any rule whose commands return a nonzero exit status.

.EXPORT_ALL_VARIABLES:
If this target exists, export all macros to all child processes.

.IGNORE:
Ignore error codes. Same as the -i option.

.INTERMEDIATE:
This target's dependencies should be treated as intermediate files.

.NOTPARALLEL:
If this target exists in a makefile, run make serially, ignoring option -j.

.PHONY:
Always execute commands under a target, even if it is an existing, up-to-date file.

.PRECIOUS:
Files you specify for this target are not removed when you send a signal (such as an interrupt) that aborts make or when a command line in your description file returns an error.

.SECONDARY:
Like .INTERMEDIATE, this target's dependencies should be treated as intermediate files, but never automatically deleted.

.SILENT:
Execute commands, but do not echo them. Same as the -s option.

.SUFFIXES:
Suffixes associated with this target are meaningful in suffix rules. If no suffixes are listed, the existing list of suffix rules is effectively "turned off."

makedbm

makedbm [options] infile outfile
makedbm [option]

NFS/NIS command. Create or dump an NIS dbm file. makedbm will take a text infile and convert it to a gdbm database file named outfile. This file is suitable for use with ypserv. Each line of the input file is converted to a single record. All characters up to the first TAB or SPACE form the key, and the rest of the line is the data. If a line ends with \&, the data for that record is continued on to the next line. The # character is given no special treatment. infile can be -, in which case the standard input is read.

makedbm generates two special keys: the YP_MASTER_NAME key, which is the value of the current host (unless another name is specified with -m), and the YP_LAST_MODIFIED key, which is the date of infile (or the current time if infile is -).

Options

-a
Add support for mail aliases.

-b
Insert YP_INTERDOMAIN key into map. This indicates that ypserv should fall back to DNS lookups when a host's address is not found in NIS.

-c
Send a YPPROC_CLEAR signal to ypserv, causing it to clear all cached entries.

-i file_name
Create a YP_INPUT_NAME key with the value file_name.

-l
Convert keys of the given map to lowercase.

-m master_name
Specify the value of the YP_MASTER_NAME key. The default value is the current hostname.

--no-limit-check
Don't enforce NIS size limits for keys or data.

-o file_name
Create a YP_OUTPUT_NAME key with the value file_name.

-r
Treat lines beginning with # as comments. Do not include them in the data file.

-s
Add the key YP_SECURE, indicating that ypserv should accept connections to the database only from secure NIS networks.

-u filename
Undo a gdbm file--print out a dbm file, one entry per line, with a single space separating keys from values.

Example

It is easy to write shell scripts to convert standard files such as /etc/passwd to the key value form used by makedbm. For example, the awk program:

BEGIN { FS =":";OFS = "\t";}
{ print $1, $0}

takes the /etc/passwd file and converts it to a form that can be read by makedbm to make the NIS file passwd.byname. That is, the key is a username and the value is the remaining line in the /etc/passwd file.

man

man [options] [section] [title]

Display information from the online reference manuals. man locates and prints the named title from the designated reference section.

Traditionally, manpages are divided into nine sections, where section 1 consists of user commands, section 2 contains system calls, and so forth. By default, all sections are consulted, so the section option serves to bypass the most common entry and find an entry of the same name in a different section (e.g., man 2 nice).

Numerous other utilities, such as info, xman, and the Konqueror browser, can also display manpages.

Options

-7, --ascii
Expect a pure ASCII file, and format it for a 7-bit terminal or terminal emulator.

-a, --all
Show all pages matching title.

-b
Leave blank lines in output.

-d, --debug
Display debugging information. Suppress actual printing of manual pages.

-f, --whatis
Same as whatis command.

-k, --apropos
Same as apropos command.

-l, --local-file
Search local files, not system files, for manual pages. If i is given as filename, search standard input.

-m systems, --systems=systems
Search systems' manual pages. systems should be a comma-separated list.

-p preprocessors, --preprocessor=preprocessors
Preprocess manual pages with preprocessors before turning them over to nroff, troff, or groff. Always runs soelim first to read in files to be included in this one. preprocessors can be any combination of e for equations, p for pictures, t for tables, and r for bibliographical references.

-r prompt, --prompt=prompt
Set prompt if less is used as pager.

-t, --troff
Format the manual page with /usr/bin/groff -Tgv -mandoc. Implied by -T and -Z.

-u, --update
Perform a consistency check between manual page cache and filesystem.

-w, -W, --path, --where
Print pathnames of entries on standard output.

-D
Display debugging information about how the page was retrieved.

-K directory
A kind of super-k option. Search for a term in all manpages and display the name of each page, along with a prompt asking whether you want to view the page.

-L locale, --locale=locale
Assume current locale to be locale; do not consult the setlocale( ) function.

-M path, --manpath=path
Search for manual pages in path. Ignore -m option.

-Ppager, --pager=pager
Select paging program pager to display the entry.

-S sections
Sections to look in for an entry. Like specifying section on the command line, except that multiple section numbers can be specified, separated by colons.

-T device, --troff-device[=device]
Format groff or troff output for device, such as dvi, latin1, X75, and X100.

-Z, --ditroff
Do not allow postprocessing of manual page after groff has finished formatting it.

Section names

Manual pages are divided into sections for various audiences:

1
Executable programs or shell commands.

2
System calls (functions provided by the kernel).

3
Library calls (functions within system libraries).

4
Special files (usually found in /dev).

5
File formats and conventions (e.g., /etc/passwd).

6
Games.

7
Macro packages and conventions.

8
System administration commands (usually only for a privileged user).

9
Kernel routines (nonstandard).

merge

merge [options] file1 file2 file3

Perform a three-way file merge. The effect is easiest to understand if file2 is considered the original version of a file, file3 an altered version of file2, and file1 a later altered version of file2.

After the merge, file1 contains both the changes from file2 to file1 and the changes from file2 to file3. In other words, file1 keeps its changes and incorporates the changes in file3 as well. merge does not change file2 or file3.

If a line from file2 was changed in different ways in both file1 and file3, merge recognizes a conflict. By default, the command outputs a warning and puts brackets around the conflict, with lines preceded by <<<<<<< and >>>>>>>. A typical conflict looks like this:

<<<<<<< file1
relevant lines from file1
=  ==  ==  ==
relevant lines from file3
>>>>>>> file3

If there are conflicts, the user should edit the result and delete one of the alternatives.

Options

-e
Don't warn about conflicts.

-p
Send results to standard output instead of overwriting file1.

-q
Quiet; do not warn about conflicts.

-A
Output conflicts using the -A style of diff3. This merges all changes leading from file2 to file3 into file1 and generates the most verbose output.

-E
Output conflict information in a less verbose style than -A; this is the default.

-L label
Specify up to three labels to be used in place of the corresponding filenames in conflict reports. That is:

merge -L x -L y -L z file_a file_b file_c

generates output that looks as if it came from x, y, and z instead of from file_a, file_b, and file_c.

-V
Print version number.

metamail

metamail [options] [filename]

Normally invisible to users, metamail is used to send and display rich text or multimedia email using MIME typing metadata. Mail-reading programs normally call metamail to determine how to handle the data, but metamail can be called directly by developers who want to use it for their own mail software, or by system administrators and power users adding lines to their printcap files. Any argument passed to metamail that is not preceded by a hyphen (-) is assumed to be the name of a file to read. If no filename is specified, standard input is assumed.

Options

-b
The message is not in RFC 822 format; treat as the body of the message. Requires -c.

-B
Display the message in the background, if noninteractive. Cannot be used with -p or -P.

-c type
Use the specified content type instead of the one in the headers.

-d
Don't ask before running an interpreter to view the message. The default is to ask.

-e
Remove ("eat") leading newlines in the message body. Useful for MH-format mail.

-f addr
Specify the name of the message sender. The default is to try to determine the name from the header.

-h
Specify that a message is to be printed. Automatically sets -d.

-m mailer
Specify the mail program to be called by metamail.

-p
If necessary, display the output one page at a time. The default is to pipe the output through more, but the environment variable METAMAIL_PAGER can be set to specify an alternative command. Use -p rather than piping the message to a pager.

-P
Like -p, but also print "Press RETURN to go on" at the end of each page. Cannot be used with -B.

-q
Run quietly.

-r
Specify that metamail can be run as root.

-R
Run /usr/ucb/reset to reset the terminal before performing any other I/O.

-s subject
Specify the Subject field. By default, the subject is determined from the headers.

-T
Turn off the effect of the environment variable MM_TRANSPARENT. Intended to be used recursively by metamail, and should be used only when the program restarts itself in a terminal emulator window.

-w
Don't consult a mailcap file to determine how to display the data, but simply decode each part and write to a file in its raw format (which might be binary). Depending on how metamail is called, the filename is determined from the message headers, by asking the user, or by generating a unique temporary filename.

-x
Tell metamail that it is not running on a terminal. The environment variable MM_NOTTY can be set instead of specifying -x.

-y
Try to "yank" a MIME-format message from the body of the message.

-z
Delete the input file when done.

metasend

metasend [options] [filename]

A largely developer-oriented interface for sending non-text email using MIME typing metadata. If no arguments are specified, metasend prompts the user for the information it needs. See mailto for a possible alternative with a friendlier interface.

Options

-/ subtype
Specify the MIME multipart subtype other than mixed.

-b
Batch mode. All information must be provided on the command line.

-c cc
Specify any CC addresses.

-D string
Specify a string to be used as the Content-description value.

-e encoding
Specify the encoding to use. Possible values are base64, quoted-printable, 7bit (no encoding is done), or x-uue.

-E
The file to be included is already MIME-encoded and doesn't need any Content- or other header fields added.

-f file
The file to be included. If more than one file is specified with separate -f options (see -n), they are combined into a single multipart MIME object.

-F from
The From address.

-i content-id
The content ID value for the MIME entity. Must be a valid content ID enclosed in angle brackets (<>).

-I content-id
The content ID value for a multipart entity being created by metasend. Must be a valid content ID enclosed in angle brackets (<>).

-m type
The MIME content type.

-n
Specify that an additional file is to be included. Must appear after one occurrence of at least -m, -c, and -f and must be specified for each included file.

-ooutfile
Send the output to the specified file instead of delivering as mail.

-P preamblefile
Specify a file containing alternative text for the preamble portion of a multipart MIME message.

-s subject
The Subject field.

-S splitsize
Specify the maximum size before the file is split into parts to be sent separately.

-t to
The To field.

-z
Delete temporary files even if the send fails.

mformat

mformat [options] drive

Format a blank disk in MS-DOS format. See mtools for more information about how to handle MS-DOS filesystems. After using mformat to format a disk, you should use mbadblocks to check for bad blocks.

Options

The mformat command accepts many of the same options as the MS-DOS FORMAT command:

-v [label]
Choose a label for this volume. Maximum length is 11 characters.

-f N
If you are using a floppy disk, use this flag and note the size of the disk in kilobytes as 160, 180, 320, 360, 720, 1200, 1440, or 2280. For most relatively recent systems, only the last two are relevant. If you are not using a floppy, you must use the -h, -t, or -n flags.

-t N
The number of tracks on the disk.

-h N
The number of heads, or sides, on the disk (either 1 or 2).

-n
The number of sectors per track.

You can also use a number of option flags that are not included in the MS-DOS version of FORMAT, including:

-F
Format as a FAT32 partition.

-S N
Size code. You are defining a sector that is the N+7th power of two.

-X
Format as an XDF (OS/2) disk.

-2
Use a 2m format.

-3
Don't use a 2m format, even if the disk looks like a 2m disk.

-C
Create a disk image file. Useful only for virtual disks.

-M N
Set the software sector size to be different from the physical sector size.

-N serialno
Choose a serial number. Use -a for an Atari-style serial number, stored in the OEM label.

-c N
Set the cluster size to N sectors.

-r N
Set the root directory size to N sectors for 12- and 16-bit FAT formats.

-L N
Set the length of the File Allocation Table (FAT).

mkdosfs

mkdosfs [options] device [blocks]mkfs.msdos [options] device [blocks]

System administration command. Format device as an MS-DOS filesystem. You may specify the number of blocks on the device or allow mkdosfs to guess.

Options

-b backup-sector
Specify sector for backup boot sector. The default value depends on the number of reserved sectors, but is usually sector 6.

-c
Scan device for bad blocks before execution.

-f n
Specify number of File Allocation Tables (FATs) to create (either 1 or 2).

-i volume-id
Use the specified 32-bit hexadecimal volume-id instead of calculating a number based on the time of creation.

-l file
Read list of bad blocks from file.

-m message-file
Set the message to be used when the filesystem is booted without an installed operating system to the contents of the file message-file. The message may be up to 418 bytes in size. If filename is a hyphen, read text from standard input.

-n label
Set volume name for filesystem to label. The volume name may be up to 11 characters long.

-r maximum-entries
Set the maximum-entries allowed in the root directory. The default is 112 or 224 for floppies and 512 for hard disks.

-s sectors
Set the number of disk sectors per cluster. The number must be a power of 2.

-v
Print verbose information about progress.

-A
Create an Atari MS-DOS filesystem.

-C
Create and format a file suitable for use on a floppy disk. The device given on the command line should be a filename, and the number of blocks must also be specified.

-F fat-size
Create File Allocation Tables (FATs) of size fat-size. By default this will be between 12 and 16 bits. Set to 32 to create a FAT32 filesystem.

-I
Force installation to a device without partitions. This is useful when formating magneto-optical disks.

-R reserved-sectors
Create the specified number of reserved-sectors. The default depends on the size of the File Allocation Table (FAT). For 32-bit FAT, the default is 32; for all other sizes, the default is 1.

-S sector-size
Create logical sectors of sector-size bytes. Size must be a power of 2 and at least 512 bytes.

mke2fs

mke2fs [options] device [blocks]
mkfs.ext2 [options] device [blocks]

System administration command. Format device as a Linux Second Extended Filesystem. You may specify the number of blocks on the device or allow mke2fs to guess.

Options

-b block-size
Specify block size in bytes.

-c
Scan device for bad blocks before execution.

-f fragment-size
Specify fragment size in bytes.

-i bytes-per-inode
Create an inode for each bytes-per-inode of space. bytes-per-inode must be 1024 or greater; it is 4096 by default.

-j
Create an ext3 journal. This is the same as invoking mkfs.ext3.

-l filename
Consult filename for a list of bad blocks.

-m percentage
Reserve percentage percent of the blocks for use by privileged users.

-n
Don't create the filesystem, just show what would happen if it were run. This option is overridden by -F.

-o os
Set filesystem operating system type to os. The default value is usually Linux.

-q
Quiet mode.

-r revision
Set filesystem revision number to revision.

-v
Verbose mode.

-F
Force mke2fs to run even if filesystem is mounted or device is not a block special device. This option is probably best avoided.

-J parameterlist
Use specified parameterlist to create an ext3 journal. The following two parameters may be given in a comma-separated list:

size=journal-size
Create a journal of journal-size megabytes. The size may be between 1024 filesystem blocks and 102,400 filesystem blocks in size (e.g., 1-100 megabytes if using 1K blocks, 4-400 megabytes if using 4K blocks).

device=journal-device
Use an external journal-device to hold the filesystem journal. The journal-device can be specified by name, by volume label, or by UUID.

-L label
Set volume label for filesystem.

-M directory
Set the last mounted directory for filesystem to directory.

-N inodes
Specify number of inodes to reserve for filesystem. By default, this number is calculated from number of blocks and inode size.

-O featurelist
Use specified featurelist to create filesystem. The sparse_super and filetype features are used by default on kernels 2.2 and later. The following parameters may be given in a comma-separated list:

filetype
Store file type information in directory entries.

has_journal
Create an ext3 journal. Same as using the -j option.

journal_dev
Prepare an external journaling device by creating an ext3 journal on device instead of formatting it.

sparse_super
Save space on large filesystem by creating fewer superblock backup copies.

-R stride=size
Configure filesystem for a RAID array. Set stride size to size blocks per stripe.

-S
Write only superblock and group descriptors; suppress writing of inode table and block and inode bitmaps. Useful only when attempting to salvage damaged systems.

-T use
Set bytes-per-inode based on the intended use of the filesystem. Supported filesystem types are:

news
Four kilobytes per inode.

largefile
One megabyte per inode.

largefile4
Four megabytes per inode.

-V
Print version number, then exit.

mkisofs

mkisofs [options] -o file pathspecs

Generate an ISO9660/Joliet/HFS filesystem for writing to a CD with a utility such as cdrecord. (HFS is the native Macintosh Hierarchical File System.) mkisofs takes a snapshot of a directory tree and generates a binary image that corresponds to an ISO9660 or HFS filesystem when it is written to a block device. Each specified pathspec describes the path of a directory tree to be copied into the ISO9660 filesystem; if multiple paths are specified, the files in all the paths are merged to form the image.

Options

-A id, -appid id
Specify a text string id that describes the application to be written into the volume header.

-abstract file
Specify the abstract filename. Overrides an ABST=file entry in .mkisofsrc.

-allow-lowercase
Allow ISO9660 filenames to be lowercase. Violates the ISO9660 standard.

-allow-multidot
Allow more than one dot in ISO9660 filenames. Violates the ISO9660 standard.

-b image
Specify the path and filename of the boot image to be used for making a bootable CD based on the El Torito specification.

-B sun-images
Specify a comma-separated list of boot images needed to make a bootable CD for a Sun Sparc system.

-biblio file
Specify bibliographic filename. Overrides a BIBLIO=file entry in .mkisofsrc.

-boot-info-table
Specify that a 56-byte table with information on the CD layout is to be patched in at offset 8 of the boot file. If specified, the table is patched into the source boot file, so make a copy if the file isn't recreatable.

-boot-load-seg addr
Specify the load segment address of the boot image for a no-emulation El Torito CD.

-boot-load-size size
Specify the number of virtual 512-byte sectors to load in no-emulation mode. The default is to load the entire boot file. The number may need to be a multiple of 4 to prevent problems with some BIOSes.

-c catalog
Specify the path, relative to the source pathspec, and the filename of the boot catalog for an El Torito bootable CD. Required for making a bootable CD.

-C last-start,next-start
Required for creating a CDExtra or a second or higher-level session for a multisession CD. last-start is the first sector number in the last session on the disk, and next-start is the first sector number for the new session. Use the command:

cdrecord -msinfo

to get the values. Use -C with -M to create an image that is a continuation of the previous session; without -M, create an image for a second session on a CDExtra (a multisession CD with audio data in the first session and an ISO9660 filesystem image in the second).

-[no-]cache-inodes
Cache [do not cache] inode and device numbers to find hard links to files. The default on Linux is to cache. Use -no-cache-inodes for filesystems that do not have unique inode numbers.

-check-oldnames
Check all filenames imported from old sessions for mkisofs compliance with ISO9660 file-naming rules. If not specified, check only those files with names longer than 31 characters.

-check-session file
Check all old sessions for mkisofs compliance with ISO9660 file-naming rules. This option is the equivalent of:

-M file -C 0,0 -check-oldnames

where file is the pathname or SCSI device specifier that would be specified with -M.

-copyright file
Specify the name of the file that contains the copyright information. Overrides a COPY=file entry in .mkisofsrc.

-d
Omit trailing period from files that do not have one. Violates the ISO9660 standard, but works on many systems.

-D
Do not use deep directory relocation. Violates the ISO9660 standard, but works on many systems.

-dir-mode mode
Specify the mode for directories used to create the image. Automatically enables the Rock Ridge extensions.

-eltorito-alt-boot
Start with a new set of El Torito boot parameters. Allows putting more than one El Torito boot image on a CD (maximum is 63).

-exclude-list file
Check filenames against the globs contained in the specified file and exclude any that match.

-f
Follow symbolic links when generating the filesystem.

-file-mode mode
Specify the mode for files used to create the image. Automatically enables the Rock Ridge extensions.

-force-rr
Do not use automatic Rock Ridge detection for the previous session.

-G image
Specify the path and filename of the generic boot image for making a generic bootable CD.

-gid gid
Set the group ID to gid for the source files. Automatically enables the Rock Ridge extensions.

-graft-points
Allow the use of graft points for filenames, which permits paths to be grafted at locations other than the root directory. -graft-points checks all filenames for graft points and divides the filename at the first unescaped equals sign (=).

-gui
Switch the behavior for a GUI. Currently, the only effect is to make the output more verbose.

-hard-disk-boot
Specify that the boot image to be used to create an El Torito bootable CD is a hard disk image and must begin with a master boot record containing a single partition.

-hidden glob
Set the hidden (existence) ISO9660 directory attribute for paths or filenames matching the shell-style pattern glob. To match a directory, the path must not end with a trailing /.

-hidden-list file
Specify a file containing a list of globs that are to be hidden with -hidden.

-hide glob
Find paths or files that match the shell-style pattern glob and hide them from being seen on the ISO9660 or Rock Ridge directory. The files are still included in the image file. If the pattern matches a directory, the contents of the directory are hidden. To match a directory, the path must not end with a trailing /. Use with the -hide-joliet option.

-hide-joliet glob
Hide paths or files that match the shell-style pattern glob so they will not be seen in the Joliet directory. If the pattern matches a directory, the contents of the directory are hidden. To match a directory, the path must not end with a trailing /. Should be used with -hide.

-hide-joliet-list file
Specify a file containing a list of globs to be hidden with -hide-joliet.

-hide-joliet-trans-tbl
Hide the TRANS.TBL files from the Joliet tree.

-hide-list file
Specify a file containing a list of globs to be hidden with -hide.

-hide-rr-moved
Rename the directory RR_MOVED to .rr_moved to hide it as much as possible from the Rock Ridge directory tree. Use the -D option to omit the file entirely.

-input-charset charset
Specify the character set for characters used in local filenames. Specify help in place of a charset for a list of valid character sets.

-iso-level level
Set the ISO9660 conformance level. Possible values are:

1
Filenames are restricted to 8.3 characters and files may have only one section.

2
Files may have only one section.

3
No restrictions.

-J
Generate Joliet directory records in addition to regular ISO9660 filenames.

-jcharset charset
The equivalent of -input-charset -J.

-l
Allow full 31-character filenames instead of restricting them to the MS-DOS-compatible 8.3 format.

-L
Allow ISO9660 filenames to begin with a period.

-log-file file
Send all messages to the specified log file.

-m glob
Exclude files matching the shell-style pattern glob.

-M path
Specify the path to an existing ISO9660 image to be merged. path can also be a SCSI device specified in the same syntax as cdrecord's dev= parameter. May be used only with -C.

-max-iso9660-filenames
Allow up to 37 characters in ISO9660 filenames. Forces -N. Violates the ISO9660 standard.

-N
Omit version numbers from ISO9660 filenames. Violates the ISO9660 standard. Use with caution.

-new-dir-mode mode
Specify the mode to use for new directories in the image. The default is 0555.

-nobak, -no-bak
Do not include backup files on the ISO9660 filesystem.

-no-boot
Mark the El Torito CD to be created as not bootable.

-no-emul-boot
Specify that the boot image for creating an El Torito bootable CD is a no-emulation image.

-no-iso-translate
Do not translate the # and ~ characters. Violates the ISO9660 standard.

-no-rr
Do not use Rock Ridge attributes from previous sessions.

-no-split-symlink-components
Do not split symlink components.

-no-split-symlink-fields
Do not split symlink fields.

-o file
Specify the filename of the output ISO9660 filesystem image.

-output-charset charset
Specify the output character set for Rock Ridge filenames. The default is the input character set.

-p prepid
Specify a text string of up to 128 characters describing the preparer of the CD. Overrides a PREP= parameter set in the file .mkisofsrc.

-P pubid
Specify a text string of up to 128 characters describing the publisher of the CD to be written to the volume header. Overrides a PUBL= parameter set in .mkisofsrc.

-[no -]pad
Pad [do not pad] the ISO9660 filesystem by 16 sectors (32KB). If the resulting size is not a multiple of 16 sectors, add sectors until it is. The default is -pad.

-path-list file
Specify a file that contains a list of pathspec directories and filenames to add to the ISO9660 filesystem. Note that at least one pathspec must be given on the command line.

-print-size
Print estimated filesystem size and exit.

-quiet
Run in quiet mode; do not display progress output.

-r
Like -R, but set UID and GID to zero, set all file read bits to write, and turn off all file write bits. If any execute bit is set for a file, set all execute bits; if any search bit is set for a directory, set all search bits; if any special mode bits are set, clear them.

-R
Generate SUSP (System Use Sharing Protocol) and Rock Ridge records using the Rock Ridge protocol.

-relaxed-filenames
Allow ISO9660 filenames to include seven-digit ASCII characters except lowercase characters. Violates the ISO9660 standard.

-sort file
Sort file locations according to the rules in the specified file, which contains pairs of filenames and weights, with one space or tab between them. A higher weight puts the file closer to the beginning of the media.

-sysid id
Specify the system ID. Overrides a SYSI= parameter set in the file .mkisofsrc.

-T
Generate the file TRANS.TBL in each directory for establishing the correct filenames on non-Rock Ridge-capable systems.

-table-name table
Use table as the translation table name instead of TRANS.TBL. Implies -T. For a multisession image, the table name must be the same as the previous session.

-U
Allow untranslated filenames. Violates the ISO9660 standard. Forces the options -d, -l, -L, -n, -relaxed-filenames, -allow-lowercase, -allow-multidot, -no-iso-translate. Use with extreme caution.

-ucs-level num
Set the Unicode conformance level to the specified number, which can be between 1 and 3 (default is 3).

-use-fileversion
Use file version numbers from the filesystem. The version number is a string from 1 to 32767. The default is to set a version of 1.

-v
Run in verbose mode. Specify twice to run even more verbosely.

-V volid
Specify the volume ID (volume name or label) to be written to the master block. Overrides a VOLI= parameter specified in the file .mkisofsrc.

-volset id
Specify the volume set ID. Overrides a VOLS= parameter specified in .mkisofsrc.

-volset-seqno num
Set the volume set sequence number to num. Must be specified after -volset-size.

-volset-size num
Set the volume set size (the number of CDs in a set) to num. Must be specified before -volset-seqno.

-x path
Exclude path from being written to the CD, where path is the complete pathname derived from the concatenation of the pathname from the command line and the path relative to this directory. May be specified more than once to exclude multiple paths.

HFS options

-apple
Create an ISO9660 CD with Apple's extensions.

-auto file
Set file as the Autostart file to make the HFS CD use the QuickTime 2.0 Autostart feature. file must be the name of an application or document at the top level of the CD and must be less than 12 characters long.

-boot-hfs-file file
Install file as the driver file that may make the CD bootable on a Macintosh.

-cluster-size size
Specify the size in bytes of a cluster or allocation units of PC Exchange files. Implies the use of --exchange.

-hfs
Create a hybrid ISO9660/HFS CD. Use with -map, -magic, and/or the various --HFS options.

-hfs-bless folder
"Bless" the specified directory (folder), specified as the full pathname as mkisofs. This is usually the System Folder and is used in creating HFS bootable CDs. The pathname must be in quotes if it contains spaces.

-hfs-creator creator
Set the four-character default creator for all files.

-hfs-type type
Set the four-character default type for all files.

-hfs-unlock
Leave the HFS volume unlocked so other applications can modify it. The default is to lock the volume.

-hfs-volid id
Specify the volume name for the HFS partition. This name is assigned to the CD on a Macintosh and replaces the ID set with the -V option.

-hide-hfs glob
Hide files or directories matching the shell-style pattern glob from the HFS volume, although they still exist in the ISO9660 and/or Joliet directory. May be specified multiple times.

-hide-hfs-list file
The specified file contains a list of globs to be hidden.

-input-hfs-charset charset
Specify the input character set used for HFS filenames when used with the -mac-name option. The default is cp10000 (Mac Roman).

-mac-name
Use the HFS filename as the starting point for the ISO9660, Joliet, and Rock Ridge filenames.

-magic file
Use the specified magic file to set a file's creator and type information based on the file's magic number, which is usually the first few bytes of the file. The magic file contains entries consisting of four tab-separated columns specifying the byte offset, type, test, and a message.

-map file
Use the specified mapping file to set a file's creator and type information based on the filename extension. Only files that are not known Apple or Unix file types need to be mapped. The mapping file consists of five-column entries specifying the extension, file translation, creator, type, and a comment. Creator and type are both four-letter strings.

-no-desktop
Do not create empty Desktop files. The default is to create such files.

-output-hfs-charset charset
Specify the output character set used for HFS filenames. Defaults to the input character set.

-part
Generate an HFS partition table. The default is not to generate the table.

-probe
Search the contents of files for known Apple or Unix file types.

--format
Look for Macintosh files of the specified file format type. The valid formats are cap (Apple/Unix File System (AUFS) CAP files), netatalk, double, ethershare, ushare, exchange, sgi, xinet, macbin, single, dave, and sfm.

modprobe

modprobe [options] [modules]

System administration command. With no options, attempt to load the specified module, as well as all modules on which it depends. If more than one module is specified, attempt to load further modules only if the previous module failed to load. When specifying a module, use only its name without its path or trailing .o.

Options

-a, --all
Load all listed modules, not just the first one.

-c, --showconfig
Print modprobe's current configuration.

-d, --debug
Print debugging information about module.

-h, --help
Print help message, then exit.

-k, --autoclean
Mark module to be removed when inactive by setting its autoclean flag. This option is passed on to insmod.

-l, --list
List modules. This option may be combined with -t to specify a type of module.

-n, --show
Don't load or remove modules; only show what would happen if modules were loaded or removed.

-q, --quiet
Suppress warnings from insmod when it fails to load a module. Continue processing other modules. This option is passed on to insmod.

-r, --remove
Remove the specified modules, as well as the modules on which they depend.

-s, --syslog
Send error messages to syslogd instead of to standard error. This option is passed on to insmod.

-t type, --type type
Load only a specific type of module. Consult /etc/modules.conf for the directories in which all modules of that type reside.

-v, --verbose
Print commands as they are executed.

-C file, --config file
Read additional configuration from file instead of /etc/modules.conf.

-V, --version
Print version, then exit.

Files

/etc/modules.conf
Information about modules: which ones depend on others, and which directories correspond to particular types of modules.

/sbin/insmod, /sbin/rmmod, /sbin/depmod
Programs that modprobe relies on.

more

more [options] [files]

Display the named files on a terminal, one screenful at a time. See less for an alternative to more.

Options

+num
Begin displaying at line number num.

-num number
Set screen size to number lines.

+/pattern
Begin displaying two lines before pattern.

-c
Repaint screen from top instead of scrolling.

-d
Display the prompt "Hit space to continue, Del to abort" in response to illegal commands; disable bell.

-f
Count logical rather than screen lines. Useful when long lines wrap past the width of the screen.

-l
Ignore form-feed (Ctrl-L) characters.

-p
Page through the file by clearing each window instead of scrolling. This is sometimes faster.

-s
Squeeze; display multiple blank lines as one.

-u
Suppress underline characters.

Commands

All commands in more are based on vi commands. You can specify a number before many commands to have them executed multiple times. For instance, 3:p causes more to skip back three files, the same as issuing :p three times. The optional number is indicated by num in the following list.

SPACE
Display next screen of text.

z
Display next num lines of text, and redefine a screenful to num lines. Default is one screenful.

RETURN
Display next num lines of text, and redefine a screenful to num lines. Default is one line.

d, ^D
Scroll num lines of text, and redefine scroll size to num lines. Default is one line.

q, Q, INTERRUPT
Quit.

s
Display next screen of text.

f
Skip forward two screens of text.

b, ^B
Skip backward one screen of text.

'
Return to point where previous search began.

=
Print number of current line.

/pattern
Search for pattern, skipping to numth occurrence if an argument is specified.

n
Repeat last search, skipping to numth occurrence if an argument is specified.

!cmd, :!cmd
Invoke shell and execute cmd in it.

v
Invoke vi editor on the file at the current line.

^L
Redraw screen.

:n
Skip to next file.

:p
Skip to previous file.

:f
Print current filename and line number.

.
Reexecute previous command.

Examples

Page through file in "clear" mode, and display prompts:

more -cd file

Format doc to the screen, removing underlines:

nroff doc | more -u

View the manpage for the more command; begin at the first appearance of the word "scroll":

man more|more +/scroll
mount

mount [options] [[device] directory]

System administration command. Mount a file structure. The file structure on device is mounted on directory. If no device is specified, mount looks for an entry in /etc/fstab to find what device is associated with the given directory. The directory, which must already exist and should be empty, becomes the name of the root of the newly mounted file structure. If mount is invoked with no arguments, it displays the name of each mounted device, the directory on which it is mounted, its filesystem type, and any mount options associated with the device.

Options

-a
Mount all filesystems listed in /etc/fstab. Use -t to limit this to all filesystems of a particular type.

-f
Fake mount. Go through the motions of checking the device and directory, but do not actually mount the filesystem.

-h
Print help message, then exit.

-l
When reporting on mounted filesystems, show filesystem labels for filesystems that have them.

-n
Do not record the mount in /etc/mtab.

-o option
Qualify the mount with a mount option. Many filesystem types have their own options. The following are common to most filesystems:

async
Read input and output to the device asynchronously.

atime
Update inode access time for each access. This is the default behavior.

auto
Allow mounting with the -a option.

defaults
Use all options' default values (async, auto, dev, exec, nouser, rw, suid).

dev
Interpret any special devices that exist on the filesystem.

exec
Allow binaries to be executed.

_netdev
Filesystem is a network device requiring network access.

noatime
Do not update inode access time for each access.

noauto
Do not allow mounting via the -a option.

nodev
Do not interpret any special devices that exist on the filesystem.

noexec
Do not allow the execution of binaries on the filesystem.

nosuid
Do not acknowledge any suid or sgid bits.

nouser
Only privileged users will have access to the filesystem.

remount
Expect the filesystem to have already been mounted, and remount it.

ro
Allow read-only access to the filesystem.

rw
Allow read/write access to the filesystem.

suid
Acknowledge suid and sgid bits.

sync
Read input and output to the device synchronously.

user
Allow unprivileged users to mount or unmount the filesystem. The defaults on such a system will be nodev, noexec, and nosuid, unless otherwise specified.

users
Allow any user to mount or unmount the filesystem. The defaults on such a system will be nodev, noexec, and nosuid, unless otherwise specified.

-r
Mount filesystem read-only.

-s
Where possible, ignore mount options specified by -o that are not supported by the filesystem.

-t type
Specify the filesystem type. Possible values include adfs, affs, autofs, coda, cramfs, devpts, efs, ext2, ext3, hfs, hpfs, iso9660, jfs, msdos, ncpfs, nfs, ntfs, proc, qnx4, reiserfs, romfs, smbfs, sysv, tmpfs, udf, ufs, umsdos, vfat, xfs, and xiafs. The default type is iso9660. The type auto may also be used to set mount to autodetect the filesystem. When used with -a, this option can limit the types mounted. Use a comma-separated list to specify more than one type to mount, and prefix a type with no to exclude that type.

-v
Display mount information verbosely.

-w
Mount filesystem read/write. This is the default.

-F
When used with -a, fork a new process to mount each system.

-L label
Mount filesystem with the specified label.

-O option
Limit systems mounted with -a by its filesystem options. (As used with -o.) Use a comma-separated list to specify more than one option, and prefix an option with no to exclude filesystems with that option. Options -t and -O are cumulative.

-U uuid
Mount filesystem with the specified uuid.

-V
Print version, then exit.

Files

/etc/fstab
List of filesystems to be mounted and options to use when mounting them.

/etc/mtab
List of filesystems currently mounted and the options with which they were mounted.

/proc/partitions
Used to find filesystems by label and uuid.

mpartition

mpartition [options] drive

Create the MS-DOS partition specified by drive; used mostly on proprietary Unix systems where fdisk is unavailable. See mtools for more information. When a partition is being created, the default is for the number of sectors and heads and the length to be automatically determined, but they can also be specified as options.

Options

-a
Activate the partition, making it the bootable partition.

-b offset
The starting offset of the partition to be created, in sectors. The default is the start of the disk (partition 1) or immediately after the end of the previous partition.

-B bootsector
Read the template master boot record from the file specified by bootsector. Can be specified with -I.

-c
Create the partition.

-d
Deactivate the partition, making it nonbootable.

-f
Allow overriding of safeguards that perform consistency checking before any change is made to a partition. Can be specified with any operation that modifies the partition table.

-h heads
The number of heads for a partition being created.

-I
Initialize the partition table and remove all partitions.

-l length
The size of the partition to be created, in sectors.

-p
Print a command line to re-create the partition. With -v, print the current partition table.

-r
Remove the partition.

-s sectors
The number of sectors per track of the partition to be created.

-t cylinders
The number of cylinders of the partition to be created.

-v
With -p, print the current partition table; otherwise, for commands that modify the partition table, print it after it has been modified.

-vv
Print a hexadecimal dump of the partition table when reading and writing it.

mpg321

mpg321 [options] file
mpg123 [options] file

Command-line MP3 players, often used as backends for GUI music players. The files played may be local files or URLs. mpg321 and mpg123 behave the same way, except that mpg123 lacks the option --skip-printing-frames.

Options

-o devicetype
Name the type of audio device you are using. Valid types are oss (Open Sound System), sun (Sun audio system), alsa (Advanced Linux Sound Architecture), alsa09 (ALSA, version 0.9), esd (Enlightened Sound Daemon), and arts (Analog Real-Time Synthesizer).

-a, --audiodevice device
Name the actual device (e.g., /dev/sound/dsp1) you are using. This option is ignored if you have chosen -o arts. For esd running on remote systems, you must specify the host, and for alsa, you must specify the card and device (default is 0:0).

-g, --gain n
Set the volume (gain) to an integer between 1 and 100.

-k, --skip n
Do not play the first n frames of the file or stream.

-n, --frames n
Play only the first n frames of the file or stream.

-@, --list filename
Specify a playlist file. The format of filename is just a list of filenames, one file per line, to be played.

-z, --shuffle
Shuffle the files in the playlist and any files supplied on the command line, and play the list once. Each file will be played once.

-Z, --random
Each time one file is finished playing, choose a new file at random. Files may be played more than once, and mpg321 will continue playing songs at random until it is stopped.

-v, --verbose
Verbose mode. Display additional information about the file, including ID3 tags and time played/time remaining.

-s, --stdout
Mostly useful for developers, this option uses stdout instead of an audio device for its output. The output is 16-bit PCM, little-endian data.

-w, --wav filename
Instead of playing the song, write the output to the .wav file you specify. Choosing - as the filename sends the WAV data to stdout. This option is usually used with the --cdr option.

--cdr filename
Write to a CDR file. Choosing - as the filename sends the data to stdout.

--au filename
Instead of playing the file, write the output to the .au file you specify. Choosing - as the filename sends the data to stdout.

-t, --test
Test mode. Do not play or write any data.

-q, --quiet
Quiet mode. This still plays the file, but does not display any data about the file or about mpg321.

-R
Operate in "remote control" mode, allowing seek and pause. This option is useful almost exclusively for developers of graphical frontends for mpg321.

--stereo
Play in stereo. If audio is mono, send two identical streams as stereo output.

--aggressive
Aggressive mode takes a higher priority in the system if possible. It requires root access because it can preempt processes owned by other users.

--skip-printing-frames n
Save CPU cycles by displaying a status update only once every n frames. This option is not available in mpg123.

--help, --longhelp
Display usage information.

-V, --version
Display the version of mpg321 and then quit.

mt

mt [option] operation [count]

Control a magnetic tape drive used to back up or restore system data. The operation argument determines what action will be taken, and unless the -f or --file option is used, the action is applied to the default tape drive named in the TAPE environment variable. The count argument determines how many times the operation is to be repeated. If not specified, it defaults to 1.

Options

-f, --file=device
Name the tape device to use. This may be a local device, character special file (see mknod), or a remote device, named as host:/path/to/drive or user@host:path/to/drive.

--rsh-command=command
Choose a different command to use when connecting to a remote drive. The default is set in MT_RSH, and is normally either ssh or rsh.

-V, --version
Print version number and exit.

Operations

mt can perform the following operations on tape drives. Operations applicable only to SCSI tape drives are marked as such.

eof, weof n
Write n end-of-file (EOF) notations at the current location on the tape.

fsf n
Move forward n files, positioning the tape at the first block of the next file.

bsf n
Move backward n files, positioning the tape at the first block of the previous file.

fsr n
Move forward n records.

bsr n
Move backward n records.

bsfm n
Move backward n file marks, to a position on side of the file mark closer to the beginning of the tape.

fsfm n
Move forward n file marks, to a position on side of the file mark closer to the beginning of the tape.

asf n
Move to file number n on the tape. This is the same as rewinding the tape and moving forward n spaces with fsf.

eom
Move to the end of recording on the tape. Usually used when preparing to record new data onto the tape.

rewind
Return to the beginning of the tape.

offline, rewoffl
Rewind and unload the tape (if drive supports unload).

status
Display the status of the tape drive.

retension
Used when the tape has become loosely wound, usually because it has been dropped, shaken, or transported. Rewinds the tape, moves forward to the end of the tape, then rewinds again.

erase
Erase the tape.

fss n
SCSI drives only. Move forward n set marks.

bss n
SCSI drives only. Move backward n set marks.

wset n
SCSI drives only. Write n set marks at current position.

eod, seod
Move to the end of valid data on the tape. Similar to eom, but used with streamer tapes.

setblk n
SCSI drives only. Set the block size to n bytes per record.

setdensity n
SCSI drives only. Set the data density for your tape drive to n. The appropriate value should be in the tape or tape drive documentation. For more information, see the densities operation.

drvbuffer n
SCSI drives only. Set the buffer value. For no buffer, choose 0, and for normal buffering, choose 1. Other values may have different effects depending on the drive.

stoptions n
SCSI drives only. Set the driver bits for the device; items are added as with chmod. 1 is for write buffering, 2 for asynchronous writing, 4 for read-ahead, and 8 for debugging output.

stwrthreshold n
SCSI drives only. Set the write threshold for the tape drive to n kilobytes. This value may not be higher than the driver buffer value.

seek n
SCSI drives only. Seek to block n on the tape.

tell
SCSI drives only. Tell the number of the current block on the tape.

densities
SCSI tapes only. Display information about data densities on stdout.

datacompression [n]
Works on some SCSI-2 DAT tapes only. If n is 0, turn data compression off. If n is 1, display the compression status. Other values turn compression on.

mv

mv [option] sources target

Move or rename files and directories. The source (first column) and target (second column) determine the result (third column):

Source

Target

Result

File

name (nonexistent)

Rename file to name.

File

Existing file

Overwrite existing file with source file.

Directory

name (nonexistent)

Rename directory to name.

Directory

Existing directory

Move directory to be a subdirectory of existing directory.

One or more files

Existing directory

Move files to directory.

Options

-b, --backup
Back up files before removing.

-f, --force
Force the move, even if target file exists; suppress messages about restricted access modes.

--help
Print a help message and then exit.

-i, --interactive
Query user before removing files.

-u, --update
Do not remove a file or link if its modification date is the same as or newer than that of its replacement.

-v, --verbose
Print the name of each file before moving it.

--version
Print version information and then exit.

-S suffix, --suffix=suffix
Override the SIMPLE_BACKUP_SUFFIX environment variable, which determines the suffix used for making simple backup files. If the suffix is not set either way, the default is a tilde (~).

-V value, --version-control=value
Override the VERSION_CONTROL environment variable, which determines the type of backups made. The acceptable values for version control are:

t, numbered
Always make numbered backups.

nil, existing
Make numbered backups of files that already have them, simple backups of the others. This is the default.

never, simple
Always make simple backups.

netstat

netstat [options]

TCP/IP command. Show network status. Print information on active sockets, routing tables, interfaces, masquerade connections, or multicast memberships. By default, netstat lists open sockets.

Options

The first five options( -g, -i, -r, -s, and -M) determine what kind of information netstat should display.

-g, --groups
Show multicast group memberships.

-i, --interface[=name]
Show all network interfaces, or just the interface specified by name.

-r, --route
Show kernel routing tables.

-s, --statistics
Show statistics for each protocol.

-M, --masquerade
Show masqueraded connections.

-a, --all
Show all entries.

-c, --continuous
Display information continuously, refreshing once every second.

-e, --extend
Increase level of detail in reports. Use twice for maximum detail.

-l, --listening
Show only listening sockets.

-n, --numeric
Show network addresses, ports, and users as numbers.

--numeric-hosts
Show host addresses as numbers, but resolve others.

--numeric-ports
Show ports as numbers, but resolve others.

--numeric-users
Show user ID numbers for users, but resolve others.

-o, --timers
Include information on network timers.

-p, --program
Show the process ID and name of the program owning the socket.

--protocol=family
Show connections only for the specified address family. Accepted values are inet, unix, ipx, ax25, netrom, and ddp.

-t, --tcp
Limit report to information on TCP sockets.

-u, --udp
Limit report to information on UDP sockets.

-v, --verbose
Verbose mode.

-w, --raw
Limit report to information on raw sockets.

-C
Print routing information from the route cache.

-F
Print routing information from the forward information database (FIB). This is the default.

-N, --symbolic
Where possible, print symbolic host, port, or user names instead of numerical representatitons. This is the default behavior.

nm

nm [options] [objfiles]

Print the symbol table (name list) in alphabetical order for one or more object files. If no object files are specified, perform operations on a.out. Output includes each symbol's value, type, size, name, and so on. A key letter categorizing the symbol can also be displayed.

Options

-a, --debug-syms
Print debugger symbols.

--defined-only
Display only defined symbols.

-f format, --format=format
Specify output format (bsd, sysv, or posix). Default is bsd.

-g, --extern-only
Print external symbols only.

--help
Print help message, then exit.

-l, --line-numbers
Print source filenames and line numbers for each symbol from available debugging information.

-n, -v, --numeric-sort
Sort the external symbols by address.

-p, --no-sort
Don't sort the symbols at all.

-r, --reverse-sort
Sort in reverse, alphabetically or numerically.

-s, --print-armap
Include mappings stored by ar and ranlib when printing archive symbols.

--size-sort
Sort by size.

-t radix, --radix=radix
Use the specified radix for printing symbol values. Accepted values are d for decimal, o for octal, and x for hexadecimal.

--target=format
Specify an object code format other than the system default.

-u, --undefined-only
Report only the undefined symbols.

-A, -o, -print-file-name
Print input filenames before each symbol.

-C, --demangle[=style]
Translate low-level symbol names into readable versions. You may specify a style to use when demangling symbol names from a foreign compiler.

-D, --dynamic
Print dynamic, not normal, symbols. Useful only when working with dynamic objects (some kinds of shared libraries, for example).

-P, --portability
Same as -f posix.

-S, --print-size
Print the size of defined symbols.

-V, --version
Print nm's version number on standard error.

nslookup

nslookup [-option...] [host_to_find | -[server ]]

TCP/IP command. Query Internet domain name servers. nslookup is deprecated; its functionality is replaced by the dig and host commands. nslookup may not be included in some distributions.

nslookup has two modes: interactive and noninteractive. Interactive mode allows the user to query name servers for information about various hosts and domains or to print a list of hosts in a domain. It is entered either when no arguments are given (default name server will be used) or when the first argument is a hyphen and the second argument is the hostname or Internet address of a name server. Noninteractive mode is used to print just the name and requested information for a host or domain. It is used when the name of the host to be looked up is given as the first argument. Any of the keyword=value pairs listed under the interactive set command can be used as an option on the command line by prefacing the keyword with a -. The optional second argument specifies a name server.

Options

All of the options under the set interactive command can be entered on the command line, with the syntax -keyword[=value].

Interactive commands

exit
Exit nslookup.

finger [name] [>|>>filename]
Connect with finger server on current host, optionally creating or appending to filename.

help, ?
Print a brief summary of commands.

host [server]
Look up information for host using the current default server, or server if specified.

ls -[ahd] domain [>|>>filename]
List information available for domain, optionally creating or appending to filename. The -a option lists aliases of hosts in the domain. -h lists CPU and operating system information for the domain. -d lists all contents of a zone transfer.

lserver domain
Change the default server to domain. Use the initial server to look up information about domain.

root
Change default server to the server for the root of the domain namespace.

server domain
Change the default server to domain. Use the current default server to look up information about domain.

set keyword[=value]
Change state information affecting the lookups. Valid keywords are:

all
Print the current values of the frequently used options to set.

class=name
Set query class to IN (Internet), CHAOS, HESIOD, or ANY. Default is IN.

domain=name
Change default domain name to name.

[no]debug
Turn debugging mode on or off.

[no]d2
Turn exhaustive debugging mode on or off.

[no]defname
Append default domain name to every lookup.

[no]ignoretc
Ignore truncate error.

[no]recurse
Tell name server to query or not query other servers if it does not have the information.

[no]search
With defname, search for each name in parent domains of current domain.

[no]vc
Always use a virtual circuit when sending requests to the server.

port=port
Connect to name server using port.

querytype=value
See type=value.

retry=number
Set number of retries to number.

root=host
Change name of root server to host.

srchlist=domain
Set search list to domain.

timeout=number
Change timeout interval for waiting for a reply to number seconds.

type=value
Change type of information returned from a query to one of:

A

Host's Internet address

ANY

Any available information

CNAME

Canonical name for an alias

HINFO

Host CPU and operating system type

MD

Mail destination

MG

Mail group member

MINFO

Mailbox or mail list information

MR

Mail rename domain name

MX

Mail exchanger

NS

Name server for the named zone

PTR

Hostname or pointer to other information

SOA

Domain start-of-authority

TXT

Text information

UINFO

User information

WKS

Supported well-known services

view filename
Sort and list output of previous ls command(s) with more.

nsupdate

nsupdate [options] [filename]

System administration command. Interactively submit dynamic DNS update requests to a name server. Use nsupdate to add or remove records from a zone without manually editing the zone file. Commands may be entered interactively or read from filename. An update message is built from multiple commands, some establishing prerequisites, some adding or deleting resource records. Messages are executed as a single transaction. A blank line or the send command will send the current message. Lines beginning with a semicolon are treated as comments. For additional information on dynamic DNS updates, see RFC 2136.

Options

-d
Print additional tracing information usable for debugging.

-k keyfile
Read encrypted transaction signature key from keyfile. The key should be encrypted using the HMAC-MD5 algorithm. Keyfiles are generated by the dnssec-keygen command.

-v
Use TCP instead of UDP to send update requests.

-y keyname:secret
Generate transaction signature from specified keyname and secret.

Interactive commands

key keyname secret
Generate transaction signature from specified keyname and secret. This command overrides command-line options -k or -y.

local address [port]
Use local address and, if specified, port to send updates.

prereq nxdomain domain-name
Perform updates only if there are no preexisting records with the name domain-name.

prereq nxrset domain-name [class] type
Perform updates only if there are no preexisting records of the specified type and class for domain-name. When no class is given, IN is assumed.

prereq yxdomain domain-name
Perform updates only if there is a preexisting record with the name domain-name.

prereq nxrset domain-name [class] type [data.
Perform updates only if there is a preexisting record of the specified type and class for domain-name. If data is given, the RDATA of the specified resource must match it exactly. When no class is given, IN is assumed.

send
Send the current message. Same as entering a blank line.

server servername [port]
Update records on DS server servername instead of the master server listed in the MNAME field of the appropriate zone's SOA record.

show
Print all commands in current message.

update add domain-name [ttl] [class] type data
Add a resource record with the specified values.

update delete domain-name [ttl] [class] [type [data]]
Delete resource records for domain-name. The ttl field is always ignored, but if other fields are given, only delete records that match all criteria.

zone zonename
Apply updates to the specified zonename. If no zone command is given, nsupdate attempts to determine the correct zone based on other input.

objcopy

objcopy [options] infile [outfile]

Copy the contents of the input object file to another file, optionally changing the file format in the process (but not the endian-ness). If outfile is not specified, objcopy creates a temporary file and renames it to infile when the copy is complete, destroying the original input file. The GNU Binary File Descriptor (BFD) library is used to read and write the object files.

Options

--add-section section=file
Add a new section to the output object file with the specified section name and the contents taken from the specified file. Available only for formats that allow arbitrarily named sections.

--alt-machine-code=n
If the output architecture has alternate machine codes, use the nth code instead of the default.

-b n, --byte=n
Copy only every nth byte. Header data is not affected. The value of n can be from 0 to interleave-1, where interleave is specified by -i (default is 4). This option is useful for creating files to program ROM and is typically used with srec as the output format.

-B bfdarch, --binary-architecture=bfdarch
Set the output architecture to bfdarch (e.g., i386) for transforming a raw binary file into an object file. Otherwise, this option is ignored. After the conversion, your program can access data inside the created object file by referencing the special symbols _binary_objfile_start, _binary_objfile_end, and _binary_objfile_size.

--change-addresses=incr, --adjust-vma=incr
Change the VMA and LMA addresses of all sections, plus the start address, by adding incr. Changing section addresses is not supported by all object formats. Sections are not relocated.

--change-leading-char
For object formats that use a special character (such as an underscore) to begin symbols, change the leading character when converting between formats. If the character is the same in both formats, the option has no effect. Otherwise, it adds, removes, or changes the leading character as appropriate for the output format.

--change-section-address section{=|+|-}val, --adjust-section-vma section{=|+|-}val
Set or change the VMA and LMA addresses of the specified section. With =, set the section address to the specified value; otherwise, add or subtract the value to get the new address.

--change-section-lma section{=|+|-}val
Set or change the LMA address of the specified section. With =, set the section address to the specified value; otherwise, add or subtract the value to get the new address.

--change-section-vma section{=|+|-}val
Set or change the VMA address of the specified section. With =, set the section address to the specified value; otherwise, add or subtract the value to get the new address.

--change-start incr, --adjust-start incr
Add incr to the start address to get a new start address. Not supported by all object formats.

--change-warnings, --adjust-warnings
Issue a warning if the section specified in one of the options --change-section-address, --change-section-lma, or --change-section-vma does not exist.

--debugging
Convert debugging information if possible.

-F bfdname, --target=bfdname
Set the binary format for both input and output files to the binary file descriptor name bfdname. No format translation is done. Use the -h option for a list of supported formats for your system.

-g, --strip-debug
Do not copy debugging information.

-G symbol, --keep-global-symbol=symbol
Copy only the specified global symbol, making all other symbols local to the file. May be specified multiple times.

--gap-fill=val
Fill gaps between sections with the specified value; applies to the load address (LMA) of the sections.

-h, --help
Print help information, including a list of supported target object formats, then exit.

-i interleave, --interleave=interleave
Copy one out of every interleave bytes. Use -b to set the byte to copy (default is 4). This option is ignored if -b is not specified.

-I bfdname, --input-target=bfdname
Set the binary file format of the input file using its binary file descriptor name, bfdname.

-j section, --only-section=section
Copy only the specified section. May be specified multiple times.

-K symbol, --keep-symbol=symbol
Copy only the specified symbol from the source file. May be specified multiple times.

--keep-global-symbols=filename
Apply the option --keep-global-symbol to each symbol listed in the specified file. The file should have one symbol per line, with comments beginning with a hash mark (#). May be specified multiple times.

--keep-symbols=file
Apply the option --keep-symbol to each symbol listed in the specified file. The file should have one symbol per line, with comments beginning with a hash mark (#). May be specified multiple times.

-L symbol, --localize-symbol=symbol
Make the specified symbol local. May be specified multiple times.

--localize-symbols=filename
Apply the option --localize-symbol to each symbol listed in the specified file. The file should have one symbol per line, with comments beginning with a hash mark (#). May be specified multiple times.

-N symbol, --strip-symbol=symbol
Do not copy the specified symbol. May be specified multiple times.

--no-change-warnings, --no-adjust-warnings
Do not issue a warning even if the section specified in one of the options --change-section-address, --change-section-lma, or --change-section-vma does not exist.

-O bfdname, --output-target=bfdname
Set the binary file format of the output file using its binary file descriptor name, bfdname. The format srec generates S-records (printable ASCII versions of object files), and binary generates a raw binary file. Use -h for other available formats.

-p, --preserve-dates
Preserve the input file's access and modification dates in the output file.

--pad-to=addr
Pad the output file up to the load address. Use the fill value specified by --gap-fill (default is 0).

-R section, --remove-section=section
Do not copy any section with the specified name. May be specified multiple times.

--redefine-sym old=new
Change the name of the symbol old to new.

--remove-leading-char
If the first character of a global symbol is a special character (such as an underscore) used by the input object file format, remove it. Unlike --change-leading-char, this option always changes the symbol name when appropriate, regardless of the output object format.

--rename-section oldname=newname[,flags]
Rename a section from oldname to newname, optionally also changing the flags to flags.

-S, --strip-all
Do not copy relocation and symbol information.

--set-section-flags section=flags
Set flags for the specified section as a comma-separated string of flag names. Not all flags are meaningful for all object formats. The possible flags are alloc, code, contents, data, debug, load, noload, readonly, rom, and share.

--set-start=val
Set the start address of the new file to the specified value. Not supported by all object formats.

--srec-forceS3
Force all srec output records to be type S3 records.

--srec-len=ival
Set the maximum length of srec output records to the specified value. The length includes the address, data, and crc fields.

--strip-symbols=filename
Apply the option --strip-symbol to each symbol listed in the specified file. The file should have one symbol per line, with comments beginning with a hash mark (#). May be specified multiple times.

--strip-unneeded
Strip all symbols not needed for relocation processing.

-v, --verbose
Run in verbose mode, listing all object files modified; for archives, list all archive members.

-V, --version
Print version information and exit.

-W symbol, --weaken-symbol=symbol
Make the specified symbol weak. May be specified multiple times.

--weaken
Make all global symbols weak.

--weaken-symbols=filename
Apply the option --weaken-symbol to each symbol listed in the specified file. The file should have one symbol per line, with comments beginning with a hash mark (#). May be specified multiple times.

-x, --discard-all
Do not copy nonglobal symbols.

-X, --discard-locals
Do not copy compiler-generated local symbols (usually those starting with L or ..).

objdump

objdump [options] objfiles

Display information about one or more object files. If an archive is specified, objdump displays information on each object file in the archive. At least one of the options -a, -d, -D, -f, -g, -G, -h, -H, -p, -r, -S, -t, -T, -V, or -x must be given to tell objdump what information to show.

Options

-a, --archive-header
If any input files are archives, display the archive header information. The output includes the object file format of each archive member.

--adjust-vma=offset
Add offset to all section headers before dumping information. Useful if the section addresses do not correspond to the symbol table.

-b bfdname, --target=bfdname
Set the binary file format using its binary file descriptor name, bfdname. Use the -h option for a list of supported formats for your system.

-C [style], --demangle[=style]
Decode (demangle) low-level symbol names into user-level names, optionally specifying a mangling style. Removes any initial underscores and makes C++ function names readable.

-d, --disassemble
Display assembler mnemonic names for the machine instructions. Disassemble only sections that are expected to contain instructions.

-D, --disassemble-all
Disassemble all sections, not just those expected to contain instructions.

-EB, --endian=big
-EL, --endian=little
Specify whether the object files are big- or little-endian, for disassembling. Useful for disassembling formats such as S-records (printable ASCII versions of object files) that do not include that information.

-f, --file-header
Display overall header summary information.

--file-start-context
When using -S and displaying source code from a file that hasn't been displayed yet, include context from the start of the file.

-g, --debugging
Display debugging information.

-G, --stabs
Display any stabs (debugging symbol table entries) information, in addition to the contents of any sections requested.

-h, --section-header, --header
Display section header summary information.

-H, --help
Display help information and exit.

-i, --info
Display the architectures and object formats available on your system for use with -b or -m.

-j name, --section=name
Display information for section name.

-l, --line-numbers
Label the display with filename and source code line numbers corresponding to the object code or relocation entries shown. Use with -d, -D, or -r.

-m arch, --architecture=arch
Specify the architecture for disassembling object files. Useful when disassembling files such as S-records that do not include this information.

-M options, --disassembler-options=options
Pass target-specific information to the disassembler. Supported only on some targets.

--no-show-raw-insn
Do not show instructions in hexadecimal when disassembling. This is the default with --prefix-addresses.

-p, --private-headers
Display information specific to the object format. For some formats, no additional information is displayed.

--prefix-addresses
When disassembling, print the complete address on each line.

-r, --reloc
Display relocation entries. With -b or -D, the entries are intermixed with the disassembly.

-R, --dynamic-reloc
Print dynamic relocation entries. Meaningful only for dynamic objects such as certain types of shared libraries.

-s, --full-contents
Display the full contents of any requested sections.

-S, --source
Display source code intermixed with disassembly, if possible. Implies -d.

--show-raw-insn
When disassembling, show instructions in hexadecimal as well as symbolic form. This is the default except with --prefix-addresses.

--start-address=addr
Start displaying data at the specified address. Applies to -d, -r, and -s.

--stop-address=addr
Stop displaying data at the specified address. Applies to -d, -r, and -s.

-t, --syms
Print symbol table entries.

-T, --dynamic-syms
Print dynamic symbol table entries. Meaningful only for dynamic objects such as certain types of shared libraries.

-V, --version
Print version information and exit.

-w, --wide
Format lines for output devices wider than 80 characters, and do not truncate symbol table names.

-x, --all-header
Display all available header information. Equivalent to specifying -a -f -h -r -t.

-z, --disassemble-zeroes
Disassemble blocks of zeroes. The default is to skip such blocks.

od

od [options] [files]
od --traditional [file] [[+]offset [[+]label]]

Dump the specified files to standard output. The default is to dump in octal format, but other formats can be specified. With multiple files, concatenate them in the specified order. If no files are specified or file is -, read from standard input. With the second form, using the --traditional option, only one file can be specified.

Options

For the following options, see the later "Arguments" section for an explanation of the arguments bytes, size, and type. If no options are specified, the default is -A o -t d2 -w 16.

-a
Print as named characters. Same as -ta.

-Aradix, --address-radix=radix
Specify the radix (base) for the file offsets printed at the beginning of each output line. The possible values are:

d
Decimal.

n
None; do not print an offset.

o
Octal; the default.

x
Hexadecimal.

-b
Print as octal bytes. Same as -toC.

-c
Print as ASCII characters or backslash escapes. Same as -tc.

-d
Print as unsigned decimal shorts. Same as -tu2.

-f
Print as floating point. Same as -tfF.

-h
Print as hexadecimal shorts. Same as -tx2.

--help
Display a usage message and exit.

-i
Print as decimal shorts. Same as -td2.

-jbytes, --skip-bytes=bytes
Skip the specified number of input bytes before starting.

-l
Print as decimal longs. Same as -td4.

-Nbytes, --read-bytes=bytes
Format and print only the specified number of input bytes.

-o
Print as octal shorts. Same as -to2.

-sbytes, --strings[=bytes]
Output strings that are at least bytes ASCII graphic characters long (default 3 if bytes is not specified for --strings).

-ttype, --format=type
Format the output according to type, where type is a string of one or more of the characters listed in the "Arguments" section. If more than one type is specified, each output line is written once in each specified format. If a trailing z is appended to type, od appends any printable characters to the end of each output line.

--traditional
Accept arguments in the traditional form, which takes a single file specification with an optional offset and label as shown in the second form of the command. offset is an octal number indicating how many input bytes to skip over. label specifies an initial pseudo-address, which is printed in parentheses after any normal address. Both the offset and the label can begin with an optional plus sign (+), and can have a trailing decimal point (.) to force the offset to be interpreted as a decimal number and/or a trailing b to multiply the number of bytes skipped by offset by 512.

-v, --output-duplicates
Print all lines, including duplicates. By default, only the first of a series of identical lines is printed, and an asterisk is printed at the beginning of the following line to indicate that there were duplicates.

--version
Display version information and exit.

-wbytes, --width[=bytes]
Dump bytes input bytes to each output line. Defaults to 16 if this option is omitted. If --width is specified but bytes is omitted, the default is 32.

-x
Print as hexadecimal shorts. Same as -tx2.

Arguments

bytes
Specify a number of bytes. Treated as hexadecimal if it begins with 0x or 0X, as octal if it begins with 0, or as decimal otherwise. Append b to multiply by 512, k to multiply by 1024, or m to multiply by 10248576.

size
Specified as part of type to indicate how many bytes to use in interpreting each number. Types a and c do not take a size. For other types, size is a number. For type f, size can also be one of the following:

D
Double.

F
Float.

L
Long double.

For the remaining types (d, o, u, x), size can be one of the following in addition to a number:

C
Character.

I
Integer.

L
Long.

S
Short.

type
Specify the format type. The possible types are:

a
Named character.

c
ASCII character or backslash escape.

dsize
Signed decimal, with size bytes per integer.

fsize
Floating point, with size bytes per integer.

o
Octal, with size bytes per integer.

u
Unsigned decimal, with size bytes per integer.

x
Hexadecimal, with size bytes per integer.

patch

patch [options] [original [patchfile]]

Apply the patches specified in patchfile to original. Replace the original with the new, patched version; move the original to original.orig or original~. The patch file is a difference listing produced by the diff command.

Options

-b, --backup
Back up the original file.

--backup-if-mismatch, --no-backup-if-mismatch
When not backing up all original files, these options control whether a backup should be made when a patch does not match the original file. The default is to make backups unless --posix is specified.

-c, --context
Interpret patchfile as a context diff.

-d dir, --directory=dir
cd to directory before beginning patch operations.

--dry-run
Print results of applying a patch, but don't change any files.

-e, --ed
Treat the contents of patchfile as ed commands.

-f, --force
Force all changes, even those that look incorrect. Skip patches if the original file does not exist; force patches for files with the wrong version specified; assume patches are never reversed.

-g num, --get num
Specify whether to check the original file out of source control if it is missing or read-only. If num is a positive number, get the file. If it is negative, prompt the user. If it is 0, do not check files out of source control. The default is negative or the value of the PATCH_GET environment variable when set, unless the --posix option is given. Then the default is 0.

--help
Print help message, then exit.

-i file, --input=file
Read patch from file instead of stdin.

-l, --ignore-whitespace
Ignore whitespace while pattern matching.

-n, --normal
Interpret patch file as a normal diff.

-o file, --output=file
Print output to file.

-p[num], --strip[=num]
Specify how much of preceding pathname to strip. A num of 0 strips everything, leaving just the filename. 1 strips the leading /. Each higher number after that strips another directory from the left.

--quoting-style=style
Set the quoting style used when printing names. The default style is shell unless set by the environment variable QUOTING_STYLE. style may be one of the following:

c
Quote as a C language string.

escape
Like c, but without surrounding double-quote characters.

literal
Print without quoting.

shell
Quote for use in shell when needed.

shell-always
Quote for use in shell even if not needed.

--posix
Conform more strictly to the POSIX standard.

-r file, --reject-file=file
Place rejects (hunks of the patch file that patch fails to place within the original file) in file. Default is original.rej.

-s, --silent, --quiet
Suppress commentary.

-t, --batch
Skip patches if the original file does not exist.

-u, --unified
Interpret patch file as a unified context diff.

--verbose
Verbose mode.

-v, --version
Print version number and exit.

-z suffix, --suffix=suffix
Back up the original file in original.suffix.

-B prefix, --prefix=prefix
Prepend prefix to the backup filename.

-D string, --ifdef=string
Mark all changes with:

#ifdef
   string
#endif
-E, --remove-empty-files
If patch creates any empty files, delete them.

-F num, --fuzz=num
Specify the maximum number of lines that may be ignored (fuzzed over) when deciding where to install a hunk of code. The default is 2. Meaningful only with context diffs.

-N, --forward
Ignore patches that appear to be reversed or to have already been applied.

-R, --reverse
Do a reverse patch: attempt to undo the damage done by patching with the old and new files reversed.

-T, --set-time
When original file timestamps match the times given in the patch header, set timestamps for patched files according to the context diff headers. Use option -f to force date changes. Assume timestamps are in local time.

-V method, --version-control=method
Specify method for creating backup files (overridden by -B):

t, numbered
Make numbered backups.

nil, existing
Back up files according to preexisting backup schemes, with simple backups as the default. This is patch's default behavior.

never, simple
Make simple backups.

-Y prefix, --basename-prefix=prefix
Use the specified prefix with a file's basename to create backup filenames. Useful for specifying a directory.

-Z, --set-utc
When original file timestamps match the times given in the patch header, set timestamps for patched files according to the context diff headers. Use option -f to force date changes. Assume timestamps are in Coordinated Universal Time (UTC).

Environment variables

TMPDIR, TMP, TEMP
Specify the directory for temporary files; /tmp by default.

SIMPLE_BACKUP_SUFFIX
Suffix to append to backup files instead of .orig or ~.

QUOTING_STYLE
Specify how output should be quoted (see --quoting-style).

PATCH_GET
Specify whether patch should retrieve missing or read-only files from source control (see -g).

POSIXLY_CORRECT
When set, patch conforms more strictly to the POSIX standard (see --posix).

VERSION_CONTROL, PATCH_VERSION_CONTROL
Specify what method to use in naming backups (see -V).

ping

ping [options] host

System administration command. Confirm that a remote host is online and responding. ping is intended for use in network testing, measurement, and management. Because of the load it can impose on the network, it is unwise to use ping during normal operations or from automated scripts.

Options

-a
Make ping audible. Beep each time response is received.

-b
Ping a broadcast address.

-c count
Stop after sending (and receiving) count ECHO_RESPONSE packets.

-d
Set SO_DEBUG option on socket being used.

-f
Flood ping-output packets as fast as they come back or 100 times per second, whichever is more. This can be very hard on a network and should be used with caution. Only a privileged user may use this option.

-i wait
Wait wait seconds between sending each packet. Default is to wait 1 second between each packet. This option is incompatible with the -f option.

-l preload
Send preload number of packets as fast as possible before falling into normal mode of behavior.

-n
Numeric output only. No attempt will be made to look up symbolic names for host addresses.

-p digits
Specify up to 16 pad bytes to fill out packet sent. This is useful for diagnosing data-dependent problems in a network. digits are in hex. For example, -p ff will cause the sent packet to be filled with all 1s.

-q
Quiet output--nothing is displayed except the summary lines at startup time and when finished.

-r
Bypass the normal routing tables and send directly to a host on an attached network.

-s packetsize
Specify number of data bytes to be sent. Default is 56, which translates into 64 ICMP data bytes when combined with the 8 bytes of ICMP header data.

-t n
Set the IP Time to Live to n seconds.

-v
Verbose; list ICMP packets received other than ECHO_RESPONSE.

-w n
Exit ping after n seconds.

-A
Adapt to return interval of packets. Like -f ping, sends packets at approximately the rate at which they are received. This option may be used by an unprivileged user.

-I name
Set source address to interface name. name may also be specified as an IP address.

-L
If destination is a multicast address, suppress loopback.

-Q tos
Set Quality of Service on ICMP datagrams.

-S size
Set send buffer (SNDBUF) size. The default is the size of one packet.

-T option
Set IP timestamp options. Accepted option values are:

tsonly
Timestamps only.

tsandaddr
Timestamps and addresses.

tsprespec hosts
Timestamps with prespecified hops of one or more hosts.

-M hint
Specify Path MTU Discovery strategy. Accepted values are do, want, or dont.

-R
Set the IP record route option, which will store the route of the packet inside the IP header. The contents of the record route will be printed if the -v option is given, and will be set on return packets if the target host preserves the record route option across echoes or the -l option is given.

-U
Use older ping behavior and print full user-to-user latency instead of network round trip time.

-V
Print version, then exit.

pppd

pppd [tty] [speed] [options]

System administration command. PPP stands for the Point-to-Point Protocol; it allows datagram transmission over a serial connection. pppd attempts to configure tty for PPP (searching in /dev) or, by default, the controlling terminal. You can also specify a baud rate of speed. pppd accepts many options. Only the most common options are listed here.

Options

asyncmap map
Specify which control characters cannot pass over the line. map should be a 32-bit hex number, where each bit represents a character to escape. For example, bit 00000001 represents the character 0x00; bit 80000000 represents the character 0x1f or _. You may specify multiple characters.

auth
Require self-authentication by peers before allowing packets to move.

call file
Read options from file in /etc/ppp/peers/. Unlike the file option, call file may contain privileged options, even when pppd is not run by root.

connect command
Connect as specified by command, which may be a binary or shell command.

crtscts
Use hardware flow control.

debug
Log contents of control packets to syslogd.

defaultroute
Add a new default route in which the peer is the gateway. When the connection shuts down, remove the route.

nodetach
Operate in the foreground. By default, pppd forks and operates in the background.

disconnect command
Close the connection as specified by command, which may be a binary or shell command.

domain d
Specify a domain name of d.

escape character-list
Escape all characters in character-list, which should be a comma-separated list of hex numbers. You cannot escape 0x20-0x3f or 0x5e.

file file
Consult file for options.

init script
Run specified command or shell script to initialize the serial line.

lock
Allow only pppd to access the device.

mru bytes
Refuse packets of more than bytes bytes.

mtu bytes
Do not send packets of more than bytes bytes.

name name
Specify a machine name for the local system.

netmask mask
Specify netmask (for example, 255.255.255.0).

passive, -p
Do not exit if peer does not respond to attempts to initiate a connection. Instead, wait for a valid packet from the peer.

silent
Send no packets until after receiving one.

[local_IP_address]:[remote_IP_address]
Specify the local and/or remote interface IP addresses, as hostnames or numeric addresses.

Files

/var/run/pppn.pid
pppd's process ID. The n in pppn.pid is the number of the PPP interface unit corresponding to this pppd process.

/etc/ppp/ip-up
Binary or script to be executed when the PPP link becomes active.

/etc/ppp/ip-down
Binary or script to be executed when the PPP link goes down.

/etc/ppp/pap-secrets
Contains usernames, passwords, and IP addresses for use in PAP authentication.

/etc/ppp/options
System defaults. Options in this file are set before the command-line options.

~/.ppprc
The user's default options. These are read before command-line options but after the system defaults.

/etc/ppp/options.ttyname
Name of the default serial port.

pr

pr [options] [files]

Convert a text file or files to a paginated, columned version, with headers. If - is provided as the filename, read from standard input.

Options

+beg_pag[:end-pag], --pages=[beg_pag[:end-pag]
Begin printing on page beg_pag and end on end-pag if specified.

-num_cols, --columns=num_cols
Print in num_cols number of columns, balancing the number of lines in the columns on each page.

-a, --across
Print columns horizontally, not vertically.

-c, --show-control-chars
Convert control characters to hat notation (such as ^C), and other unprintable characters to octal backslash format.

-d, --double-space
Double space.

-D format, --date-format=format
Format the header date using format. See the date command for the possible formats.

-e[tab-char[width]], --expand-tabs=[tab-char[width]]
Convert tabs (or tab-chars) to spaces. If width is specified, convert tabs to width characters (default is 8).

-f, -F, --form-feed
Separate pages with form feeds, not newlines.

-h header, --header=header
Use header for the header instead of the filename.

-i[out-tab-char[out-tab-width]], --output-tabs[=out-tab-char[out-tab-width]]
Replace spaces with tabs on output. Can specify alternative tab character (default is tab) and width (default is 8).

-J, --join-lines
Merge full lines; ignore -W if set.

-l lines, --length=lines
Set page length to lines (default is 66). If lines is less than 10, omit headers and footers.

-m, --merge
Print all files, one per column.

-n[delimiter[digits]], --number-lines[=delimiter[digits]]
Number columns, or, with the -m option, number lines. Append delimiter to each number (default is a tab) and limit the size of numbers to digits (default is 5).

-N num, --first-line-number=num
Start counting with num at the first line of the first page printed. Also see +beg_page.

-o width, --indent=width
Set left margin to width. Does not affect the page width set with -w or -W.

-r, --no-file-warnings
Continue silently when unable to open an input file.

-s[delimiter], --separator[=delimiter]
Separate columns with delimiter (default is a tab) instead of spaces.

-S[string], --sep-string[=string]
Separate columns with string. Default is a tab with -J and a space otherwise.

-t, --omit-header
Suppress headers, footers, and fills at end of pages.

-T, --omit-pagination
Like -t but also suppress form feeds.

-v, --show-non-printing
Convert unprintable characters to octal backslash format.

-w page_width, --width=page_width
Set the page width to page_width characters for multi-column output. Default is 72.

-W page_width, --page-width=page_width
Set the page width to always be page_width characters. Default is 72.

--help
Print a help message and then exit.

--version
Print version information and then exit.

ps

ps [options]

Report on active processes. ps has three types of options. GNU long options start with two dashes, which are required. BSD options may be grouped and do not start with a dash, while Unix98 options may be grouped and require an initial dash. The meaning of the short options can vary depending on whether or not there is a dash. In options, list arguments should either be separated by commas or put in double quotes. In comparing the amount of output produced, note that e prints more than a and l prints more than f for each entry.

Options

nums, p nums, -p nums, --pid=nums
Include only specified processes, which are given in a space-delimited list.

-nums, --sid=nums
Include only specified session IDs, which are given in a space-delimited list.

[-]a
As a, list all processes on a terminal. As -a, list all processes on a terminal except session leaders.

[-]c
As -c, show different scheduler information with -l. As c, show the true command name.

-C cmds
Select by command name.

--cols=cols, --columns=cols, --width=cols
Set the output width (the number of columns to display).

-d
Select all processes except session leaders.

-e, -A
Select all processes.

e
Include environment information after the command.

[-]f, --forest
As -f, display full listing. As f or --forest, display "forest" family tree format, with ASCII art showing the relationships.

-g list, -G list, --group=groups, --Group=groups
For -g, select by session leader if list contains numbers, or by group if it contains group names. For -G, select by the group IDs in list. --group selects by effective group and --Group selects by real group, where groups can be either group names or group IDs.

h, --no-headers
Suppress header. If you select a BSD personality by setting the environment variable PS_PERSONALITY to bsd, then h prints a header on each page.

-H
Display "forest" family tree format, without ASCII art.

--headers
Repeat headers.

--help
Display help information and exit.

--info
Print debugging information.

[-]j
Jobs format. j prints more information than -j.

[-]l
Produce a long listing. -l prints more information than l.

L
Print list of field specifiers that can be used for output formatting or for sorting.

--lines=num, --rows=num
Set the screen height to num lines. If --headers is also set, the headers repeat every num lines.

[-]m
Show threads.

n
Print user IDs and WCHAN numerically.

-nfile, Nfile
Specify the System.map file for ps to use as a namelist file. The map file must correspond to the Linux kernel; e.g., /boot/System.map-2.4.19.

-N, --deselect
Negate the selection.

[-]o fields, --format=fields
As -o, o, or --format, specify user-defined format with a list of fields to display.

[-]O fields
As -O, is like -o, but some common fields are predefined. As O, can be either the same as -O in specifying fields to display, or can specify single-letter fields for sorting. For sorting, each field specified as a key can optionally have a leading + (return to default sort direction on key) or - (reverse the default direction).

r
Show only processes that are currently running.

s
Display signal format.

-s sessions
Show processes belonging to the specified sessions.

-S, --cumulative
Include some dead child process data in parent total.

[-]tttys, --tty=ttys
Display processes running on the specified terminals.

T
Display all processes on this terminal.

[-]u [users], --user=users
As u with no argument, display user-oriented output . As -u or --users, display by effective user ID (and also support names), showing results for users. With no argument, -u displays results for the current user.

[-]U users, --User=users
As U, display processes for the specified users. As -U or --User, display processes for users by real user ID (and also support names).

v
Display virtual memory format.

[-]V, --version
Display version information and then exit.

[-]w
Wide format. Don't truncate long lines.

x
Display processes without an associated terminal.

X
Use old Linux i386 register format.

-y
Do not show flags; show rss instead of addr.

Sort keys

c, cmd
Name of executable.

C, cmdline
Whole command line.

f, flags
Flags.

g, pgrp
Group ID of process.

G, tpgid
Group ID of associated tty.

j, cutime
Cumulative user time.

J, cstime
Cumulative system time.

k, utime
User time.

K, stime
System time.

m, min_flt
Number of minor page faults.

M, maj_flt
Number of major page faults.

n, cmin_flt
Total minor page faults.

N, cmaj_flt
Total major page faults.

o, session
Session ID.

p, pid
Process ID.

P, ppid
Parent's process ID.

r, rss
Resident set size.

R, resident
Resident pages.

s, size
Kilobytes of memory used.

S, share
Number of shared pages.

t, tty
Terminal.

T, start_time
Process's start time.

U, uid
User ID.

u, user
User's name.

v, vsize
Bytes of virtual memory used.

y, priority
Kernel's scheduling priority.

Fields

%CPU
Percent of CPU time used recently.

%MEM
Percent of memory used.

ADDR
Address of the process.

C, CMD, COMMAND
The command the process is running.

ELAPSED
Elapsed time since the start of the process.

F
Process flags:

001
Print alignment warning messages.

002
Being created.

004
Being shut down.

010
ptrace(0) has been called.

020
Tracing system calls.

040
Forked but didn't exec.

100
Used superuser privileges.

200
Dumped core.

400
Killed by a signal.

GROUP
Effective group ID.

NI
The nice value of the process. A higher number indicates less CPU time.

PAGEIN
Number of major page faults.

PID
Process ID.

PPID
Parent process ID.

PRI
Process's scheduling priority. A higher number indicates lower priority.

RSS
Resident set size (the amount of physical memory), in kilobytes.

SHARE
Shared memory.

SIZE
Size of virtual image.

STAT
Status:

R
Runnable.

T
Stopped.

D
Asleep and not interruptible.

S
Asleep.

Z
Zombie.

W
No resident pages (second field).

N
Positive nice value (third field).

STIME
Process start time.

SWAP
Amount of swap used, in kilobytes.

TIME
Cumulative CPU time.

TRS
Size of resident text.

TT, TTY
Associated terminal.

UID
User ID.

VSZ
Virtual memory size, in kilobytes.

WCHAN
Kernel function in which process resides.

rdist

rdist [options] [names]

System administration command. Remote file distribution client program. rdist maintains identical copies of files over multiple hosts. It reads commands from a file named distfile to direct the updating of files and/or directories. An alternative distfile can be specified with the -f option or the -c option.

Options

-a num
Do not update filesystems with fewer than num bytes free.

-c name [login@]host[:dest]
Interpret the arguments as a small distfile, where login is the user to log in as, host is the destination host, name is the local file to transfer, and dest is the remote name where the file should be installed.

-d var=value
Define var to have value. This option defines or overrides variable definitions in the distfile. Set the variable var to value.

-f file
Read input from file (by default, distfile). If file is -, read from standard input.

-l options
Specify logging options on the local machine.

-m machine
Update only machine. May be specified multiple times for multiple machines.

-n
Suppress normal execution. Instead, print the commands that would have been executed.

-ooptions
Specify one or more options, which must be comma-separated.

chknfs
Suppress operations on files that reside on NFS filesystems.

chkreadonly
Check filesystem to be sure it is not read-only before attempting to perform updates.

chksym
Do not update files that exist on the local host but are symbolic links on the remote host.

compare
Compare files; use this comparison rather than age as the criteria for determining which files should be updated.

follow
Interpret symbolic links, copying the file to which the link points instead of creating a link on the remote machine.

ignlnks
Ignore links that appear to be unresolvable.

nochkgroup
Do not update a file's group ownership unless the entire file needs updating.

nochkmode
Do not update file mode unless the entire file needs updating.

nochkowner
Do not update file ownership unless the entire file needs updating.

nodescend
Suppress recursive descent into directories.

noexec
Suppress rdist of executables that are in a.out format.

numchkgroup
Check group ownership by group ID instead of by name.

numchkowner
Check file ownership by user ID instead of by name.

quiet
Quiet mode; do not print commands as they execute.

remove
Remove files that exist on the remote host but not the local host.

savetargets
Save updated files in name.old.

sparse
Check for sparse files, for example ndbm files.

verify
Print a list of all files on the remote machine that are out of date, but do not update them.

whole
Preserve directory structure by creating subdirectories on the remote machine. For example, if you rdist the file /foo/bar into the directory /baz, it would produce the file /baz/foo/bar instead of the default /baz/bar.

younger
Do not update files that are younger than the master files.

-p path
Specify the path to search for rdistd on the remote machine.

-t seconds
Specify the timeout period (default 900 seconds) after which rdist will sever the connection if the remote server has not yet responded.

-A num
Specify the minimum number of inodes that rdist requires.

-D
Debugging mode.

-F
Execute all commands sequentially, without forking.

-L options
Specify logging options on the remote machine.

-M num
Do not allow more than num child rdist processes to run simultaneously. Default is 4.

-P path
Specify path to the transport command to use on the local machine. This is normally rsh, but may also be ssh. The path argument may also be specified as a colon-separated list of acceptable transports to use in order of preference.

-V
Display version, then exit.

readelf

readelf option[...] elffiles

Display information about about one or more ELF (Executable and Linking Format) object files. At least one option is required to specify the information to be displayed for each file. readelf does not currently work on archive files or 64-bit ELF files.

Options

-a, --all
Display all. Equivalent to -h -l -S -s -r -d -n -V.

-d, --dynamic
Display the dynamic section.

-D, --use-dynamic
When displaying symbols, use the symbol table in the dynamic section, not the symbols section.

-e, --headers
Display all headers. Equivalent to -h -l -s.

-h, --file-header
Display the ELF header at the beginning of the file.

--help
Display help information and exit.

--histogram
Display a histogram of bucket bit lengths when displaying the symbol tables.

-l, --program-headers, --segments
Display the segment headers, if any.

-n, --notes
Display the NOTE segment, if any.

-r, --relocs
Display the relocation segment, if any.

-s, --symbols, --syms
Display entries in symbol table sections, if any.

-S, --section-headers, --sections
Display the section headers, if any.

-u, --unwind
Display the unwind section, if any (currently applies only to IA64 ELF files).

-v, --version
Display version information and exit.

-V, --version-info
Display the version sections, if any.

-w[option], --debug-dump[=option]
Display the debug sections. If specified with an option, display only that section. The options shown here in parentheses are for -w; the words preceding them are for --debug-dump. The options are line (l), info (i), abbrev (a), pub-names (p), ranges (r), macro (m), frames (f), frames-interp (F), str (s), and loc (o).

-W, --wide
Don't break output lines at 80 columns. The default is to break them.

-x num, --hex-dump=num
Display a hexadecimal dump of the section number.

rexecd

rexecd command-line

TCP/IP command. Server for the rexec routine, providing remote execution facilities with authentication based on usernames and passwords. rexecd is started by inetd and must have an entry in inetd's configuration file, /etc/inetd.conf. When rexecd receives a service request, the following protocol is initiated:

  1. The server reads characters from the socket up to a null byte. The resulting string is interpreted as an ASCII number, base 10.

  2. If the number received in Step 1 is nonzero, it is interpreted as the port number of a secondary stream to be used for stderr. A second connection is then created to the specified port on the client's machine.

  3. A null-terminated username of at most 16 characters is retrieved on the initial socket.

  4. A null-terminated, unencrypted password of at most 16 characters is retrieved on the initial socket.

  5. A null-terminated command to be passed to a shell is retrieved on the initial socket. The length of the command is limited by the upper bound on the size of the system's argument list.

  6. rexecd then validates the user, as is done at login time. If the authentication was successful, rexecd changes to the user's home directory and establishes the user and group protections of the user.

  7. A null byte is returned on the connection associated with stderr, and the command line is passed to the normal login shell of the user. The shell inherits the network connections established by rexecd.

Diagnostics

Username too long
Name is longer than 16 characters.

Password too long
Password is longer than 16 characters.

Command too long
Command passed is too long.

Login incorrect
No password file entry for the username exists.

Password incorrect
Wrong password was supplied.

No remote directory
chdir to home directory failed.

Try again
fork by server failed.

<shellname>:...
fork by server failed. User's login shell could not be started.

route

route [options] [command]

TCP/IP command. Add or remove entries in the routing tables maintained by routed. route accepts two commands: add, to add a route, and del, to delete a route. The two commands have the following syntax:

add [-net | -host] address [modifiers]
del [-net | -host] address [modifiers]

address is treated as a plain route unless -net is specified or address is found in /etc/networks. -host can be used to specify that address is a plain route whether or not it is found in /etc/networks. Using route modifiers, you can specify the gateway through which to route packets headed for that address, its netmask, TCP mss, or the device with which to associate the route; you can also mask certain routes. Only a privileged user may modify the routing tables.

If no command is specified, route prints the routing tables.

Options

-n, --numeric
Show numerical addresses; do not look up hostnames. (Useful if DNS is not functioning properly.)

-e, --extend
Use netstat -r format to print routing table. Use twice to print extended information. Same as netstat -ree.

-h, --help
Print help message, then exit.

-v, --verbose
Verbose mode.

-A family, --family
Specify an address family to use with an add or del command. family may be inet, inet6, ax25, netrom, ipx, ddp, or x25.

-C, --cache
Perform command on the routing cache instead of the forwarding information base (FIB) routing table.

-F, --fib
Perform command on the forwarding information base (FIB) routing table. This is the default behavior.

-V, --version
Print version and configuration options, then exit.

Route modifiers

netmask mask
Use netmask mask.

gw gateway
Route packets through gateway.

metric n
Set routing metric to n.

mss bytes
Set maximum segment size for connections over this route.

reject
Cause route lookup for target to fail. Used to mask out networks from a default route.

[dev] interface
Associate route with specified device. When the interface is given as the last argument on a command line, the word dev is optional.

rpcinfo

rpcinfo [options] [host] [program] [version]

NFS/NIS command. Report RPC information. program can be either a name or a number. If a version is specified, rpcinfo attempts to call that version of the specified program. Otherwise, it attempts to find all the registered version numbers for the specified program by calling Version 0, and then attempts to call each registered version.

Options

-b program version
Make an RPC broadcast to the specified program and version using UDP, and report all hosts that respond.

-d program version
Delete the specified version of program's registration. Can be executed only by the user who added the registration or a privileged user.

-n portnum
Use portnum as the port number for the -t and -u options, instead of the port number given by the portmapper.

-p [host]
Probe the portmapper on host and print a list of all registered RPC programs. If host is not specified, it defaults to the value returned by hostname.

-t host program [version]
Make an RPC call to program on the specified host using TCP, and report whether a response was received.

-u host program [version]
Make an RPC call to program on the specified host using UDP, and report whether a response was received.

Examples

To show all the RPC services registered on the local machine, use:

$ rpcinfo -p

To show all the RPC services registered on the machine named klaxon, use:

$ rpcinfo -p klaxon

To show all machines on the local network that are running the Network Information Service (NIS), use:

$ rpcinfo -b ypserv version | uniq

where version is the current NIS version obtained from the results of the -p switch earlier in this list.

screen

screen [options] [command [args]]

Provide ANSI/VT100 terminal emulation, making it possible to run multiple full-screen pseudo-terminals from one real terminal, and letting you manipulate and save your screen input and output, copy and paste between windows, etc.

Options

-a
Include all capabilities in each window's termcap.

-A
Adapt all windows to the size of the current terminal. Default is to try to use the previous window size.

-c file
Use file as the configuration file instead of the default $HOME/.screenrc.

-d
Detach session running elsewhere. With -r, reattach to this terminal. With -R, reattach to this terminal or create it if it doesn't already exist. With -RR, use the first session when reattaching if more than one session is available.

-D
Detach session running elsewhere, logging out before detaching. With -r, reattach to this terminal. With -R, reattach to this terminal or create it if it doesn't already exist. With -RR, do whatever is necessary to create a new session.

-e xy
Change command characters. Specify x as the command character (default Ctrl-a) and y as the character that generates a literal command character (default a). Specify in caret notation (e.g., ^A for Ctrl-a).

-f, -fn, -fa
Turn flow control on, off, or to automatic switching mode.

-h num
Specify the size of the history scrollback buffer.

-i
Cause the interrupt key (usually Ctrl-c) to interrupt the display immediately when flow control is on. Use of this option is discouraged.

-l, -ln
Turn login mode on or off for /etc/utmp updating.

-ls, -list
Print list of pid.tty.host strings identifying screen sessions.

-L
Tell screen that automargin terminal has a writable last position.

-m
Ignore the $STY environment variable and create a new session. With -d, start session in detached mode; useful for scripts. With -D, start session in detached mode but don't fork a new process; the command exits if the session terminates.

-O
Use optimal output mode for terminal rather than true VT100 emulation.

-p window
Preselect the specified window if it exists.

-q
Suppress error message printing on startup. Exit with nonzero return code if unsuccessful.

-r [pid.tty.host]
-r sessionowner/[pid.tty.host]
Resume detached session. No other options except -d or -D can be specified. With sessionowner, resume another user's detached session; requires setuid root.

-R
Attempt to resume the first session found, or start a new session with the specified options. Set by default if screen is run as a login shell.

-s shell
Set the default shell, overriding the $SHELL environment variable.

-S name
Specify a name for the session being started.

-t name
Set the window's title.

-T term
Set $TERM to term instead of "screen".

-U
Run in UTF-8 mode.

-v
Print version information and exit.

-wipe [match]
Like -ls, but remove destroyed sessions instead of marking them dead. If a match is specified, it should be in the same form as the argument to the -r option.

-x
Attach to a session that is not detached. Requires multi-display mode.

-X
Run specified command in specified session. Requires multi-display mode, and session must not be password-protected.

Key bindings

screen commands consist of a command character (Ctrl-a by default) followed by another character. For many of the commands, you can also specify the character as Ctrl-character; e.g., Ctrl-a Ctrl-d as well as Ctrl-a d. The default key bindings are listed here. You can change the bindings for yourself in the $HOME/.screenrc configuration file, or for all users in /etc/screenrc. The term in parentheses following the description is the equivalent configuration file command for changing the key binding.

Ctrl-a '
Prompt for window name or number to switch to. (select)

Ctrl-a "
List all windows for selection. (windowlist -b)

Ctrl-a num
Switch to window num, where num is a digit in the range 0-9 or - (the blank window). (select num)

Ctrl-a Tab
Switch input focus to next region. (focus)

Ctrl-a Ctrl-a
Toggle to previously displayed window. (other)

Ctrl-a a
Send the command character (Ctrl-a) to the window. (meta)

Ctrl-a A
Prompt user to enter a name for the current window. (title)

Ctrl-a b
Send a break to the window. (break)

Ctrl-a B
Reopen the terminal line and send a break. (pow-break)

Ctrl-a c
Create a new window with a shell and switch to it. (screen)

Ctrl-a C
Clear the screen. (clear)

Ctrl-a d
Detach screen from this terminal. (detach)

Ctrl-a D D
Detach and log out. (pow-detach)

Ctrl-a f
Toggle flow control between on, off, and auto. (flow)

Ctrl-a F
Resize window to current region size. (fit)

Ctrl-a Ctrl-g
Toggle visual bell mode. (vbell)

Ctrl-a h
Write contents of the current window to the file hardcopy.n. (hardcopy)

Ctrl-a H
Begin/end logging of the current window to the file screenlog.n. (log)

Ctrl-a i
Show information about this window. (info)

Ctrl-a k
Kill current window. (kill)

Ctrl-a l
Refresh current window. (redisplay)

Ctrl-a L
Toggle window's login slot. Requires that screen be configured to update the utmp database. (login)

Ctrl-a m
Redisplay last message. (lastmsg)

Ctrl-a M
Toggle monitoring of the current window. (monitor)

Ctrl-a Space
Ctrl-a n
Switch to next window. (next)

Ctrl-a N
Show number and title of current window. (number)

Ctrl-a Backspace
Ctrl-a h
Ctrl-a p
Switch to previous window. (prev)

Ctrl-a q
Send a start signal (associated with Ctrl-q by terminals) to current window. (xon)

Ctrl-a Q
Delete all regions except the current one. (only)

Ctrl-a r
Toggle current window's line-wrap setting. (wrap)

Ctrl-a s
Send a stop signal (associated with Ctrl-s by terminals) to current window. (xoff)

Ctrl-a S
Split current region into two new regions. (split)

Ctrl-a t
Show system information, including time and date. (time)

Ctrl-a v
Display version information. (version)

Ctrl-a Ctrl-v
Enter digraph for entering characters that can't normally be entered. (digraph)

Ctrl-a w
List all windows. (windows)

Ctrl-a W
Toggle 80/132 columns. (width)

Ctrl-a x
Lock terminal. (lockscreen)

Ctrl-a X
Kill the current region. (remove)

Ctrl-a z
Suspend screen. (suspend)

Ctrl-a Z
Reset virtual terminal to its "power-on" values. (reset)

Ctrl-a .
Write out a .termcap file. (dumptermcap)

Ctrl-a ?
Show all key bindings. (help)

Ctrl-a Ctrl-\
Kill all windows and terminate screen. (quit)

Ctrl-a :
Enter command-line mode. (colon)

Ctrl-a [
Ctrl-a Esc
Enter copy/scrollback mode. (copy)

Ctrl-a ]
Write contents of the paste buffer to the standard input queue of the current window. (paste)

Ctrl-a {
Ctrl-a }
Copy and paste a previous line. (history)

Ctrl-a >
Write paste buffer to a file. (writebuf)

Ctrl-a <
Read screen-exchange file into paste buffer. (readbuf)

Ctrl-a =
Remove file used by Ctrl-a < and Ctrl-a >. (removebuf)

Ctrl-a ,
Shows where screen comes from, where it went to, and why you can use it. (license)

Ctrl-a _
Start/stop monitoring the current window for inactivity. (silence)

Ctrl-a *
List all currently attached displays. (displays)

sdiff

sdiff -o outfile [options] from to

Find differences between the two files from and to and merge interactively, writing the results to outfile.

Options

--
Treat remaining options as filenames, even if they begin with -.

-a, --text
Treat all files as text and compare line-by-line.

-b, --ignore-space-change
Ignore differences in whitespace.

-B, --ignore-blank-lines
Ignore added or missing blank lines.

-d, --minimal
Use a different algorithm to find fewer changes. This option causes sdiff to run more slowly.

-H, --speed-large-files
Heuristically speed comparison of large files with many small scattered changes.

-i, --ignore-case
Ignore case changes.

-I regexp, --ignore-matching-lines=regexp
Ignore any changes that insert or delete lines matching the regular expression regexp.

--ignore-all-space
Ignore whitespace when comparing lines.

-l, --left-column
Print only the left column of common lines.

-o file, --output=file
Write merged output to the specified file.

-s, --suppress-common-lines
Suppress common lines.

-t, --expand-tabs
Convert tabs to spaces in the output to preserve alignment.

-v, --version
Print version information and exit.

-w cols, --width=cols
Set the output to cols columns wide.

-W
Ignore horizontal whitespace when comparing lines.

Interactive commands

ed
Edit, then use both versions, with a header for each.

eb
Edit, then use both versions.

el
Edit, then use the left version.

er
Edit, then use the right version.

e
Edit a new version to replace the others.

l
Use the left version.

r
Use the right version.

s
Silently include common lines.

v
Verbosely include common lines.

q
Quit.

sendmail

sendmail [flags] [address...]

System administration command. sendmail is a mail transfer agent (MTA) or, more simply, a mail router. It accepts mail from a user's mail program, interprets the mail address, rewrites the address into the proper form for the delivery program, and routes the mail to the correct delivery program.

Command-line flags

-Ac
Use local submission configuration file /etc/mail/submit.cf, even when no mail is sent from the command line.

-Am
Use configuration file /etc/mail/sendmail.cf, even when mail is sent from the command line.

-Btype
Set message body type. Accepted values are 7BIT and 8BITMIME.

-bx
Set operation mode to x. Operation modes are:

a
Run in ARPAnet mode.

d
Run as a daemon.

D
Run as a daemon, but remain in the foreground.

h
Print persistent host status information.

H
Purge expired entries from persistent host status information.

i
Initialize the alias database.

m
Deliver mail (the default).

p
Print the mail queue.

s
Speak SMTP on input side.

t
Run in test mode.

v
Verify addresses; do not collect or deliver.

-C file
Use configuration file file.

-d level
Set debugging level.

-F name
Set full name of user to name.

-f name
Sender's name is name.

-G
Relay message submission. Used by rmail.

-i
Do not interpret dots on a line by themselves as a message terminator.

-h cnt
Set hop count (number of times message has been processed by sendmail) to cnt.

-L identifier
Use the specified log identifier for messages sent to syslogd.

-N conditions
Specify conditions for delivery status notification (DSN) as a comma-separated list. Accepted values are never, delay, failure, and success.

-n
Do not alias or forward.

-O option=value
Set an option specified by its long name. Options are described in the next section.

-oXvalue
Set an option specified by its short name X. Options are described in the next section.

-pprotocol
Receive messages via the protocol protocol.

-q[time]
Process queued messages immediately, or at intervals indicated by time (for example, -q30m for every half hour).

-qp[time]
Same as -q, but create a persistent process to handle the queue instead of initiating a new process at each time interval.

-qf
Process saved messages in the queue using the foreground process.

-qG group
Process saved messages in the named queue group.

-q[!]I substring
Process jobs for named queues containing substring. Use ! to process mail for all queues not containing substring.

-q[!]R substring
Process jobs with recipients containing substring. Use ! to process mail for recipients not containing substring.

-q[!]S substring
Process jobs from senders containing substring. Use ! to process mail from senders not containing substring.

-R portion
When bouncing messages, return only the specified portion of the bounced message. portion may be hdrs for headers, or full for the full message.

-r name
Obsolete form of -f.

-t
Read header for To:, Cc:, and Bcc: lines, and send to everyone on those lists.

-v
Verbose mode.

-V envid
Use envid as the original envelope ID.

-X file
Log all traffic to file. Not to be used for normal logging.

Configuration options

Command-line configuration options are the same options normally set with an O in the sendmail configuration file. On the command line they are set using -O and the option's long name. Many of these options have short name variations that are used with the -o option. Here we document items most likely to be useful on the command line, providing both their short and long name forms. Many of the commands call for timeout values. These should be given as a number followed by a letter indicating the interval: s for seconds, m for minutes, h for hours, or d for days. For example, 30s is 30 seconds, 10m is 10 minutes, 3d is 3 days. The default is minutes when no letter is given.

Aliasfile=file, Afile
Use alternate alias file.

AliasWait=min, amin
If the D option is set, wait min minutes for the aliases file to be rebuilt before returning an alias database out-of-date warning.

BlankSub=char, Bchar
Set unquoted space replacement character.

CheckAliases, n
When running newaliases, validate the right side of aliases.

CheckpointInterval=num, Cnum
Checkpoint the queue when mailing to multiple recipients. sendmail will rewrite the list of recipients after each group of num recipients has been processed.

ClassFactor=factor, zfactor
Multiplier for priority increments. This determines how much weight to give to a message's precedence header. sendmail's default is 1800.

ConnectionCacheSize=num, knum
Specify the maximum number of open connections to cache.

ConnectionCacheTimeout=timeout, Ktimeout
Time out connections after timeout.

ConnectionRateThrottle=num
Restrict SMTP connections per second to num.

DefaultUser=uid[:gid], uuid[:gid]
Use user ID and group ID for mailers instead of 1:1. If no group ID is specified, the user's default group is used.

DefaultCharSet=label
Use the specified label for 8-bit data.

DeliveryMode=x, dx
Set the delivery mode to x. Delivery modes are d for deferred delivery, i for interactive (synchronous) delivery, b for background (asynchronous) delivery, and q for queue only (i.e., deliver the next time the queue is run).

DialDelay=seconds
Specify the number of seconds to wait before redialing after a connection fails.

DontPruneRoutes, R
Don't prune route addresses.

EightBitMode=mode, 8mode
Specify how to handle 8-bit input. Accepted values for mode are mimefy (convert to 7-bit), pass (send as is), or strict (bounce the message).

ErrorHeader=text, Etext
Set error message header. text is either text to add to an error message, or the name of a file. A filename must include its full path and begin with a /.

ErrorMode=x, ex
Set error processing to mode x. Valid modes are m to mail back the error message, w to write back the error message, p to print the errors on the terminal (default), q to throw away error messages, and e to do special processing for the BerkNet.

FallbackMXhost=host, Vhost
Set fallback MX host. host should be the fully qualified domain name of the fallback host.

ForkEachJob, Y
Deliver each job that is run from the queue in a separate process. This helps limit the size of running processes on systems with very low amounts of memory.

ForwardPath=path, Jpath
Set an alternative .forward search path.

HelpFile=file, Hfile
Specify SMTP help file to use instead of /etc/mail/helpfile.

HoldExpensive, c
On mailers that are considered "expensive" to connect to, don't initiate immediate connection.

IgnoreDots, i
Do not take dots on a line by themselves as a message terminator.

LogLevel=n, Ln
Specify log level. Default is 9.

MatchGECOS, G
Compare local mail names to the GECOS section in the password file.

MaxDaemonChildren=num
Restrict incoming SMTP daemon to no more than num child processes.

MaxHopCount=num, hnum
Allow a maximum of num hops per message.

MeToo, m
Send to me (the sender) also if I am in an alias expansion.

MinFreeBlocks=minblocks, bminblocks
Require at least minblocks on the filesystem to be free.

MinQueueAge=timeout
Wait the specified time before processing a new job in the queue.

NoRecipientAction=action
Specify what headers, if any, to add to a message without recipient headers. Accepted values are none, add-to, add-apparently-to, add-bcc, and add-to-undisclosed.

OldStyleHeaders, o
If set, this message may have old-style headers. If not set, this message is guaranteed to have new-style headers (i.e., commas instead of spaces between addresses).

PostmasterCopy=user, Puser
Send copies of all failed mail to user (usually postmaster).

PrivacyOptions=optionlist, poptionlist
Adjust the privacy of the SMTP daemon. The optionlist argument should be a comma-separated list of the following values:

public
Make SMTP fully public (the default).

needmailhelo
Require site to send HELO or ELHO before sending mail.

needexpnhelo
Require site to send HELO or ELHO before answering an address expansion request.

needvrfyhelo
Like preceding argument, but for verification requests.

noetrn
Deny requests to reverse the connection using extended TURN.

noexpn
Deny all expansion requests.

noverb
Deny requests for verbose mode.

novrfy
Deny all verification requests.

authwarnings
Insert special headers in mail messages advising recipients that the message may not be authentic.

goaway
Set all of the previous arguments (except public).

nobodyreturn
Don't return message body with a delivery status notification.

noreceipts
Turn off delivery status notification on success.

restrictexpand
Deny untrusted users access to aliases, forwards, or include files. Restrict sendmail -bv and disallow -v.

restrictmailq
Allow only users of the same group as the owner of the queue directory to examine the mail queue.

restrictqrun
Limit queue processing to root and the owner of the queue directory.

QueueDirectory=dir, Qdir
Select the directory in which to queue messages.

QueueFactor=factor, qfactor
Multiplier (factor) for high-load queuing. Default is 600000.

QueueLA=load, xload
Queue messages when load level is higher than load.

QueueTimeout=timeout, Ttimeout
Set the timeout on undelivered messages in the queue to the specified time (overridden by Timeout.queuereturn).

RecipientFactor=factor, yfactor
Penalize large recipient lists by factor.

RefuseLA=load, Xload
Refuse SMTP connections when load is higher than load.

ResolverOptions=arg, I arg
Use DNS lookups and tune them. Queue messages on connection refused. The arg arguments are identical to resolver flags without the RES_ prefix. Each flag can be preceded by a plus or minus sign to enable or disable the corresponding name server option. There must be whitespace between the I and the first flag.

RetryFactor=inc, Zinc
Increment priority of items remaining in queue by inc after each job is processed. sendmail uses 90,000 by default.

SaveFromLine, f
Save Unix-style From lines at the front of messages.

SendMimeErrors, j
Use MIME format for error messages.

SevenBitInput, 7
Format all incoming messages in seven bits.

StatusFile=file, Sfile
Save statistics in the named file.

SuperSafe, s
Always instantiate the queue file, even when it is not strictly necessary.

TempFileMode=mode, Fmode
Set default file permissions for temporary files. If this option is missing, default permissions are 0600.

Timeout.queuereturn=timeout
Return undelivered mail that has been in the queue longer than the specified timeout. The default is 5d (five days).

TimeZoneSpec=timezone, ttimezone
Set name of the time zone.

UseErrorsTo, l
Do not ignore Errors-To header.

UserDatabaseSpec=database, Udatabase
Consult the user database for forwarding information.

Verbose, v
Run in verbose mode.

sendmail support files

/usr/lib/sendmail
Traditional location of sendmail binary.

/usr/bin/newaliases
Link to /usr/lib/sendmail; rebuilds the alias database from information in /etc/aliases.

/usr/bin/mailq
Prints a listing of the mail queue.

/etc/mail/sendmail.cf
Configuration file, in text form.

/etc/mail/submit.cf
Configuration file used for local message submissions.

/etc/mail/helpfile
SMTP help file.

/etc/mail/statistics
Statistics file.

/etc/aliases
Alias file, in text form.

/etc/aliases.db
Alias file in dbm format. Created by newaliases

/var/spool/mqueue
Directory in which the mail queue and temporary files reside.

setterm

setterm [options]

Set terminal attributes by writing to standard output a character string to invoke the specified attributes.

Options

For Boolean options, the default value is on. Where 8-color is specified, the possible colors are black, red, green, yellow, blue, magenta, cyan, and white. Where 16-color is specified, the possible colors include the 8-color colors, plus grey, bright red, bright green, bright yellow, bright blue, bright magenta, bright cyan, and bright white.

-appcursorkeys [on|off]
Set cursor key application mode on or off. Virtual consoles only. Can cause problems with vi.

-append [num]
Write a snapshot of virtual console num to the file specified with the -file option, appending the snapshot to any existing contents. With no argument, write a snapshot of the current virtual terminal.

-background 8-color|default
Set background color. Virtual consoles only.

-bfreq [freq]
Set the bell frequency in Hz (default 0).

-blank [min]
Set the delay before the screen blanks to the specified number of minutes. Virtual consoles only.

-blength [millisec]
Set the bell duration in milliseconds (default 0).

-blink [on|off]
Turn blinking mode on or off. If the terminal is not a virtual console, -blink off also turns off bold, half-bright, and reverse modes.

-bold [on|off]
Turn bold on or off. If the terminal is not a virtual console, -bold off also turns off blink, half-bright, and reverse modes.

-clear [all]
Clear the screen.

-clear rest
Clear from the current cursor position to the end of the screen.

-cleartabs [tab1...tabn]
With no arguments, clear all tab stops. Otherwise, clear the specified tab stops. Virtual consoles only.

-cursor [on|off]
Turn the cursor on or off.

-default
Set rendering options to defaults.

-dump [num]
Write a snapshot of virtual console num to the file specified with the -file option, overwriting any existing contents. With no argument, dump the current virtual console. Overrides -append.

-file file
Write output from the -dump or -append option to the specified file. If no filename is specified, write to the file screen.dump in the current directory.

-foreground 8-color|default
Set foreground color. Virtual consoles only.

-half-bright [on|off]
Turn half-bright (dim) mode on or off. If the terminal is not a virtual console, -half-bright off also turns off bold, blink, and reverse modes.

-hbcolor 16-color
Set color for half-bright characters. Virtual consoles only.

-initialize
Display the terminal initialization string to reset the rendering options and other attributes to their defaults.

-inversescreen [on|off]
Invert the screen colors, swapping foreground and background, and underline and half-bright. Virtual consoles only.

-linewrap [on|off]
Turn line-wrapping on or off. Virtual consoles only.

-msg [on|off]
Enable or disable the sending of kernel printk( ) messages to the console. Virtual consoles only.

-msglevel [num]
Set the console logging level for kernel printk( ) messages. The value of num can be in the range 0-8. Messages more important than the specified number are printed, with 8 printing all kernel messages, and 0 equivalent to -msg on. Virtual consoles only.

-powerdown [min]
Set the VESA powerdown interval to the specified number of minutes, from 0-60. If no value is specified for min, defaults to 0, disabling powerdown.

-powersave [mode]
Put the monitor in the specified VESA powersave mode. Specifying no mode is equivalent to off. The possible values of mode are:

on, vsync
vsynch suspend mode.

hsync
hsync suspend mode.

powerdown
Powerdown mode.

off
Turn off VESA powersaving features.

-regtabs [num]
Clear all existing tab stops and set a regular tab stop pattern at every num number (default 8). num is a number in the range 1-160. Virtual consoles only.

-repeat [on|off]
Turn keyboard repeat on or off. Virtual consoles only.

-reset
Display the terminal reset string to reset the terminal to its power-on state.

-reverse [on|off]
Turns reverse-video mode on or off. If the terminal is not a virtual console, -reverse off also turns off bold, half-bright, and blink modes.

-store
Store the current rendering options as the defaults. Virtual consoles only.

-tabs [tab1...tabn]
Set tab stops at the specified cursor positions, which can range from 1 to 160. Virtual consoles only.

-term term
Replace the value of the TERM environment variable with term.

-ulcolor 16-color
Set color for underlining. Virtual consoles only.

-underline [on|off]
Turn underlining on or off.

sftp

sftp [options] host

An interactive file transfer program, similar to ftp except that it uses ssh to perform file transfers securely. sftp connects to host and logs in, prompting for a password if required. The host can be specified in the following ways:

host
[user@]host[:file [file] ...]
[user@]host[:dir[/]]

If user is specified, that username is used for the login. If any files are specified, the sftp client automatically retrieves them after the user has been authenticated and then exits. If a directory dir is specified, the client starts in that directory on the remote host. sftp is part of the OpenSSH suite of network tools.

Options

-1
Use SSH1. The default is to use SSH2.

-b file
Run in batch mode, taking commands from the specified file. Requires the use of a noninteractive authentication mechanism.

-B bytes
Specify the size of the buffer sftp uses for file transfers. Default is 32768 bytes.

-C
Enable compression (uses ssh -C).

-F file
Use file as the ssh configuration file instead of the default system configuration file. The systemwide file is usually /etc/ssh/ssh_config and per-user files are $HOME/.ssh/config.

-ooption
Pass an option to ssh. The passed option is in the format used by ssh_config(5) (e.g., -oPORT=nn, where nn is the port number). -o can appear more than once to pass multiple options to ssh. This option is useful for passing options that don't have an equivalent sftp command-line option.

-P server_path
Connect directly to the local sftp server specified in server_path. Useful for debugging.

-R num
Specify the number of requests that may be outstanding at any time (default 16).

-s subsys|server_path
Specify the SSH2 subsystem or path to the sftp server on the remote system. Specifying the path is useful for using sftp via SSH1 or if the remote sshd does not have an sftp subsystem configured.

-S program
Specify the name of a program that understands ssh options and that you want to use for the encrypted connection.

-v
Raise the logging level.

shar

shar [options] files
shar -S [options]

Create shell archives ("shar" files) that are in text format and can be mailed. These files may be unpacked later by executing them with /bin/sh. Other commands may be required on the recipient's system, such as compress, gzip, and uudecode. The resulting archive is sent to standard output unless the -o option is given.

Options

-a, --net-headers
Allows automatic generation of headers. The -n option is required if the -a option is used.

-b bits, --bits-per-code=bits
Use -b bits as a parameter to compress (when doing compression). Default value is 12. The -b option automatically turns on -Z.

-c, --cut-mark
Start the shar file with a line that says "Cut here."

-d delimiter, --here-delimiter=delimiter
Use delimiter for the files in the shar instead of SHAR_EOF.

-f, --basename
Causes only simple filenames to be used when restoring, which is useful when building a shar from several directories or another directory. (If a directory name is passed to shar, the substructure of that directory will be restored whether or not -f is used.)

-g level, --level-for-gzip=level
Use -level as a parameter to gzip (when doing compression). Default is 9. The -g option turns on the -z option by default.

--help
Print a help summary on standard output, then exit.

-l nn, --whole-size-limit=nn
Limit the output file size to nn kilobytes but don't split input files. Requires use of -o.

-m, --no-timestamp
Don't generate touch commands to restore the file modification dates when unpacking files from the archive.

-n name, --archive-name=name
Name of archive to be included in the header of the shar files. Required if the -a option is used.

--no-i18n
Do not produce internationalized shell archives; use default English messages. By default, shar produces archives that will try to output messages in the unpacker's preferred language (as determined by LANG/LC_MESSAGES).

-o prefix, --output-prefix=prefix
Save the archive to files prefix.01 through prefix.nn (instead of sending it to standard output). This option must be used when either -l or -L is used.

-p, --intermix-type
Allow positional parameter options. The options -B, -T, -z, and -Z may be embedded, and files to the right of the option will be processed in the specified mode.

--print-text-domain-dir
Print the directory shar looks in to find message files for different languages, then immediately exit.

-q, --quiet, --silent
Turn off verbose mode.

-s who@where, --submitter=who@where
Supply submitter name and address, instead of allowing shar to determine it automatically.

--version
Print the version number of the program on standard output, then exit.

-w, --no-character-count
Do not check each file with wc -c after unpacking. The default is to check.

-x, --no-check-existing
Overwrite existing files without checking. Default is to check and not overwrite existing files. If -c is passed as a parameter to the script when unpacking (sh archive -c), existing files will be overwritten unconditionally. See also -X.

-z, --gzip
gzip and uuencode all files prior to packing. Must be unpacked with uudecode and gunzip (or zcat).

-B, --uuencode
Treat all files as binary; use uuencode prior to packing. This increases the size of the archive, and it must be unpacked with uudecode.

-D, --no-md5-digest
Do not use md5sum digest to verify the unpacked files. The default is to check.

-F, --force-prefix
Force the prefix character to be prepended to every line even if not required. May slightly increase the size of the archive, especially if -B or -Z is used.

-L nn, --split-size-limit=nn
Limit output file size to nn kilobytes and split files if necessary. The archive parts created with this option must be unpacked in the correct order. Requires use of -o.

-M, --mixed-uuencode
Pack files in mixed mode (the default). Distinguishes files as either text or binary; binaries are uuencoded prior to packing.

-P, --no-piping
Use temporary files instead of pipes in the shar file.

-Q, --quiet-unshar
Disable verbose mode.

-S, --stdin-file-list
Read list of files to be packed from standard input rather than from the command line. Input must be in a form similar to that generated by the find command, with one filename per line.

-T, --text-files
Treat all files as text.

-V, --vanilla-operation
Produce shars that rely only upon the existence of sed and echo in the unsharing environment.

-X, --query-user
Prompt user to ask if files should be overwritten when unpacking.

-Z, --compress
Compress and uuencode all files prior to packing.

sort

sort [options] [files]

Sort the lines of the named files. Compare specified fields for each pair of lines; if no fields are specified, compare them by byte, in machine collating sequence. If no files are specified or if the file is -, the input is taken from standard input. See also uniq, comm, and join.

Options

-b, --ignore-leading-blanks
Ignore leading spaces and tabs.

-c, --check
Check whether files are already sorted and, if so, produce no output.

-d, --dictionary-order
Sort in dictionary order.

-f, --ignore-case
Fold; ignore uppercase/lowercase differences.

-g, --general-numeric-sort
Sort in general numeric order.

--help
Print a help message and then exit.

-i, --ignore-nonprinting
Ignore nonprinting characters (those outside ASCII range 040-176).

-n
Sort in arithmetic order.

-k n[,m], --key=n[,m]
Skip n-1 fields and stop at m-1 fields (i.e., start sorting at the nth field, where the fields are numbered beginning with 1).

-ofile
Put output in file.

-m, --merge
Merge already sorted input files.

-r, --reverse
Reverse the order of the sort.

-s, --stable
Stabilize sort by disabling last-resort comparison.

-tc, --field-separator=c
Separate fields with c (default is a tab).

-u, --unique
Identical lines in input file appear only one time in output.

-z, --zero-terminated
End lines with zero byte, not with newline.

--version
Print version information and then exit.

-M, --month-sort
Attempt to treat the first three characters as a month designation (JAN, FEB, etc.). In comparisons, treat JAN < FEB and any invalid name for a month as less than a valid month.

-Ssize, --buffer-size=size
Set the size of the main memory buffer to size, which may include a suffix; e.g., K (1024, the default) or M.

-T tempdir, --temporary-directory=dir
Directory pathname to be used for temporary files.

Examples

List files by decreasing number of lines:

wc -l * | sort -r

Alphabetize a list of words, remove duplicates, and print the frequency of each word:

sort -fd wordlist | uniq -c

Sort the password file numerically by the third field (user ID):

sort -nk3,4 -t: /etc/passwd
ssh

ssh [options] hostname [command]

Securely log a user into a remote system and run commands on that system. The version of ssh described here is the OpenSSH client. ssh can use either Version 1 (SSH1) or Version 2 (SSH2) of the SSH protocol. SSH2 is preferable, as it provides better encryption methods and greater connection integrity. The hostname can be specified either as hostname or as user@hostname. If a command is specified, the user is authenticated, the command is executed, and the connection is closed. Otherwise, a terminal session is opened on the remote system. See later under "Escape characters" for functions that can be supported through an escape character. The default escape character is a tilde (~). The exit status returned from ssh is the exit status from the remote system or 255 if there was an error.

Options

-1
Try only SSH1.

-2
Try only SSH2.

-4
Use only IPv4 addresses.

-6
Use only IPv6 addresses.

-a
Disable forwarding of the authentication agent connection.

-A
Allow forwarding of the authentication agent connection. Can also be specified on a per-host basis in a configuration file.

-b bind_address
Specify the interface to transmit from when there are multiple available interfaces or aliased addresses.

-c blowfish|3des|des|ciphers
Select the cipher for encrypting the session. The default is 3des. For SSH2, a comma-separated list of ciphers can also be specified, with the ciphers listed in order of preference. des is supported only for legacy SSH1 compatibility and otherwise should not be used.

-C
Enable compression. Useful mainly for slow connections. The default compression level can be set on a per-host basis in the configuration file with the CompressionLevel option.

-D port
Enable dynamic application-level port forwarding using port on the local side. Can be specified in the configuration file. Only root can forward privileged ports.

-e char|^char|none
Set the escape character (default ~). The escape character must be the first character on a line. If none is specified, disable the use of an escape character.

-f
Run interactively for user authentication, then go into background mode for command execution. Implies -n.

-F configfile
Specify a per-user configuration file (default is $HOME/.ssh/config).

-g
Allow remote hosts to connect to local forwarded ports.

-i idfile
Use idfile to read identity (private key) for RSA or DSA authentication. Default is $HOME/.ssh/id_rsa or $HOME/.ssh/id_dsa for SSH2, or $HOME/.ssh/identity for SSH1. You can specify more than one -i option on the command line or in the configuration file.

-I device
Specify a smartcard device from which to get the user's private RSA key.

-k
Disable Kerberos ticket and AFS token forwarding. Can be set on a per-host basis in the configuration file.

-l user
Log in as user on the remote system. Can be specified on a per-host basis in the configuration file.

-L port:host:hostport
Forward port on the local host to the specified remote host and port. Can be specified in the configuration file. Only root can forward privileged ports. For IPv6, an alternative syntax is port/host/hostport.

-m macspec
For SSH2, the contents of macspec specify message authentication code (MAC) algorithms to use. macspec is a comma-separated list of algorithms in order of preference.

-n
Get standard input as a redirection from /dev/null. Used to prevent reading from standard input, which is required when running ssh in the background. Useful for running X programs on a remote host.

-N
Do not execute a remote command. Useful with SSH2 for port forwarding.

-o option
Specify options in configuration-file format. Useful for specifying options that have no command-line equivalent.

-p port
Specify the port on the remote host to which ssh is to connect. Can be specified on a per-host basis in the configuration file.

-P
Use a nonprivileged port for outgoing connections. Useful if a firewall prevents connections from privileged ports.

-q
Run quietly, suppressing warnings and error messages.

-R port:host:hostport
Forward port on the remote host to the local host:hostport. Can be specified in the configuration file. You can forward privileged ports only if you are logged in as root on the remote host. For IPv6, an alternative syntax is port/host/hostport.

-s
For SSH2, request invocation of a subsystem on the remote host to be used for another application such as sftp. The desired subsystem is specified as the remote command.

-t
Force pseudo-tty allocation. Multiple -t options can be specified to force tty allocation even when ssh has no local tty.

-T
Disable pseudo-tty allocation.

-v
Verbose mode. Useful for debugging. Specify multiple -v options to increase verbosity.

-x
Disable X11 forwarding.

-X
Enable X11 forwarding. Can be specified on a per-host basis in the configuration file.

Escape characters

~.
Disconnect.

~~
Send a single ~.

~#
List forwarded connections.

~&
Run ssh in the background at logout, while waiting for a forwarded connection or X11 sessions to terminate.

~?
Display the available escape characters.

~C
Open a command line. Useful for adding port forwardings when using the -L and -R options.

~R
Request rekeying of the connection. Useful only for SSH2 and if the peer supports it.

~^Z
Suspend the connection.

Environment variables

DISPLAY
Set by SSH to hostname:n for forwarding X11 connections. hostname is the host where the shell is running and n is an integer greater than zero.

HOME
The path to the user's home directory.

LOGNAME
The same as USER; set only for compatibility with systems that use LOGNAME.

MAIL
The path to the user's mailbox.

PATH
The default PATH as specified when SSH was compiled.

SSH_ASKPASS
Can be set to the name of a program to run to open an X11 window and read the user's passphrase if ssh does not have an associated terminal.

SSH_AUTH_SOCK
The path of a Unix-domain socket for communicating with the agent.

SSH_CLIENT
Three space-separated values that contain the client IP address, the client port number, and the server port number.

SSH_ORIGINAL_COMMAND
The original command line, including arguments, if a forced command is executed.

SSH_TTY
The path to the tty device associated with the current shell or command. Not set if there is no associated tty.

TZ
The time zone, passed from the SSH daemon, if it was set when the daemon was started.

USER
The name of the user logging in.

Files

ssh uses the following files in the user's home directory:

$HOME/.rhosts
Lists host/user pairs allowed to log in. Used with rhosts authentication.

$HOME/.shosts
Like .rhosts, but allows rhosts authentication without permitting login with rlogin or rsh.

$HOME/.ssh/authorized_keys
Lists RSA/DSA public keys that can be used to log in as this user.

$HOME/.ssh/config
The user's configuration file.

$HOME/.ssh/environment
Additional environment variable definitions.

$HOME/.ssh/identity, $HOME/.ssh/id_dsa, $HOME/.ssh/id_rsa
The authentication identity of the user for SSH1 RSA, SSH2 DSA, and SSH2 RSA, respectively.

$HOME/.ssh/identity.pub, $HOME/.ssh/id_dsa.pub, $HOME/.ssh/id_rsa.pub
The public key for user authentication for SSH1 RSA, SSH2 DSA, and SSH2 RSA, respectively.

$HOME/.ssh/known_hosts
Contains host keys for all hosts the user has logged into that are not already in the systemwide file at /etc/ssh/ssh_known_hosts.

$HOME/.ssh/rc
Contains commands executed by ssh after the user has logged in but before the shell or command is started.

sshd

sshd [options]

TCP/IP command. Server for the ssh program, providing a secure remote login and remote execution facility equivalent to rlogin and rsh. Normally started at boot, sshd listens for incoming connections, forking a new daemon when one is detected. The forked daemon handles authentication, command execution, and encryption. Most implementations of sshd support both SSH protocols 1 and 2. The following options are those used by OpenSSH, OpenBSD's Secure Shell implementation.

Options

-b bits
Use the specified number of bits in the server key. Default is 768.

-d
Run sshd in the foreground and send verbose debug information to the system log. Process only one connection. Use the specified number of bits in the server key. This option may be specified from one to three times. Each additional -d increases the level of information sent to the system log.

-e
Send output to standard error instead of the system log.

-f file
Read configuration information from file instead of the default configuration file /etc/ssh/sshd_config.

-g seconds
Set the grace time a client has to authenticate itself before the server disconnects and exits. The default is 600 seconds. A value of means there is no limit.

-h keyfile
Read the host's cryptographic key from the specified keyfile instead of from the default file /etc/ssh/ssh_host_key for SSH protocol 1, and the default files /etc/ssh/ssh_host_rsa_key and /etc/ssh/ssh_host_dsa_key for SSH protocol 2. The -h option may be given more than once to specify multiple keyfiles.

-i
Use when running sshd from inetd.

-k seconds
Set how often the version 1 server key should be regenerated. Default value is 3600 seconds. If set to 0 seconds, the key will never be regenerated.

-o setting
Pass a configuration file setting as an option.

-p port
Listen for connections on port. The default is 22. More than one -p option may be specified. This option overrides ports specified in a configuration file.

-q
Send no messages to the system log.

-t
Test configuration files and keys, then exit.

-u namelength
Specify the length of the remote hostname field in the UTMP structure as specifed in utmp.h. A namelength of 0 will cause sshd to write dotted decimal values instead of hostnames to the utmp file and prevent DNS requests unless required by the authentication mechanism.

-D
Do not detach from the foreground process.

-4
Use only IPv4 addresses.

-6
Use only IPv6 addresses.

stat

stat [options] files

Print out the contents of an inode as they appear to the stat system call in a human-readable format. The error messages "Can't stat file" and "Can't lstat file" usually mean the file doesn't exist. "Can't readlink file" generally indicates that something is wrong with a symbolic link.

Options

-c format
Display the output as specified by format.

-f
Display information about the filesystem where the file is located, not about the file itself.

-l
For links, display information about the files found by following the links.

-s
For SE (Security Enhanced) Linux, show security information, if it's available, in addition to stat's normal output.

-t
Print the output tersely, in a form suitable for parsing by other programs.

-v
Print version information and exit.

Output

stat and stat -l display the following:

  • Device number

  • Inode number

  • Access rights

  • Number of hard links

  • Owner's user ID and name, if available

  • Owner's group ID and name, if available

  • Device type for inode device

  • Total size, in bytes

  • Number of blocks allocated

  • I/O blocksize

  • Last access time

  • Last modification time

  • Last change time

  • Security context for SE Linux

If -f is specified, stat displays the following information about the filesystem:

  • Filesystem type

  • Filesystem blocksize

  • Total blocks in the filesystem

  • Number of free blocks

  • Number of free blocks for nonroot users

  • Total number of inodes

  • Number of free inodes

  • Maximum filename length

Format

The printf(3) flag characters #, 0, -, +, and space can be used in format. In addition, the field width and precision options can be used.

If -c format is specified, the following sequences can be used for format:

%a
Access rights in octal

%A
Access rights in human-readable form

%b
Number of blocks allocated

%c
SE Linux security context

%d
Device number in decimal

%D
Device number in hex

%f
Raw mode in hex

%F
File type

%g
Owner's group ID

%G
Owner's group name

%h
Number of hard links

%i
Inode number

%n
Filename

%N
Quoted filename. If file is a symbolic link, include path to original.

%o
I/O blocksize

%s
Total size, in bytes

%S
SE Linux SID (security identifier)

%t
Major device type in hex

%T
Minor device type in hex

%u
Owner's user ID

%U
Owner's username

%x
Last access time

%X
Last access time as seconds since the Epoch

%y
Last modification time (modification of the file contents)

%Y
Last modification time as seconds since the Epoch

%z
Time of last change (modification of the inode)

%Z
Time of last change as seconds since the Epoch

If both -c format and -f are specified, the following sequences can be used for format:

%a
Free blocks available to nonroot user

%b
Total data blocks in filesystem

%c
Total file nodes in filesystem

%d
Free file nodes in filesystem

%f
Free blocks in filesystem

%i
Filesystem ID, _ _val[0] in hex

%I
Filesystem ID, _ _val[1] in hex

%l
Maximum filename length

%n
Filename

%s
Optimal transfer blocksize

%t
Type in hex

%T
Type in human-readable form

Examples

Sample output from the command stat /:

stat /
  File: "/"
  Size: 4096            Blocks: 8          IO Block: 4096   Directory
Device: 303h/771d       Inode: 2           Links: 19
Access: (0755/drwxr-xr-x)  Uid: (    0/    root)   Gid: (    0/    root)
Access: Thu Jan  2 04:02:40 2003
Modify: Wed Jan  1 23:03:20 2003
Change: Wed Jan  1 23:03:20 2003

Sample output with -f, displaying information about the filesystem:

stat -f /
  File: "/"
    ID: 0        0        Namelen: 255     Type: ext2/ext3
Blocks: Total: 2612475    Free: 1869472    Available: 1736735    Size: 4096
Inodes: Total: 1329696    Free: 1150253
strace

strace [options] command [arguments]

Trace the system calls and signals for command and arguments. strace shows you how data is passed between the program and the system kernel. With no options, strace prints a line to stderr for each system call. It shows the call name, arguments given, return value, and any error messages generated. A signal is printed with both its signal symbol and a descriptive string.

Options

-a n
Align the return values in column n.

-c
Count all calls and signals and create a summary report when the program has ended.

-d
Debug mode. Print debugging information for strace on stderr.

-e [keyword=][!]values
Pass an expression to strace to limit the types of calls or signals that are traced or to change how they are displayed. If no keyword is given, trace is assumed. The values can be given as a comma-separated list. Preceding the list with an exclamation mark (!) negates the list. The special values all and none are valid, as are the values listed with the following keywords.

abbrev=names
Abbreviate output from large structures for system calls listed in names.

read=descriptors
Print all data read from the given file descriptors.

signal=symbols
Trace the listed signal symbols (for example, signal=SIGIO,SIGHUP).

trace=sets
sets may be a list of system call names or one of the following:

file

Calls that take a filename as an argument

ipc

Interprocess communication

network

Network-related

process

Process management

signal

Signal-related

raw=names
Print arguments for the given system calls in hexadecimal.

verbose=names
Unabbreviate structures for the given system calls. Default is none.

write=descriptors
Print all data written to the given file descriptors.

-f
Trace forked processes.

-ff
Write system calls for forked processes to separate files named filename.pid when using the -o option.

-h
Print help and exit.

-i
Print instruction pointer with each system call.

-o filename
Write output to filename instead of stderr. If filename starts with the pipe symbol |, treat the rest of the name as a command to which output should be piped.

-O n
Override strace's built-in timing estimates, and just subtract n microseconds from the timing of each system call to adjust for the time it takes to measure the call.

-p pid
Attach to the given process ID and begin tracking. strace can track more than one process if more than one option -p is given. Type Ctrl-c to end the trace.

-q
Quiet mode. Suppress attach and detach messages from strace.

-r
Relative timestamp. Print time in microseconds between system calls.

-s n
Print only the first n characters of a string. Default value is 32.

-S value
Sort output of -c option by the given value. value may be calls, name, time, or nothing. Default is time.

-T
Print time spent in each system call.

-t
Print time of day on each line of output.

-tt
Print time of day with microseconds on each line of output.

-ttt
Print timestamp on each line as number of seconds since the Epoch.

-u username
Run command as username. Needed when tracing setuid and setgid programs.

-V
Print version and exit.

-v
Verbose. Do not abbreviate structure information.

-x
Print all non-ASCII strings in hexadecimal.

-xx
Print all strings in hexadecimal.

stty

stty [options] [modes]

Set terminal I/O options for the current standard input device. Without options, stty reports the terminal settings that differ from those set by running stty sane, where ^ indicates the Ctrl key and ^` indicates a null value. Most modes can be negated using an optional - (shown in brackets). The corresponding description is also shown in brackets. Some arguments use non-POSIX extensions; these are marked with *.

Options

-a, --all
Report all option settings.

-F, --device
Open the specified device and use it instead of standard input.

-g, --save
Report settings in stty-readable form (i.e., hex).

--help
Print help message and exit.

--version
Print version information and exit.

Control modes

n
Set terminal baud rate to n (e.g., 2400).

[-]clocal
[Enable] disable modem control.

[-]cread
[Disable] enable the receiver.

[-]crtscts*
[Disable] enable RTS/CTS handshaking.

csbits
Set character size to bits, which must be 5, 6, 7, or 8.

[-]cstopb
[1] 2 stop bits per character.

[-]hup
[Do not] hang up connection on last close.

[-]hupcl
Same as previous.

ispeed n
Set terminal input baud rate to n.

ospeed n
Set terminal output baud rate to n.

[-]parenb
[Disable] enable parity generation and detection.

[-]parodd
Use [even] odd parity.

Flow control modes

The following flow control modes are available by combining the ortsfl, ctsflow, and rtsflow flags:

Flag settings

Flow control mode

ortsfl rtsflow ctsflow

Enable unidirectional flow control.

ortsfl rtsflow -ctsflow

Assert RTS when ready to send.

ortsfl -rtsflow ctsflow

No effect.

ortsfl -rtsflow -ctsflow

Enable bidirectional flow control.

-ortsfl rtsflow ctsflow

Enable bidirectional flow control.

-ortsfl rtsflow -ctsflow

No effect.

-ortsfl -rtsflow ctsflow

Stop transmission when CTS drops.

-ortsfl -rtsflow -ctsflow

Disable hardware flow control.

Input modes

[-]brkint
[Do not] signal INTR on break.

[-]icrnl
[Do not] map CR to NL on input.

[-]ignbrk
[Do not] ignore break on input.

[-]igncr
[Do not] ignore CR on input.

[-]ignpar
[Do not] ignore parity errors.

[-]inlcr
[Do not] map NL to CR on input.

[-]inpck
[Disable] enable input parity checking.

[-]istrip
[Do not] strip input characters to 7 bits.

[-]iuclc*
[Do not] map uppercase to lowercase on input.

[-]ixany*
Allow [XON] any character to restart output.

[-]ixoff, [-]tandem
[Enable] disable sending of START/STOP characters.

[-]ixon
[Disable] enable XON/XOFF flow control.

[-]parmrk
[Do not] mark parity errors.

[-]imaxbel*
When input buffer is too full to accept a new character, [flush the input buffer] beep without flushing the input buffer.

Output modes

bsn
Select style of delay for backspaces (0 or 1).

crn
Select style of delay for carriage returns (0-3).

ffn
Select style of delay for formfeeds (0 or 1).

nln
Select style of delay for linefeeds (0 or 1).

tabn
Select style of delay for horizontal tabs (0-3).

vtn
Select style of delay for vertical tabs (0 or 1).

[-]ocrnl*
[Do not] map CR to NL on output.

[-]ofdel*
Set fill character to [NULL] DEL.

[-]ofill*
Delay output with [timing] fill characters.

[-]olcuc*
[Do not] map lowercase to uppercase on output.

[-]onlcr*
[Do not] map NL to CR-NL on output.

[-]onlret*
On the terminal, NL performs [does not perform] the CR function.

[-]onocr*
Do not [do] output CRs at column 0.

[-]opost
[Do not] postprocess output.

Local modes

[-]echo
[Do not] echo every character typed.

[-]echoe, [-]crterase
[Do not] echo ERASE character as BS-space-BS string.

[-]echok
[Do not] echo NL after KILL character.

[-]echonl
[Do not] echo NL.

[-]icanon
[Disable] enable canonical input (ERASE, KILL, WERASE, and RPRINT processing).

[-]iexten
[Disable] enable extended functions for input data.

[-]isig
[Disable] enable checking of characters against INTR, SUSPEND, and QUIT.

[-]noflsh
[Enable] disable flush after INTR or QUIT.

[-]tostop*
[Do not] send SIGTTOU when background processes write to the terminal.

[-]xcase*
[Do not] change case on local output.

[-]echoprt, [-]prterase*
When erasing characters, echo them backward, enclosed in \ and /.

[-]echoctl. [-]ctlecho*
Do not echo control characters literally. Use hat notation (e.g., ^Z).

[-]echoke [-]crtkill*
Erase characters as specified by the echoprt and echoe settings (default is echoctl and echok settings).

Control assignments

ctrl-char c
Set control character to c. ctrl-char is dsusp (flush input and then send stop), eof, eol, eol2 (alternate end-of-line), erase, intr, lnext (treat next character literally), kill, rprnt (redraw line), quit, start, stop, susp, swtch, or werase (erase previous word). c can be a literal control character, a character in hat notation (e.g., ^Z), in hex (must begin with 0x), in octal (must begin with 0), or in decimal. Disable the control character with values of ^- or undef.

min n
Set the minimum number of characters that will satisfy a read until the time value has expired when -icanon is set.

time n
Set the number of tenths of a second before reads time out if the min number of characters have not been read when -icanon is set.

line i*
Set line discipline to i (1-126).

Combination modes

[-]cooked
Same as [raw]-raw.

[-]evenp, [-]parity
Same as [-]parenb and cs[8]7.

[-]parity
Same as [-]parenb and cs[8]7.

ek
Reset ERASE and KILL characters to Ctrl-h and Ctrl-u, their defaults.

[-]lcase
[Unset] set xcase, iuclc, and olcuc.

[-]LCASE
Same as [-]lcase.

[-]nl
[Unset] set icrnl and onlcr. -nl also unsets inlcr, igncr, ocrnl, and onlret, icrnl, onlcr.

[-]oddp
Same as [-]parenb, [-]parodd, and cs7[8].

[-]raw
[Disable] enable raw input and output (no ERASE, KILL, INTR, QUIT, EOT, SWITCH, or output postprocessing).

sane
Reset all modes to reasonable values.

[-]tabs*
[Expand to spaces] preserve output tabs.

[-]cbreak
Same as [icanon]-icanon.

[-]pass8
Same as -parenb -istrip cs8.

[-]litout
Same as -parenb -istrip cs8.

[-]decctlq*
Same as -ixany.

crt
Same as echoe echoctl echoke.

dec
Same as echoe echoctl echoke -ixany. Additionally, set INTERRUPT to ^C, ERASE to DEL, and KILL to ^U.

Special settings

ispeed speed
Specify input speed.

ospeed speed
Specify output speed.

rows rows*
Specify number of rows.

cols columns, columns columns*
Specify number of columns.

size*
Display current row and column settings.

speed
Display terminal speed.

sudo

sudo [options] [command]

If you are allowed, execute command as the superuser. Authorized users of sudo and the commands they are permitted to execute are listed in the sudo configuration file, /etc/sudoers. If an unauthorized user attempts to run a command, sudo will inform an administrator via email. By default, it will send the message to the root account. Users attempting to run commands are prompted for their password. Once authenticated, sudo sets a timestamp for the user. For five minutes from the timestamp, the user may execute further commands without being prompted for their password. This grace period may be overriden by settings in the /etc/sudoers file.

Options

-b
Execute command in the background.

-h
Print help message, then exit.

-k
Revoke user's sudo permissions. Similar to -K, but changes user's timestamp to the Epoch instead of revoking it.

-l
List all allowed and forbidden commands for the user on the current host, then exit.

-p promptstring
Use the specified promptstring to prompt for a password. The string may contain escape codes %u and %h, which will be replaced with the current user's login name and local hostname.

-s
Run the shell specified in the SHELL environment variable, or the default shell specified in /etc/passwd. If a command is given, it should be a shell script and not a binary file.

-u user
Run command as the specified user instead of the root user. This may also be specified as a user ID number using #uid.

-v
Update timestamp for user. Prompt for password if necessary.

-H
Set the HOME environment variable to the home directory of the target user.

-K
Remove user's timestamp.

-L
List parameters that may be set as defaults for a user in the /etc/sudoers file.

-P
Preserve initial user's group membership.

-S
Read password from standard input instead of from the console.

-V
Print version number, then exit. When run by the root user, print sudo's defaults and the local network address as well.

--
Stop reading command-line arguments.

sysklogd

syslogd [options]

System administration command. sysklogd provides both syslogd and klogd functionality. By default, it is meant to behave exactly like the BSD version of syslogd. While the difference should be completely transparent to the user, sysklogd supports an extended syntax. It is invoked as syslogd.

sysklogd logs system messages into a set of files described by the configuration file /etc/syslog.conf. Each message is one line. A message can contain a priority code, marked by a number in angle brackets at the beginning of the line. Priorities are defined in <sys/syslog.h>. syslogd reads from an Internet domain socket specified in /etc/services. To bring syslogd down, send it a terminate signal. See also klogd.

Options

-a socket
Add socket to the list of sockets syslogd listens to.

-d
Turn on debugging.

-f configfile
Specify alternate configuration file.

-h
Forward messages from remote hosts to forwarding hosts.

-l hostlist
Specify hostnames that should be logged with just the hostname, not the fully qualified domain name. Multiple hosts should be separated by a colon (:).

-m markinterval
Select number of minutes between mark messages.

-n
Avoid auto-backgrounding. This is needed when starting syslogd from init.

-p socket
Send log to socket instead of /dev/log.

-r
Receive messages from the network using an Internet domain socket with the syslog service.

-s domainlist
Strip off domain names specified in domainlist before logging. Multiple domain names should be separated by a colon (:).

-v
Print version number, then exit.

-x
Disable domain name lookups for remote messages.

tail

tail [options] [files]

Print the last 10 lines of each named file (or standard input if - is specified) on standard output. If more than one file is specified, the output includes a header at the beginning of each file:

=  =>filename<=  =

Options

-n[k]
Begin printing at nth item from end-of-file. k specifies the item to count: l (lines, the default), b (blocks), or c (characters).

-k
Same as -n, but use the default count of 10.

+n[k]
Like -n, but start at nth item from beginning of file.

+k
Like -k, but count from beginning of file.

-c num{bkm}, --bytes num{bkm}
Print last num bytes. An alternate blocksize may be specified:

b
512 bytes

k
1 kilobyte

m
1 megabyte

-f, --follow[=name|descriptor]
Don't quit at the end of file; "follow" file as it grows and end when the user presses Ctrl-c. Following by file descriptor is the default, so -f, --follow, and --follow=descriptor are equivalent. Use --follow=name to track the actual name of a file even if the file is renamed, as with a rotated log file.

-F
Identical to --follow=name --retry.

--help
Print a help message and exit.

-n num, --lines=num
Print the last num lines.

--max-unchanged-stats=num
Used with --follow=name to reopen a file whose size hasn't changed after num iterations (default 5), to see if it has been unlinked or renamed (as with rotated log files).

--pid=pid
Used with -f to end when process ID pid dies.

-q, --quiet, --silent
Suppress filename headers.

--retry
With -f, keep trying to open a file even if it isn't accessible when tail starts or if it becomes inaccessible later.

-s sec, --sleep-interval=sec
With -f, sleep approximately sec seconds between iterations. Default is 1 second.

-v, --verbose
With multiple files, always output the filename headers.

--version
Print version information and then exit.

Examples

Show the last 20 lines containing instances of .Ah:

grep '\.Ah' file | tail -20

Show the last 10 characters of variable name:

echo "$name" | tail -c

Print the last two blocks of bigfile:

tail -2b bigfile
tar

tar [options] [tarfile] [other-files]

Copy files to or restore files from an archive medium. If any files are directories, tar acts on the entire subtree. Options need not be preceded by - (though they may be). The exception to this rule is when you are using a long-style option (such as --modification-time). In that case, the exact syntax is:

tar --long-option -function-options files

For example:

tar --modification-time -xvf tarfile.tar

Function options

You must use exactly one of these, and it must come before any other options:

-c, --create
Create a new archive.

-d, --diff, --compare
Compare the files stored in tarfile with other-files. Report any differences: missing files, different sizes, different file attributes (such as permissions or modification time).

--delete
Delete from the archive. This option cannot be used with magnetic tape.

-r, --append
Append other-files to the end of an existing archive.

-t, --list
Print the names of other-files if they are stored on the archive (if other-files are not specified, print names of all files).

-u, --update
Add files if not in the archive or if modified.

-x, --extract, --get
Extract other-files from an archive (if other-files are not specified, extract all files).

-A, --catenate, --concatenate
Concatenate a second tar file to the end of the first.

Options

[drive][density]
Set drive (0-7) and storage density (l, m, or h, corresponding to low, medium, or high). Not available in all versions of tar.

--anchored
Exclude patterns must match the start of the filename (the default).

--atime-preserve
Preserve original access time on extracted files.

-b n, --blocking-factor=n
Set blocksize to n × 512 bytes.

--backup[=type]
Back up files rather than deleting them. If no backup type is specified, a simple backup is made with ~ as the suffix. (See also --suffix.) The possible values of type are:

t, numbered
Make numbered backups.

nil, existing
Make numbered backups if there are already numbered backups, otherwise make simple backups.

never, simple
Always make simple backups.

--checkpoint
List directory names encountered.

--exclude=pattern
Remove files matching pattern from any list of files.

-f file, --file=file
Store files in or extract files from archive file. Note that file may take the form hostname:filename.

--force-local
Interpret filenames in the form hostname:filename as local files.

-g file, --listed-incremental=file
Create new-style incremental backup.

--group=group
Use group as the group for files added to the archive.

-h, --dereference
Dereference symbolic links and archive the files they point to rather than the symbolic link.

--help
Print help message and exit.

-i, --ignore-zeros
Ignore zero-sized blocks (i.e., EOFs).

--ignore-case
Ignore case when excluding files.

--ignore-failed-read
Ignore unreadable files to be archived. Default behavior is to exit when encountering these.

-j, --bzip2, -i
Compress files with bzip2 before archiving them, or uncompress them with bunzip2 before extracting them.

-l, --one-file-system
Do not archive files from other filesystems.

-k, --keep-old-files
When extracting files, do not overwrite files with similar names. Instead, print an error message.

-m, --touch
Do not restore file modification times; update them to the time of extraction.

--mode=permissions
Use permissions when adding files to an archive. The permissions are specified the same way as for the chmod command.

--newer-mtime=date
Add only files whose contents have changed since date to the archive.

--no-anchor
Exclude patterns may match anything following a slash.

--no-ignore-case
Do not ignore case when excluding files.

--no-same-permissions
Do not extract permissions information when extracting files from the archive. This is the default for users, and therefore affects only the superuser.

--no-recursion
Do not move recursively through directories.

--no-same-owner
When extracting, create files with yourself as owner.

--no-wildcards
Don't use wildcards when excluding files; treat patterns as strings.

--no-wildcards-match-slash
Wildcards do not match slash when excluding files.

--null
Allow filenames to be null-terminated with -T. Override -C.

--numeric-owner
Use the numeric owner and group IDs rather than the names.

-o, --old-archive, --portability
Create old-style archive in Unix V7 rather than ANSI format.

--overwrite
Overwrite existing files and directory metadata when extracting from archive.

--overwrite-dir
Overwrite existing directory metadata when extracting from archive.

--owner=owner
Set owner as the owner of extracted files instead of the original owner. owner is first assumed to be a username, then, if there is no match, a numeric user ID.

-p, --same-permissions, --preserve-permissions
Keep permissions of extracted files the same as the originals.

--posix
Create a POSIX-compliant archive.

--preserve
Equivalent to invoking both the -p and -s options.

--record-size=size
Treat each record as having size bytes, where size is a multiple of 512.

--recursion
Move recursively through directories.

--recursive-unlink
Remove existing directory hierarchies before extracting directories with the same name.

--remove-files
Remove originals after inclusion in archive.

--rsh-command=command
Do not connect to remote host with rsh; instead, use command.

-s, --same-order, --preserve-order
When extracting, sort filenames to correspond to the order in the archive.

--same-owner
When extracting, create files with the same ownership as the originals.

--show-omitted-dirs
List directories being omitted when operating on an archive.

--suffix=suffix
Use suffix instead of the default ~ when creating a backup file.

--totals
Print byte totals.

--use-compress-program=program
Compress archived files with program, or uncompress extracted files with program.

-v, --verbose
Verbose. Print filenames as they are added or extracted.

--version
Print version information and exit.

--volno-file=file
Use/update the volume number in file.

-w, --interactive, --confirmation
Wait for user confirmation (y) before taking any actions.

--wildcards
Use wildcards when excluding files.

--wildcards-match-slash
Wildcards match / when excluding files.

-z, --gzip, --gunzip, --ungzip
Compress files with gzip before archiving them, or uncompress them with gunzip before extracting them.

-B, --read-full-records
Reblock while reading; used for reading from 4.2BSD pipes.

-C directory, --directory=directory
cd to directory before beginning tar operation.

-F script, --info-script=script, --new-volume-script=script
Implies -M (multiple archive files). Run script at the end of each file.

-G, --incremental
Create old-style incremental backup.

-K file, --starting-file=file
Begin tar operation at file in archive.

-L length, --tape-length=length
Write a maximum of length × 1024 bytes to each tape.

-M, --multivolume
Expect archive to be multivolume. With -c, create such an archive.

-N date, --newer=date, --after-date=date
Ignore files older than date.

-O, --to-stdout
Print extracted files to standard output.

-P, --absolute-names
Do not remove initial slashes (/) from input filenames.

-R, --block-number
Display archive's block number in messages.

-S, --sparse
Treat sparse files more efficiently when adding to archive.

-T file, --files-from=file
Consult file for files to extract or create.

-U, --unlink-first
Remove each existing file from the filesystem before extracting from the archive.

-V name, --label=name
Name this volume name.

-W, --verify
Check archive for corruption after creation.

-X file, --exclude-from file
Consult file for list of files to exclude.

-Z, --compress, --uncompress
Compress files with compress before archiving them, or uncompress them with uncompress before extracting them.

Examples

Create an archive of /bin and /usr/bin (c), show the command working (v), and store on the tape in /dev/rmt0:

tar cvf /dev/rmt0 /bin /usr/bin

List the tape's contents in a format like ls -l:

tar tvf /dev/rmt0

Extract the /bin directory:

tar xvf /dev/rmt0 /bin

Create an archive of the current directory and store it in a file backup.tar:

tar cvf - `find . -print` > backup.tar

(The - tells tar to store the archive on standard output, which is then redirected.)

telnet

telnet [options] [host [port]]

Access remote systems. telnet is the user interface that communicates with another host using the Telnet protocol. If telnet is invoked without host, it enters command mode, indicated by its prompt, telnet>, and accepts and executes the commands listed after the following options. If invoked with arguments, telnet performs an open command (shown in the following list) with those arguments. host indicates the host's official name, alias, or Internet address. port indicates a port number (default is the Telnet port).

The Telnet protocol is often criticized because it uses no encryption and makes it easy for snoopers to pick up user passwords. Most sites now use ssh instead.

Options

-a
Automatic login to the remote system.

-b hostalias
Use bind to bind the local socket to an aliased address or the address of an interface other than the one that would be chosen by connect.

-c
Disable reading of the user's .telnetrc file.

-d
Turn on socket-level debugging.

-e [escape_char]
Set initial telnet escape character to escape_char. If escape_char is omitted, no escape character is predefined.

-f
With Kerberos V5 authentication, allow forwarding of the local credentials to the remote system.

-k realm
With Kerberos authentication, obtain tickets for the remote host in realm, instead of in the remote host's realm.

-l user
When connecting to remote system and if remote system understands ENVIRON, send user to the remote system as the value for variable USER. Implies the -a option.

-n tracefile
Open tracefile for recording the trace information.

-r
Emulate rlogin. The default escape character for this mode is a tilde (~); an escape character followed by a dot causes telnet to disconnect from the remote host; a ^Z instead of a dot suspends telnet; and a ^] (the default telnet escape character) generates a normal telnet prompt. These codes are accepted only at the beginning of a line.

-x
Turn on datastream encryption if possible.

-8
Request 8-bit operation.

-E
Disable the escape character functionality.

-F
With Kerberos V5 authentication, allow local credentials to be forwarded to the remote system, including any that were already forwarded to the local environment.

-K
Do not allow automatic login to the remote system.

-L
Specify an 8-bit data path on output.

-X atype
Disable the atype type of authentication.

Commands

Ctrl-Z
Suspend telnet.

! [command]
Execute a single command in a subshell on the local system. If command is omitted, an interactive subshell will be invoked.

? [command]
Get help. With no arguments, print a help summary. If a command is specified, print the help information for just that command.

close
Close a Telnet session and return to command mode.

display argument ...
Display all or some of the set and toggle values.

environ [arguments [...]]
Manipulate variables that may be sent through the TELNET ENVIRON option. Valid arguments for environ are:

?
Get help for the environ command.

define variable value
Define variable to have a value of value.

undefine variable
Remove variable from the list of environment variables.

export variable
Mark variable to have its value exported to the remote side.

unexport variable
Mark variable to not be exported unless explicitly requested by the remote side.

list
Display current variable values.

send variable
Send the environment variable variable.

logout
If the remote host supports the logout command, close the telnet session.

mode [type]
Depending on state of Telnet session, type is one of several options:

?
Print out help information for the mode command.

character
Disable TELNET LINEMODE option, or, if remote side does not understand the option, enter "character-at-a-time" mode.

[-]edit
Attempt to [disable] enable the EDIT mode of the TELNET LINEMODE option.

[-]isig
Attempt to [disable] enable the TRAPSIG mode of the LINEMODE option.

line
Enable LINEMODE option, or, if remote side does not understand the option, enter "old line-by-line" mode.

[-]softtabs
Attempt to [disable] enable the SOFT_TAB mode of the LINEMODE option.

[-]litecho
[Disable] enable LIT_ECHO mode.

open[-l user] host [port]
Open a connection to the named host. If no port number is specified, attempt to contact a Telnet server at the default port.

quit
Close any open Telnet session and then exit telnet.

send arguments
Send one or more special character sequences to the remote host. Following are the arguments that may be specified:

?
Print out help information for send command.

abort
Send Telnet ABORT sequence.

ao
Send Telnet AO sequence, which should cause the remote system to flush all output from the remote system to the user's terminal.

ayt
Send Telnet AYT (Are You There) sequence.

brk
Send Telnet BRK (Break) sequence.

do cmd
dont cmd
will cmd
wont cmd
Send Telnet DO cmd sequence, where cmd is a number between 0 and 255 or a symbolic name for a specific telnet command. If cmd is ? or help, this command prints out help (including a list of symbolic names).

ec
Send Telnet EC (Erase Character) sequence, which causes the remote system to erase the last character entered.

el
Send Telnet EL (Erase Line) sequence, which causes the remote system to erase the last line entered.

eof
Send Telnet EOF (End Of File) sequence.

eor
Send Telnet EOR (End Of Record) sequence.

escape
Send current Telnet escape character (initially ^]).

ga
Send Telnet GA (Go Ahead) sequence.

getstatus
If the remote side supports the Telnet STATUS command, getstatus sends the subnegotiation request that the server send its current option status.

ip
Send Telnet IP (Interrupt Process) sequence, which causes the remote system to abort the currently running process.

nop
Send Telnet NOP (No Operation) sequence.

susp
Send Telnet SUSP (Suspend Process) sequence.

synch
Send Telnet SYNCH sequence, which causes the remote system to discard all previously typed (but not read) input.

set argument value
unset argument value
Set any one of a number of telnet variables to a specific value or to TRUE. The special value off disables the function associated with the variable. unset disables any of the specified functions. The values of variables may be interrogated with the aid of the display command. The variables that may be specified are:

?
Display legal set and unset commands.

ayt
If telnet is in LOCALCHARS mode, this character is taken to be the alternate AYT character.

echo
This is the value (initially ^E) that, when in "line-by-line" mode, toggles between doing local echoing of entered characters and suppressing echoing of entered characters.

eof
If telnet is operating in LINEMODE or in the old "line-by-line" mode, entering this character as the first character on a line will cause the character to be sent to the remote system.

erase
If telnet is in LOCALCHARS mode and operating in the "character-at-a-time" mode, entering this character will send a Telnet EC sequence to the remote system.

escape
This is the Telnet escape character (initially ^]), which causes entry into the Telnet command mode when connected to a remote system.

flushoutput
If telnet is in LOCALCHARS mode and the flushoutput character is entered, a Telnet AO sequence is sent to the remote host.

forw1
If Telnet is in LOCALCHARS mode, this character is taken to be an alternate end-of-line character.

forw2
If Telnet is in LOCALCHARS mode, this character is taken to be an alternate end-of-line character.

interrupt
If Telnet AO is in LOCALCHARS mode and the interrupt character is entered, a Telnet IP sequence is sent to the remote host.

kill
If Telnet IP is in LOCALCHARS mode and operating in the "character-at-a-time" mode, entering this character causes a Telnet EL sequence to be sent to the remote system.

lnext
If Telnet EL is in LINEMODE or the old "line-by-line" mode, this character is taken to be the terminal's lnext character.

quit
If Telnet EL is in LOCALCHARS mode and the quit character is entered, a Telnet BRK sequence is sent to the remote host.

reprint
If Telnet BRK is in LINEMODE or the old "line-by-line" mode, this character is taken to be the terminal's reprint character.

rlogin
Enable rlogin mode. Same as using the -r command-line option.

start
If the Telnet TOGGLE-FLOW-CONTROL option has been enabled, this character is taken to be the terminal's start character.

stop
If the Telnet TOGGLE-FLOW-CONTROL option has been enabled, this character is taken to be the terminal's stop character.

susp
If Telnet is in LOCALCHARS mode or if the LINEMODE is enabled, the suspend character causes a Telnet SUSP sequence to be sent to the remote host.

tracefile
This is the file to which output generated by netdata is written.

worderase
If Telnet BRK is in LINEMODE or the old "line-by-line" mode, this character is taken to be the terminal's worderase character. Defaults for these are the terminal's defaults.

slc [state]
Set state of special characters when Telnet LINEMODE option has been enabled.

?
List help on the slc command.

check
Verify current settings for current special characters. If discrepancies are discovered, convert local settings to match remote ones.

export
Switch to local defaults for special characters.

import
Switch to remote defaults for special characters.

status
Show current status of telnet. This includes the peer you are connected to as well as the current mode.

toggle arguments [...]
Toggle various flags that control how Telnet responds to events. The flags may be set explicitly to true or false using the set and unset commands listed previously. The valid arguments are:

?
Display legal toggle commands.

autoflush
If autoflush and LOCALCHARS are both true, then when the ao or quit characters are recognized, Telnet refuses to display any data on the user's terminal until the remote system acknowledges that it has processed those Telnet sequences.

autosynch
If autosynch and LOCALCHARS are both true, then when the intr or quit character is entered, the resulting Telnet sequence sent is followed by the Telnet SYNCH sequence. Initial value for this toggle is false.

binary
Enable or disable the Telnet BINARY option on both the input and the output.

inbinary
Enable or disable the Telnet BINARY option on the input.

outbinary
Enable or disable the Telnet BINARY option on the output.

crlf
If this toggle value is true, carriage returns are sent as CR-LF. If false, carriage returns are sent as CR-NUL. Initial value is false.

crmod
Toggle carriage return mode. Initial value is false.

debug
Toggle socket-level debugging mode. Initial value is false.

localchars
If the value is true, flush, interrupt, quit, erase, and kill characters are recognized locally, then transformed into appropriate Telnet control sequences. Initial value is true.

netdata
Toggle display of all network data. Initial value is false.

options
Toggle display of some internal telnet protocol processing that pertains to Telnet options. Initial value is false.

prettydump
When netdata and prettydump are enabled, the output from the netdata command is reorganized into a more user-friendly format, spaces are put between each character in the output, and an asterisk precedes any Telnet escape sequence.

skiprc
Toggle whether to process ~/.telnetrc file. Initial value is false, meaning the file is processed.

termdata
Toggle printing of hexadecimal terminal data. Initial value is false.

z
Suspend telnet; works only for tcsh.

telnetd

telnetd [options]

TCP/IP command. Telnet protocol server. telnetd is invoked by the Internet server for requests to connect to the Telnet port (port 23 by default). telnetd allocates a pseudo-terminal device for a client, thereby creating a login process that has the slave side of the pseudo-terminal serving as stdin, stdout, and stderr. telnetd manipulates the master side of the pseudo-terminal by implementing the Telnet protocol and by passing characters between the remote client and the login process.

The Telnet protocol is often criticized because it uses no encryption and makes it easy for snoopers to pick up user passwords. Most sites now use ssh instead.

Options

-a type
When compiled with authentication support, this option sets the authentication type. Accepted values are:

debug
Debug authentication code.

user
Allow only authenticated remote users with permission to access their accounts without giving a password.

valid
Allow only authenticated remote users. Use login for any additional verification needed to access an account.

none
No authentication required, but accept it if offered. Use login for any further verification needed to access an account.

off
Disable authentication.

-debug [port]
Start telnetd manually instead of through inetd. port may be specified as an alternate TCP port number on which to run telnetd.

-D modifier(s)
Debugging mode. This allows telnet to print out debugging information to the connection, enabling the user to see what telnet is doing. Several modifiers are available for the debugging mode:

netdata
Display data stream received by telnetd.

options
Print information about the negotiation of the Telnet options.

ptydata
Display data written to the pseudo-terminal device.

report
Print options information, as well as some additional information about what processing is going on.

-edebug
When compiled with support for encryption, enable encryption debugging code.

-h
Don't print host-specific information until after login is complete.

-L command
Use command for login instead of /bin/login.

-n
Disable checking for lost connections with TCP keep-alives.

-X type
Disable authentication type.

test

test expression 
[expression]

Evaluate an expression and, if its value is true, return a zero exit status; otherwise, return a nonzero exit status. In shell scripts, you can use the alternate form [expression]. This command is generally used with conditional constructs in shell programs. Also exists as a built-in in most shells.

File testers

The syntax for all of these options is test option file. If the specified file does not exist, they return false. Otherwise, they test the file as specified in the option description.

-b
Is the file block special?

-c
Is the file character special?

-d
Is the file a directory?

-e
Does the file exist?

-f
Is the file a regular file?

-g
Does the file have the set-group-ID bit set?

-k
Does the file have the sticky bit set?

-L
Is the file a symbolic link?

-p
Is the file a named pipe?

-r
Is the file readable by the current user?

-s
Is the file nonempty?

-S
Is the file a socket?

-t [file-descriptor]
Is the file associated with file-descriptor (or 1, standard output, by default) connected to a terminal?

-u
Does the file have the set-user-ID bit set?

-w
Is the file writable by the current user?

-x
Is the file executable?

-O
Is the file owned by the process's effective user ID?

-G
Is the file owned by the process's effective group ID?

File comparisons

The syntax for file comparisons is test file1 option file2. A string by itself, without options, returns true if it's at least one character long.

-nt
Is file1 newer than file2? Check modification date, not creation date.

-ot
Is file1 older than file2? Check modification date, not creation date.

-ef
Do the files have identical device and inode numbers?

String tests

The syntax for string tests is test option string or test string1 [!]= string2.

-z
Is the string 0 characters long?

-n
Is the string at least 1 character long?

string1 = string2
Are the two strings equal?

string1 != string2
Are the strings unequal?

Expression tests

Note that an expression can consist of any of the previous tests.

! expression
Is the expression false?

expression -a expression
Are the expressions both true?

expression -o expression
Is either expression true?

Integer tests

The syntax for integer tests is test integer1 option integer2. You may substitute -l string for an integer; this evaluates to string's length.

-eq
Are the two integers equal?

-ne
Are the two integers unequal?

-lt
Is integer1 less than integer2?

-le
Is integer1 less than or equal to integer2?

-gt
Is integer1 greater than integer2?

-ge
Is integer1 greater than or equal to integer2?

tftp

tftp [options] [host [port]]

User interface to TFTP (IPv4 Trivial File Transfer Protocol), which allows users to transfer files to and from a remote machine. The remote host may be specified, and optionally the port, in which case tftp uses host as the default host for future transfers. The version of tftp described here is tftp-hpa.

Options

-v
Verbose mode.

-V
Print version and configuration information and exit.

Commands

Once tftp is running, it issues the prompt:

tftp>

and recognizes the following commands:

? [command...]
help [command...]
Print help information. If no command is specified, list the commands and a brief usage message. With a command, list the usage message for that command.

ascii
Shorthand for mode ascii.

binary
Shorthand for mode binary.

connect hostname [port]
Set the hostname, and optionally the port, for transfers.

get filename
get remotename localname
get filename1 filename2 filename3...filenameN
Get a file or set of files from the specified remote sources. The filename can be specified as host:filename to set both host and filename at the same time. In that case, the last host specified becomes the default for future file transfers.

mode transfer-mode
Set the mode for transfers. transfer-mode may be ascii, netascii, binary, octet, or image. The default is ascii.

put filename
put localfile remotefile
put filename1 filename2...filenameN remote-directory
Transfer a file or set of files to the specified remote file or directory. The destination can be specified as host:filename to set both host and filename at the same time. In that case, the last host specified becomes the default for future file transfers. If remote-directory is specified, the remote host is assumed to be a Unix-style system that uses / as the directory path separator.

quit
Exit tftp.

rexmt retransmission-timeout
Set the per-packet retransmission timeout, in seconds.

status
Print status information: whether tftp is connected to a remote host (i.e., whether a host has been specified for the next connection), the current mode, whether verbose and tracing modes are on, and the values for retransmission timeout and total transmission timeout.

timeout total-transmission-timeout
Set the total transmission timeout, in seconds.

trace
Toggle packet tracing.

verbose
Toggle verbose mode.

tftpd

in.tftpd [options] [directories]

TCP/IP command. IPv4 Trivial File Transfer Protocol server. in.tftpd is normally started by inetd and operates at the port indicated in the tftp Internet service description in /etc/services. Only publicly readable files may be accessed. By default, only files that already exist and are publicly writable can be written. In addition, if any directories are specified, access is restricted to files in those directories. The version of tftp described here is tftp-hpa.

Options

-a [address][:port]
Specify the address and port to listen to when run in standalone mode with -l. By default, use the address and port in /etc/services.

-c
Allow new files to be written. The default permissions allow anyone to read and write the files. Use -p or -U to set other permissions.

-l
Run tftpd in standalone mode, not from inetd. This mode ignores -t.

-m remap-file
Remap filenames based on rules specified in remap-file. Each line in the file contains an operation, an egrep-style regular expression (regex), and optionally a replacement pattern. If the regex matches any part of a filename, the operation is performed. The operation is specified as any of the letters shown in the next section, alone or in combination. Comment lines begin with #.

-p
Use only normal system access controls for the user specified with -u (the tftpd username).

-r option
Never accept the specified RFC 2347 option (see the later section "Standards"). The possible options are blksize, blksize2 (not based on a standard; like blksize but the blocksize must be a power of 2), tsize (transfer size), and timeout.

-s
On startup, change root directory to the directory specified as directory on the command line. With -s, only one directory should be specified. Recommended for security and compatibility with certain boot ROMs.

-t timeout
When run from inetd, specify how long, in seconds, to wait for another connection before timing out and terminating the server. Default timeout is 900 (15 minutes). If server is terminated, inetd spawns a new server on receiving a new request.

-u username
Specify the name of the tftpd user. The default user is nobody.

-U umask
Set the umask for newly created files. Without -p, the default is 0. With -p, it is inherited from the calling process.

-v
Increase verbosity. Specify multiple times for greater verbosity.

-V
Print version and configuration information and exit.

Filename remapping rules

a
If this rule matches, refuse the request and send an "access denied" error to the client.

e
If this rule matches, execute it and then end rule processing.

g
Repeat the rule until it no longer matches. Used with r.

G
Apply this rule to GET (RRQ) requests only.

i
Use case-insensitive regex matching. The default is for case-sensitive matching.

P
Apply this rule to PUT (WRQ) requests only.

r
Replace the matching substring with the replacement pattern.

s
If this rule matches, execute it and then restart rule processing with the first rule.

The replacement pattern can include the following escape sequences:

\0
The entire string matching the regex.

\1...\9
The strings matched by each of the first nine substrings in the regex.

\i
The IP address of the requesting host, in dotted-quad notation.

\x
The IP address of the requesting host, in hexadecimal notation.

\\
Literal backslash.

\whitespace
Literal whitespace.

\#
Literal hash mark.

Standards

  • RFC 1123, Requirements for Internet Hosts--Application and Support

  • RFC 1350, The TFTP Protocol (Revision 2)

  • RFC 2347, TFTP Option Extension

  • RFC 2348, TFTP Blocksize Option

  • RFC 2349, TFTP Timeout Interval and Transfer Size Options

time

time [options] command [arguments]

Run the specified command, passing it any arguments, and time the execution. Note that there is also a shell time command, so you might need to specify the full path, usually /usr/bin/time, to run this version of time. time displays its results on standard error. The output includes elapsed time, user CPU time, system CPU time, and other information such as memory used and number of I/Os. The output can be formatted using printf format strings specified with the -f option or the TIME environment variable.

Options

--
The end of the options. Anything after the -- is the command or one of its arguments.

-a, --append
Used with -o to append the output to file instead of overwriting it.

-f format, --format=format
Specify the output format. Overrides any format specified in the TIME environment variable.

--help
Print help message and exit.

-o file, --output=file
Send the output from time to the specified file instead of to standard error. If file exists, it is overwritten.

-p, --portability
Use portable output format (POSIX).

-v, --verbose
Give verbose output, providing all available information.

-V, --version
Print version information and exit.

Resources

The following resources can be specified in format strings:

c
Number of involuntary context switches because of time slice expiring.

C
Name and arguments of command being timed.

D
Average size of unshared data area, in kilobytes.

e
Elapsed real time, in seconds.

E
Elapsed real time as hours:minutes:seconds.

F
Number of major (I/O-requiring) page faults.

I
Number of filesystem inputs.

k
Number of signals delivered to the process.

K
Average total (data+stack+text) memory use, in kilobytes.

M
Maximum resident set size, in kilobytes.

O
Number of filesystem outputs.

p
Average unshared stack size, in kilobytes.

P
Percent of CPU used.

r
Number of socket messages received.

R
Number of minor (recoverable) page faults.

s
Number of socket messages received.

S
Total CPU seconds used by the system on behalf of the process.

t
Average resident set size, in kilobytes.

U
Total CPU seconds used directly by the process.

w
Number of voluntary context switches.

W
Number of times the process was swapped out of main memory.

x
Exit status of the command.

X
Average shared text size, in kilobytes.

Z
System page size, in bytes.

Example

Time the execution of the command ls -l and display the user time, system time, and exit status of the command:

/usr/bin/time -f "\t%U user,\t%S system,\t%x status" ls -Fs
top

top [options]

Provide information (frequently refreshed) about the most CPU-intensive processes currently running. You do not need to include a - before options. See ps for explanations of the field descriptors.

Options

-b
Run in batch mode; don't accept command-line input. Useful for sending output to another command or to a file.

-c
Show command line in display instead of just command name.

-C
For SMP systems, display total CPU information in addition to information for the individual CPUs.

-d delay
Specify delay between refreshes.

-h
Print a help message and exit.

-i
Suppress display of idle and zombie processes.

-n num
Update display num times, then exit.

-p pid
Monitor only processes with the specified process ID.

-q
Refresh without any delay. If user is privileged, run with highest priority.

-s
Secure mode. Disable some (dangerous) interactive commands.

-S
Cumulative mode. Print total CPU time of each process, including dead child processes.

-v
Print version information and exit.

Interactive commands

space
Update display immediately.

c
Toggle display of command name or full command line.

f, F
Add fields to or remove fields from the display.

h, ?
Display help about commands and the status of secure and cumulative modes.

H
Prompt for a process ID and show all threads for that process.

k
Prompt for process ID to kill and signal to send (default is 15) to kill it.

i
Toggle suppression of idle and zombie processes.

l
Toggle display of load average and uptime information.

m
Toggle display of memory information.

n, #
Prompt for number of processes to show. If 0 is entered, show as many as will fit on the screen (default).

o, O
Change order of displayed fields.

q
Exit.

r
Apply renice to a process. Prompt for PID and renice value. Suppressed in secure mode.

s
Change delay between refreshes. Prompt for new delay time, which should be in seconds. Suppressed in secure mode.

t
Toggle display of processes and CPU states lines.

A
Sort by age, with newest first.

^L
Redraw screen.

M
Sort tasks by resident memory usage.

N
Sort numerically by process ID.

P
Sort tasks by CPU usage (default).

S
Toggle cumulative mode. (See the -S option.)

T
Sort tasks by time/cumulative time.

W
Write current setup to ~/.toprc. This is the recommended way to write a top configuration file.

Field descriptions

The first five entries in the following list describe the lines that appear at the top of the top display. The rest are the fields that can be displayed for each task (sizes are in kilobytes). Use the interactive f command to add or remove fields.

uptime
Display the time the system has been up, and three load averages consisting of the average number of processes ready to run in the last 1, 5, and 15 minutes.

processes
The total number of processes running when the last update was taken, shown as the number of running, sleeping, stopped, or undead tasks.

CPU states
The percentage of CPU time spent in user mode, in system mode, on tasks with a negative nice value, and idle.

Mem
Memory statistics, including total available memory, free memory, memory used, shared memory, and memory used for buffers.

Swap
Swap-space statistics, including total, available, and used.

PID
Process ID.

PPID
Parent process ID.

UID
User ID of task's owner.

USER
Username of task's owner.

PRI
Priority.

NI
Nice value.

PAGEIN
Page fault count.

SIZE
Total size of the task's code, data, and stack space.

TSIZE
Code size.

DSIZE
Data plus stack size.

TRS
Resident text size.

SWAP
Size of swapped-out portion of task.

D
Size of pages marked dirty.

LC
Last-used processor, for multiprocessor systems.

RSS
Total amount of physical memory used.

SHARE
Amount of shared memory used.

STAT
State of the task. Values are S (sleeping), D (uninterruptible sleep), R (running), Z (zombies), or T (stopped or traced), possibly followed by < (negative nice value), N (positive nice value), or W (swapped out).

WCHAN
Address or name of the kernel function in which the task is currently sleeping.

TIME
Total CPU time used by task and any children.

%CPU
Share of CPU time since last update, as percentage of total CPU time.

%MEM
Share of physical memory.

TTY
Controlling tty.

COMMAND
Command line (truncated if too long) if task is in memory, or command name in parentheses if swapped out.

FLAGS
Task flags.

tr

tr [options] [string1 [string2]]

Translate characters. Copy standard input to standard output, substituting characters from string1 to string2 or deleting characters in string1.

Options

-c, --complement
Complement characters in string1 with respect to ASCII 001-377.

-d, --delete
Delete characters in string1 from output.

-s, --squeeze-repeats
Squeeze out repeated output characters in string2.

-t, --truncate-set1
Truncate string1 to the length of string2 before translating.

--help
Print help message and then exit.

--version
Print the version number and then exit.

Special characters

Include brackets ([ ]) where shown.

\a
^G (bell)

\b
^H (backspace)

\f
^L (form feed)

\n
^J (newline)

\r
^M (carriage return)

\t
^I (tab)

\v
^K (vertical tab)

\nnn
Character with octal value nnn

\\
Literal backslash

char1-char2
All characters in the range char1 through char2. If char1 does not sort before char2, produce an error.

[char*]
In string2, expand char to the length of string1.

[char*number]
Expand char to number occurrences. [x*4] expands to xxxx, for instance.

[:class:]
Expand to all characters in class, where class can be:

alnum
Letters and digits

alpha
Letters

blank
Whitespace

cntrl
Control characters

digit
Digits

graph
Printable characters except space

lower
Lowercase letters

print
Printable characters

punct
Punctuation

space
Whitespace (horizontal or vertical)

upper
Uppercase letters

xdigit
Hexadecimal digits

[=char=]
The class of characters to which char belongs.

Examples

Change uppercase to lowercase in a file:

cat file | tr 'A-Z' 'a-z'

Turn spaces into newlines (ASCII code 012):

tr ' ' '
' < file

Strip blank lines from file and save in new.file (or use 011 to change successive tabs into one tab):

cat file | tr -s "" "
" > new.file

Delete colons from file and save result in new.file:

tr -d : < file > new.file
traceroute

traceroute [options] host [packetsize]

TCP/IP command. Trace route taken by packets to reach network host. traceroute attempts tracing by launching UDP probe packets with a small TTL (time-to-live), then listening for an ICMP "time exceeded" reply from a gateway. host is the destination hostname or the IP number of the host to reach. packetsize is the packet size in bytes of the probe datagram. Default is 40 bytes.

Options

-d
Turn on socket-level debugging.

-g addr
Enable the IP LSRR (Loose Source Record Route) option in addition to the TTL tests, to ask how someone at IP address addr can reach a particular target.

-i interface
Specify the network interface for getting the source IP address for outgoing probe packets. Useful with a multi-homed host. Also see the -s option.

-I
Use ICMP ECHO requests instead of UDP datagrams.

-m max_ttl
Set maximum time-to-live used in outgoing probe packets to max-ttl hops. Default is 30.

-n
Show numerical addresses; do not look up hostnames. (Useful if DNS is not functioning properly.)

-p port
Set base UDP port number used for probe packets to port. Default is (decimal) 33434.

-q n
Set number of probe packets for each time-to-live setting to the value n. Default is 3.

-r
Bypass normal routing tables and send directly to a host on an attached network.

-s src_addr
Use src_addr as the IP address that will serve as the source address in outgoing probe packets.

-t tos
Set the type-of-service in probe packets to tos (default 0). The value must be a decimal integer in the range 0 to 255.

-v
Verbose; received ICMP packets (other than TIME_EXCEEDED and PORT_UNREACHABLE) will be listed.

-w wait
Set time to wait for a response to an outgoing probe packet to wait seconds (default is 5).

-x
Toggle IP checksums, usually to turn them off. IP checksums are always calculated if -I is specified.

-z msecs
Set the delay between probes, in milliseconds. The default is 0.

tune2fs

tune2fs [options] device

System administration command. Tune the parameters of a Linux Second Extended Filesystem by adjusting various parameters. You must specify the device on which the filesystem resides; it must not be mounted read/write when you change its parameters.

Options

-c max-mount-counts
Specify the maximum number of mount counts between two checks on the filesystem.

-C mount-count
Specify the mount count. For use with -c to force a check the next time the system boots.

-e behavior
Specify the kernel's behavior when encountering errors. behavior must be one of:

continue
Continue as usual.

remount-ro
Remount the offending filesystem in read-only mode.

panic
Cause a kernel panic.

-f
Force completion even if there are errors.

-g group
Allow group (a group ID or name) to use reserved blocks.

-i interval[d|w|m]
Specify the maximum interval between filesystem checks. Units may be in days (d), weeks (w), or months (m). If interval is 0, checking will not be time-dependent.

-j
Add an ext3 journal to the filesystem. If specified without -J, use the default journal parameters.

-J jrnl-options
Specify ext3 journal parameters as a comma-separated list of option=value pairs. The specified options override the default values. Only one size or device option can be specified for a filesystem. Possible options are:

device=ext-jrnl
Attach to the journal block device on ext-jrnl, which must exist and must have the same blocksize as the filesystem to be journaled. ext-jrnl can be specified by its device name, by the volume label (LABEL=label), or by the Universal Unique Identifier (UUID) stored in the journal's ext2 superblock (UUID=uuid; see uuidgen). Create the external journal with:

     mke2fs -O jrnl-dev ext-jrnl
size=jrnl-size
The size of the journal in megabytes. The size must be at least equivalent to 1024 blocks and not more than 102,400 blocks.

-l
Display a list of the superblock's contents.

-L label
Specify the volume label of filesystem. The label must be no more than 16 characters.

-m percentage
Specify the percentage of blocks that will be reserved for use by privileged users.

-M dir
Specify the filesystem's last-mounted directory.

-O option
Set or clear the specified filesystem options in the filesystem's superblock. Specify multiple options as a comma-separated list. Prefixing an option with a caret (^) clears the option. No prefix or a plus sign (+) causes the option to be set. Run e2fsck after changing filetype or sparse_super. The following options can be cleared or set:

filetype
Save file type information in directory entries.

has_journal
Create an ext3 journal. Same as the -j option.

sparse_super
Save space on large filesystems by limiting the number of backup superblocks. Same as -s.

-r num
Specify the number of blocks that will be reserved for use by privileged users.

-s [0|1]
Turn the sparse superblock feature on or off. Run e2fsck after changing this feature.

-T time
Set the time e2fsck was last run. The time specification is international date format, with the time optional; i.e., YYYYMMDD[[HHMM]SS]. If time is specified as time-last-checked, the current time is used.

-u user
Allow user (a user ID or name) to use reserved blocks.

-U uuid
Set the UUID of the filesystem to a UUID generated by uuidgen or to one of the following:

clear
Clear the existing UUID.

random
Randomly generate a new UUID.

time
Generate a new time-based UUID.

umount

umount [options] [directory|special-device]

System administration command. Unmount a filesystem. umount announces to the system that the removable file structure previously mounted on the specified directory is to be removed. umount also accepts the special-device to indicate the filesystem to be unmounted; however, this usage is obsolete and will fail if the device is mounted on more than one directory. Any pending I/O for the filesystem is completed, and the file structure is flagged as clean. A busy filesystem cannot be unmounted.

Options

-a
Unmount all filesystems that are listed in /etc/mtab.

-d
If the unmounted device was a loop device, free the loop device too. See also the losetup command.

-f
Force the unmount. This option requires kernel 2.1.116 or later.

-h
Print help message and exit.

-l
Lazy unmount. Detach the filesystem from the hierarchy immediately, but don't clean up references until it is no longer busy. Requires kernel 2.4.11 or later.

-n
Unmount, but do not record changes in /etc/mtab.

-O options
Unmount only filesystems with the specified options in /etc/fstab. Specify multiple options as a comma-separated list. Add no as a prefix to an option to indicate filesystems that should not be unmounted.

-r
If unmounting fails, try to remount read-only.

-t type
Unmount only filesystems of type type. Multiple types can be specified as a comma-separated list, and any type can be prefixed with no to specify that filesystems of that type should not be unmounted.

-v
Verbose mode.

-V
Print version information and exit.

update

update [options]

System administration command. update is a daemon that controls how often the kernel's disk buffers are flushed to disk. update is also known as bdflush. The daemon forks a couple of processes to call system functions flush( ) and sync( ). When called by an unprivileged user, no daemon is created. Instead, update calls sync( ) and then exits. By default, update will wake up every 5 seconds and flush( ) some dirty buffers. If that doesn't work, it will try waking up every 30 seconds to sync( ) the buffers to disk. Not all of the listed options are available in every version of update.

Options

-d
Display the kernel parameters. This does not start the update daemon.

-f seconds
Call flush( ) at this interval. Default is 5.

-h
Help. Print a command summary.

-s seconds
Call sync( ) at this interval. Default is 30.

-0 percent
Flush buffers when the specified percent of the buffer cache is dirty.

-1 blocks
The maximum number of dirty blocks to write out per wake cycle.

-2 buffers
The number of clean buffers to try to obtain each time the free buffers are refilled.

-3 blocks
Flush buffers if dirty blocks exceed blocks when trying to refill the buffers.

-4 percent
Percent of buffer cache to scan when looking for free clusters.

-5 seconds
Time for a data buffer to age before being flushed.

-6 seconds
Time for a nondata buffer to age before being flushed.

-7 constant
The time constant to use for load average.

-8 ratio
How low the load average can be before trimming back the number of buffers.

useradd

useradd [options] [user]

System administration command. Create new user accounts or update default account information. Unless invoked with the -D option, user must be given. useradd will create new entries in system files. Home directories and initial files may also be created as needed.

Options

-c comment
Comment field.

-d dir
Home directory. The default is to use user as the directory name under the home directory specified with the -D option.

-e date
Account expiration date. date is in the format MM/DD/YYYY. Two-digit year fields are also accepted. The value is stored as the number of days since January 1, 1970. This option requires the use of shadow passwords.

-f days
Permanently disable account this many days after the password has expired. A value of -1 disables this feature. This option requires the use of shadow passwords.

-g group
Initial group name or ID number. If a different default group has not been specified using the -D option, the default group is 1.

-G groups
Supplementary groups given by name or number in a comma-separated list with no whitespace.

-k [dir]
Copy default files to the user's home directory. Meaningful only when used with the -m option. Default files are copied from /etc/skel/ unless an alternate dir is specified.

-m
Make user's home directory if it does not exist. The default is not to make the home directory.

-M
Do not create a home directory for the user, even if the system default in /etc/login.defs is to create one.

-n
Red Hat-specific option. Turn off the Red Hat default that creates a group with the same name as the username and puts the user in that group.

-o
Override. Accept a nonunique uid with the -u option. (Probably a bad idea.)

-p passwd
The encrypted password, as returned by crypt(3).

-r
Red Hat-specific option. Create a system account with a non-expiring password and a UID lower than the minimum defined in /etc/login.defs. Do not create a home directory for the account unless -m is also specified.

-s shell
Login shell.

-u uid
Numerical user ID. The value must be unique unless the -o option is used. The default value is the smallest ID value greater than 99 and greater than every other uid.

-D [options]
Set or display defaults. If options are specified, set them. If no options are specified, display current defaults. The options are:

-b dir
Home directory prefix to be used in creating home directories. If the -d option is not used when creating an account, the user name will be appended to dir.

-e date
Expire date. Requires the use of shadow passwords.

-f days
Number of days after a password expires to disable an account. Requires the use of shadow passwords.

-g group
Initial group name or ID number.

-s shell
Default login shell.

usermod

usermod [options] user

System administration command. Modify user account information.

Options

-c comment
Comment field.

-d dir
Home directory.

-e date
Account expiration date. date is in the format MM/DD/YYYY; two-digit year fields are also accepted. The value is stored as the number of days since January 1, 1970. This option requires the use of shadow passwords.

-f days
Permanently disable account this many days after the password has expired. A value of -1 disables this feature. This option requires the use of shadow passwords.

-g group
Initial group name or number.

-G groups
Supplementary groups given by name or number in a comma-separated list with no whitespace. user will be removed from any groups to which it currently belongs that are not included in groups.

-l name
Login name. This cannot be changed while the user is logged in.

-L
Lock user's password by putting a ! in front of it. This option cannot be used with -p or -U.

-o
Override. Accept a nonunique uid with the -u option.

-p pw
Encrypted password, as returned from crypt(3).

-s shell
Login shell.

-u uid
Numerical user ID. The value must be unique unless the -o option is used. Any files owned by user in the user's home directory will have their user ID changed automatically. Files outside of the home directory will not be changed. user should not be executing any processes while this is changed.

-U
Unlock the user's password by removing the ! that -L put in front of it. This option cannot be used with -p or -L.

vacation

vacationvacation [options] [user]

Automatically return a mail message to the sender announcing that you are on vacation.

Use vacation with no options to initialize the vacation mechanism. The process performs several steps.

  1. Creates a .forward file in your home directory. The .forward file contains:

    \user, "|/usr/bin/vacation user"

    user is your login name. The action of this file is to actually deliver the mail to user (i.e., you) and to run the incoming mail through vacation.

  2. Creates the .vacation.pag and .vacation.dir files. These files keep track of who has sent you messages so that they receive only one "I'm on vacation" message from you per week.

  3. Starts an editor to edit the contents of .vacation.msg. The contents of this file are mailed back to whomever sends you mail. Within its body, $subject is replaced with the contents of the incoming message's Subject line.

Remove or rename the .forward file to disable vacation processing.

Options

The -a and -r options are used within a .forward file; see the example.

-a alias
Mail addressed to alias is actually mail for the user and should produce an automatic reply.

-i
Reinitialize the .vacation.pag and .vacation.dir files. Use this right before leaving for your next vacation.

-r interval
By default, no more than one message per week is sent to any sender; this option changes that interval. interval is a number with a trailing s, m, h, d, or w indicating seconds, minutes, hours, days, or weeks, respectively. If interval is infinite, only one reply is sent to each sender.

Example

Send no more than one reply every three weeks to any given sender:

$ cd
$ vacation -I
$ cat .forward
\jp, "|/usr/bin/vacation -r3w jp"
$ cat .vacation.msg
From: jp@wizard-corp.com (J. Programmer, via the vacation program)
Subject: I'm out of the office ...

Hi. I'm off on a well-deserved vacation after finishing
up whizprog 1.0. I will read and reply to your mail
regarding "$SUBJECT" when I return.

Have a nice day.
which

which [options] [--] [commands]

List the full pathnames of the files that would be executed if the named commands had been run. which searches the user's $PATH environment variable. tcsh has a built-in which command that has no options. To use the options with tcsh, specify the full pathname (e.g., /usr/bin/which).

Options

-a, --all
Print all matches, not just the first.

-i, --read-alias
Read aliases from standard input and write matches to standard output. Useful for using an alias for which.

--read-functions
Read shell functions from standard input and report matches to standard output. Useful for also using a shell function for which itself.

--skip-alias
Ignore --read-alias if present. Useful for finding normal binaries while using --read-alias in an alias for which.

--skip-dot
Skip directories that start with a dot.

--skip-functions
Ignore --read-functions if present. Useful when searching for normal binaries while using --read-functions in an alias or function for which.

--skip-tilde
Skip directories that start with a tilde (~) and executables in $HOME.

--show-dot
If a matching command is found in a directory that starts with a dot, print ./cmdname instead of the full pathname.

--show-tilde
Print a tilde (~) to indicate the user's home directory. Ignored if the user is root.

--tty-only
Stop processing options on the right if not on a terminal.

-v, -V, --version
Print version information and then exit.

--help
Print help information and then exit.

Example

 which cc ls
/usr/bin/cc
ls:      aliased to ls -sFC
xargs

xargs [options] [command]

Execute command (with any initial arguments), but read remaining arguments from standard input instead of specifying them directly. xargs passes these arguments in several bundles to command, allowing command to process more arguments than it could normally handle at once. The arguments are typically a long list of filenames (generated by ls or find, for example) that get passed to xargs via a pipe.

Options

-0, --null
Expect filenames to be terminated by NULL instead of whitespace. Do not treat quotes or backslashes specially.

-e[string], --eof[=string]
Set EOF to _ or, if specified, to string.

--help
Print a summary of the options to xargs and then exit.

-i[string], --replace[=string]
Edit all occurrences of { }, or string, to the names read in on standard input. Unquoted blanks are not considered argument terminators. Implies -x and -l 1.

-l[lines], --max-lines[=lines]
Allow no more than lines nonblank input lines on the command line (default is 1). Implies -x.

-n args, --max-args=args
Allow no more than args arguments on the command line. May be overridden by -s.

-p, --interactive
Prompt for confirmation before running each command line. Implies -t.

-P max, --max-procs=max
Allow no more than max processes to run at once. The default is 1. A maximum of 0 allows as many as possible to run at once.

-r, --no-run-if-empty
Do not run command if standard input contains only blanks.

-s max, --max-chars=max
Allow no more than max characters per command line.

-t, --verbose
Verbose mode. Print command line on standard error before executing.

-x, --exit
If the maximum size (as specified by -s) is exceeded, exit.

--version
Print the version number of xargs and then exit.

Examples

grep for pattern in all files on the system:

find / -print | xargs grep pattern > out &

Run diff on file pairs (e.g., f1.a and f1.b, f2.a and f2.b, etc.):

echo $* | xargs -n2 diff

The previous line would be invoked as a shell script, specifying filenames as arguments. Display file, one word per line (same as deroff -w):

cat file | xargs -n1

Move files in olddir to newdir, showing each command:

ls olddir | xargs -i -t mv olddir/{  } newdir/{  }
xinetd

xinetd [options]

TCP/IP command. The extended Internet services daemon. (On some systems this replaces inetd.) Similar to inetd, xinetd saves system resources by listening to multiple sockets on the behalf of other server programs, invoking necessary programs as requests are made for their services. Beyond this, xinetd provides better logging facilities, including remote user ID, access times, and server-specific information. It also provides access control facilities. Not limited to system administration use, it can launch services that are not listed in /etc/services. Unprivileged users can use this tool to start their own servers.

Options

-cc num
Perform an internal state consistency check every num seconds.

-d
Turn on debugging support.

-f file
Read configuration from the specified file instead of /etc/xinetd.conf.

-filelog file
Write log messages to the specified file. Cannot be combined with -syslog or -debug.

-limit num
Start no more than num concurrent processes.

-logprocs num
Limit processes used to look up remote user IDs to num.

-p file
Write xinetd's process ID to file.

-stayalive
Keep running even when no services have been specified.

-syslog facility
Log messages to the specified syslogd facility. Accepted values are daemon, auth, user, and localn, where n can range from 0 to 7. Cannot be combined with -syslog or -debug. The default behavior is to write messages to syslogd using the daemon facility.

Configuration files

By default xinetd reads its configuration information from file /etc/xinetd.conf. Lines in this file beginning with # are treated as comments. The entries for each service differ completely from /etc/inetd entries. xinetd configuration entries for services follow the pattern:

service servicename
{
    attribute1 = valueset1
    attribute2 = valueset2
}

Some attributes allow assignment operators other than =. Other operators are +=, to add to a value set, and -=, to remove a value from a value set. There are many attributes available to control services; the following are the most common:

deny_time
Set the time in minutes to deny access to an address that sets off a SENSOR. Other accepted values are NEVER and FOREVER. See the flags attribute.

disable
Accept a Boolean yes or no. When disabled, xinetd will ignore the entry.

flags
Accept a set of the following values defining xinetd's behavior:

IDONLY
Accept only connections when the remote user's ID can be verified by an identification server. Cannot be used with USERID logging.

INTERCEPT
Intercept packets to ensure they are coming from allowed locations. Cannot be used with internal or multithreaded services.

IPv4
Service is an IPv4 service.

IPv6
Service is an IPv6 service.

KEEPALIVE
Set flag on socket, enabling periodic checks to determine if the line is still receiving data.

NAMEINARGS
Expect the first argument for the server_args attribute to be the command to run. This flag is necessary to wrap services with tcpd.

NODELAY
Set socket's NODELAY flag.

NOLIBWRAP
Don't use xinetd's internal TCP wrapping facilities.

NORETRY
If service fails to fork, don't try to fork again.

SENSOR
Instead of launching a service, add IP addresses that attempt to access this service to a list of denied addresses for a time specified by the deny_time attribute.

group
Specify a group ID for the server process. This may be used only when xinetd runs as root.

nice
Set service priority. This attribute accepts the same values as the renice command.

id
Specify a unique identifier for the service. Useful when creating multiple entries with the servicename. For example, two versions of the echo service, one supporting UDP and the other TCP, might be given the identifiers echo-stream and echo-dgram.

log_on_failure
Specify values to log when a server cannot be started. Accepted values are HOST, USERID, or just ATTEMPT.

log_on_success
Specify values to log when a server is started. Accepted values are PID, HOST, USERID, EXIT, and DURATION.

no_access
Specify hosts that should not be allowed access to a service. May be given as an IP address, a netmask, a hostname, a network name from /etc/networks, or a group of IP addresses like so: 192.168.1.{10,11,12,15,32}.

only_from
Restrict access to the service to the specified hosts. This attribute accepts the same values as no_access.

port
Specify the service port to listen to. This attribute is required for non-RPC services not listed in /etc/services. If the service is listed, the value of port cannot differ from what is listed.

protocol
Specify protocol to use, usually tcp or udp. The protocol must be listed in /etc/protocols. This attribute is required for RPC services as well as services not found in /etc/services.

rpc_version
The RPC version used by the service. This can be a single number or a range of numbers from x-y. This attribute is required for RPC services.

rpc_number
Specify RPC ID number. This is required only for services not listed in /etc/rpc; otherwise it's ignored.

server
The program to execute for the service. When using tcpd to wrap a service, also set the NAMEINARGS flag and use the server's program name as the first argument for server_args. This attribute is required for all non-internal services.

server_args
Arguments to pass to the server program.

socket_type
Specify the socket type to create. Accepted values are stream, dgram, raw, and seqpacket.

type
Describe the type of service. Accepted values are RPC, INTERNAL, and UNLISTED.

user
Specify a user ID for the server process. This may be used only when xinetd runs as root.

wait
Determine whether services should be treated as single-threaded (yes) and xinetd should wait until the server exits to resume listening for new connections, or multithreaded (no) and xinetd should not wait to resume listening. This attribute is required for all serices.

Files

/etc/xinetd.conf
Default configuration file.

/etc/xinetd.d
Common directory containing configuration files included from /etc/xinetd.conf.

ypbind

ypbind [options]

NFS/NIS command. NIS binder process. ypbind is a daemon process typically activated at system startup time. Its function is to remember information that lets client processes on a single node communicate with some ypserv process. The information ypbind remembers is called a binding--the association of a domain name with the Internet address of the NIS server and the port on that host at which the ypserv process is listening for service requests. This information is cached in the file /var/yp/bindings/domainname.version.

Options

-c
Check configuration file for syntax errors, then exit.

-broadcast
Ignore configuration information in /etc/yp.conf and directly request configuration information from a remote system using ypset.

-broken-server
Allow connections to servers using normally illegal port numbers. Sometimes needed for compatibility with other versions of ypserv.

-f file
Read configuration information, from file instead of /etc/yp.conf.

-no-ping
Don't ping remote servers to make sure they are alive.

--version
Print version information then exit.

-ypset
Allow remote machine to change the local server's bindings. This option is very dangerous and should be used only for debugging the network from a remote machine.

-ypsetme
ypset requests may be issued from this machine only. Security is based on IP address checking, which can be defeated on networks on which untrusted individuals may inject packets. This option is not recommended.

-debug
Run in the foreground process instead of detaching and running as a daemon.

yppasswdd

rpc.yppasswdd [options]

NFS/NIS command. Server for modifying the NIS password file. yppasswdd handles password-change requests from yppasswd. It changes a password entry only if the password represented by yppasswd matches the encrypted password of that entry and if the user ID and group ID match those in the server's /etc/passwd file. Then it updates /etc/passwd and the password maps on the local server. If the server was compiled with the CHECKROOT=1 option, the password is also checked against the root password.

Options

-D dir
Specify a directory that contains the passwd and shadow files for rpc.yppasswdd to use instead of /etc/passwd and /etc/shadow. Useful to prevent all users in the NIS database from automatically gaining access to the NIS server.

-e chsh|chfn]
Permit users to change the shell or user information in the GECOS field of their passwd entry. By default, rpc.yppasswdd does not permit users to change these fields.

-E program
Specify a program to edit the passwd and shadow files instead of rpc.yppasswdd. The program should return 0 for successful completion, 1 for successful completion but the pwupdate program should not be run to update the NIS server's maps, and anything else if the change failed.

-p pwfile
Specify an alternative passwd file to /etc/passwd, to prevent all users in the NIS database from automatically gaining access to the NIS server.

--port num
Specify a port that rpc.yppasswdd will try to register itself, allowing a router to filter packets to the NIS ports.

-s shadowfile
Use shadowfile instead of /etc/passwd for shadow password support.

--version
Print version information and whether the package was compiled with CHECKROOT.

-x program
Modify files using the specified program instead of using internal default functions. rpc.yppasswdd passes information to program in the following format:

username o:oldpassword p:password s:shell g:gcos

Any of the fields p, s, or g may be missing.

yppush

yppush [options] mapnames

NFS/NIS command. Force propagation of changed NIS map. yppush copies a new version of an NIS map, mapname, from the master NIS server to the slave NIS servers. It first constructs a list of NIS server hosts by reading the NIS map ypservers with the -d option's domain argument. Keys within this map are the ASCII names of the machines on which the NIS servers run. A map transfer request is sent to the NIS server at each host, along with the information needed by the transfer agent to call back the yppush. When the attempt has been completed and the transfer agent has sent yppush a status message, the results may be printed to standard error. Normally invoked by /var/yp/Makefile after commenting out the NOPUSH=true line.

Options

-d domain
Specify a domain.

-h host
Specify one or a group of systems to which a map should be transferred instead of using the list of servers in the ypservers map. Multiple -h options can be specified to create a list of hosts.

-p count
Send maps to count NIS slaves simultaneously (in parallel). By default, yppush sends maps to one server at a time (serially).

-t secs
Specify a timeout value in seconds. The timeout determines how long yppush will wait for a response from a slave server before sending a map transfer request to the next server. The default timeout is 90 seconds, but for big maps a longer timeout may be needed.

-v
Verbose; print message when each server is called and for each response. Specify twice to make yppush even more verbose.

zic

zic [options] [files]

System administration command. Create time conversion information files from the file or files specified. If the specified file is -, read information from standard input.

Options

-d directory
Place the newly created files in directory. Default is /usr/local/etc/zoneinfo.

-l timezone
Specify a timezone to use for local time. zic links the zone information for timezone with the zone localtime.

-p timezone
Set the default rules for handling POSIX-format environment variables to the zone name specified by timezone.

-s
Store time values only if they are the same when signed as when unsigned.

-v
Verbose mode. Include extra error checking and warnings.

-y command
Check year types with command. Default is yearistype.

-L file
Consult file for information about leap seconds.

The source files for zic should be formatted as a sequence of rule lines, zone lines, and link lines. An optional file containing leap-second rules can be specified on the command line. Rule lines describe how time should be calculated. They describe changes in time, daylight savings time, and any other changes that might affect a particular time zone. Zone lines specify which rules apply to a given zone. Link lines link similar zones together. Leap lines describe the exact time when leap seconds should be added or subtracted. Each of these lines is made up of fields. Fields are separated from one another by any number of whitespace characters. Comment lines are preceded by #. The fields used in each line are listed in the next section.

Rule line fields

The format of a rule line is:

Rule NAME FROM TO TYPE IN ON AT SAVE LETTERS
NAME
Name this set of rules.

FROM
Specify the first year to which this rule applies. Gregorian calendar dates are assumed. Instead of specifying an actual year, you may specify minimum or maximum for the minimum or maximum year representable as an integer.

TO
Specify the last year to which this rule applies. Syntax is the same as for the FROM field.

TYPE
Specify the type of year to which this rule should be applied. The wildcard - instructs that all years be included. Any given year's type will be checked with the command given with the -y option or the default yearistype year type. An exit status of 0 is taken to mean the year is of the given type; an exit status of 1 means that it is not of the given type (see -y option).

IN
Specify month in which this rule should be applied.

ON
Specify day on which this rule should be applied. Whitespace is not allowed. For example:

1
The 1st.

firstSun
The first Sunday.

Sun>=3
The first Sunday to occur before or on the 3rd.

AT
Specify the time after which the rule is in effect. For example, you may use 13, 13:00, or 13:00:00 for 1:00 p.m. You may include one of several suffixes (without whitespace between):

s
Local standard time.

u, g, z
Universal time.

w
Wall clock time (default).

SAVE
Add this amount of time to the local standard time. Formatted like AT, without suffixes.

LETTERS
Specify letter or letters to be used in time zone abbreviations (for example, S for EST). For no abbreviation, enter -.

Zone line fields

The format of a zone line is:

Zone NAME GMTOFF RULES/SAVE FORMAT [UNTIL]
NAME
Time zone name.

GMTOFF
The amount of hours by which this time zone differs from GMT. Formatted like AT. Negative times are subtracted from GMT; by default, times are added to it.

RULES/SAVE
Either the name of the rule to apply to this zone or the amount of time to add to local standard time. To make the zone the same as local standard time, specify -.

FORMAT
The format of time zone abbreviations. Specify the variable part with %s.

UNTIL
Change the rule for the zone at this date. The next line must specify the new zone information and therefore must omit the string "Zone" and the NAME field.

Link line fields

The format of a link line is:

Link LINK-FROM LINK-TO
LINK-FROM
The name of the zone that is being linked.

LINK-TO
An alternate name for the zone that was specified as LINK-FROM.

Leap line fields

The format of a leap line is:

Leap YEAR MONTH DAY HH:MM:SS CORR R|S
YEAR MONTH DAY HH:MM:SS
Specify when the leap second happened.

CORR
Uses + or - to show whether the second was added or skipped.

R|S
Rolling or Stationary. Describe whether the leap second should be applied to local wall clock time or GMT, respectively.



Library Navigation Links

Copyright © 2003 O'Reilly & Associates. All rights reserved.