Suggest a StoryDo you have a news tip? We would like to hear from you.

[How To]: Use Chmod Modes For changing Files and Directories Permissions

Spread the love

For who interesting to know how to use Chmod using command line, usually to change file permission for reading, writing, and executing file as a program it’s quite easy using GUI, it’s even better using command line. Just checked Wikipedia for Chmod file permissions. it’s really good idea to change file permissions using command line.

to change the file permissions you can go to file’s properties then permissions, and that’s quite easy to use.

it’s the same to use the command line. so let’s check some examples.

1. Showing current permissions for a file

Open terminal then type

[cc lang=”php]

ls -l launchy_2.5-1_i386.deb 

The output showing current mode

[cc lang=”php]

-rwxr-xr-x 1 mb mb 900452 2010-06-21 11:57 launchy_2.5-1_i386.deb  

if you compared the output line with the image there you will figure out that both are the same.

” -rwxr-xr-x “ means it has read – write – executable access for both user and group called ” mb “

including last modify date and the name of this file.

2. Showing Current modes located on a directory

Using same command on first example but with the directory name ex.

ls -l " directory name "

without quotes

3. How To Change File Permissions?

There are two ways to change files permission, also you will be able to know more special modes for changing files permissions Octal Numbers and symbolic modes.

First example using octal numbers with four digits

chmod 0755 " launchy_2.5-1_i386.deb "

Replace the file name between quotes with your file name.

Second example symbolic modes.

chmod a+rw launchy_2.5-1_i386.deb

This command will change the file to read and write only, it was executable before we do that in the first step.

Another example using symbolic modes.

chmod +rwx launchy_2.5-1_i386.deb

This command will restore all permissions to the default.

4. Listing Resources and Links might help also.

  1. Chmod Wikipedia   Here
  2. Files permissions for Here
  3. Chmod Tutorials   Here

That’s it for Now.

Spread the love

Leave a Reply