Finding a lost PYTHONPATH with find

J

John J. Lee

OK, this is really a reminder to myself next time I forget where I set
my PYTHONPATH and forget exactly how to invoke the GNU "find" command
;-)

Hope somebody else finds it useful too

find / -maxdepth 3 -size -100k -type f -exec grep -sli pythonpath '{}' \;


The minus in '-100k' (meaning "less than 100k") seems to be
undocumented, at least on my system. I suppose the -maxdepth is
redundant since I think find searches breadth-first by default.

The file I was looking for turned out to be in /etc/profile.d/, whose
existence I completely forgot about...


John
 
E

Edward Elliott

John said:
find / -maxdepth 3 -size -100k -type f -exec grep -sli pythonpath '{}' \;


The minus in '-100k' (meaning "less than 100k") seems to be
undocumented, at least on my system.

It should be standard in linux man pages, can't speak for other unices:

TESTS
Numeric arguments can be specified as

+n for greater than n,

-n for less than n,

n for exactly n.

Maybe you were fooled because it's not directly under the description of
-size.

I suppose the -maxdepth is
redundant since I think find searches breadth-first by default.

??? maxdepth determines how deep the search will look, not the order the
search occurs. Your search only find things within 3 levels of the root,
unless your directory tree goes no deeper than that (very unlikely) the
maxdepth can't be redundant.
 
J

John J. Lee

Edward Elliott said:
It should be standard in linux man pages, can't speak for other unices:

TESTS
Numeric arguments can be specified as

+n for greater than n,

-n for less than n,

n for exactly n.

Maybe you were fooled because it's not directly under the description of
-size.

Yes, that's right -- thanks.

??? maxdepth determines how deep the search will look, not the order the
search occurs. Your search only find things within 3 levels of the root,
unless your directory tree goes no deeper than that (very unlikely) the
maxdepth can't be redundant.

It can if you hit Control-C as soon as it finds the damn thing :) --
which is exactly what I would have done, of course.


John
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,769
Messages
2,569,579
Members
45,053
Latest member
BrodieSola

Latest Threads

Top