These commands read and write entire files, possibly transforming them in some way.
cat
: Concatenate and write files
cat
copies each file (`-' means standard input), or
standard input if none are given, to standard output. Synopsis:
cat [option] [file]...
The program accepts the following options. Also see section Common options.
tac
: Concatenate and write files in reverse
tac
copies each file (`-' means standard input), or
standard input if none are given, to standard output, reversing the
records (lines by default) in each separately. Synopsis:
tac [option]... [file]...
Records are separated by instances of a string (newline by default). By default, this separator string is attached to the end of the record that it follows in the file.
The program accepts the following options. Also see section Common options.
nl
: Number lines and write files
nl
writes each file (`-' means standard input), or
standard input if none are given, to standard output, with line numbers
added to some or all of the lines. Synopsis:
nl [option]... [file]...
nl
decomposes its input into (logical) pages; by default, the
line number is reset to 1 at the top of each logical page. nl
treats all of the input files as a single document; it does not reset
line numbers or logical pages between files.
A logical page consists of three sections: header, body, and footer. Any of the sections can be empty. Each can be numbered in a different style from the others.
The beginnings of the sections of logical pages are indicated in the input file by a line containing exactly one of these delimiter strings:
The two characters from which these strings are made can be changed from `\' and `:' via options (see below), but the pattern and length of each string cannot be changed.
A section delimiter is replaced by an empty line on output. Any text
that comes before the first section delimiter string in the input file
is considered to be part of a body section, so nl
treats a
file that contains no section delimiters as a single body section.
The program accepts the following options. Also see section Common options.
rn
):
od
: Write files in octal or other formats
od
writes an unambiguous representation of each file
(`-' means standard input), or standard input if none are given.
Synopsis:
od [option]... [file]... od -C [file] [[+]offset [[+]label]]
Each line of output consists of the offset in the input, followed by
groups of data from the file. By default, od
prints the offset in
octal, and each group of file data is two bytes of input printed as a
single octal number.
The program accepts the following options. Also see section Common options.
bytes
are interpreted as for the `-j' option.
od
writes one copy
of each output line using each of the data types that you specified,
in the order that you specified.
a
outputs things like `sp' for space, `nl' for
newline, and `nul' for a null (zero) byte. Type c
outputs
` ', `\n', and \0
, respectively.
Except for types `a' and `c', you can specify the number
of bytes to use in interpreting each number in the given data type
by following the type indicator character with a decimal integer.
Alternately, you can specify the size of one of the C compiler's
built-in data types by following the type indicator character with
one of the following characters. For integers (`d', `o',
`u', `x'):
f
):
od
outputs only
the first line, and puts just an asterisk on the following line to
indicate the elision.
n
input bytes per output line. This must be a multiple of
the least common multiple of the sizes associated with the specified
output types. If n is omitted, the default is 32. If this option
is not given at all, the default is 16.
The next several options map the old, pre-POSIX format specification
options to the corresponding POSIX format specs. GNU od
accepts
any combination of old- and new-style options. Format specification
options accumulate.
od
accepted. The following syntax:
od --traditional [file] [[+]offset[.][b] [[+]label[.][b]]]can be used to specify at most one file and optional arguments specifying an offset and a pseudo-start address, label. By default, offset is interpreted as an octal number specifying how many input bytes to skip before formatting and writing. The optional trailing decimal point forces the interpretation of offset as a decimal number. If no decimal is specified and the offset begins with `0x' or `0X' it is interpreted as a hexadecimal number. If there is a trailing `b', the number of bytes skipped will be offset multiplied by 512. The label argument is interpreted just like offset, but it specifies an initial pseudo-address. The pseudo-addresses are displayed in parentheses following any normal address.
Go to the first, previous, next, last section, table of contents.