Uly.me

cloud engineer

  • Home
  • About
  • Archives
Home/Archives for wc

May 14, 2019

Count Number of Files in Directory

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

  • Cloud
  • Linux
  • Git

Copyright © 2012–2021