A file is not merely its contents, a name, and a file type (see section 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 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:
chown
performs the same function as chgrp
.
The program accepts the following options. Also see section Common options.
lchown
system call is provided.
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.
lchown
system call is provided.
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.
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 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 section Common options.
touch
.
Go to the first, previous, next, last section, table of contents.