->Title Page
->Intro
->Unix
-->Overview
-->File Structure
-->Online Manual
-->Basic Commands
-->Additional Commands
--->alias
--->ap
--->biff
->chmod
--->compress/uncompress
--->df
--->diff
--->du
--->echo
--->find
--->finger
--->ftp
--->grep
--->history
--->kill
--->look
--->mail
--->ps
--->script
--->setenv
--->source
--->spell
--->tar
--->telnet
--->umask
--->who
--->Miscellaneous
-->Login files
-->Special characters
-->Miscellaneous Tips
-->Things to try
->Vi editor
->Mirror sites
->Further reading

[ Up ]
[Prev][Home][Next]
[Author]

Unix ---> chmod

Your files and directories have a number of attributes that are set when they are created. Listing the files with the -la flag, i.e., ls -la, displays the attributes of each file and directory in the working directory. Here is an example listing:


    total 3
    drwxr-xr-x  2 taylor        512 Aug  2 08:41 .
    drwxrwxr-x 12 taylor       1024 Aug  2 08:41 ..
    -rw-r--r--  1 taylor          5 Aug  2 08:41 blue
    -rw-r--r--  1 taylor         12 Aug  2 08:41 green
    -rw-r--r--  1 taylor          7 Aug  2 08:41 yellow
To the far left of each file or directory name are ten characters which show the attributes. The first column indicates whether the entry is a directory (d) or not (-). The other nine characters are organized into three groups of the three. The first group pertains to the owner (that would be you for your files). The second group pertains to people in your group. The third group pertains to everyone else. Within each group of three are three characters. The first indicates read (r) permission. The second indicates write (w) permission. The third indicates execute (x) permission. If the permission is not present, a "-" will replace the r, w, or x.

The chmod (change mode) command lets you change the attributes on a file or directory. There are a number of forms, but I have chosen to cover the following syntax because of its similarity with umask. The syntax is as follows:


    chmod mode filename
where mode is a three digit octal number. The first digit pertains to the owners privileges. The second pertains to the groups privileges, and the third pertains to everyone elses privileges. Each octal digit is composed of the addition of three components. The read component is worth 4, the write component worth 2, and the execute component worth 1. Suppose I wanted the owner to have read, write, and execute privileges, the group to have read and write privileges, and everyone else to have read privileges only. The octal number I would use with chmod would be 764.

Site Statistics

Find this site useful? Want to give something back?

t a y l o r@l i n u x a v e.n e t

© 1993-2000 Christopher C. Taylor