cd then ls new directory in same command
I would like to use something like a 'cdl' alias that would cd into the directory i choose and then ls the contents automatically. I find myself using ls after i cd into a directory all the time. Something like:
alias='cdl=cd $1;ls' usage: cdl /local/dir (not very good at scripting up commands but hopefully that makes sense) |
you have the right idea, but your alias syntax is wrong. Also, rather than using an alias for this idea, you would likely be better off writing a function and putting it into your ~/.bash_profile or /etc/bash_profile.
A simple function like this (which I named "cdl"): Code:
cdl () { shell$ cdl /some/dir would go to that dir, and ls the contents. NOTE: this is untested, but should work, or very nearly so. Sasha |
Quote:
|
All times are GMT -5. The time now is 05:35 AM. |