[NBLUG/talk] bash shell commands
Andru Luvisi
luvisi at andru.sonoma.edu
Fri Aug 29 09:13:00 PDT 2003
On Fri, 29 Aug 2003 jeff at dreadidread.homelinux.org wrote:
> I have a couple of basic bash shell questions that would really be useful to
> know but I haven't figured out yet (I'm still a new linux user).
>
> How do I delete a directory and everything in the directory (including
> subdirectories) in one command? is there some option of the 'rmdir -f ./dir'
> that I'm missing? I want to get rid of my phpmyadmin from the web and I don't
> want to do through rm -f *.php in every directory followed by rmdir... :-)
rm -rf ./dir
> How do I grep through every file in a directory ( and optionally the
> subdirectories )? When I try find *.py | grep 'something' I'm coming up
> empty...
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
--
Andru Luvisi
Quote Of The Moment:
Heisenberg may have been here.
More information about the talk
mailing list