This manual documents version 4.0 of the GNU file utilities.
This manual is incomplete: No attempt is made to explain basic file concepts in a way suitable for novices. Thus, if you are interested, please get involved in improving this manual. The entire GNU community will benefit.
The GNU file utilities are mostly compatible with the POSIX.2 standard.
Please report bugs to bug-fileutils@gnu.org. Remember to include the version number, machine architecture, input files, and any other information needed to reproduce the bug: your input, what you expected, what you got, and why it is wrong. Diffs are welcome, but please include a description of the problem as well, since this is sometimes difficult to infer. See Bugs.
This manual was originally derived from the Unix man pages in the distribution, which were written by David MacKenzie and updated by Jim Meyering. What you are reading now is the authoritative documentation for these utilities; the man pages are no longer being maintained. François Pinard did the initial conversion to Texinfo format. Karl Berry did the indexing, some reorganization, and editing of the results. Richard Stallman contributed his usual invaluable insights to the overall process.
Certain options are available in all of these programs (in fact, every GNU program should accept them). Rather than writing identical descriptions for each of the programs, they are described here.
--help
--version
Some GNU programs (at least cp
, install
, ln
, and
mv
) optionally make backups of files before writing new versions.
These options control the details of these backups. The options are also
briefly mentioned in the descriptions of the particular programs.
-b
--backup
-S suffix
--suffix=suffix
-b
. If this
option is not specified, the value of the SIMPLE_BACKUP_SUFFIX
environment variable is used. And if SIMPLE_BACKUP_SUFFIX
is not
set, the default is ~
, just as in Emacs.
-V method
--version-control=method
-b
.
If this option is not specified, the value of the VERSION_CONTROL
environment variable is used. And if VERSION_CONTROL
is not set,
the default backup type is existing
.
This option corresponds to the Emacs variable version-control
;
the same values for method are accepted as in Emacs. This options
also more descriptive name. The valid methods (unique
abbreviations are accepted):
t
numbered
nil
existing
never
simple
Some GNU programs (at least df
, du
, and ls
) display
file sizes in "blocks". You can adjust the block size to make file
sizes easier to read. The block size used for display is independent of
any filesystem block size. Displayed sizes are rounded to the nearest
block, with ties rounding to an even number.
The default block size is chosen by examining the following environment variables in turn; the first one that is set determines the block size.
DF_BLOCK_SIZE
df
command.
Similarly, DU_BLOCK_SIZE
specifies the default for du
and
LS_BLOCK_SIZE
for ls
.
BLOCK_SIZE
POSIXLY_CORRECT
command_BLOCK_SIZE
nor the BLOCK_SIZE
variables are set, but this variable is set, the block size defaults to 512.
If none of the above environment variables are set, the block size currently defaults to 1024 bytes, but this number may change in the future.
A block size specification can be a positive integer specifying the number
of bytes per block, or it can be human-readable
or si
to
select a human-readable format.
With human-readable formats, output sizes are followed by a size letter
such as M
for megabytes. BLOCK_SIZE=human-readable
uses
powers of 1024; M
stands for 1,048,576 bytes.
BLOCK_SIZE=si
is similar, but uses powers of 1000; M
stands
for 1,000,000 bytes. (SI, the International System of Units, defines
these power-of-1000 prefixes.)
An integer block size can be followed by a size letter to specify a
multiple of that size. When this notation is used, the size letters
normally stand for powers of 1024, and can be followed by an optional
B
for "byte"; but if followed by D
(for "decimal
byte"), they stand for powers of 1000. For example,
BLOCK_SIZE=4MB
is equivalent to BLOCK_SIZE=4194304
, and
BLOCK_SIZE=4MD
is equivalent to BLOCK_SIZE=4000000
.
The following size letters are defined. Large sizes like 1Y
may be rejected by your computer due to limitations of its arithmetic.
k
human-readable
,
or 10^3 = 1000 for si
.
M
G
T
P
E
Z
Y
Block size defaults can be overridden by an explicit
--block-size=size
option. The -k
or
--kilobytes
option is equivalent to --block-size=1k
, which
is the default unless the POSIXLY_CORRECT
environment variable is
set. The -h
or --human-readable
option is equivalent to
--block-size=human-readable
. The -H
or --si
option
is equivalent to --block-size=si
.
Each file has a set of permissions that control the kinds of access that users have to that file. The permissions for a file are also called its access mode. They can be represented either in symbolic form or as an octal number.
There are three kinds of permissions that a user can have for a file:
There are three categories of users who may have different permissions to perform any of the above operations on a file:
Files are given an owner and group when they are created. Usually the
owner is the current user and the group is the group of the directory
the file is in, but this varies with the operating system, the
filesystem the file is created on, and the way the file is created. You
can change the owner and group of a file by using the chown
and
chgrp
commands.
In addition to the three sets of three permissions listed above, a file's permissions have three special components, which affect only executable files (programs) and, on some systems, directories:
Symbolic modes represent changes to files' permissions as
operations on single-character symbols. They allow you to modify either
all or selected parts of files' permissions, optionally based on
their previous values, and perhaps on the current umask
as well
(see Umask and Protection).
The format of symbolic modes is:
[ugoa...][[+-=][rwxXstugo...]...][,...]
The following sections describe the operators and other details of symbolic modes.
The basic symbolic operations on a file's permissions are adding, removing, and setting the permission that certain users have to read, write, and execute the file. These operations have the following format:
users operation permissions
The spaces between the three parts above are shown for readability only; symbolic modes can not contain spaces.
The users part tells which users' access to the file is changed. It consists of one or more of the following letters (or it can be empty; see Umask and Protection, for a description of what happens then). When more than one of these letters is given, the order that they are in does not matter.
u
g
o
a
ugo
.
The operation part tells how to change the affected users' access to the file, and is one of the following symbols:
+
-
=
The permissions part tells what kind of access to the file should
be changed; it is zero or more of the following letters. As with the
users part, the order does not matter when more than one letter is
given. Omitting the permissions part is useful only with the
=
operation, where it gives the specified users no access
at all to the file.
r
w
x
For example, to give everyone permission to read and write a file, but not to execute it, use:
a=rw
To remove write permission for from all users other than the file's owner, use:
go-w
The above command does not affect the access that the owner of the file has to it, nor does it affect whether other users can read or execute the file.
To give everyone except a file's owner no permission to do anything with that file, use the mode below. Other users could still remove the file, if they have write permission on the directory it is in.
go=
Another way to specify the same thing is:
og-rxw
You can base a file's permissions on its existing permissions. To do
this, instead of using r
, w
, or x
after the
operator, you use the letter u
, g
, or o
. For
example, the mode
o+g
adds the permissions for users who are in a file's group to the
permissions that other users have for the file. Thus, if the file
started out as mode 664 (rw-rw-r--
), the above mode would change
it to mode 666 (rw-rw-rw-
). If the file had started out as mode
741 (rwxr----x
), the above mode would change it to mode 745
(rwxr--r-x
). The -
and =
operations work
analogously.
In addition to changing a file's read, write, and execute permissions, you can change its special permissions. See Mode Structure, for a summary of these permissions.
To change a file's permission to set the user ID on execution, use
u
in the users part of the symbolic mode and
s
in the permissions part.
To change a file's permission to set the group ID on execution, use
g
in the users part of the symbolic mode and
s
in the permissions part.
To change a file's permission to stay permanently on the swap device,
use o
in the users part of the symbolic mode and
t
in the permissions part.
For example, to add set user ID permission to a program, you can use the mode:
u+s
To remove both set user ID and set group ID permission from it, you can use the mode:
ug-s
To cause a program to be saved on the swap device, you can use the mode:
o+t
Remember that the special permissions only affect files that are
executable, plus, on some systems, directories (on which they have
different meanings; see Mode Structure). Using a
in the users part of a symbolic mode does not cause the special
permissions to be affected; thus,
a+s
has no effect. You must use u
, g
, and o
explicitly to affect the special permissions. Also, the
combinations u+t
, g+t
, and o+s
have no effect.
The =
operator is not very useful with special permissions; for
example, the mode:
o=t
does cause the file to be saved on the swap device, but it also removes all read, write, and execute permissions that users not in the file's group might have had for it.
There is one more special type of symbolic permission: if you use
X
instead of x
, execute permission is affected only if the
file already had execute permission or is a directory. It affects
directories' execute permission even if they did not initially have any
execute permissions set.
For example, this mode:
a+X
gives all users permission to execute files (or search directories) if anyone could before.
The format of symbolic modes is actually more complex than described above (see Setting Permissions). It provides two ways to make multiple changes to files' permissions.
The first way is to specify multiple operation and permissions parts after a users part in the symbolic mode.
For example, the mode:
og+rX-w
gives users other than the owner of the file read permission and, if it is a directory or if someone already had execute permission to it, gives them execute permission; and it also denies them write permission to it file. It does not affect the permission that the owner of the file has for it. The above mode is equivalent to the two modes:
og+rX og-w
The second way to make multiple changes is to specify more than one simple symbolic mode, separated by commas. For example, the mode:
a+r,go-w
gives everyone permission to read the file and removes write permission on it for all users except its owner. Another example:
u=rwx,g=rx,o=
sets all of the non-special permissions for the file explicitly. (It gives users who are not in the file's group no permission at all for it.)
The two methods can be combined. The mode:
a+r,g+x-w
gives all users permission to read the file, and gives users who are in the file's group permission to execute it, as well, but not permission to write to it. The above mode could be written in several different ways; another is:
u+r,g+rx,o+r,g-w
If the users part of a symbolic mode is omitted, it defaults to
a
(affect all users), except that any permissions that are
set in the system variable umask
are not affected.
The value of umask
can be set using the
umask
command. Its default value varies from system to system.
Omitting the users part of a symbolic mode is generally not useful
with operations other than +
. It is useful with +
because
it allows you to use umask
as an easily customizable protection
against giving away more permission to files than you intended to.
As an example, if umask
has the value 2, which removes write
permission for users who are not in the file's group, then the mode:
+w
adds permission to write to the file to its owner and to other users who are in the file's group, but not to other users. In contrast, the mode:
a+w
ignores umask
, and does give write permission for
the file to all users.
File permissions are stored internally as 16 bit integers. As an alternative to giving a symbolic mode, you can give an octal (base 8) number that corresponds to the internal representation of the new mode. This number is always interpreted in octal; you do not have to add a leading 0, as you do in C. Mode 0055 is the same as mode 55.
A numeric mode is usually shorter than the corresponding symbolic mode, but it is limited in that it can not take into account a file's previous permissions; it can only set them absolutely.
The permissions granted to the user, to other users in the file's group, and to other users not in the file's group are each stored as three bits, which are represented as one octal digit. The three special permissions are also each stored as one bit, and they are as a group represented as another octal digit. Here is how the bits are arranged in the 16 bit integer, starting with the lowest valued bit:
Value in Corresponding Mode Permission Other users not in the file's group: 1 Execute 2 Write 4 Read Other users in the file's group: 10 Execute 20 Write 40 Read The file's owner: 100 Execute 200 Write 400 Read Special permissions: 1000 Save text image on swap device 2000 Set group ID on execution 4000 Set user ID on execution
For example, numeric mode 4755 corresponds to symbolic mode
u=rwxs,go=rx
, and numeric mode 664 corresponds to symbolic mode
ug=rw,o=r
. Numeric mode 0 corresponds to symbolic mode
ugo=
.
First, a quote:
Our units of temporal measurement, from seconds on up to months, are so complicated, asymmetrical and disjunctive so as to make coherent mental reckoning in time all but impossible. Indeed, had some tyrannical god contrived to enslave our minds to time, to make it all but impossible for us to escape subjection to sodden routines and unpleasant surprises, he could hardly have done better than handing down our present system. It is like a set of trapezoidal building blocks, with no vertical or horizontal surfaces, like a language in which the simplest thought demands ornate constructions, useless particles and lengthy circumlocutions. Unlike the more successful patterns of language and science, which enable us to face experience boldly or at least level-headedly, our system of temporal calculation silently and persistently encourages our terror of time. ... It is as though architects had to measure length in feet, width in meters and height in ells; as though basic instruction manuals demanded a knowledge of five different languages. It is no wonder then that we often look into our own immediate past or future, last Tuesday or a week from Sunday, with feelings of helpless confusion. ...-- Robert Grudin, Time and the Art of Living.
This section describes the textual date representations that GNU
programs accept. These are the strings you, as a user, can supply as
arguments to the various programs. The C interface (via the
getdate
function) is not described here.
Although the date syntax here can represent any possible time since zero A.D., computer integers are not big enough for such a (comparatively) long time. The earliest date semantically allowed on Unix systems is midnight, 1 January 1970 UCT.
A date is a string, possibly empty, containing many items separated by whitespace. The whitespace may be omitted when no ambiguity arises. The empty string means the beginning of today (i.e., midnight). Order of the items is immaterial. A date string may contain many flavors of items:
We describe each of these item types in turn, below.
A few numbers may be written out in words in most contexts. This is
most useful for specifying day of the week items or relative items (see
below). Here is the list: first
for 1, next
for 2,
third
for 3, fourth
for 4, fifth
for 5,
sixth
for 6, seventh
for 7, eighth
for 8,
ninth
for 9, tenth
for 10, eleventh
for 11 and
twelfth
for 12. Also, last
means exactly -1.
When a month is written this way, it is still considered to be written numerically, instead of being "spelled in full"; this changes the allowed strings.
Alphabetic case is completely ignored in dates. Comments may be introduced between round parentheses, as long as included parentheses are properly nested. Hyphens not followed by a digit are currently ignored. Leading zeros on numbers are ignored.
A calendar date item specifies a day of the year. It is specified differently, depending on whether the month is specified numerically or literally. All these strings specify the same calendar date:
1970-09-17 # ISO 8601. 70-9-17 # This century assumed by default. 70-09-17 # Leading zeros are ignored. 9/17/72 # Common U.S. writing. 24 September 1972 24 Sept 72 # September has a special abbreviation. 24 Sep 72 # Three-letter abbreviations always allowed. Sep 24, 1972 24-sep-72 24sep72
The year can also be omitted. In this case, the last specified year is used, or the current year if none. For example:
9/17 sep 17
Here are the rules.
For numeric months, the ISO 8601 format
year-month-day
is allowed, where year is
any positive number, month is a number between 01 and 12, and
day is a number between 01 and 31. A leading zero must be present
if a number is less than ten. If year is less than 100, then 1900
is added to it to force a date in this century. The construct
month/day/year
, popular in the United States,
is accepted. Also month/day
, omitting the year.
Literal months may be spelled out in full: January
,
February
, March
, April
, May
, June
,
July
, August
, September
, October
,
November
or December
. Literal months may be abbreviated
to their first three letters, possibly followed by an abbreviating dot.
It is also permitted to write Sept
instead of September
.
When months are written literally, the calendar date may be given as any of the following:
day month year day month month day year day-month-year
Or, omitting the year:
month day
A time of day item in date strings specifies the time on a given day. Here are some examples, all of which represent the same time:
20:02:0 20:02 8:02pm 20:02-0500 # In EST (Eastern U.S. Standard Time).
More generally, the time of the day may be given as
hour:minute:second
, where hour is
a number between 0 and 23, minute is a number between 0 and
59, and second is a number between 0 and 59. Alternatively,
:second
can be omitted, in which case it is taken to
be zero.
If the time is followed by am
or pm
(or a.m.
or p.m.
), hour is restricted to run from 1 to 12, and
:minute
may be omitted (taken to be zero). am
indicates the first half of the day, pm
indicates the second
half of the day. In this notation, 12 is the predecessor of 1:
midnight is 12am
while noon is 12pm
.
The time may alternatively be followed by a time zone correction,
expressed as shhmm
, where s is +
or -
, hh is a number of zone hours and mm is a number
of zone minutes. When a time zone correction is given this way, it
forces interpretation of the time relative to
Coordinated Universal Time (UTC), overriding any previous
specification for the time zone or the local time zone. The minute
part of the time of the day may not be elided when a time zone correction
is used. This is the only way to specify a time zone correction by
fractional parts of an hour.
Either am
/pm
or a time zone correction may be specified,
but not both.
A time zone item specifies an international time zone, indicated by
a small set of letters. They are supported for backward compatibility reasons,
but they are not recommended because they are ambiguous in practice:
for example, the abbreviation EST
has different meanings in
Australia and the United States. Any included period is ignored. Military
time zone designations use a single letter. Currently, only integral
zone hours may be represented in a time zone item. See the previous
section for a finer control over the time zone correction.
Here are many non-daylight-saving-time time zones, indexed by the zone hour value.
Y
for militaries.
X
for militaries.
W
for militaries.
V
for militaries.
PST
for Pacific Standard, and
U
for militaries.
MST
for Mountain Standard, and
T
for militaries.
CST
for Central Standard, and
S
for militaries.
EST
for Eastern Standard, and
R
for militaries.
AST
for Atlantic Standard, and
Q
for militaries.
P
for militaries.
O
for militaries.
N
for militaries.
GMT
for Greenwich Mean,
UT
for Universal,
UTC
for Coordinated Universal,
WET
for Western European, and
Z
for ISO 8601 and militaries.
A
for militaries,
CET
for Central European,
MET
for Midden Europesche Tijd (Dutch), and
MEZ
for Mittel-Europäische Zeit (German).
B
for militaries, and
EET
for Eastern European.
C
for militaries.
D
for militaries.
E
for militaries.
F
for militaries.
G
for militaries.
H
for militaries.
I
for militaries, and
JST
for Japan Standard.
GST
for Guam Standard, and
K
for militaries.
L
for militaries.
M
for militaries, and
NZST
for New Zealand Standard.
Here are many daylight-saving time (DST) time zones,
indexed by the zone hour value. Also, by
following a non-DST time zone by the string DST
in a separate word
(that is, separated by some whitespace), the corresponding DST time zone
may be specified.
PDT
for Pacific Daylight.
MDT
for Mountain Daylight.
CDT
for Central Daylight.
EDT
for Eastern Daylight.
ADT
for Atlantic Daylight.
BST
for British Summer, and
WEST
for Western European Summer.
CEST
for Central European Summer,
MEST
for Midden Europesche S. Tijd (Dutch), and
MESZ
for Mittel-Europäische Sommerzeit (German).
NZDT
for New Zealand Daylight.
The explicit mention of a day of the week will forward the date (only if necessary) to reach that day of the week in the future.
Days of the week may be spelled out in full: Sunday
,
Monday
, Tuesday
, Wednesday
, Thursday
,
Friday
or Saturday
. Days may be abbreviated to their
first three letters, optionally followed by a period. The special
abbreviations Tues
for Tuesday
, Wednes
for
Wednesday
and Thur
or Thurs
for Thursday
are
also allowed.
A number may precede a day of the week item to move forward
supplementary weeks. It is best used in expression like third
monday
. In this context, last day
or next
day
is also acceptable; they move one week before or after
the day that day by itself would represent.
A comma following a day of the week item is ignored.
Relative items adjust a date (or the current date if none) forward or backward. The effects of relative items accumulate. Here are some examples:
1 year 1 year ago 3 years 2 days
The unit of time displacement may be selected by the string year
or month
for moving by whole years or months. These are fuzzy
units, as years and months are not all of equal duration. More precise
units are fortnight
which is worth 14 days, week
worth 7
days, day
worth 24 hours, hour
worth 60 minutes,
minute
or min
worth 60 seconds, and second
or
sec
worth one second. An s
suffix on these units is
accepted and ignored.
The unit of time may be preceded by a multiplier, given as an optionally
signed number. Unsigned numbers are taken as positively signed. No
number at all implies 1 for a multiplier. Following a relative item by
the string ago
is equivalent to preceding the unit by a
multiplicator with value -1.
The string tomorrow
is worth one day in the future (equivalent
to day
), the string yesterday
is worth
one day in the past (equivalent to day ago
).
The strings now
or today
are relative items corresponding
to zero-valued time displacement, these strings come from the fact
a zero-valued time displacement represents the current time when not
otherwise change by previous items. They may be used to stress other
items, like in 12:00 today
. The string this
also has
the meaning of a zero-valued time displacement, but is preferred in
date strings like this thursday
.
When a relative item makes the resulting date to cross the boundary between DST and non-DST (or vice-versa), the hour is adjusted according to the local time.
The precise intepretation of a pure decimal number is dependent of the context in the date string.
If the decimal number is of the form yyyymmdd and no other calendar date item (see Calendar date item) appears before it in the date string, then yyyy is read as the year, mm as the month number and dd as the day of the month, for the specified calendar date.
If the decimal number is of the form hhmm and no other time of day item appears before it in the date string, then hh is read as the hour of the day and mm as the minute of the hour, for the specified time of the day. mm can also be omitted.
If both a calendar date and a time of day appear to the left of a number in the date string, but no relative item, then the number overrides the year.
getdate
getdate
was originally implemented by Steven M. Bellovin
(smb@research.att.com) while at the University of North Carolina
at Chapel Hill. The code was later tweaked by a couple of people on
Usenet, then completely overhauled by Rich $alz (rsalz@bbn.com)
and Jim Berets (jberets@bbn.com) in August, 1990. Various
revisions for the GNU system were made by David MacKenzie, Jim Meyering,
and others.
This chapter was originally produced by François Pinard
(pinard@iro.umontreal.ca) from the getdate.y
source code,
and then edited by K. Berry (kb@cs.umb.edu).
This chapter describes the ls
command and its variants dir
and vdir
, which list information about files.
ls
: List directory contentsThe ls
program lists information about files (of any type,
including directories). Options and file arguments can be intermixed
arbitrarily, as usual.
For non-option command-line arguments that are directories, by default
ls
lists the contents of directories, not recursively, and
omitting files with names beginning with .
. For other non-option
arguments, by default ls
lists just the file name. If no
non-option arguments are specified, ls
lists the contents of the
current directory.
By default, the output is sorted alphabetically. If standard output is a terminal, the output is in columns (sorted vertically) and control characters are output as question marks; otherwise, the output is listed one per line and control characters are output as-is.
Because ls
is such a fundamental program, it has accumulated many
options over the years. They are described in the subsections below;
within each section, options are listed alphabetically (ignoring case).
The division of options into the subsections is not absolute, since some
options affect more than one aspect of ls
's operation.
The -g
option is accepted but ignored, for compatibility
with Unix. Also see Common options.
These options determine which files ls
lists information for.
By default, any files and the contents of any directories on the command
line are shown.
-a
--all
.
.
-A
--almost-all
.
and ..
.
-B
--ignore-backups
~
, unless they are given on the
command line.
-d
--directory
-I PATTERN
--ignore=PATTERN
.
in a file name does not match a
wildcard at the start of pattern. Sometimes it is useful
to give this option several times. For example,
$ ls --ignore='.??*' --ignore='.[^.]' --ignore='#*'
The first option ignores names of length 3 or more that start with .
,
the second ignores all two-character names that start with .
except ..
, and the third ignores names that start with #
.
-L
--dereference
-R
--recursive
These options affect the information that ls
displays. By
default, only file names are shown.
-D
--dired
-l
) format, print an additional line after
the main output:
//DIRED// beg1 end1 beg2 end2 ...
The begN and endN are unsigned integers that record the byte position of the beginning and end of each file name in the output. This makes it easy for Emacs to find the names, even when they contain unusual characters such as space or newline, without fancy searching.
If directories are being listed recursively (-R
), output a similar
line after each subdirectory:
//SUBDIRED// format beg1 end1 ...
Finally, output a line of the form:
//DIRED-OPTIONS// --quoting-style=wordwhere word is the quoting style (see Formatting the file names).
-G
--no-group
ls
, so we
provide this option for compatibility.)
-h
--human-readable
M
for megabytes to each size.
Powers of 1024 are used, not 1000; M
stands for 1,048,576 bytes.
Use the -H
or --si
option if you prefer powers of 1000.
-H
--si
M
for megabytes to each size. (SI
is the International System of Units, which defines these letters as
prefixes.) Powers of 1000 are used, not 1024; M
stands for
1,000,000 bytes. Use the -h
or --human-readable
option if
you prefer powers of 1024.
-i
--inode
-l
--format=long
--format=verbose
For each directory that is listed, preface the files with a line
total blocks
, where blocks is the total disk allocation
for all files in that directory. The block size currently defaults to 1024
bytes, but this can be overridden (see Block size).
The blocks computed counts each hard link separately;
this is arguably a deficiency.
The permissions listed are similar to symbolic mode specifications
(see Symbolic Modes). But ls
combines multiple bits into the
third character of each set of permissions as follows:
s
S
t
T
x
-
-o
--format=long
with --no-group
.
This option is provided for compatibility with other versions of ls
.
-s
--size
Normally the disk allocation is printed in units of 1024 bytes, but this can be overridden (see Block size).
For files that are NFS-mounted from an HP-UX system to a BSD system,
this option reports sizes that are half the correct values. On HP-UX
systems, it reports sizes that are twice the correct values for files
that are NFS-mounted from BSD systems. This is due to a flaw in HP-UX;
it also affects the HP-UX ls
program.
These options change the order in which ls
sorts the information
it outputs. By default, sorting is done by character code (e.g., ASCII
order).
-c
ctime
in the
inode). If the long listing format (-l
) is being used, print the
status change time instead of the modification time.
-f
-U
--do not sort; list the files in whatever
order they are stored in the directory. But also enable -a
(list
all files) and disable -l
, --color
, and -s
(if they
were specified before the -f
).
-r
--reverse
-S
--sort=size
-t
--sort=time
mtime
in the inode), newest first.
-u
atime
in the inode). If the long
listing format is being used, print the last access time.
--time=atime
--time=access
--sort=time
(-t
), this is equivalent to -u
.
With options that print times (e.g., --format=long
), print each file's
time of last access, rather than its time of last modification.
--time=ctime
--time=status
--time=use
--sort=time
(-t
), this is equivalent to -c
.
With options that print times (e.g., --format=long
), print each file's
time of last inode change, rather than its time of last modification.
-U
--sort=none
-f
does.) This is especially useful when listing very large
directories, since not doing any sorting can be noticeably faster.
-v
--sort=version
-X
--sort=extension
.
); files with no extension are sorted first.
The version sort takes into account the fact that file names frequently include indices or version numbers. Standard sorting functions usually do not produce the ordering that people expect because comparisons are made on a character-by-character basis. The version sort adresses this problem, and is especially useful when browsing directories that contain many files with indices/version numbers in their names:
> ls -1 > ls -1v foo.zml-1.gz foo.zml-1.gz foo.zml-100.gz foo.zml-2.gz foo.zml-12.gz foo.zml-6.gz foo.zml-13.gz foo.zml-12.gz foo.zml-2.gz foo.zml-13.gz foo.zml-25.gz foo.zml-25.gz foo.zml-6.gz foo.zml-100.gz
Note also that numeric parts with leading zeroes are considered as fractional one:
> ls -1 > ls -1v abc-1.007.tgz abc-1.007.tgz abc-1.012b.tgz abc-1.01a.tgz abc-1.01a.tgz abc-1.012b.tgz
These options affect the appearance of the overall output.
-1
--format=single-column
ls
when standard
output is not a terminal.
-C
--format=vertical
ls
if standard output is a terminal. It is always the default
for the dir
and d
programs.
GNU ls
uses variable width columns to display as many files as
possible in the fewest lines.
--color [=when]
--color
and no when is equivalent to
--color=always
.
-F
--classify
--indicator-style=classify
*
. The file type
indicators are /
for directories, @
for symbolic links,
|
for FIFOs, =
for sockets, and nothing for regular files.
--full-time
date
's default; it's not
possible to change this, but you can extract out the date string with
cut
and then pass the result to date -d
. See date invocation.
This is most useful because the time output includes the seconds. (Unix
filesystems store file timestamps only to the nearest second, so this
option shows all the information there is.) For example, this can help
when you have a Makefile that is not regenerating files properly.
--indicator-style=word
none
file-type
/
for directories, @
for symbolic links, |
for FIFOs, =
for sockets, and nothing for regular files. This is
the same as the -p
or --file-type
option.
classify
*
for executable regular files, otherwise behave as for
file-type
. This is the same as the -F
or
--classify
option.
-k
--kilobytes
-m
--format=commas
,
(a comma and a space).
-n
--numeric-uid-gid
-p
--file-type
--indicator-style=file-type
-F
, except that executables are not marked.
-x format
--format=across
--format=horizontal
-T cols
--tabsize=cols
ls
uses tabs where possible in the output, for efficiency. If
cols is zero, do not use tabs at all.
-w
--width=cols
COLUMNS
is used if it is set; otherwise the default
is 80.
These options change how file names themselves are printed.
-b
--escape
--quoting-style=escape
-N
--literal
-q
--hide-control-chars
ls
.
-Q
--quote-name
--quoting-style=c
--quoting-style=word
literal
shell
shell-always
c
-Q
or --quote-name
option.
escape
c
except omit the surrounding double-quote
characters; this is the same as the -b
or --escape
option.
You can specify the default value of the --quoting-style
option
with the environment variable QUOTING_STYLE
. If that environment
variable is not set, the default value is literal
, but this
default may change to shell
in a future version of this package.
--show-control-chars
ls
.
dir
: Briefly list directory contentsdir
(also installed as d
) is equivalent to ls -C
-b
; that is, by default files are listed in columns, sorted vertically,
and special characters are represented by backslash escape sequences.
See ls
.
vdir
: Verbosely list directory contentsvdir
(also installed as v
) is equivalent to ls -l
-b
; that is, by default files are listed in long format and special
characters are represented by backslash escape sequences.
dircolors
: Color setup for ls
dircolors
outputs a sequence of shell commands to set up the
terminal for color output from ls
(and dir
, etc.).
Typical usage:
eval `dircolors [option]... [file]`
If file is specified, dircolors
reads it to determine which
colors to use for which file types and extensions. Otherwise, a
precompiled database is used. For details on the format of these files,
run dircolors --print-database
.
The output is a shell command to set the LS_COLORS
environment
variable. You can specify the shell syntax to use on the command line,
or dircolors
will guess it from the value of the SHELL
environment variable.
The program accepts the following options. Also see Common options.
-b
--sh
--bourne-shell
SHELL
environment variable is set and does not end with csh
or
tcsh
.
-c
--csh
--c-shell
SHELL
ends with
csh
or tcsh
.
-p
--print-database
This chapter describes the commands for basic file manipulation: copying, moving (renaming), and deleting (removing).
cp
: Copy files and directoriescp
copies files (or, optionally, directories). The copy is
completely independent of the original. You can either copy one file to
another, or copy arbitrarily many files to a destination directory.
Synopsis:
cp [option]... source dest cp [option]... source... directory
If the last argument names an existing directory, cp
copies each
source file into that directory (retaining the same name).
Otherwise, if only two files are given, it copies the first onto the
second. It is an error if the last argument is not a directory and more
than two non-option arguments are given.
Generally, files are written just as they are read. For exceptions,
see the --sparse
option below.
By default, cp
does not copy directories (see -r
below).
cp
generally refuses to copy a file onto itself, with the
following exception: if --force --backup
is specified with
source and dest identical, and referring to a regular file,
cp
will make a backup file, either regular or numbered, as
specified in the usual ways (see Backup options). This is useful when
you simply want to make a backup of an existing file before changing it.
The program accepts the following options. Also see Common options.
-a
--archive
-dpR
.
-b
--backup
-d
--no-dereference
-f
--force
-i
--interactive
-l
--link
-p
--preserve
-P
--parents
cp
must be the name of an existing directory.
For example, the command:
cp --parents a/b/c existing_dir
copies the file a/b/c
to existing_dir/a/b/c
, creating
any missing intermediate directories.
-r
cp -r
to special files like FIFOs and the ones typically
found in the /dev
directory. In most cases, cp -r
will hang indefinitely trying to read from FIFOs and special files
like /dev/console
, and it will fill up your destination disk
if you use it to copy /dev/zero
.
Use the --recursive
(-R
) option instead if you want
to copy special files, preserving their special nature
rather than reading from them to copy their contents.
-R
--recursive
-r
just above).
--sparse=when
read
system call
reads these as zeroes. This can both save considerable disk space and
increase speed, since many binary files contain lots of consecutive zero
bytes. By default, cp
detects holes in input source files via a crude
heuristic and makes the corresponding output file sparse as well.
The when value can be one of the following:
auto
always
efs
filesystems in SGI IRIX 5.3 and
earlier), but the output file is on another type of filesystem.
never
-s
--symbolic-link
/
) unless the
destination files are in the current directory. This option merely
results in an error message on systems that do not support symbolic links.
-S suffix
--suffix=suffix
-b
.
See Backup options.
-u
--update
-v
--verbose
-V method
--version-control=method
-b
. The method
argument can be numbered
(or t
), existing
(or
nil
), or never
(or simple
). See Backup options.
-x
--one-file-system
dd
: Convert and copy a filedd
copies a file (from standard input to standard output, by
default) with a changeable I/O block size, while optionally performing
conversions on it. Synopsis:
dd [option]...
The program accepts the following options. Also see Common options.
The numeric-valued options below (bytes and blocks) can be
followed by a multiplier: b
=512, c
=1,
w
=2, xm
=m, or any of the
standard block size suffixes like k
=1024 (see Block size).
if=file
of=file
conv=notrunc
is given, dd
truncates file to zero
bytes (or the size specified with seek=
).
ibs=bytes
obs=bytes
bs=bytes
ibs
and obs
.
cbs=bytes
skip=blocks
ibs
-byte blocks in the input file before copying.
seek=blocks
obs
-byte blocks in the output file before copying.
count=blocks
ibs
-byte blocks from the input file, instead
of everything until the end of the file.
conv=conversion[,conversion]...
Conversions:
ascii
ebcdic
ibm
block
cbs
bytes, replacing the
input newline with a space and padding with spaces as necessary.
unblock
cbs
-sized input block with a
newline.
lcase
ucase
swab
dd
, unlike others, works
when an odd number of bytes are read--the last byte is simply copied
(since there is nothing to swap it with).
noerror
notrunc
sync
ibs
with trailing zero bytes.
install
: Copy files and set attributesinstall
copies files while setting their permission modes and, if
possible, their owner and group. Synopses:
install [option]... source dest install [option]... source... directory install -d [option]... directory...
In the first of these, the source file is copied to the dest target file. In the second, each of the source files are copied to the destination directory. In the last, each directory (and any missing parent directories) is created.
install
is similar to cp
, but allows you to control the
attributes of destination files. It is typically used in Makefiles to
copy programs into their destination directories. It refuses to copy
files onto themselves.
The program accepts the following options. Also see Common options.
-b
--backup
-c
install
.
-d
--directory
install
, which
gives directories that it creates the default attributes.)
-g group
--group=group
-m mode
--mode=mode
chmod
, with 0 as the point of departure (see File permissions). The default mode is 0755--read, write, and execute
for the owner, and read and execute for group and other.
-o owner
--owner=owner
install
has appropriate privileges (is run as root), set the
ownership of installed files or directories to owner. The default
is root
. owner may be either a user name or a numeric user
ID.
-p
--preserve-timestamps
-s
--strip
-S suffix
--suffix=suffix
-b
.
See Backup options.
-v
--verbose
-V method
--version-control=method
-b
. The method
argument can be numbered
(or t
), existing
(or
nil
), or never
(or simple
). See Backup options.
mv
: Move (rename) filesmv
moves or renames files (or directories). Synopsis:
mv [option]... source dest mv [option]... source... directory
If the last argument names an existing directory, mv
moves each
other given file into a file with the same name in that directory.
Otherwise, if only two files are given, it renames the first as
the second. It is an error if the last argument is not a directory
and more than two files are given.
mv
can move only regular files across filesystems.
If a destination file exists but is normally unwritable, standard input
is a terminal, and the -f
or --force
option is not given,
mv
prompts the user for whether to replace the file. (You might
own the file, or have write permission on its directory.) If the
response does not begin with y
or Y
, the file is skipped.
The program accepts the following options. Also see Common options.
-b
--backup
-f
--force
-i
--interactive
y
or
Y
, the file is skipped.
-u
--update
-v
--verbose
-S suffix
--suffix=suffix
-b
.
See Backup options.
-V method
--version-control=method
-b
. The method
argument can be numbered
(or t
), existing
(or
nil
), or never
(or simple
). See Backup options.
rm
: Remove files or directoriesrm
removes each given file. By default, it does not remove
directories. Synopsis:
rm [option]... [file]...
If a file is unwritable, standard input is a terminal, and the -f
or --force
option is not given, or the -i
or
--interactive
option is given, rm
prompts the user
for whether to remove the file. If the response does not begin with
y
or Y
, the file is skipped.
The program accepts the following options. Also see Common options.
-d
--directory
unlink
instead of rmdir
, and don't
require a directory to be empty before trying to unlink it. Only works
if you have appropriate privileges. Because unlinking a directory
causes any files in the deleted directory to become unreferenced, it is
wise to fsck
the filesystem after doing this.
-f
--force
--interactive
(-i
) option.
-i
--interactive
y
or Y
, the file is skipped.
Ignore any previous --force
(-f
) option.
-r
-R
--recursive
-v
--verbose
One common question is how to remove files whose names begin with a
-
. GNU rm
, like every program that uses the getopt
function to parse its arguments, lets you use the --
option to
indicate that all following arguments are non-options. To remove a file
called -f
in the current directory, you could type either:
rm -- -f
or:
rm ./-f
The Unix rm
program's use of a single -
for this purpose
predates the development of the getopt standard syntax.
This chapter describes commands which create special types of files (and
rmdir
, which removes directories, one special file type).
Although Unix-like operating systems have markedly fewer special file types than others, not everything can be treated only as the undifferentiated byte stream of normal files. For example, when a file is created or removed, the system must record this information, which it does in a directory--a special type of file. Although you can read directories as normal files, if you're curious, in order for the system to do its job it must impose a structure, a certain order, on the bytes of the file. Thus it is a "special" type of file.
Besides directories, other special file types include named pipes (FIFOs), symbolic links, sockets, and so-called special files.
ln
: Make links between filesln
makes links between files. By default, it makes hard links;
with the -s
option, it makes symbolic (or soft) links.
Synopses:
ln [option]... target [linkname] ln [option]... target... directory
ln
creates a
link to each target file in that directory, using the
targets' names. (But see the description of the
--no-dereference
option below.)
ln
creates a link from the
second to the first.
ln
creates a link to that
file in the current directory.
-f
or -i
(see below),
ln
will not remove an existing file. Use the --backup
option to make ln
rename existing files.
A hard link is another name for an existing file; the link and the original are indistinguishable. Technically speaking, they share the same inode, and the inode contains all the information about a file--indeed, it is not incorrect to say that the inode is the file. On all existing implementations, you cannot make a hard link to a directory, and hard links cannot cross filesystem boundaries. (These restrictions are not mandated by POSIX, however.)
Symbolic links (symlinks for short), on the other hand, are a special file type (which not all kernels support: System V release 3 (and older) systems lack symlinks) in which the link file actually refers to a different file, by name. When most operations (opening, reading, writing, and so on) are passed the symbolic link file, the kernel automatically dereferences the link and operates on the target of the link. But some operations (e.g., removing) work on the link file itself, rather than on its target. See Symbolic Links.
The program accepts the following options. Also see Common options.
-b
--backup
-d
-F
--directory
-f
--force
-i
--interactive
-n
--no-dereference
When the destination is an actual directory (not a symlink to one),
there is no ambiguity. The link is created in that directory.
But when the specified destination is a symlink to a directory,
there are two ways to treat the user's request. ln
can
treat the destination just as it would a normal directory and create
the link in it. On the other hand, the destination can be viewed as a
non-directory--as the symlink itself. In that case, ln
must delete or backup that symlink before creating the new link.
The default is to treat a destination that is a symlink to a directory
just like a directory.
-s
--symbolic
-S suffix
--suffix=suffix
-b
.
See Backup options.
-v
--verbose
-V method
--version-control=method
-b
. The method
argument can be numbered
(or t
), existing
(or
nil
), or never
(or simple
). See Backup options.
Examples:
ln -s /some/name # creates link ./name pointing to /some/name ln -s /some/name myname # creates link ./myname pointing to /some/name ln -s a b .. # creates links ../a and ../b pointing to ./a and ./b
mkdir
: Make directoriesmkdir
creates directories with the specified names. Synopsis:
mkdir [option]... name...
It is not an error if a name is already a directory; mkdir
simply proceeds. But if a name is an existing file and is
anything but a directory, mkdir
complains.
The program accepts the following options. Also see Common options.
-m mode
--mode=mode
chmod
and uses 0777 (read, write and execute allowed for
everyone) minus the bits set in the umask for the point of the
departure. See File permissions.
-p
--parents
u+wx
.
Ignore arguments corresponding to existing directories.
--verbose
--parents
.
mkfifo
: Make FIFOs (named pipes)mkfifo
creates FIFOs (also called named pipes) with the
specified names. Synopsis:
mkfifo [option] name...
A FIFO is a special file type that permits independent processes to communicate. One process opens the FIFO file for writing, and another for reading, after which data can flow as with the usual anonymous pipe in shells or elsewhere.
The program accepts the following option. Also see Common options.
-m mode
--mode=mode
chmod
and uses 0666 (read and write allowed for everyone) minus
the bits set in the umask for the point of departure. See File permissions.
mknod
: Make block or character special filesmknod
creates a FIFO, character special file, or block special
file with the specified name. Synopsis:
mknod [option]... name type [major minor]
Unlike the phrase "special file type" above, the term special
file has a technical meaning on Unix: something that can generate or
receive data. Usually this corresponds to a physical piece of hardware,
e.g., a printer or a disk. (These files are typically created at
system-configuration time.) The mknod
command is what creates
files of this type. Such devices can be read either a character at a
time or a "block" (many characters) at a time, hence we say there are
block special files and character special files.
The arguments after name specify the type of file to make:
p
b
c
When making a block or character special file, the major and minor device numbers must be given after the file type.
The program accepts the following option. Also see Common options.
-m mode
--mode=mode
chmod
and uses 0666 minus the bits set in the umask as the point
of departure. See File permissions.
rmdir
: Remove empty directoriesrmdir
removes empty directories. Synopsis:
rmdir [option]... directory...
If any directory argument does not refer to an existing empty directory, it is an error.
The program accepts the following option. Also see Common options.
--ignore-fail-on-non-empty
-p
--parents
--verbose
See rm invocation, for how to remove non-empty directories (recursively).
A file is not merely its contents, a name, and a file type (see Special file types). A file also has an owner (a userid), a group (a group id), permissions (what the owner can do with the file, what people in the group can do, and what everyone else can do), various timestamps, and other information. Collectively, we call these a file's attributes.
These commands change file attributes.
chown
: Change file owner and groupchown
changes the user and/or group ownership of each given file
to new-owner or to the user and group of an existing reference file.
Synopsis:
chown [option]... {new-owner | --reference=file} file...
If used, new-owner specifies the new owner and/or group as follows (with no embedded white space):
[owner] [ [:.] [group] ]
Specifically:
.
group
:
group
.
:
.
group
:
group
chown
performs the same function as chgrp
.
The program accepts the following options. Also see Common options.
-c
--changes
-f
--silent
--quiet
--dereference
-h
--no-dereference
lchown
system call.
On systems that do not provide the lchown
system call,
chown
fails when a file specified on the command line
is a symbolic link.
By default, no diagnostic is issued for symbolic links encountered
during a recursive traversal, but see --verbose
.
--reference=file
-v
--verbose
lchown
system call, and --no-dereference
is in effect, then issue a diagnostic saying neither the symbolic link nor
its referent is being changed.
-R
--recursive
chgrp
: Change group ownershipchgrp
changes the group ownership of each given file
to group (which can be either a group name or a numeric group id)
or to the group of an existing reference file. Synopsis:
chgrp [option]... {group | --reference=file} file...
The program accepts the following options. Also see Common options.
-c
--changes
-f
--silent
--quiet
-f
--no-dereference
lchown
system call is provided.
--reference=file
-v
--verbose
-R
--recursive
chmod
: Change access permissionschmod
changes the access permissions of the named files. Synopsis:
chmod [option]... {mode | --reference=file} file...
chmod
never changes the permissions of symbolic links, since
the chmod
system call cannot change their permissions.
This is not a problem since the permissions of symbolic links are
never used. However, for each symbolic link listed on the command
line, chmod
changes the permissions of the pointed-to file.
In contrast, chmod
ignores symbolic links encountered during
recursive directory traversals.
If used, mode specifies the new permissions. For details, see the section on File permissions.
The program accepts the following options. Also see Common options.
-c
--changes
-f
--silent
--quiet
-v
--verbose
--reference=file
-R
--recursive
touch
: Change file timestampstouch
changes the access and/or modification times of the
specified files. Synopsis:
touch [option]... file...
If the first file would be a valid argument to the -t
option and no timestamp is given with any of the -d
, -r
,
or -t
options and the --
argument is not given, that
argument is interpreted as the time for the other files instead of
as a file name.
Any file that does not exist is created empty.
If changing both the access and modification times to the current
time, touch
can change the timestamps for files that the user
running it does not own but has write permission for. Otherwise, the
user must own the files.
The program accepts the following options. Also see Common options.
-a
--time=atime
--time=access
--time=use
-c
--no-create
-d
--date=time
am
and pm
, etc. See Date input formats.
-f
touch
.
-m
--time=mtime
--time=modify
-r file
--reference=file
-t [[CC]YY]MMDDhhmm[.ss]
No disk can hold an infinite amount of data. These commands report on
how much disk storage is in use or available. (This has nothing much to
do with how much main memory, i.e., RAM, a program is using when
it runs; for that, you want ps
or pstat
or swap
or some such command.)
df
: Report filesystem disk space usagedf
reports the amount of disk space used and available on
filesystems. Synopsis:
df [option]... [file]...
With no arguments, df
reports the space used and available on all
currently mounted filesystems (of all types). Otherwise, df
reports on the filesystem containing each argument file.
Normally the disk space is printed in units of 1024 bytes, but this can be overridden (see Block size).
If an argument file is a disk device file containing a mounted
filesystem, df
shows the space available on that filesystem
rather than on the filesystem containing the device node (i.e., the root
filesystem). GNU df
does not attempt to determine the disk usage
on unmounted filesystems, because on most kinds of systems doing so
requires extremely nonportable intimate knowledge of filesystem
structures.
The program accepts the following options. Also see Common options.
-a
--all
-h
--human-readable
M
for megabytes to each size.
Powers of 1024 are used, not 1000; M
stands for 1,048,576 bytes.
Use the -H
or --si
option if you prefer powers of 1000.
-H
--si
M
for megabytes to each size. (SI
is the International System of Units, which defines these letters as
prefixes.) Powers of 1000 are used, not 1024; M
stands for
1,000,000 bytes. Use the -h
or --human-readable
option if
you prefer powers of 1024.
-i
--inodes
-k
--kilobytes
-l
--local
-m
--megabytes
--no-sync
sync
system call before getting any usage data.
This may make df
run significantly faster on systems with many
disks, but on some systems (notably SunOS) the results may be slightly
out of date. This is the default.
-P
--portability
--sync
sync
system call before getting any usage data. On
some systems (notably SunOS), doing this yields more up to date results,
but in general this option makes df
much slower, especially when
there are many or very busy filesystems.
-t fstype
--type=fstype
-t
options.
By default, nothing is omitted.
-T
--print-type
-t
and -x
. The particular
types printed are whatever is supported by the system. Here are some of
the common names (this list is certainly not exhaustive):
nfs
4.2, ufs, efs...
hsfs, cdfs
cdfs
, most other
systems use hsfs
(hs
for `High Sierra').
pcfs
-x fstype
--exclude-type=fstype
-x
options. By default, no filesystem types are omitted.
-v
df
.
du
: Estimate file space usagedu
reports the amount of disk space used by the specified files
and for each subdirectory (of directory arguments). Synopsis:
du [option]... [file]...
With no arguments, du
reports the disk space for the current
directory. Normally the disk space is printed in units of
1024 bytes, but this can be overridden (see Block size).
The program accepts the following options. Also see Common options.
-a
--all
-b
--bytes
-c
--total
-D
--dereference-args
/usr/tmp
, which
are often symbolic links.
-h
--human-readable
M
for megabytes to each size.
Powers of 1024 are used, not 1000; M
stands for 1,048,576 bytes.
Use the -H
or --si
option if you prefer powers of 1000.
-H
--si
M
for megabytes to each size. (SI
is the International System of Units, which defines these letters as
prefixes.) Powers of 1000 are used, not 1024; M
stands for
1,000,000 bytes. Use the -h
or --human-readable
option if
you prefer powers of 1024.
-k
--kilobytes
-l
--count-links
-L
--dereference
--max-depth=DEPTH
du --max-depth=0
is equivalent to du -s
.
-m
--megabytes
-s
--summarize
-S
--separate-dirs
-x
--one-file-system
--exclude=PAT
du --exclude='*.o'
excludes files whose names
end in .o
.
-X FILE
--exclude-from=FILE
--exclude
, except take the patterns to exclude from FILE,
one per line. If FILE is -
, take the patterns from standard
input.
On BSD systems, du
reports sizes that are half the correct
values for files that are NFS-mounted from HP-UX systems. On HP-UX
systems, it reports sizes that are twice the correct values for
files that are NFS-mounted from BSD systems. This is due to a flaw
in HP-UX; it also affects the HP-UX du
program.
sync
: Synchronize data on disk with memorysync
writes any data buffered in memory out to disk. This can
include (but is not limited to) modified superblocks, modified inodes,
and delayed reads and writes. This must be implemented by the kernel;
The sync
program does nothing but exercise the sync
system
call.
The kernel keeps data in memory to avoid doing (relatively slow) disk
reads and writes. This improves performance, but if the computer
crashes, data may be lost or the filesystem corrupted as a
result. sync
ensures everything in memory is written to disk.
Any arguments are ignored, except for a lone --help
or
--version
(see Common options).
-
and Unix rm
: rm invocation
-
, removing files beginning with: rm invocation
--all
: Which files are listed, du invocation, df invocation
--almost-all
: Which files are listed
--archive
: cp invocation
--backup
: mv invocation, Backup options, cp invocation, ln invocation, install invocation
--block-size=size
: Block size
--bourne-shell
: dircolors invocation
--bytes
: du invocation
--c-shell
: dircolors invocation
--changes
: chown invocation, chmod invocation, chgrp invocation
--classify
: General output formatting
--color
: General output formatting
--count-links
: du invocation
--csh
: dircolors invocation
--date
: touch invocation
--dereference
: Which files are listed, du invocation, chown invocation
--dereference-args
: du invocation
--directory
: install invocation, Which files are listed, ln invocation, rm invocation
--dired
: What information is listed
--escape
: Formatting the file names
--exclude-from=FILE
: du invocation
--exclude-type
: df invocation
--exclude=PAT
: du invocation
--file-type
: General output formatting
--force
: ln invocation, mv invocation, cp invocation, rm invocation
--format
: What information is listed, General output formatting
--full-time
: General output formatting
--group
: install invocation
--help
: Common options
--hide-control-chars
: Formatting the file names
--human-readable
: du invocation, Block size, df invocation, What information is listed
--ignore-backups
: Which files are listed
--ignore-fail-on-non-empty
: rmdir invocation
--ignore=pattern
: Which files are listed
--indicator-style
: General output formatting
--inode
: What information is listed
--inodes
: df invocation
--interactive
: cp invocation, rm invocation, mv invocation, ln invocation
--kilobytes
: Block size, General output formatting, du invocation, df invocation
--link
: cp invocation
--literal
: Formatting the file names
--local
: df invocation
--max-depth=DEPTH
: du invocation
--megabytes
: df invocation, du invocation
--mode
: mkfifo invocation, mkdir invocation, install invocation, mknod invocation
--no-create
: touch invocation
--no-dereference
: chgrp invocation, ln invocation, cp invocation, chown invocation
--no-group
: What information is listed
--no-sync
: df invocation
--numeric-uid-gid
: General output formatting
--one-file-system
: cp invocation, du invocation
--owner
: install invocation
--parents
: rmdir invocation, cp invocation, mkdir invocation
--portability
: df invocation
--preserve
: cp invocation
--preserve-timestamps
: install invocation
--print-database
: dircolors invocation
--print-type
: df invocation
--quiet
: chgrp invocation, chmod invocation, chown invocation
--quote-name
: Formatting the file names
--quoting-style
: Formatting the file names
--recursive
: chgrp invocation, chown invocation, cp invocation, rm invocation, chmod invocation, Which files are listed
--reference
: chown invocation, chmod invocation, touch invocation, chgrp invocation
--reverse
: Sorting the output
--separate-dirs
: du invocation
--sh
: dircolors invocation
--show-control-chars
: Formatting the file names
--si
: du invocation, df invocation, What information is listed, Block size
--silent
: chgrp invocation, chown invocation, chmod invocation
--size
: What information is listed
--sort
: Sorting the output
--sparse=when
: cp invocation
--strip
: install invocation
--suffix
: cp invocation, ln invocation, install invocation, mv invocation, Backup options
--summarize
: du invocation
--symbolic
: ln invocation
--symbolic-link
: cp invocation
--sync
: df invocation
--tabsize
: General output formatting
--time
: touch invocation, Sorting the output
--total
: du invocation
--type
: df invocation
--update
: cp invocation, mv invocation
--verbose
: rmdir invocation, chgrp invocation, chown invocation, chmod invocation, ln invocation, install invocation, mkdir invocation, cp invocation, mv invocation, rm invocation
--version
: Common options
--version-control
: Backup options, cp invocation, install invocation, ln invocation, mv invocation
--width
: General output formatting
-1
: General output formatting
-a
: touch invocation, df invocation, du invocation, Which files are listed
-A
: Which files are listed
-a
: cp invocation
-B
: Which files are listed
-b
: mv invocation, dircolors invocation, install invocation, Backup options, du invocation, cp invocation, ln invocation, Formatting the file names
-c
: chmod invocation, Sorting the output
-C
: General output formatting
-c
: chown invocation, du invocation, touch invocation, chgrp invocation, dircolors invocation, install invocation
-d
: rm invocation, install invocation, ln invocation, touch invocation, cp invocation, Which files are listed
-D
: What information is listed, du invocation
-f
: chgrp invocation, chown invocation, touch invocation, rm invocation
-F
: ln invocation, General output formatting
-f
: ln invocation, chmod invocation, cp invocation, chgrp invocation, Sorting the output, mv invocation
-g
: install invocation
-G
: What information is listed
-g
(ignored)
: ls invocation
-h
: chown invocation
-H
: du invocation
-h
: What information is listed, Block size, df invocation
-H
: df invocation
-h
: du invocation
-H
: Block size, What information is listed
-i
: rm invocation, cp invocation, df invocation, ln invocation
-I
: Which files are listed
-i
: mv invocation, What information is listed
-k
: du invocation, General output formatting, Block size, df invocation
-l
: cp invocation
-L
: du invocation, Which files are listed
-l
: du invocation, df invocation, What information is listed
-m
: mkdir invocation, mkfifo invocation, General output formatting, mknod invocation, install invocation, du invocation, df invocation, touch invocation
-n
: ln invocation
-N
: Formatting the file names
-n
: General output formatting
-o
: What information is listed, install invocation
-p
: mkdir invocation, install invocation
-P
: df invocation
-p
: dircolors invocation, rmdir invocation
-P
: cp invocation
-p
: cp invocation
-Q
: Formatting the file names
-q
: Formatting the file names
-r
: rm invocation, touch invocation
-R
: chown invocation
-r
: Sorting the output
-R
: Which files are listed, chgrp invocation, rm invocation, cp invocation, chmod invocation
-S
: du invocation, install invocation, Sorting the output, ln invocation, cp invocation
-s
: install invocation, du invocation
-S
: Backup options
-s
: cp invocation, ln invocation
-S
: mv invocation
-s
: What information is listed
-t
: Sorting the output
-T
: General output formatting
-t
: df invocation
-T
: df invocation
-u
: cp invocation
-U
: Sorting the output
-u
: Sorting the output, mv invocation
-v
: chmod invocation, Sorting the output, rm invocation, cp invocation
-V
: cp invocation, install invocation, Backup options
-v
: install invocation
-V
: ln invocation
-v
: chown invocation
-V
: mv invocation
-v
: ln invocation, chgrp invocation, mv invocation
-w
: General output formatting
-X
: Sorting the output
-x
: df invocation, du invocation, General output formatting, cp invocation
-X FILE
: du invocation
4.2
filesystem type
: df invocation
access
time, changing
: touch invocation
access time
, printing or sorting files by
: Sorting the output
access time
, sorting files by
: Sorting the output
across
, listing files
: General output formatting
ago
in date strings
: Relative item in date strings
alternate ebcdic
, converting to
: dd invocation
always
color option
: General output formatting
am
in date strings
: Time of day item
ascii
, converting to
: dd invocation
atime
, changing
: touch invocation
atime
, printing or sorting files by
: Sorting the output
atime
, sorting files by
: Sorting the output
getdate
: Authors of getdate
auto
color option
: General output formatting
b
for block special file
: mknod invocation
block
(space-padding)
: dd invocation
BLOCK_SIZE
: Block size
bs
: dd invocation
touch
compatibility: touch invocation
c
for character special file
: mknod invocation
cbs
: dd invocation
cdfs
filesystem type
: df invocation
chgrp
: chgrp invocation
chmod
: chmod invocation
chown
: chown invocation
COLUMNS
: General output formatting
commas
, outputting between files
: General output formatting
conv
: dd invocation
count
: dd invocation
cp
: cp invocation
csh
syntax for color setup: dircolors invocation
ctime
, printing or sorting by
: Sorting the output
day
in date strings
: Relative item in date strings
dd
: dd invocation
df
: df invocation
DF_BLOCK_SIZE
: Block size
dir
: dir invocation
dircolors
: dircolors invocation
unlink
: rm invocation
du
: du invocation
DU_BLOCK_SIZE
: Block size
ebcdic
, converting to
: dd invocation
efs
filesystem type
: df invocation
du
: du invocation
existing
backup method
: Backup options
extension
, sorting files by
: Sorting the output
-
, removing: rm invocation
first
in date strings
: General date syntax
fortnight
in date strings
: Relative item in date strings
fsck
: rm invocation
getdate
: Date input formats
du
: du invocation
horizontal
, listing files
: General output formatting
hour
in date strings
: Relative item in date strings
hsfs
filesystem type
: df invocation
ibs
: dd invocation
if
: dd invocation
install
: install invocation
last day
: Day of week item
last
in date strings
: General date syntax
lcase
, converting to
: dd invocation
lchown
: chown invocation, chgrp invocation, chown invocation
du
: du invocation
ln
: ln invocation
long ls
format
: What information is listed
ls
: ls invocation
LS_BLOCK_SIZE
: Block size
LS_COLORS
: dircolors invocation
midnight
in date strings
: Time of day item
minute
in date strings
: Relative item in date strings
mkdir
: mkdir invocation
mkfifo
: mkfifo invocation
mknod
: mknod invocation
modification time
, sorting files by
: Sorting the output
modify
time, changing
: touch invocation
month
in date strings
: Relative item in date strings
mtime
, changing
: touch invocation
mv
: mv invocation
next day
: Day of week item
next
in date strings
: General date syntax
noerror
: dd invocation
none
color option
: General output formatting
none
, sorting option for ls
: Sorting the output
noon
in date strings
: Time of day item
notrunc
: dd invocation
now
in date strings
: Relative item in date strings
numbered
backup method
: Backup options
obs
: dd invocation
of
: dd invocation
du
to: du invocation
p
for FIFO file
: mknod invocation
cp
: cp invocation
pcfs
: df invocation
ls
: What information is listed
pm
in date strings
: Time of day item
POSIXLY_CORRECT
, and block size
: Block size
ln
: ln invocation
mv
: mv invocation
rm
: rm invocation
read
system call, and holes
: cp invocation
rm
: rm invocation
rmdir
: rmdir invocation
root
as default owner
: install invocation
seek
: dd invocation
sh
syntax for color setup: dircolors invocation
SHELL
environment variable, and color
: dircolors invocation
simple
backup method
: Backup options
SIMPLE_BACKUP_SUFFIX
: Backup options
single-column
output of files
: General output formatting
size of files
, sorting files by
: Sorting the output
skip
: dd invocation
ls
output: Sorting the output
status time
, printing or sorting by
: Sorting the output
status time
, sorting by
: Sorting the output
swab
(byte-swapping)
: dd invocation
du
: du invocation
sync
: sync invocation
sync
(padding with nulls)
: dd invocation
this
in date strings
: Relative item in date strings
time
: touch invocation
today
in date strings
: Relative item in date strings
tomorrow
in date strings
: Relative item in date strings
touch
: touch invocation
ucase
, converting to
: dd invocation
ufs
filesystem type
: df invocation
unblock
: dd invocation
unlink
: rm invocation
use
time, changing
: touch invocation
use time
, printing or sorting files by
: Sorting the output
use time
, sorting files by
: Sorting the output
vdir
: vdir invocation
verbose ls
format
: What information is listed
version
, sorting option for ls
: Sorting the output
version-control
Emacs variable
: Backup options
VERSION_CONTROL
: Backup options
vertical
sorted files in columns
: General output formatting
week
in date strings
: Relative item in date strings
year
in date strings
: Relative item in date strings
yesterday
in date strings
: Relative item in date strings