Re: [SLUG] list files with certain permissions

From: Chuck Hast (wchast@gmail.com)
Date: Sat Jul 02 2005 - 12:51:25 EDT


On 7/2/05, Eben King <eben1@tampabay.rr.com> wrote:
> On Sat, 2 Jul 2005, Kwan Lowe wrote:
>
> > Chuck Hast wrote:
> > > Folks, I am trying to sort through a load of files and find some that need the
> > > permissions changed.
> > > Of course I can do a ls -al and see the whole thing, indeed I can dump it
> > > into less and go page by page, but I would like to really see the files that
> > > have the permissions set to 744, there are some that I need to set to 755.
> > >
> > > How can I see only those files with the 744 permissions?
> >
> > BTW, you can combine the find with an arbitrary command:
> >
> > find . -perm 744 -type f -exec chmod 755 {} \;
> >
> > The above will change *all* files (not directories) that have 744 perms
> > to 755 perms.
> >
> > To only list the files:
> >
> > find . -perm 744 -type f -exec ls -l {} \;
>
> If there are lots (like thousands) of files, try
>
> find . -perm 744 -type f | xargs chmod 755
>
> and
>
> find . -perm 744 -type f | xargs ls -l
>
> (for that last one, you can skip the "| xargs ..." for a listing of just the
> names)
>
> You can stick "-print0" before the pipe and "-0" after the "xargs" if you
> might have filenames with "bad" characters (and you have GNU tools, which
> you almost always do if you're running Linux).
>

That is the neat thing, you can do what needs to be done it is just
knowing how..
Thank you guys for the info, another one to file in the things to make life
easier file...

-- 
Chuck Hast 
To paraphrase my flight instructor;
"the only dumb question is the one you DID NOT ask resulting in my going
out and having to identify your bits and pieces in the midst of torn
and twisted metal."

----------------------------------------------------------------------- This list is provided as an unmoderated internet service by Networked Knowledge Systems (NKS). Views and opinions expressed in messages posted are those of the author and do not necessarily reflect the official policy or position of NKS or any of its employees.



This archive was generated by hypermail 2.1.3 : Fri Aug 01 2014 - 17:03:45 EDT