alias
is it possible to setup an alias for cd to automatically give me an ls?
for example: alias -x cdls="cd $whatever:ls -la" |
alias cdls='cd $whatever; ls -la'
|
that will work for any directory? so now if I put cdls /home its the same as
$cd /home $ls -la correcT? |
Yes.
To be more precise, if you set your alias like this: Code:
alias cdls='cd $1; ls -la $1' so if you type: Code:
cdls /tmp Code:
cd /tmp; ls -la /tmp |
I have since found that the above doesn't actually work as intended, apparently aliases don't work with arguments inside the command string; therefore you must use shell functions instead.
Type this in your ~/.bashrc instead: Code:
cdls() { |
great, thank you
|
All times are GMT -5. The time now is 02:02 PM. |