DEV Community

Cover image for Count files in a directory in Linux
Adam K Dean
Adam K Dean

Posted on

2 1

Count files in a directory in Linux

Count files in current directory with:

ls | wc -l
Enter fullscreen mode Exit fullscreen mode

Or count files in a specific directory with:

ls /some/path | wc -l
Enter fullscreen mode Exit fullscreen mode

Top comments (0)

AWS Security LIVE!

Tune in for AWS Security LIVE!

Join AWS Security LIVE! for expert insights and actionable tips to protect your organization and keep security teams prepared.

Learn More

👋 Kindness is contagious

Discover a treasure trove of wisdom within this insightful piece, highly respected in the nurturing DEV Community enviroment. Developers, whether novice or expert, are encouraged to participate and add to our shared knowledge basin.

A simple "thank you" can illuminate someone's day. Express your appreciation in the comments section!

On DEV, sharing ideas smoothens our journey and strengthens our community ties. Learn something useful? Offering a quick thanks to the author is deeply appreciated.

Okay