home *** CD-ROM | disk | FTP | other *** search
/ Geek Gadgets 1 / ADE-1.bin / ade-dist / fileutils-3.13-bin.lha / info / fileutils.info-1 (.txt) < prev    next >
GNU Info File  |  1996-10-12  |  50KB  |  964 lines

  1. This is Info file fileutils.info, produced by Makeinfo-1.64 from the
  2. input file /ade-src/fsf/fileutils/doc/fileutils.texi.
  3. START-INFO-DIR-ENTRY
  4. * File utilities: (fileutils).  GNU file utilities.
  5. * chgrp: (fileutils)chgrp invocation.           Change file groups.
  6. * chown: (fileutils)chown invocation.           Change file owners/groups.
  7. * chmod: (fileutils)chmod invocation.           Change file permissions.
  8. * cp: (fileutils)cp invocation.                 Copy files.
  9. * dd: (fileutils)dd invocation.                 Copy and convert a file.
  10. * df: (fileutils)df invocation.                 Report filesystem disk usage.
  11. * dir: (fileutils)dir invocation.               List directories briefly.
  12. * dircolors: (fileutils)dircolors invocation.   Color setup for ls.
  13. * du: (fileutils)du invocation.                 Report on disk usage.
  14. * install: (fileutils)install invocation.       Copy and change attributes.
  15. * ln: (fileutils)ln invocation.                 Make links between files.
  16. * ls: (fileutils)ls invocation.                 List directory contents.
  17. * mkdir: (fileutils)mkdir invocation.           Create directories.
  18. * mkfifo: (fileutils)mkfifo invocation.         Create FIFOs: (named pipes).
  19. * mknod: (fileutils)mknod invocation.           Create special files.
  20. * mv: (fileutils)mv invocation.                 Rename files.
  21. * rm: (fileutils)rm invocation.                 Remove files.
  22. * rmdir: (fileutils)rmdir invocation.           Remove empty directories.
  23. * sync: (fileutils)sync invocation.             Synchronize memory and disk.
  24. * touch: (fileutils)touch invocation.           Change file timestamps.
  25. * vdir: (fileutils)vdir invocation.             List directories verbosely.
  26. END-INFO-DIR-ENTRY
  27.    This file documents the GNU set of file utilities.
  28.    Copyright (C) 1994, 95, 96 Free Software Foundation, Inc.
  29.    Permission is granted to make and distribute verbatim copies of this
  30. manual provided the copyright notice and this permission notice are
  31. preserved on all copies.
  32.    Permission is granted to copy and distribute modified versions of
  33. this manual under the conditions for verbatim copying, provided that
  34. the entire resulting derived work is distributed under the terms of a
  35. permission notice identical to this one.
  36.    Permission is granted to copy and distribute translations of this
  37. manual into another language, under the above conditions for modified
  38. versions, except that this permission notice may be stated in a
  39. translation approved by the Foundation.
  40. File: fileutils.info,  Node: Top,  Next: Introduction,  Up: (dir)
  41. GNU file utilities
  42. ******************
  43.    This manual minimally documents version 3.13 of the GNU file
  44. utilities.
  45. * Menu:
  46. * Introduction::                Caveats, overview, and authors.
  47. * Common options::              Common options.
  48. * File permissions::            Access modes.
  49. * Date input formats::          Specifying date strings.
  50. * Directory listing::           ls dir vdir d v dircolors
  51. * Basic operations::            cp dd install mv rm
  52. * Special file types::          ln mkdir rmdir mkfifo mknod
  53. * Changing file attributes::    chgrp chmod chown touch
  54. * Disk usage::                  df du sync
  55. * Index::                       General index.
  56. File: fileutils.info,  Node: Introduction,  Next: Common options,  Prev: Top,  Up: Top
  57. Introduction
  58. ************
  59.    This manual is incomplete: No attempt is made to explain basic file
  60. concepts in a way suitable for novices.  Thus, if you are interested,
  61. please get involved in improving this manual.  The entire GNU community
  62. will benefit.
  63.    The GNU file utilities are mostly compatible with the POSIX.2
  64. standard.
  65.    Please report bugs to `bug-gnu-utils@prep.ai.mit.edu'.  Remember to
  66. include the version number, machine architecture, input files, and any
  67. other information needed to reproduce the bug: your input, what you
  68. expected, what you got, and why it is wrong.  Diffs are welcome, but
  69. please include a description of the problem as well, since this is
  70. sometimes difficult to infer. *Note Bugs: (gcc)Bugs.
  71.    This manual is based on the Unix man pages in the distribution, which
  72. were originally written by David MacKenzie and updated by Jim Meyering.
  73. Franc,ois Pinard did the initial conversion to Texinfo format.  Karl
  74. Berry did the indexing, some reorganization, and editing of the results.
  75. Richard Stallman contributed his usual invaluable insights to the
  76. overall process.
  77. File: fileutils.info,  Node: Common options,  Next: File permissions,  Prev: Introduction,  Up: Top
  78. Common options
  79. **************
  80.    Certain options are available in all of these programs (in fact,
  81. every GNU program should accept them).  Rather than writing identical
  82. descriptions for each of the programs, they are described here.
  83. `--help'
  84.      Print a usage message listing all available options, then exit
  85.      successfully.
  86. `--version'
  87.      Print the version number, then exit successfully.
  88. * Menu:
  89. * Backup options::              -b -S -V, in some programs.
  90. File: fileutils.info,  Node: Backup options,  Up: Common options
  91. Backup options
  92. ==============
  93.    Some GNU programs (at least `cp', `install', `ln', and `mv')
  94. optionally make backups of files before writing new versions.  These
  95. options control the details of these backups.  The options are also
  96. briefly mentioned in the descriptions of the particular programs.
  97. `--backup'
  98.      Make backups of files that are about to be overwritten or removed.
  99.      Without this option, the original versions are destroyed.
  100. `-S SUFFIX'
  101. `--suffix=SUFFIX'
  102.      Append SUFFIX to each backup file made with `-b'.  If this option
  103.      is not specified, the value of the `SIMPLE_BACKUP_SUFFIX'
  104.      environment variable is used.  And if `SIMPLE_BACKUP_SUFFIX' is not
  105.      set, the default is `~', just as in Emacs.
  106. `-V METHOD'
  107. `--version-control=METHOD'
  108.      Use METHOD to determine the type of backups made with `-b'.  If
  109.      this option is not specified, the value of the `VERSION_CONTROL'
  110.      environment variable is used.  And if `VERSION_CONTROL' is not set,
  111.      the default backup type is `existing'.
  112.      This option corresponds to the Emacs variable `version-control';
  113.      the same values for METHOD are accepted as in Emacs.  This options
  114.      also more descriptive name.  The valid METHODs (unique
  115.      abbreviations are accepted):
  116.     `t'
  117.     `numbered'
  118.           Always make numbered backups.
  119.     `nil'
  120.     `existing'
  121.           Make numbered backups of files that already have them, simple
  122.           backups of the others.
  123.     `never'
  124.     `simple'
  125.           Always make simple backups.
  126. File: fileutils.info,  Node: File permissions,  Next: Date input formats,  Prev: Common options,  Up: Top
  127. File permissions
  128. ****************
  129.    Each file has a set of "permissions" that control the kinds of
  130. access that users have to that file.  The permissions for a file are
  131. also called its "access mode".  They can be represented either in
  132. symbolic form or as an octal number.
  133. * Menu:
  134. * Mode Structure::              Structure of file permissions.
  135. * Symbolic Modes::              Mnemonic permissions representation.
  136. * Numeric Modes::               Permissions as octal numbers.
  137. File: fileutils.info,  Node: Mode Structure,  Next: Symbolic Modes,  Up: File permissions
  138. Structure of File Permissions
  139. =============================
  140.    There are three kinds of permissions that a user can have for a file:
  141.   1. permission to read the file.  For directories, this means
  142.      permission to list the contents of the directory.
  143.   2. permission to write to (change) the file.  For directories, this
  144.      means permission to create and remove files in the directory.
  145.   3. permission to execute the file (run it as a program).  For
  146.      directories, this means permission to access files in the
  147.      directory.
  148.    There are three categories of users who may have different
  149. permissions to perform any of the above operations on a file:
  150.   1. the file's owner;
  151.   2. other users who are in the file's group;
  152.   3. everyone else.
  153.    Files are given an owner and group when they are created.  Usually
  154. the owner is the current user and the group is the group of the
  155. directory the file is in, but this varies with the operating system, the
  156. filesystem the file is created on, and the way the file is created.  You
  157. can change the owner and group of a file by using the `chown' and
  158. `chgrp' commands.
  159.    In addition to the three sets of three permissions listed above, a
  160. file's permissions have three special components, which affect only
  161. executable files (programs) and, on some systems, directories:
  162.   1. set the process's effective user ID to that of the file upon
  163.      execution (called the "setuid bit").  No effect on directories.
  164.   2. set the process's effective group ID to that of the file upon
  165.      execution (called the "setgid bit").  For directories on some
  166.      systems, put files created in the directory into the same group as
  167.      the directory, no matter what group the user who creates them is
  168.      in.
  169.   3. save the program's text image on the swap device so it will load
  170.      more quickly when run (called the "sticky bit").  For directories
  171.      on some systems, prevent users from removing files that they do
  172.      not own in the directory; this is called making the directory
  173.      "append-only".
  174. File: fileutils.info,  Node: Symbolic Modes,  Next: Numeric Modes,  Prev: Mode Structure,  Up: File permissions
  175. Symbolic Modes
  176. ==============
  177.    "Symbolic modes" represent changes to files' permissions as
  178. operations on single-character symbols.  They allow you to modify either
  179. all or selected parts of files' permissions, optionally based on their
  180. previous values, and perhaps on the current `umask' as well (*note
  181. Umask and Protection::.).
  182.    The format of symbolic modes is:
  183.      [ugoa...][[+-=][rwxXstugo...]...][,...]
  184.    The following sections describe the operators and other details of
  185. symbolic modes.
  186. * Menu:
  187. * Setting Permissions::          Basic operations on permissions.
  188. * Copying Permissions::          Copying existing permissions.
  189. * Changing Special Permissions:: Special permissions.
  190. * Conditional Executability::    Conditionally affecting executability.
  191. * Multiple Changes::             Making multiple changes.
  192. * Umask and Protection::              The effect of the umask.
  193. File: fileutils.info,  Node: Setting Permissions,  Next: Copying Permissions,  Up: Symbolic Modes
  194. Setting Permissions
  195. -------------------
  196.    The basic symbolic operations on a file's permissions are adding,
  197. removing, and setting the permission that certain users have to read,
  198. write, and execute the file.  These operations have the following
  199. format:
  200.      USERS OPERATION PERMISSIONS
  201. The spaces between the three parts above are shown for readability only;
  202. symbolic modes can not contain spaces.
  203.    The USERS part tells which users' access to the file is changed.  It
  204. consists of one or more of the following letters (or it can be empty;
  205. *note Umask and Protection::., for a description of what happens then).
  206. When more than one of these letters is given, the order that they are
  207. in does not matter.
  208.      the user who owns the file;
  209.      other users who are in the file's group;
  210.      all other users;
  211.      all users; the same as `ugo'.
  212.    The OPERATION part tells how to change the affected users' access to
  213. the file, and is one of the following symbols:
  214.      to add the PERMISSIONS to whatever permissions the USERS already
  215.      have for the file;
  216.      to remove the PERMISSIONS from whatever permissions the USERS
  217.      already have for the file;
  218.      to make the PERMISSIONS the only permissions that the USERS have
  219.      for the file.
  220.    The PERMISSIONS part tells what kind of access to the file should be
  221. changed; it is zero or more of the following letters.  As with the
  222. USERS part, the order does not matter when more than one letter is
  223. given.  Omitting the PERMISSIONS part is useful only with the `='
  224. operation, where it gives the specified USERS no access at all to the
  225. file.
  226.      the permission the USERS have to read the file;
  227.      the permission the USERS have to write to the file;
  228.      the permission the USERS have to execute the file.
  229.    For example, to give everyone permission to read and write a file,
  230. but not to execute it, use:
  231.      a=rw
  232.    To remove write permission for from all users other than the file's
  233. owner, use:
  234.      go-w
  235. The above command does not affect the access that the owner of the file
  236. has to it, nor does it affect whether other users can read or execute
  237. the file.
  238.    To give everyone except a file's owner no permission to do anything
  239. with that file, use the mode below.  Other users could still remove the
  240. file, if they have write permission on the directory it is in.
  241.      go=
  242. Another way to specify the same thing is:
  243.      og-rxw
  244. File: fileutils.info,  Node: Copying Permissions,  Next: Changing Special Permissions,  Prev: Setting Permissions,  Up: Symbolic Modes
  245. Copying Existing Permissions
  246. ----------------------------
  247.    You can base a file's permissions on its existing permissions.  To do
  248. this, instead of using `r', `w', or `x' after the operator, you use the
  249. letter `u', `g', or `o'.  For example, the mode
  250.      o+g
  251. adds the permissions for users who are in a file's group to the
  252. permissions that other users have for the file.  Thus, if the file
  253. started out as mode 664 (`rw-rw-r--'), the above mode would change it
  254. to mode 666 (`rw-rw-rw-').  If the file had started out as mode 741
  255. (`rwxr----x'), the above mode would change it to mode 745
  256. (`rwxr--r-x').  The `-' and `=' operations work analogously.
  257. File: fileutils.info,  Node: Changing Special Permissions,  Next: Conditional Executability,  Prev: Copying Permissions,  Up: Symbolic Modes
  258. Changing Special Permissions
  259. ----------------------------
  260.    In addition to changing a file's read, write, and execute
  261. permissions, you can change its special permissions.  *Note Mode
  262. Structure::, for a summary of these permissions.
  263.    To change a file's permission to set the user ID on execution, use
  264. `u' in the USERS part of the symbolic mode and `s' in the PERMISSIONS
  265. part.
  266.    To change a file's permission to set the group ID on execution, use
  267. `g' in the USERS part of the symbolic mode and `s' in the PERMISSIONS
  268. part.
  269.    To change a file's permission to stay permanently on the swap device,
  270. use `o' in the USERS part of the symbolic mode and `t' in the
  271. PERMISSIONS part.
  272.    For example, to add set user ID permission to a program, you can use
  273. the mode:
  274.      u+s
  275.    To remove both set user ID and set group ID permission from it, you
  276. can use the mode:
  277.      ug-s
  278.    To cause a program to be saved on the swap device, you can use the
  279. mode:
  280.      o+t
  281.    Remember that the special permissions only affect files that are
  282. executable, plus, on some systems, directories (on which they have
  283. different meanings; *note Mode Structure::.).  Using `a' in the USERS
  284. part of a symbolic mode does not cause the special permissions to be
  285. affected; thus,
  286.      a+s
  287. has *no effect*.  You must use `u', `g', and `o' explicitly to affect
  288. the special permissions.  Also, the combinations `u+t', `g+t', and
  289. `o+s' have no effect.
  290.    The `=' operator is not very useful with special permissions; for
  291. example, the mode:
  292.      o=t
  293. does cause the file to be saved on the swap device, but it also removes
  294. all read, write, and execute permissions that users not in the file's
  295. group might have had for it.
  296. File: fileutils.info,  Node: Conditional Executability,  Next: Multiple Changes,  Prev: Changing Special Permissions,  Up: Symbolic Modes
  297. Conditional Executability
  298. -------------------------
  299.    There is one more special type of symbolic permission: if you use
  300. `X' instead of `x', execute permission is affected only if the file
  301. already had execute permission or is a directory.  It affects
  302. directories' execute permission even if they did not initially have any
  303. execute permissions set.
  304.    For example, this mode:
  305.      a+X
  306. gives all users permission to execute files (or search directories) if
  307. anyone could before.
  308. File: fileutils.info,  Node: Multiple Changes,  Next: Umask and Protection,  Prev: Conditional Executability,  Up: Symbolic Modes
  309. Making Multiple Changes
  310. -----------------------
  311.    The format of symbolic modes is actually more complex than described
  312. above (*note Setting Permissions::.).  It provides two ways to make
  313. multiple changes to files' permissions.
  314.    The first way is to specify multiple OPERATION and PERMISSIONS parts
  315. after a USERS part in the symbolic mode.
  316.    For example, the mode:
  317.      og+rX-w
  318. gives users other than the owner of the file read permission and, if it
  319. is a directory or if someone already had execute permission to it,
  320. gives them execute permission; and it also denies them write permission
  321. to it file.  It does not affect the permission that the owner of the
  322. file has for it.  The above mode is equivalent to the two modes:
  323.      og+rX
  324.      og-w
  325.    The second way to make multiple changes is to specify more than one
  326. simple symbolic mode, separated by commas.  For example, the mode:
  327.      a+r,go-w
  328. gives everyone permission to read the file and removes write permission
  329. on it for all users except its owner.  Another example:
  330.      u=rwx,g=rx,o=
  331. sets all of the non-special permissions for the file explicitly.  (It
  332. gives users who are not in the file's group no permission at all for
  333.    The two methods can be combined.  The mode:
  334.      a+r,g+x-w
  335. gives all users permission to read the file, and gives users who are in
  336. the file's group permission to execute it, as well, but not permission
  337. to write to it.  The above mode could be written in several different
  338. ways; another is:
  339.      u+r,g+rx,o+r,g-w
  340. File: fileutils.info,  Node: Umask and Protection,  Prev: Multiple Changes,  Up: Symbolic Modes
  341. The Umask and Protection
  342. ------------------------
  343.    If the USERS part of a symbolic mode is omitted, it defaults to `a'
  344. (affect all users), except that any permissions that are *set* in the
  345. system variable `umask' are *not affected*.  The value of `umask' can
  346. be set using the `umask' command.  Its default value varies from system
  347. to system.
  348.    Omitting the USERS part of a symbolic mode is generally not useful
  349. with operations other than `+'.  It is useful with `+' because it
  350. allows you to use `umask' as an easily customizable protection against
  351. giving away more permission to files than you intended to.
  352.    As an example, if `umask' has the value 2, which removes write
  353. permission for users who are not in the file's group, then the mode:
  354.      +w
  355. adds permission to write to the file to its owner and to other users who
  356. are in the file's group, but *not* to other users.  In contrast, the
  357. mode:
  358.      a+w
  359. ignores `umask', and *does* give write permission for the file to all
  360. users.
  361. File: fileutils.info,  Node: Numeric Modes,  Prev: Symbolic Modes,  Up: File permissions
  362. Numeric Modes
  363. =============
  364.    File permissions are stored internally as 16 bit integers.  As an
  365. alternative to giving a symbolic mode, you can give an octal (base 8)
  366. number that corresponds to the internal representation of the new mode.
  367. This number is always interpreted in octal; you do not have to add a
  368. leading 0, as you do in C.  Mode 0055 is the same as mode 55.
  369.    A numeric mode is usually shorter than the corresponding symbolic
  370. mode, but it is limited in that it can not take into account a file's
  371. previous permissions; it can only set them absolutely.
  372.    The permissions granted to the user, to other users in the file's
  373. group, and to other users not in the file's group are each stored as
  374. three bits, which are represented as one octal digit.  The three special
  375. permissions are also each stored as one bit, and they are as a group
  376. represented as another octal digit.  Here is how the bits are arranged
  377. in the 16 bit integer, starting with the lowest valued bit:
  378.      Value in  Corresponding
  379.      Mode      Permission
  380.      
  381.                Other users not in the file's group:
  382.         1      Execute
  383.         2      Write
  384.         4      Read
  385.      
  386.                Other users in the file's group:
  387.        10      Execute
  388.        20      Write
  389.        40      Read
  390.      
  391.                The file's owner:
  392.       100      Execute
  393.       200      Write
  394.       400      Read
  395.      
  396.                Special permissions:
  397.      1000      Save text image on swap device
  398.      2000      Set group ID on execution
  399.      4000      Set user ID on execution
  400.    For example, numeric mode 4755 corresponds to symbolic mode
  401. `u=rwxs,go=rx', and numeric mode 664 corresponds to symbolic mode
  402. `ug=rw,o=r'.  Numeric mode 0 corresponds to symbolic mode `ugo='.
  403. File: fileutils.info,  Node: Date input formats,  Next: Directory listing,  Prev: File permissions,  Up: Top
  404. Date input formats
  405. ******************
  406.    This section describes the textual date representations that GNU
  407. programs accept.  These are the strings you, as a user, can supply as
  408. arguments to the various programs.  The C interface (via the `getdate'
  409. function) is not described here.
  410.    Although the date syntax here can represent any possible time since
  411. zero A.D., computer integers are not big enough for such a
  412. (comparatively) long time.  The earliest date semantically allowed on
  413. Unix systems is midnight, 1 January 1970 UCT.
  414. * Menu:
  415. * General date syntax::            Common rules.
  416. * Calendar date item::             19 Dec 1994.
  417. * Time of day item::               9:20pm.
  418. * Timezone item::                  EST, DST, BST, UCT, AHST, ...
  419. * Day of week item::               Monday and others.
  420. * Relative item in date strings::  next tuesday, 2 years ago.
  421. * Pure numbers in date strings::   19931219, 1440.
  422. * Authors of getdate::             Bellovin, Salz, Berets, et al.
  423. File: fileutils.info,  Node: General date syntax,  Next: Calendar date item,  Up: Date input formats
  424. General date syntax
  425. ===================
  426.    A "date" is a string, possibly empty, containing many items
  427. separated by whitespace.  The whitespace may be omitted when no
  428. ambiguity arises.  The empty string means the beginning of today (i.e.,
  429. midnight).  Order of the items is immaterial.  A date string may contain
  430. many flavors of items:
  431.    * calendar date items
  432.    * time of the day items
  433.    * time zone items
  434.    * day of the week items
  435.    * relative items
  436.    * pure numbers.
  437. We describe each of these item types in turn, below.
  438.    A few numbers may be written out in words in most contexts.  This is
  439. most useful for specifying day of the week items or relative items (see
  440. below).  Here is the list: `first' for 1, `next' for 2, `third' for 3,
  441. `fourth' for 4, `fifth' for 5, `sixth' for 6, `seventh' for 7, `eighth'
  442. for 8, `ninth' for 9, `tenth' for 10, `eleventh' for 11 and `twelfth'
  443. for 12.  Also, `last' means exactly -1.
  444.    When a month is written this way, it is still considered to be
  445. written numerically, instead of being "spelled in full"; this changes
  446. the allowed strings.
  447.    Alphabetic case is completely ignored in dates.  Comments may be
  448. introduced between round parentheses, as long as included parentheses
  449. are properly nested.  Hyphens not followed by a digit are currently
  450. ignored.  Leading zeros on numbers are ignored.
  451. File: fileutils.info,  Node: Calendar date item,  Next: Time of day item,  Prev: General date syntax,  Up: Date input formats
  452. Calendar date item
  453. ==================
  454.    A "calendar date item" specifies a day of the year.  It is specified
  455. differently, depending on whether the month is specified numerically or
  456. literally.  All these strings specify the same calendar date:
  457.      1970-09-17           # ISO 8601.
  458.      70-9-17              # This century assumed by default.
  459.      70-09-17             # Leading zeros are ignored.
  460.      9/17/72              # Common U.S. writing.
  461.      24 September 1972
  462.      24 Sept 72           # September has a special abbreviation.
  463.      24 Sep 72            # Three-letter abbreviations always allowed.
  464.      Sep 24, 1972
  465.      24-sep-72
  466.      24sep72
  467.    The year can also be omitted.  In this case, the last specified year
  468. is used, or the current year if none.  For example:
  469.      9/17
  470.      sep 17
  471.    Here are the rules.
  472.    For numeric months, the ISO 8601 format `YEAR-MONTH-DAY' is allowed,
  473. where YEAR is any positive number, MONTH is a number between 01 and 12,
  474. and DAY is a number between 01 and 31.  A leading zero must be present
  475. if a number is less than ten.  If YEAR is less than 100, then 1900 is
  476. added to it to force a date in this century.  The construct
  477. `MONTH/DAY/YEAR', popular in the United States, is accepted.  Also
  478. `MONTH/DAY', omitting the year.
  479.    Literal months may be spelled out in full: `January', `February',
  480. `March', `April', `May', `June', `July', `August', `September',
  481. `October', `November' or `December'.  Literal months may be abbreviated
  482. to their first three letters, possibly followed by an abbreviating dot.
  483. It is also permitted to write `Sept' instead of `September'.
  484.    When months are written literally, the calendar date may be given as
  485. any of the following:
  486.      DAY MONTH YEAR
  487.      DAY MONTH
  488.      MONTH DAY YEAR
  489.      DAY-MONTH-YEAR
  490.    Or, omitting the year:
  491.      MONTH DAY
  492. File: fileutils.info,  Node: Time of day item,  Next: Timezone item,  Prev: Calendar date item,  Up: Date input formats
  493. Time of day item
  494. ================
  495.    A "time of day item" in date strings specifies the time on a given
  496. day.  Here are some examples, all of which represent the same time:
  497.      20:02:0
  498.      20:02
  499.      8:02pm
  500.      20:02-0500      # In EST (Eastern U.S. Standard Time).
  501.    More generally, the time of the day may be given as
  502. `HOUR:MINUTE:SECOND', where HOUR is a number between 0 and 23, MINUTE
  503. is a number between 0 and 59, and SECOND is a number between 0 and 59.
  504. Alternatively, `:SECOND' can be omitted, in which case it is taken to
  505. be zero.
  506.    If the time is followed by `am' or `pm' (or `a.m.' or `p.m.'), HOUR
  507. is restricted to run from 1 to 12, and `:MINUTE' may be omitted (taken
  508. to be zero).  `am' indicates the first half of the day, `pm' indicates
  509. the second half of the day.  In this notation, 12 is the predecessor of
  510. 1: midnight is `12am' while noon is `12pm'.
  511.    The time may alternatively be followed by a timezone correction,
  512. expressed as `SHHMM', where S is `+' or `-', HH is a number of zone
  513. hours and MM is a number of zone minutes.  When a timezone correction
  514. is given this way, it forces interpretation of the time in UTC,
  515. overriding any previous specification for the timezone or the local
  516. timezone.  The MINUTE part of the time of the day may not be elided
  517. when a timezone correction is used.  This is the only way to specify a
  518. timezone correction by fractional parts of an hour.
  519.    Either `am'/`pm' or a timezone correction may be specified, but not
  520. both.
  521. File: fileutils.info,  Node: Timezone item,  Next: Day of week item,  Prev: Time of day item,  Up: Date input formats
  522. Timezone item
  523. =============
  524.    A "timezone item" specifies an international timezone, indicated by
  525. a small set of letters.  Any included period is ignored.  Military
  526. timezone designations use a single letter.  Currently, only integral
  527. zone hours may be represented in a timezone item.  See the previous
  528. section for a finer control over the timezone correction.
  529.    Here are many non-daylight-savings-time timezones, indexed by the
  530. zone hour value.
  531.      `GMT' for Greenwich Mean, `UT' or `UTC' for Universal
  532.      (Coordinated), `WET' for Western European and `Z' for militaries.
  533.      `WAT' for West Africa and `A' for militaries.
  534.      `AT' for Azores and `B' for militaries.
  535.      `C' for militaries.
  536.      `AST' for Atlantic Standard and `D' for militaries.
  537.      `E' for militaries and `EST' for Eastern Standard.
  538.      `CST' for Central Standard and `F' for militaries.
  539.      `G' for militaries and `MST' for Mountain Standard.
  540.      `H' for militaries and `PST' for Pacific Standard.
  541.      `I' for militaries and `YST' for Yukon Standard.
  542. +1000
  543.      `AHST' for Alaska-Hawaii Standard, `CAT' for Central Alaska, `HST'
  544.      for Hawaii Standard and `K' for militaries.
  545. +1100
  546.      `L' for militaries and `NT' for Nome.
  547. +1200
  548.      `IDLW' for International Date Line West and `M' for militaries.
  549.      `CET' for Central European, `FWT' for French Winter, `MET' for
  550.      Middle European, `MEWT' for Middle European Winter, `N' for
  551.      militaries and `SWT' for Swedish Winter.
  552.      `EET' for Eastern European, USSR Zone 1 and `O' for militaries.
  553.      `BT' for Baghdad, USSR Zone 2 and `P' for militaries.
  554.      `Q' for militaries and `ZP4' for USSR Zone 3.
  555.      `R' for militaries and `ZP5' for USSR Zone 4.
  556.      `S' for militaries and `ZP6' for USSR Zone 5.
  557.      `T' for militaries and `WAST' for West Australian Standard.
  558.      `CCT' for China Coast, USSR Zone 7 and `U' for militaries.
  559.      `JST' for Japan Standard, USSR Zone 8 and `V' for militaries.
  560. -1000
  561.      `EAST' for East Australian Standard, `GST' for Guam Standard, USSR
  562.      Zone 9 and `W' for militaries.
  563. -1100
  564.      `X' for militaries.
  565. -1200
  566.      `IDLE' for International Date Line East, `NZST' for New Zealand
  567.      Standard, `NZT' for New Zealand and `Y' for militaries.
  568.    Here are many DST timezones, indexed by the zone hour value.  Also,
  569. by following a non-DST timezone by the string `DST' in a separate word
  570. (that is, separated by some whitespace), the corresponding DST timezone
  571. may be specified.
  572.      `BST' for British Summer.
  573.      `ADT' for Atlantic Daylight.
  574.      `EDT' for Eastern Daylight.
  575.      `CDT' for Central Daylight.
  576.      `MDT' for Mountain Daylight.
  577.      `PDT' for Pacific Daylight.
  578.      `YDT' for Yukon Daylight.
  579. +1000
  580.      `HDT' for Hawaii Daylight.
  581.      `MEST' for Middle European Summer, `MESZ' for Middle European
  582.      Summer, `SST' for Swedish Summer and `FST' for French Summer.
  583.      `WADT' for West Australian Daylight.
  584. -1000
  585.      `EADT' for Eastern Australian Daylight.
  586. -1200
  587.      `NZDT' for New Zealand Daylight.
  588. File: fileutils.info,  Node: Day of week item,  Next: Relative item in date strings,  Prev: Timezone item,  Up: Date input formats
  589. Day of week item
  590. ================
  591.    The explicit mention of a day of the week will forward the date
  592. (only if necessary) to reach that day of the week in the future.
  593.    Days of the week may be spelled out in full: `Sunday', `Monday',
  594. `Tuesday', `Wednesday', `Thursday', `Friday' or `Saturday'.  Days may
  595. be abbreviated to their first three letters, optionally followed by a
  596. period.  The special abbreviations `Tues' for `Tuesday', `Wednes' for
  597. `Wednesday' and `Thur' or `Thurs' for `Thursday' are also allowed.
  598.    A number may precede a day of the week item to move forward
  599. supplementary weeks.  It is best used in expression like `third
  600. monday'.  In this context, `last DAY' or `next DAY' is also acceptable;
  601. they move one week before or after the day that DAY by itself would
  602. represent.
  603.    A comma following a day of the week item is ignored.
  604. File: fileutils.info,  Node: Relative item in date strings,  Next: Pure numbers in date strings,  Prev: Day of week item,  Up: Date input formats
  605. Relative item in date strings
  606. =============================
  607.    "Relative items" adjust a date (or the current date if none) forward
  608. or backward.  The effects of relative items accumulate.  Here are some
  609. examples:
  610.      1 year
  611.      1 year ago
  612.      3 years
  613.      2 days
  614.    The unit of time displacement may be selected by the string `year'
  615. or `month' for moving by whole years or months.  These are fuzzy units,
  616. as years and months are not all of equal duration.  More precise units
  617. are `fortnight' which is worth 14 days, `week' worth 7 days, `day'
  618. worth 24 hours, `hour' worth 60 minutes, `minute' or `min' worth 60
  619. seconds, and `second' or `sec' worth one second.  An `s' suffix on
  620. these units is accepted and ignored.
  621.    The unit of time may be preceded by a multiplier, given as an
  622. optionally signed number.  Unsigned numbers are taken as positively
  623. signed.  No number at all implies 1 for a multiplier.  Following a
  624. relative item by the string `ago' is equivalent to preceding the unit
  625. by a multiplicator with value -1.
  626.    The string `tomorrow' is worth one day in the future (equivalent to
  627. `day'), the string `yesterday' is worth one day in the past (equivalent
  628. to `day ago').
  629.    The strings `now' or `today' are relative items corresponding to
  630. zero-valued time displacement, these strings come from the fact a
  631. zero-valued time displacement represents the current time when not
  632. otherwise change by previous items.  They may be used to stress other
  633. items, like in `12:00 today'.  The string `this' also has the meaning
  634. of a zero-valued time displacement, but is preferred in date strings
  635. like `this thursday'.
  636.    When a relative item makes the resulting date to cross the boundary
  637. between DST and non-DST (or vice-versa), the hour is adjusted according
  638. to the local time.
  639. File: fileutils.info,  Node: Pure numbers in date strings,  Next: Authors of getdate,  Prev: Relative item in date strings,  Up: Date input formats
  640. Pure numbers in date strings
  641. ============================
  642.    The precise intepretation of a pure decimal number is dependent of
  643. the context in the date string.
  644.    If the decimal number is of the form YYYYMMDD and no other calendar
  645. date item (*note Calendar date item::.) appears before it in the date
  646. string, then YYYY is read as the year, MM as the month number and DD as
  647. the day of the month, for the specified calendar date.
  648.    If the decimal number is of the form HHMM and no other time of day
  649. item appears before it in the date string, then HH is read as the hour
  650. of the day and MM as the minute of the hour, for the specified time of
  651. the day.  MM can also be omitted.
  652.    If both a calendar date and a time of day appear to the left of a
  653. number in the date string, but no relative item, then the number
  654. overrides the year.
  655. File: fileutils.info,  Node: Authors of getdate,  Prev: Pure numbers in date strings,  Up: Date input formats
  656. Authors of `getdate'
  657. ====================
  658.    `getdate' was originally implemented by Steven M. Bellovin
  659. (`smb@research.att.com') while at the University of North Carolina at
  660. Chapel Hill.  The code was later tweaked by a couple of people on
  661. Usenet, then completely overhauled by Rich $alz (`rsalz@bbn.com') and
  662. Jim Berets (`jberets@bbn.com') in August, 1990.  Various revisions for
  663. the GNU system were made by David MacKenzie, Jim Meyering, and others.
  664.    This chapter was originally produced by Franc,ois Pinard
  665. (`pinard@iro.umontreal.ca') from the `getdate.y' source code, and then
  666. edited by K. Berry (`kb@cs.umb.edu').
  667. File: fileutils.info,  Node: Directory listing,  Next: Basic operations,  Prev: Date input formats,  Up: Top
  668. Directory listing
  669. *****************
  670.    This chapter describes the `ls' command and its variants `dir' and
  671. `vdir', which list information about files.
  672. * Menu:
  673. * ls invocation::               List directory contents.
  674. * dir invocation::              Briefly ls.
  675. * vdir invocation::             Verbosely ls.
  676. * dircolors invocation::        Color setup for ls, etc.
  677. File: fileutils.info,  Node: ls invocation,  Next: dir invocation,  Up: Directory listing
  678. `ls': List directory contents
  679. =============================
  680.    The `ls' program lists information about files (of any type,
  681. including directories).  Options and file arguments can be intermixed
  682. arbitrarily, as usual.
  683.    For non-option command-line arguments that are directories, by
  684. default `ls' lists the contents of directories, not recursively, and
  685. omitting files with names beginning with `.'.  For other non-option
  686. arguments, by default `ls' lists just the file name.  If no non-option
  687. arguments are specified, `ls' lists the contents of the current
  688. directory.
  689.    By default, the output is sorted alphabetically.  If standard output
  690. is a terminal, the output is in columns (sorted vertically); otherwise,
  691. they are listed one per line.
  692.    Because `ls' is such a fundamental program, it has accumulated many
  693. options over the years.  They are described in the subsections below;
  694. within each section, options are listed alphabetically (ignoring case).
  695. The division of options into the subsections is not absolute, since some
  696. options affect more than one aspect of `ls''s operation.
  697.    The `-g' option is accepted but ignored, for compatibility with
  698. Unix.  Also see *Note Common options::.
  699. * Menu:
  700. * Which files are listed::
  701. * What information is listed::
  702. * Sorting the output::
  703. * General output formatting::
  704. * Formatting the file names::
  705. File: fileutils.info,  Node: Which files are listed,  Next: What information is listed,  Up: ls invocation
  706. Which files are listed
  707. ----------------------
  708.    These options determine which files `ls' lists information for.  By
  709. default, any files and the contents of any directories on the command
  710. line are shown.
  711. `--all'
  712.      List all files in directories, including files that start with `.'.
  713. `--almost-all'
  714.      List all files in directories except for `.' and `..'.
  715. `--ignore-backups'
  716.      Do not list files that end with `~', unless they are given on the
  717.      command line.
  718. `--directory'
  719.      List just the names of directories, as with other types of files,
  720.      rather than listing their contents.
  721. `--ignore'
  722.      Do not list files whose names match the shell pattern (not regular
  723.      expression) PATTERN unless they are given on the command line.  As
  724.      in the shell, an initial `.' in a file name does not match a
  725.      wildcard at the start of PATTERN.
  726. `--dereference'
  727.      List the files linked to by symbolic links instead of listing the
  728.      contents of the links.
  729. `--recursive'
  730.      List the contents of all directories recursively.
  731. File: fileutils.info,  Node: What information is listed,  Next: Sorting the output,  Prev: Which files are listed,  Up: ls invocation
  732. What information is listed
  733. --------------------------
  734.    These options affect the information that `ls' displays.  By
  735. default, only file names are shown.
  736. `--dired'
  737.      With the long listing (`-l') format, print an additional line after
  738.      the main output:
  739.           //DIRED// BEG1 END1 BEG2 END2 ...
  740.      The BEGN and ENDN are unsigned integers which record the byte
  741.      position of the beginning and end of each file name in the output.
  742.      This makes it easy for Emacs to find the names, even when they
  743.      contain unusual characters such as space or newline, without fancy
  744.      searching.
  745.      If directories are being listed recursively (`-R'), output a
  746.      similar line after each subdirectory:
  747.           //SUBDIRED// BEG1 END1 ...
  748. `--no-group'
  749.      Inhibit display of group information in a long format directory
  750.      listing.  (This is the default in some non-GNU versions of `ls',
  751.      so we provide this option for compatibility.)
  752. `--inode'
  753.      Print the inode number (also called the file serial number and
  754.      index number) of each file to the left of the file name.  (This
  755.      number uniquely identifies each file within a particular
  756.      filesystem.)
  757. `--format=long'
  758. `--format=verbose'
  759.      In addition to the name of each file, print the file type,
  760.      permissions, number of hard links, owner name, group name, size in
  761.      bytes, and timestamp (by default, the modification time).  For
  762.      files with a time more than six months old or more than one hour
  763.      into the future, the timestamp contains the year instead of the
  764.      time of day.
  765.      For each directory that is listed, preface the files with a line
  766.      `total BLOCKS', where BLOCKS is the total disk space used by all
  767.      files in that directory.  By default, 1024-byte blocks are used;
  768.      if the environment variable `POSIXLY_CORRECT' is set, 512-byte
  769.      blocks are used (unless the `-k' option is given).  The BLOCKS
  770.      computed counts each hard link separately; this is arguably a
  771.      deficiency.
  772.      The permissions listed are similar to symbolic mode specifications
  773.      (*note Symbolic Modes::.).  But `ls' combines multiple bits into
  774.      the third character of each set of permissions as follows:
  775.     `s'
  776.           If the setuid or setgid bit and the corresponding executable
  777.           bit are both set.
  778.     `S'
  779.           If the setuid or setgid bit is set but the corresponding
  780.           executable bit is not set.
  781.     `t'
  782.           If the sticky bit and the other-executable bit are both set.
  783.     `T'
  784.           If the sticky bit is set but the other-executable bit is not
  785.           set.
  786.     `x'
  787.           If the executable bit is set and none of the above apply.
  788.     `-'
  789.           Otherwise.
  790.      Produce long format directory listings, but don't display group
  791.      information.  It is equivalent to using `--format=long' with
  792.      `--no-group' .  This option is provided for compatibility with
  793.      other versions of `ls'.
  794. `--size'
  795.      Print the size of each file in 1024-byte blocks to the left of the
  796.      file name.  If the environment variable `POSIXLY_CORRECT' is set,
  797.      512-byte blocks are used instead, unless the `-k' option is given
  798.      (*note General output formatting::.).
  799.      For files that are NFS-mounted from an HP-UX system to a BSD
  800.      system, this option reports sizes that are half the correct
  801.      values.  On HP-UX systems, it reports sizes that are twice the
  802.      correct values for files that are NFS-mounted from BSD systems.
  803.      This is due to a flaw in HP-UX; it also affects the HP-UX `ls'
  804.      program.
  805. File: fileutils.info,  Node: Sorting the output,  Next: General output formatting,  Prev: What information is listed,  Up: ls invocation
  806. Sorting the output
  807. ------------------
  808.    These options change the order in which `ls' sorts the information
  809. it outputs.  By default, sorting is done by character code (e.g., ASCII
  810. order).
  811. `--time=ctime'
  812. `--time=status'
  813.      Sort according to the status change time (the `ctime' in the
  814.      inode).  If the long listing format (`-l') is being used, print the
  815.      status change time instead of the modification time.
  816.      Primarily, like `-U'--do not sort; list the files in whatever
  817.      order they are stored in the directory.  But also enable `-a' (list
  818.      all files) and disable `-l', `--color', and `-s' (if they were
  819.      specified before the `-f').
  820. `--reverse'
  821.      Reverse whatever the sorting method is--e.g., list files in reverse
  822.      alphabetical order, youngest first, smallest first, or whatever.
  823. `--sort=size'
  824.      Sort by file size, largest first.
  825. `--sort=time'
  826.      Sort by modification time (the `mtime' in the inode), newest first.
  827. `--time=atime'
  828. `--time=access'
  829. `--time=use'
  830.      Sort by access time (the `atime' in the inode).  If the long
  831.      listing format is being used, print the last access time.
  832. `--sort=none'
  833.      Do not sort; list the files in whatever order they are stored in
  834.      the directory.  (Do not do any of the other unrelated things that
  835.      `-f' does.)  This is especially useful when listing very large
  836.      directories, since not doing any sorting can be noticeably faster.
  837. `--sort=extension'
  838.      Sort directory contents alphabetically by file extension
  839.      (characters after the last `.'); files with no extension are
  840.      sorted first.
  841. File: fileutils.info,  Node: General output formatting,  Next: Formatting the file names,  Prev: Sorting the output,  Up: ls invocation
  842. General output formatting
  843. -------------------------
  844.    These options affect the appearance of the overall output.
  845. `--format=single-column'
  846.      List one file per line.  This is the default for `ls' when standard
  847.      output is not a terminal.
  848. `--format=vertical'
  849.      List files in columns, sorted vertically.  This is the default for
  850.      `ls' if standard output is a terminal.  It is always the default
  851.      for the `dir' and `d' programs.
  852. `--color [=WHEN]'
  853.      Specify whether to use color for distinguishing file types.  WHEN
  854.      may be omitted, or one of:
  855.         * none Do not use color at all.  This is the default.
  856.         * auto Only use color if standard output is a terminal.
  857.         * always Always use color.  Specifying `--color' and no WHEN is
  858.      equivalent to `--color=always'.
  859. `--classify'
  860.      Append a character to each file name indicating the file type.
  861.      Also, for regular files that are executable, append `*'.  The file
  862.      type indicators are `/' for directories, `@' for symbolic links,
  863.      `|' for FIFOs, `=' for sockets, and nothing for regular files.
  864. `--full-time'
  865.      List times in full, rather than using the standard abbreviation
  866.      heuristics.  The format is the same as `date''s default; it's not
  867.      possible to change this, but you can extract out the date string
  868.      with `cut' and then pass the result to `date -d'.  *Note `date'
  869.      invocation: (sh-utils)date invocation.
  870.      This is most useful because the time output includes the seconds.
  871.      (Unix filesystems store file timestamps only to the nearest
  872.      second, so this option shows all the information there is.)  For
  873.      example, this can help when you have a Makefile that is not
  874.      regenerating files properly.
  875. `--kilobytes'
  876.      If file sizes are being listed, print them in kilobytes.  This
  877.      overrides the environment variable `POSIXLY_CORRECT'.
  878. `--format=commas'
  879.      List files horizontally, with as many as will fit on each line,
  880.      separated by `, ' (a comma and a space).
  881. `--numeric-uid-gid'
  882.      List the numeric UID and GID instead of the names.
  883.      Append a character to each file name indicating the file type.
  884.      This is like `-F', except that executables are not marked.
  885. `-x FORMAT'
  886. `--format=across'
  887. `--format=horizontal'
  888.      List the files in columns, sorted horizontally.
  889. `-T COLS'
  890. `--tabsize=COLS'
  891.      Assume that each tabstop is COLS columns wide.  The default is 8.
  892.      `ls' uses tabs where possible in the output, for efficiency.  If
  893.      COLS is zero, do not use tabs at all.
  894. `--width=COLS'
  895.      Assume the screen is COLS columns wide.  The default is taken from
  896.      the terminal settings if possible; otherwise the environment
  897.      variable `COLUMNS' is used if it is set; otherwise the default is
  898.      80.
  899. File: fileutils.info,  Node: Formatting the file names,  Prev: General output formatting,  Up: ls invocation
  900. Formatting the file names
  901. -------------------------
  902.    These options change how file names themselves are printed.
  903. `--escape'
  904.      Quote nongraphic characters in file names using alphabetic and
  905.      octal backslash sequences like those used in C.
  906. `--literal'
  907.      Do not quote file names.
  908. `--hide-control-chars'
  909.      Print question marks instead of nongraphic characters in file
  910.      names.  This is the default.
  911. `--quote-name'
  912.      Enclose file names in double quotes and quote nongraphic
  913.      characters as in C.
  914. File: fileutils.info,  Node: dir invocation,  Next: vdir invocation,  Prev: ls invocation,  Up: Directory listing
  915. `dir': Briefly list directory contents
  916. ======================================
  917.    `dir' (also installed as `d') is equivalent to `ls -C'; that is,
  918. files are by default listed in columns, sorted vertically.
  919.    *Note `ls': ls invocation.
  920. File: fileutils.info,  Node: vdir invocation,  Next: dircolors invocation,  Prev: dir invocation,  Up: Directory listing
  921. `vdir': Verbosely list directory contents
  922. =========================================
  923.    `vdir' (also installed as `v')is equivalent to `ls -l'; that is,
  924. files are by default listed in long format.
  925. File: fileutils.info,  Node: dircolors invocation,  Prev: vdir invocation,  Up: Directory listing
  926. `dircolors': Color setup for `ls'
  927. =================================
  928.    `dircolors' outputs a sequence of shell commands to set up the
  929. terminal for color output from `ls' (and `dir', etc.).  Typical usage:
  930.      eval `dircolors [OPTION]... [FILE]`
  931.    If FILE is specified, `dircolors' reads it to determine which colors
  932. to use for which file types and extensions.  Otherwise, a precompiled
  933. database is used.  For details on the format of these files, run
  934. `dircolors --print-data-base'.
  935.    The output is a shell command to set the `LS_COLOR' environment
  936. variable.  You can specify the shell syntax to use on the command line,
  937. or `dircolors' will guess it from the value of the `SHELL' environment
  938. variable.
  939.    The program accepts the following options.  Also see *Note Common
  940. options::.
  941. `--sh'
  942. `--bourne-shell'
  943.      Output Bourne shell commands.  This is the default if the `SHELL'
  944.      environment variable is set and does not end with `csh' or `tcsh'.
  945. `--csh'
  946. `--c-shell'
  947.      Output C shell commands.  This is the default if `SHELL' ends with
  948.      `csh' or `tcsh'.
  949. `--print-data-base'
  950.      Print the (compiled-in) default color configuration database.  This
  951.      output is itself a valid configuration file, and is fairly
  952.      descriptive of the possibilities.
  953. File: fileutils.info,  Node: Basic operations,  Next: Special file types,  Prev: Directory listing,  Up: Top
  954. Basic operations
  955. ****************
  956.    This chapter describes the commands for basic file manipulation:
  957. copying, moving (renaming), and deleting (removing).
  958. * Menu:
  959. * cp invocation::               Copy files.
  960. * dd invocation::               Convert and copy a file.
  961. * install invocation::          Copy files and set attributes.
  962. * mv invocation::               Move (rename) files.
  963. * rm invocation::               Remove files or directories.
  964.