I’ve been meaning to do this for a while, but now that I’m working on lots of identical systems, I finally have checked my bashrc into source control. Over the past couple years, I’ve accrued some useful tricks. My number one useful alias is virc
, which I’ve now adapted to scm form:
alias virc='svn update; vi ~/.bashrc; source ~/.bashrc; svn ci ~/.bashrc -m "virc bashrc auto-update"'
This is, I think the secret to being sure that you put that tricky 20 command pipe, or the path that you type over and over again. With the virc
, I’m 4-letters away from pasting that and having it immediately available at the prompt. The scm calls make sure that I’m editing the latest version and that I check it right in.
A couple bits of laziness philosophy:
single letters
– I used to have things likecdwww
, but my laziness has progressed to new levels, so now I alias single letters to changing folders. Typically they go like this:
export w='/var/www'
alias u="cdd $u"The
cdd
is an alias I have to pushd. I also have some things bound to relative paths. For example, I haveh
bound to htdocs, so I can typew
to get to my web folder, and eitherh
to get to the htdocs orl
to get to the lib folder.tl
– Simple shortcuts, like in this case for tailing logs, are great for chaining together. If you’re doing a lot of tl | grep ‘foo’, you’ll probably save as much time over the years as that mega-command you create that you don’t use all that oftenmultiple hosts
– here’s what I use to create host specific branches (I probalby will need to change to globbing or regex matching)
if [ `hostname` == "muffins" ]; then
export svn='file:///var/svn'
fimultiple files
– for stuff that I don’t want check in, I have a separate file now:
if [ -f ~/.mybashrc ]; then
source ~/.mybashrc
fiThe multi-file loading can be nested in the multi-host conditionals for loading files for specific hosts.
hostnames
– Same premise as above but for SSHing. I used to have things like sshrf
, but now I do whatever’s shorter (ssh[shortcut] or [hostname])
Unfortunately, I haven’t seen any good shell-tip sharing sites, but it would be interesting. — I got sidetracked here, and it’s late, so maybe to be continued.