Finding a lost PYTHONPATH with find

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • John J. Lee

    #1

    Finding a lost PYTHONPATH with find

    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
  • Edward Elliott

    #2
    Re: Finding a lost PYTHONPATH with find

    John J. Lee wrote:
    [color=blue]
    > 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.[/color]

    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.

    [color=blue]
    > I suppose the -maxdepth is
    > redundant since I think find searches breadth-first by default.[/color]

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

    --
    Edward Elliott
    UC Berkeley School of Law (Boalt Hall)
    complangpython at eddeye dot net

    Comment

    • John J. Lee

      #3
      Re: Finding a lost PYTHONPATH with find

      Edward Elliott <nobody@127.0.0 .1> writes:
      [color=blue]
      > John J. Lee wrote:
      >[color=green]
      > > 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.[/color]
      >
      > 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.[/color]

      Yes, that's right -- thanks.

      [color=blue][color=green]
      > > I suppose the -maxdepth is
      > > redundant since I think find searches breadth-first by default.[/color]
      >
      > ??? 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.[/color]

      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

      Comment

      Working...