SLUG Mailing List Archives
[SLUG] Re: useful bash tricks thread
- To: slug@xxxxxxxxxxx
- Subject: [SLUG] Re: useful bash tricks thread
- From: Daniel Bush <dlb.id.au@xxxxxxxxx>
- Date: Sat, 7 Feb 2009 04:58:06 -0800 (PST)
- User-agent: G2/1.0
On Feb 6, 9:06 pm, Tony Sceats <t...@xxxxxxxxxxx> wrote:
> It's been a while since there's been a thread like this, so I thought it
> would be fun :)
> so, have you got any?
> I've got 2 to share today:
> alt >and then
> alt <
woo, that's kinda interesting.
It seems to pick the last "word" for each entry in the command-line
Definitely second ctrl-r; I can't imagine a world without it.. Well i
can, I used to work with an older unix guy who used some older version
of bourne or c-shell and used !<pattern> (something like that) to run
previous commands. No, never again. Mind you, I set my shell to use
vi mode (set -o vi) which I think would freak out a lot of people.
I often have several files of related commands that I "source" into my
This isn't a trick, more a set of conventions which I've found useful
to help keep me on top of things.
% . some_file.sh
This file would have the following format:
func1 - do X
func2 - do Y
Then you can simply do:
% func1 ...
to run your routine.
will list the commands and their descriptions assuming you've
There are number of plain words you can use for your function names:
You might do this to parcel up a bunch of related commands for some
area or thing. For instance, managing a database. 'go' might take
you to conf directory or put you into the database shell etc etc It's
also a good place to stash notes if you're learning something or
documenting it - either as comments or in the h() or simply in the
functions themselves. Listing things like relevant locations and
filenames as shell VARS is good documentation too.
My other even more OT tip: if you use the commandline a lot and you
haven't tried "screen", try it and become the super nerd you were
always meant to be.