Linux - NewbieThis Linux forum is for members that are new to Linux.
Just starting out and have a question?
If it is not in the man pages or the how-to's this is the place!
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
Hello All,
Can anyone give me some idea about the shell script that will display all the files and directories with rwx permission in a particular directory
Thank You
Which would match anything in the current directory with the user write bit set. You didn't say rwx permission for who, so, thats just an example.
From "man find"
Quote:
-perm mode
File's permission bits are exactly mode (octal or symbolic). Symbolic modes use mode 0 as a point of departure.
-perm -mode
All of the permission bits mode are set for the file.
-perm +mode
Any of the permission bits mode are set for the file.
You could also do it with ls and grep/
Code:
ls -l | grep rwx
But that will match for ANY of the UGO bits being set to rwx.
Hello
thank that was a great help but still i couldn't write shell script completely and well i want to display all the files and folders with rwx permission for user
And thank you fukawi1
still couldn't get what i was trying to do
"i need to list all the files from a particular directory with rwx permission for user using a shell script"
i tried to go through man but its too lengthy and kinda confusing as well
anyways thank you all
This will search for files in the directory you list under the user you want for files then filter with grep everything else but files with rwx permissions for the owner.
Quote:
find /Directory/you/want/to/search/ -user name -and -type f -exec ls -l {} \; | grep ^-rwx
@singhharmeet:
#!/bin/sh
echo "please enter path of the directory"
read path
ls -l -a $path | grep rwx
the above script displays all the files with rwx permission for all users. What do we need to alter so that is shows only files with rwx permission for user only.
grungesabin, you don't seem to understand how this site works. We're not going to do everything for you. People have given you hints as to how to write a script to do what you want and now you need to put some effort into learning and attempting to do the rest yourself. When you've attempted something, post and people will help you..
grungesabin, you don't seem to understand how this site works. We're not going to do everything for you. People have given you hints as to how to write a script to do what you want and now you need to put some effort into learning and attempting to do the rest yourself. When you've attempted something, post and people will help you..
Seconded, there is MORE than enough information, for multiple solutions to your problem, provided by a number of users contained within this thread...
Particularly considering your "too long didn't read" attitude towards the manpages.
Hey all
thank u so much for the help but as i have said i am extremely new to this OS that was the reason and it wasn't about my attitude but i wasn't getting everything from the manual.
From next time i will keep that in mind that i put enough effort but being a newbie i think i should ask question to clear up my doubts.
Thank you
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.