Museum

Home

Lab Overview

Retrotechnology Articles

Online Manuals

⇒ touch(1) — AIX PS/2 1.2.1

Media Vault

Software Library

Restoration Projects

Artifacts Sought

Related Articles

date

utime



TOUCH(1,C)                  AIX Commands Reference                   TOUCH(1,C)



-------------------------------------------------------------------------------
touch



PURPOSE

Updates the access and modification times of a file.

SYNTAX


         +- -a -m -+   +------------------+   +- directory -+
touch ---| +-----+ |---|              1   |---|             |---|
         +-| -a  |-+   | +-- mmddhhmm --+ | ^ +--- file ----+ |
          ^| -c  ||    +-|              |-+ +-----------------+
          || -f  ||      +- mmddhhmmyy -+
          || -m  ||
          |+-----+|
          +-------+


-----------------
1 The current year is the default year.


DESCRIPTION

The touch command updates the access and modification times of each file or
directory named to the one specified on the command line.  If you do not
specify a time, touch uses the current time.  If you specify a file that does
not exist, touch creates a file with that name unless you request otherwise
with the -c flag.

To touch an existing file, you must be the owner of the file or have write
permission to the file.

The environment variables LANG and LC_TIME, if defined, specify the order of
month and day in the date specification and of hour and minute in the time
specification.  Otherwise, these orders default to mmdd and hhmm.

The return code from touch is the number of files for which the times could not
be successfully modified (including files that did not exist and were not
created).

FLAGS

-a Changes only the access time.

-c Does not create the file if it does not already exist.





Processed November 8, 1990        TOUCH(1,C)                                  1





TOUCH(1,C)                  AIX Commands Reference                   TOUCH(1,C)



-f Attempts to force the touch in spite of write permissions on a file.  This
   option is unnecessary in AIX but is provided for compatibility with other
   systems.

-m Changes only the modification time.

EXAMPLES

  1. To update the access and modification times of a file:

      touch  program.c

    This sets the last access and last modification times of "program.c" to the
    current date and time.  If "program.c" does not exist, touch creates an
    empty file with that name.

  2. To avoid creating a new file:

      touch  -c  program.c

  3. To update only the modification time:

      touch  -m  *.o

    This updates only the last modification times of the files in the current
    directory that end with ".o".  touch is often used in this way to alter the
    results of the make command.

  4. To explicitly set the access and modification times:

      touch  -c  02171425  program.c

    This sets the access and modification dates to 14:25 (2:25 p.m.) February
    17 of the current year.

RELATED INFORMATION

See the following command:  "date."

See the utime system call in AIX Operating System Technical Reference.

See "Introduction to International Character Support" in Managing the AIX
Operating System.












Processed November 8, 1990        TOUCH(1,C)                                  2



Typewritten Software • bear@typewritten.org • Edmonds, WA 98026