How to list only files and not directories of a directory Bash?

前端 未结 9 1082
旧巷少年郎
旧巷少年郎 2020-12-07 21:54

How can I list all the files of one folder but not their folders or subfiles. In other words: How can I list only the files?

9条回答
  •  无人及你
    2020-12-07 22:10

    ls -p | grep -v /
    

    ls -p lets you show / after the folder name, which acts as a tag for you to remove.

提交回复
热议问题