lsd
lsd copied to clipboard
How to Show Hidden Files/Directories Last?
If I use "lsd -a", hidden files and directories are listed first since they start with '.'. I would like for them to actually be listed last.
You can reverse the order using -r
or --reverse
flag.
I would like to have the ability to keep things in alphabetical order but also have hidden files and directories listed after the non hidden files and directories.
As of now, I don't really see a strong usecase for this, but I will keep this open as of now and if there is enough interest we can add --group-hidden
flag similar to group directories.
i think this would be better as a config option and not a command switch personally
If this gets implemented, it will be available both as a cli flag and a config option like most other flags.
This sounds like a collation thing. like LC_COLLATE=C causes hidden files to be first - the only proper way :)
I prefer sorting this way as well; looking to use alongside --group-directories-first
: {dirs} {dot dirs} {files} {dot files}
As I commented on #814,
If you don't mind the inefficiency of running ls
first, I'm currently using the following work-around to get the sorting that I prefer from ls
with the display niceties of lsd
(zsh shell on Fedora 38):
alias ll="ls -1X --sort=extension --group-directories-first --color=never | xargs lsd -Uld"
- The
-1
flag tols
outputs one item per line. -
--color=never
suppresses terminal escape sequences in the output, leaving pure file and directory names as outputs. - piping to
xargs lsd
takes the lines of output fromls
, in the right order, and makes them arguments forlsd
. -
-U
suppresses the sorting done bylsd
, maintaining the order given by the order of the arguments. -
-d
makeslsd
print info on a directory, rather than its contents.