hisoka Posted April 26, 2015 Share Posted April 26, 2015 I know how to change permission of a file for all users + write : $ chmod a+r example.txt However I do not know how to do it with two files in the same time is it like this : $ chmod a+r example1.txt example2.txt ?? or how is it exactly ? Link to comment Share on other sites More sharing options...
justsomeguy Posted April 27, 2015 Share Posted April 27, 2015 I don't think that chmod supports more than one filename. You can use options like -R to change all files in a directory, though. You might also be able to give it a pattern to replace any file that matches the pattern. Link to comment Share on other sites More sharing options...
hisoka Posted April 27, 2015 Author Share Posted April 27, 2015 hello justsomeguy how are you doing I hope good concerning your reply if for example I have a directory whose name is /home in this directory there are two files : example.txt and example1.txt and I want to change permissions of these two files in the home directory to for all users + write should I do it like this $ chmod a+r /home ? is this command true or wrong ? and if it is wrong what is the right one? Link to comment Share on other sites More sharing options...
justsomeguy Posted April 27, 2015 Share Posted April 27, 2015 That will change the permissions on the directory /home itself, not the files inside it. If you used "example*.txt" I think it will change any file that starts with "example" and ends with ".txt". 1 Link to comment Share on other sites More sharing options...
hisoka Posted April 30, 2015 Author Share Posted April 30, 2015 "That will change the permissions on the directory /home itself, not the files inside it" thank you for the valuable information . However I need to change the permission of both files in /home directory regardless their name and extensions for example lets say : I have two files example.txt and intelligent.php in directory /home and I want to change the permission for these both files to all users + write so how can I do it or what is the command to do it ? Link to comment Share on other sites More sharing options...
justsomeguy Posted April 30, 2015 Share Posted April 30, 2015 /home/* Link to comment Share on other sites More sharing options...
hisoka Posted April 30, 2015 Author Share Posted April 30, 2015 you mean like this: $ chmod a+r /home/* ? Link to comment Share on other sites More sharing options...
justsomeguy Posted April 30, 2015 Share Posted April 30, 2015 I believe that should work. Link to comment Share on other sites More sharing options...
hisoka Posted April 30, 2015 Author Share Posted April 30, 2015 ok thank you I will see and tell you Link to comment Share on other sites More sharing options...
Jonathanks Posted May 18, 2015 Share Posted May 18, 2015 (edited) That will work: on all files in the home directory, I think.Maybe you should consider naming your files semantically. For example, you may suffix files intended to have read-write permission with '_rw' before the file extension and use wildcard matching to set the permission on all of them at a time.(example:example_rw.txt, example1_rw.html...exampleN_rw.php$ chmod a+r /home/*_rw.*)I don't know if such would work but I hope you get the point. Just try it for yourself.I haven't used UNIX or LINUX before: I'm just a beginner with windows. I've seen so many recommendations for linux systems to programmers. Maybe one day I'll try a linux OS. Edited May 18, 2015 by Jonathanks 1 Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now