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

前端 未结 9 1048
旧巷少年郎
旧巷少年郎 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:14

    { find . -maxdepth 1 -type f | xargs ls -1t | less; }
    

    added xargs to make it works, and used -1 instead of -l to show only filenames without additional ls info

提交回复
热议问题