我只想列出隐藏的文件和文件夹(以点开头)。当我使用命令时
ls .??*
我得到输出
.gitignore
.git:
COMMIT_EDITMSG FETCH_HEAD HEAD ORIG_HEAD branches config description hooks index info logs objects packed-refs refs
我不想要文件夹中的内容。相反,我正在寻找仅列出文件夹的输出
.gitignore
.git [different color for the folders, like the normal ls]
最佳答案
尝试:
ls -d .*
仅供引用
-d, --directory
list directories themselves, not their contents
如果你的 ls 不是其他命令的别名,上面 ls -d .*
的输出将在同一行输出文件/目录。如果你想让它们各占一行:
ls -d1 .*
如果你想要彩色输出:
ls -d1 --color=auto .*
关于linux - 如何仅列出点文件和点文件夹名称(不包含其中的内容),我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/22408455/