Search code examples
findxargslshidden-files

How to show the hidden files and hide the shown files with ls?


To list files I use ls. I know how to list almost (-A) or all (-a) of them. But when I try to show the hidden files and hide the shown files I'm out of luck with:

ls --hide='*' -A

The behavior that the -A option neutralizes the --hide option is described in the documentation of ls.

So is there another option to ls I could use? The find-xargs-ls combo cannot be the only solution, right?


Solution

  • Indeed, use:

    ls -A -I'*'
    

    In order to ease my everday command line experience with the bash shell I defined the following aliases building on top of each other:

    alias ls="ls -h --color=auto"
    alias lsa="ls -A"
    alias lsh="lsa -I'*'"
    alias ll="ls -l --time-style=long-iso"
    alias lla="ll -A"
    alias llh="lla -I'*'"
    alias lv="ll -v"
    alias lva="lv -A"
    alias lvh="lva -I'*'"
    alias lt="ll -t"
    alias lta="lt -A"
    alias lth="lta -I'*'"
    alias lr="ll -R"
    alias lra="lr -A"
    alias lrh="lra -I'*'"