grep is always recursive

Preston Kutzner shizzlecash at
Sun Jan 25 04:31:41 UTC 2009

On Jan 24, 2009, at 9:42 AM, Hal Burgiss wrote:

> Does anyone know of a setting anywhere in Ubuntu (8.04), that would
> cause grep to *always* behave as if it were run as 'grep -r'? My home
> system always greps recursively, which is highly annoying. I cannot
> find an environment setting or system file to explain this, yet
> grepping something simple in my home dir, as an example, returns a
> huge list of files, including files in various subdirectories. It
> makes no difference whatsoever whether grep is invoked as 'grep' or
> 'grep -r', the behavior is identical. I have other 8.04 systems that
> don't do this, so its quite curious to me. What I want is equivalent
> to:
>  find -maxdepth 1 -exec grep -H $sometoken {} \;
> which is what I have to run now, if I am impatient (typically, yes),
> so as to avoid grepping through gigs of image and music files that
> live within $HOME subdirs.

Hal, by any chance does this behavior present itself if you log in as  
another user?  If you don't have any other users setup on your system,  
I would suggest adding a new user (temporarily, you can remove it  
later) and log in as the new user and try running grep and see if it  
still behaves the same way.  If it does not, it's something specific  
to your normal user account, and would therefore be some sort of  
environment setting in your $HOME dir.  If it still exhibits the same  
behavior, it means it's a system-wide environment setting.  At least  
it will help pin-down where we need to look (/etc, versus most likely  
one of the "dot" files in your home dir.)
-------------- next part --------------
A non-text attachment was scrubbed...
Name: PGP.sig
Type: application/pgp-signature
Size: 194 bytes
Desc: This is a digitally signed message part
URL: <>

More information about the ubuntu-users mailing list