Eric at Lucii.org 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.


-----BEGIN PGP SIGNED MESSAGE-----
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.

Eric



On 10/01/2011 09:41 PM, Paul Jungwirth wrote:
> On Sat, Oct 1, 2011 at 8:32 PM, Ryan T. Sawyer <sawyer07+plug@gmail.com> 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
-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.10 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iEYEARECAAYFAk6H364ACgkQ2sGpvXQrZ/7g8ACfRYgQDzbWppNSdk88lzq6gEC4
d2IAnR/NIMJ44ZnkYyUbQ+n6Eqaryq6t
=3cS9
-----END PGP SIGNATURE-----
___________________________________________________________________________
Philadelphia Linux Users Group         --        http://www.phillylinux.org
Announcements - http://lists.phillylinux.org/mailman/listinfo/plug-announce
General Discussion  --   http://lists.phillylinux.org/mailman/listinfo/plug