chmod Linux Commands

Topic

What is Linux chmod Command?

Explanation

chmod COMMAND:

chmod command allows you to alter / Change access rights to files and directories.
File Permission is given for users,group and others as,

SYNTAX:


The Syntax is
chmod [options] [MODE] FileName
File Permission
#File Permission
0 none
1 execute only
2 write only
3 write and execute
4 read only
5 read and execute
6 read and write
7 set all permissions

OPTIONS:


-c Displays names of only those files whose permissions are being changed
-f Suppress most error messages
-R Change files and directories recursively
-v Output version information and exit.

EXAMPLE:


  1. To view your files with what permission they are:
    ls -alt

    This command is used to view your files with what permission they are.
  2. To make a file readable and writable by the group and others.
    chmod066file1.txt
  3. To allow everyone to read, write, and execute the file
    chmod777file1.txt