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

前端 未结 9 1084
旧巷少年郎
旧巷少年郎 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条回答
  •  慢半拍i
    慢半拍i (楼主)
    2020-12-07 22:16

    You can also use ls with grep or egrep and put it in your profile as an alias:

    ls -l | egrep -v '^d'
    ls -l | grep -v '^d'
    

提交回复
热议问题