Possible Duplicate:
Make cd automatically ls

I think that it would be very useful to have a unix utility that combines 'cd' and 'ls' so that when you change your directory, it automatically lists the files in that directory. I have tried to do this using shell scripts, and C programs and a combination of the two, but nothing seems to work, because any 'cd' or 'chdir()' call in a shell script/ c program only changes the directory for that instance (not for the shell).

The psudocode would look like (if it was only this simple!):

cd $1

If anyone has any ideas of how to implement this I would really appreciate it!

Thanks, Kevin


in your .bashrc:

cl() { cd "$1" && ls -al; }

you would use cl instead of cd to change directory and then ls -al

Not the answer you're looking for? Browse other questions tagged or ask your own question.