Before I start writing a (probably easy) script, is there a command that does the equivalent of the following one:[:~/software/scripts] % ls -ld / /usr /usr/bin /usr/bin/tee drwxr-xr-x 21 root root  4096 Mar 31 08:48 /drwxr-xr-x 11 root root  4096 Jan 30 09:48 /usrdrwxr-xr-x  2 root root 73728 Apr 14 07:54 /usr/bin-rwxr-xr-x  1 root root 26308 Jan 16  2013 /usr/bin/teewithout having to manually type all the partial paths? The idea would be to be able to say ls --this-new-flag /usr/bin/tee  or command -l /usr/bin/tee and having the output above --- showing the detailed listing of all partial path leading to the final one. A shell expansion trick that can output / /usr /usr/bin /usr/bin/tee given /usr/bin/tee will do, too.
`ls -l` of a file and all the directories leading to it?
bash;shell;zsh
ls -ld `echo 'path/to/file' | sed ':0 p;s!/[^/]*$!!;t0' | sort -u`sed part::0 label 0;p print;s!p!r! replace pattern p with replacement r;/[^/]*$ search for /, then any sequence of not-/ till the end of line;replacement is empty, so just delete the match;t0 if s!!! performs a replacement, then go to label 0.Edit by OP after commentsI did the following (thanks to the comments, especially by Jander and Andrey): adding explode() {echo $1 | sed -n ':0 p;s![^/]\+/*$!!;t0' | sort -u}to my .zshrc and then I can use ls -ld $(explode /path/to/file) and having the desired output. 