[NBLUG/talk] Neat command line tricks

Kevin Bingham kevin at oreilly.com
Tue Jul 8 11:25:01 PDT 2003


Hello All,

Here three neat command line tricks by Damian Conway (uber Perl Guru), 
found in a blog by Chromatic.

Does anybody else have similar neat tricks?

Kudos!
-Kevin

Your NBLUG and Sonoma Perl Mongers O'Reilly Host
kevin at oreilly.com
http://sonoma.pm.org/


http://www.oreillynet.com/pub/wlg/3443
--------------------------------------------------------------------

First, Damian recommends not setting your PATH on one line in your shell 
customization file. Instead, he recommends something like this:

PATH=$PATH:/usr/local/bin
PATH=$PATH:/sw/bin
export PATH=$PATH:~/bin
(Excuse the bash-isms; Damian uses tcsh.) The benefits are twofold. First, 
it's easier to read. Second, it's easier to modify. If I want to change the 
order of path items, I can just swap the appropriate lines.

The next trick was putting my shell aliases in a separate file, .aliases. 
My .bashrc just sources this file. This allows me to use the following 
alias to edit or to add aliases:

alias realias="vim ~/.aliases; source ~/.aliases"
This is really handy, allowing me to tweak my aliases in the same process. 
Sure, I'm only saving two commands, but saving two commands makes me work 
that much more quickly.

The final trick is cdd, an alias that changes to a directory and 
immediately lists the files in the directory:

alias cdd='cd $l; ls'
It only saves a couple of characters, but it saves a couple of characters.
--------------------------------------------------------------------




More information about the talk mailing list