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
The output showing current mode
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.
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
Replace the file name between quotes with your file name.
Second example symbolic modes.
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.
This command will restore all permissions to the default.
4. Listing Resources and Links might help also.
That’s it for Now.