[NBLUG/talk] bash shell commands

Jeremy Turner jeremy at linuxwebguy.com
Tue Sep 2 17:13:00 PDT 2003


On Fri, 2003-08-29 at 09:30, Andru Luvisi wrote:
> On Linux you can use:
>   rgrep 'someting' ./dir
> or
>   find ./dir -type f -print0 |xargs -0 grep 'something'
> 
> -print0 and -0 are GNU extensions to find and xargs.  On systems with
> non-GNU find and xargs you can use:
>   find ./dir -type f -print |xargs grep 'something'
> 
> ...but you may have problems with filenames that have spaces and newlines
> in their names.
> 
> Andru

Another way to skin a cat:

find ./dir -type f -print -exec grep 'something' \{\}\;

Notice the -exec flag and the escaped {}; (necessary for the find
command).

This is helpful for making sure directory permissions are correct: 

chmod -R 644
find ./dir -type d -print -exec chmod 755 \{\}\;

Jeremy

-- 
Jeremy Turner <jeremy at linuxwebguy.com>
The LinuxWebGuy
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: This is a digitally signed message part
Url : http://nblug.org/pipermail/talk/attachments/20030902/82282544/attachment.pgp


More information about the talk mailing list