Eric at on 1 Oct 2011 20:51:24 -0700

[Date Prev] [Date Next] [Thread Prev] [Thread Next] [Date Index] [Thread Index]

Re: [PLUG] saw this on /. this morning.

Hash: SHA1

Hey Ryan,  I did write this as a function and briefly tested it just to see if it would work.  It does.

If I were to run it in my home directory [almost 300 Gigabytes] it would be a long time before I got an answer.  Your mileage may vary.

Here's what I use in this case:

locate string | sort

locate has already searched your hard drive (via a cron task) and built an index.  Taking advantage of that is way more reasonable than searching in real time... unless you need a real-time answer.

If I want to limit it to the "data" branch of my home directory then I'd do this:

locate string |grep ~eric/data | sort

Way, way faster.


On 10/01/2011 09:41 PM, Paul Jungwirth wrote:
> On Sat, Oct 1, 2011 at 8:32 PM, Ryan T. Sawyer <> wrote:
>> Is there an equivalent to this in Bash?
>> alias lsr 'ls -R | grep \!* | sort'
> In general, I think with bash it's easier to write functions rather
> than aliases. If you create a file with your functions for
> command-line shortcuts, you can source it in your .bash_profile. (Or
> just define the functions in .bash_profile itself.) If you create a
> function named lsr, you can use $1, and you can call it just like
> using an alias.
> Paul

- -- 
#  Eric Lucas
#                "Oh, I have slipped the surly bond of earth
#                 And danced the skies on laughter-silvered wings...
#                                        -- John Gillespie Magee Jr
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla -

Philadelphia Linux Users Group         --
Announcements -
General Discussion  --