Thursday, October 4, 2012

UNIX Permissions (chmod Tips)

Some basic useful stuff on UNIX permissions and chmod command:
  1. 'ls' command outputs permissions for the specified file. It outputs permissions for all the files and directories in the current directory if you don't specify FILE_NAME:
    ls -lg FILE_NAME
  2. If you want to set permission for particular files or directories then you can use find + exec. The first command will change permission of all the directories. The second one specifies the search pattern - all .HTM files.
    find . -type d -exec chmod 755 {} \;
    find . -type f -name '*.htm*' -exec chmod 755 {} \;
    755 here is the permissions code.

No comments:

Post a Comment