Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

most people seem to use cd and ls very frequently. Very often they are used one after another. This reminds me of a trick I heard in a talk by Damian Conway:

    alias cdd='cd $l; ls'
I can't find the original slides, here is a writeup by cromatic:

http://www.oreillynet.com/onlamp/blog/2003/07/oscon_2003_day...



I did that with this:

function z () { if [ $# = 0 ]; then ls -lFGh else cd "$*" && ls -lFGh fi }

That way if you don't specify a directory it just does an ls.

Edit: and apparently it took away my line breaks there, but it still makes sense.


I used to have cdl aliased to that, and lost track of it during a long sojourn in Windows. I'm still in the process of building out a really kickass bash again. Thanks for the reminder of that alias!


It seems so obvious, and yet it took me several years before I finally made a cd-ls alias. I made a mkdir-cd alias too.


Tab completion!!

Why the heck not?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: