I've noticed that ls -l
doesn't only change the formatting of the output, but also how directory symlinks are handled:
> ls /rmn
biweekly.sh daily.sh logs ...
> ls -l /rmn
lrwxrwxrwx 1 root root 18 Feb 11 2011 /rmn -> /root/maintenance/
I'd like to get a detailed listing of what's in /rmn
, not information about the /rmn
symlink.
One work-around I can think of is to create a shell function that does something like this:
cd /rmn
ls -l
cd -
But that seems too hacky, especially since it messes up the next use of cd -
. Is there a better way?
(I'm on CentOS 2.6.9)
Best Answer
See if your ls has the options:
If those don't help, you can make your macro work without messing up
cd -
by doing:which runs in a subshell.