【问题标题】:How to show the hidden files and hide the shown files with ls?如何显示隐藏文件并用 ls 隐藏显示的文件?
【发布时间】:2012-10-24 06:58:48
【问题描述】:

列出文件我使用ls。我知道如何列出几乎(-A)或所有(-a)它们。但是当我尝试显示隐藏文件并隐藏显示的文件时,我不走运:

ls --hide='*' -A

-A 选项抵消--hide 选项的行为在ls 的文档中有所描述。

那么我可以使用ls 的其他选项吗? find-xargs-ls 组合不能是唯一的解决方案,对吧?

【问题讨论】:

  • 我看到总共有 n 个文件,并且带有所有修饰符的 ls 加上 find 不显示目录内容,这可能是了解正在发生的事情的解决方案

标签: find xargs ls hidden-files


【解决方案1】:

确实,使用:

ls -A -I'*'

为了简化我使用bash shell 的日常命令行体验,我定义了以下相互叠加的别名:

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'*'"

【讨论】:

    【解决方案2】:

    仅列出点文件但省略 ...

    alias ldot='ls -ld .??*'
    

    【讨论】:

      猜你喜欢
      • 2014-02-27
      • 1970-01-01
      • 2016-01-22
      • 1970-01-01
      • 1970-01-01
      • 2015-02-15
      • 1970-01-01
      • 2018-06-03
      • 2020-06-20
      相关资源
      最近更新 更多