• Skip to main content

Uly.me

cloud engineer

  • Home
  • About
  • Archives

Count Number of Files in Directory

May 14, 2019

Get a count of the number of files in a directory.

# using ls
ls | wc -l
ls -Aq | wc -l
# include hidden files 
find . ! -name . -prune -print | grep -c /
find .//. ! -name . -print | grep -c //
# using tree if installed. yum install tree. apt-get install tree
tree

# using ls ls | wc -l ls -Aq | wc -l # include hidden files find . ! -name . -prune -print | grep -c / find .//. ! -name . -print | grep -c // # using tree if installed. yum install tree. apt-get install tree tree

Filed Under: Linux Tagged With: count, find, ls, tree, wc

Search This Website

Subscribe Via Email

  • Home
  • About
  • Archives

Copyright © 2023