About Us Documentation

Contact Site Map
 

  

WinPak
Documentation

Go to the previous, next chapter.

Changing file attributes

Files are not merely contents, a name, and a file type (see section Special file types). They also have 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 all this a file's attributes.

These commands change file attributes.

chown: Change file owner and group

chown changes the user and/or group ownership of each given file. Synopsis:

chown [option]... new-owner file...

The first non-option argument, new-owner, specifies the new owner and/or group, as follows (with no embedded white space):

[owner] [ [:.] [group] ]

Specifically:

owner If only an owner (a user name or numeric user id) is given, that user is made the owner of each given file, and the files' group is not changed.

owner.group owner:group If the owner is followed by a colon or dot and a group (a group name or numeric group id), with no spaces between them, the group ownership of the files is changed as well (to group).

owner. owner: If a colon or dot but no group name follows owner, that user is made the owner of the files and the group of the files is changed to owner's login group.

.group :group If the colon or dot and following group are given, but the owner is omitted, only the group of the files is changed; in this case, chown performs the same function as chgrp.

The program accepts the following options. Also see section Common options.

-c --changes -c --changes Verbosely describe the action for each file whose ownership actually changes.

-f --silent --quiet -f --silent --quiet Do not print error messages about files whose ownership cannot be changed.

-v --verbose -v --verbose Verbosely describe the action (or non-action) taken for every file.

-R --recursive -R --recursive Recursively change ownership of directories and their contents.

chgrp: Change group ownership

chgrp changes the group ownership of each given file to group, which can be either a group name or a numeric group id. Synopsis:

chgrp [option]... group file...

The program accepts the following options. Also see section Common options.

-c --changes -c --changes Verbosely describe the action for each file whose group actually changes.

-f --silent --quiet -f --silent --quiet Do not print error messages about files whose group cannot be changed.

-v --verbose -v --verbose Verbosely describe the action or non-action taken for every file.

-R --recursive -R --recursive Recursively change the group ownership of directories and their contents.

chmod: Change access permissions

chmod changes the access permissions of the named files. Synopsis:

chmod [option]... mode 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.

The first non-option argument, mode, specifies the new permissions. See the section below for details.

The program accepts the following options. Also see section Common options.

-c --changes -c --changes Verbosely describe the action for each file whose permissions actually changes.

-f --silent --quiet -f --silent --quiet Do not print error messages about files whose permissions cannot be changed.

-v --verbose -v --verbose Verbosely describe the action or non-action taken for every file.

-R --recursive -R --recursive Recursively change permissions of directories and their contents.

touch: Change file timestamps

touch 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 filename.

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 section Common options.

-a --time=atime --time=access --time=use -a --time atime, changing access time, changing use time, changing Change the access time only.

-c --no-create -c --no-create Do not create files that do not exist.

-d --date=time -d --date time Use time instead of the current time. It can contain month names, timezones, am and pm, etc. @xref{date invocation} invocation, , sh-utils, Shell utilities}.

-f Ignored; for compatibility with BSD versions of touch.

-m --time=mtime --time=modify -m --time mtime, changing modify time, changing Change the modification time only.

-r reference-file --file=reference-file -r --file Use the times of reference-file instead of the current time.

-t MMDDhhmm[[CC]YY][.ss] Use the argument (months, days, hours, minutes, optional century and years, optional seconds) instead of the current time.


 

 

Email addresses listed on this site may  NOT be used for unsolicited commercial email.

Ready-to-Run Software, Inc Privacy Statement

Portions (c)Copyright, 1996-2005 by Ready-to-Run Software, Inc
(All rights reserved.)
212 Cedar Cove
Lansing, NY 14882
Phone: 607 533 UNIX (8649)
Fax: 607 533 4002