I'm trying to figure out how to list the contents of a directory in the following group order:
- Hidden directories
- Non-hidden directories
- All other hidden files (including regular files, symlinks, sockets)
- All other non-hidden files (including regular files, symlinks, sockets)
Each group should be sorted A-Z, preferably case-insensitive.
Based on this answer I tried the following:
ls -dlU .*/ */
This gets me half-way there by listing hidden directories and then non-hidden directories. The problem is it doesn't list any files.
I've also tried various ways of piping the output to sort
with no luck.
How can I do this?
Best Answer
The straightforward way :