Re: find/list read only files
From: Alan Connor (zzzzzz_at_xxx.yyy)
Date: 06/29/04
- Next message: Stephane CHAZELAS: "Re: removing lines from a file"
- Previous message: Jan Hovius: "Csh - How to distinguish between symbolic link and directory in script?"
- In reply to: Alan Connor: "Re: find/list read only files"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Date: Tue, 29 Jun 2004 09:45:18 GMT
On Tue, 29 Jun 2004 05:40:25 GMT, Alan Connor <zzzzzz@xxx.yyy> wrote:
>
>
> On 28 Jun 2004 21:03:30 -0700, Tron Thomas <tron.thomas@verizon.net> wrote:
>>
>>
>> In DOS a person can type:
>>
>> dir /ar
>>
>> and it will display all the files in the current directory that has a
>> read only attribute.
>>
>> What is an eqivalent UNIX command that will accomplish the same task?
>
> Unix/Linux permissions are a bit more complex than DOS permissions.
>
> It's simpler if you are looking for files with specific permissions.
>
> find . -type f -perm 440 -maxdepth 1 -print
>
> would find all of the regular files in your current directory with
> -r--r----- permissions, which is to say that user and group had
> only read permissions and other had no permissions.
>
>
> ls -l | grep '^-r--r-----'
>
> would accomplish the same thing.
>
> (drop the "-maxdepth 1" if you want it to search through all of
> the sub-directories too)
>
> If you wanted to find every file with read-only permissions of every
> possible combination, the script gets quite a bit longer.
>
> man find, man chmod, man grep
>
> This is one of the reasons that Unix/Linux are so much more secure
> than DOS/Windoze. It's a tradeoff...
>
>
> AC
>
Correction!
find . -type f ! -perm +ugo+wx -maxdepth 1 -print
will find all the files with no write or execute permissions,
which is pretty close to read-only, if not there.
You could alias that to something like "lr" to make it easy to
use again. What shell do you have?
AC
- Next message: Stephane CHAZELAS: "Re: removing lines from a file"
- Previous message: Jan Hovius: "Csh - How to distinguish between symbolic link and directory in script?"
- In reply to: Alan Connor: "Re: find/list read only files"
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Relevant Pages
|