Chmod Command – How to Change File, Directory Permissions in Linux

How to change file and directory permissions in linux using chmod command.

In Linux operating system everything is a file. If it is not a file then it’s a process so everything has default permission assigned. File permission defines which file has read,write,execute permission and for which user group.

In this article you will learn how file permissions work and how you change file permissions using chmod command.

How to Copy Files and Directories in Ubuntu.

Linux Command with Examples .

How to Change File, Directory Permissions in Linux

Before we start digging go to the terminal (shortcut ctrl+atl+T) and type ls -l .

It displays list of files and folders and their permssion.

So start from first column what rwx indicates.

r – stands for read permission
w – stands for write permission
x – stands for execute permission
(dash) – represents no permission is assigned

*** Beginning of three letter indicates owner permission, then group and next three for anyone else.

Chmod Command Examples – Change Files & Directory Permission

In Linux operating system  file and directory permission can be changed through chmod command.  Let’s learn how it works.

This command assigns read, write and execute permission to owner,usergroup and other users.

Subscribe Our Tutorials

Get Latest Updates on Facebook

Numeric representation of read,write and execute permission.

4 – read

2 – write

1 – execute

Combination of permission

0 – no permission, this person cannot read, write or execute

1 – execute only

2 – write only

3 – execute and write only (1 + 2)

4 – read only

5 – execute and read only (1 + 4)

6 – write and read only (2 + 4)

7 – execute, write and read (1 + 2 + 3)

How to create new files using Touch command.

Another example

Using this command we gave following permissions.

owner = read+write+execute permission

group = read+write

other = read

How to Remove Package through Ubuntu Terminal Command.

Apply read,write,execute permission to all files under directory.

To learn more about chmod command you can take the help of ubuntu manual. Just go to terminal and type

WebRewrite

About WebRewrite

I am technology lover who loves to keep updated with latest technology. My interest field is Web Development.
Tagged , , . Bookmark the permalink.