[NBLUG/talk] bash shell commands

Justin Thiessen thiessen at sonic.net
Fri Aug 29 09:08:00 PDT 2003


On Fri, Aug 29, 2003 at 10:59:48AM -0500, 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 <top level directory>

Should do the job.


> 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...

grep <pattern> *

Will search through all files in the current directory.

Obviously, 

grep <pattern> <directory>/*

will look through all files under the specified directory.

grep -r <pattern> <directory>/*

will recurse through all subdirectories under the specified directory in
its search.


Much more on both of these is available in the appropriate manpages.  (Try
"man rm" and "man grep".)

Justin Thiessen
thiessen at sonic.net




More information about the talk mailing list