Created
December 17, 2015 05:50
-
-
Save mckartha/18656940039d41635f97 to your computer and use it in GitHub Desktop.
filesystem count by dir
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# count-files.sh | |
# [2015Dec17 MCK] Count files in directories the root dir of a Linux/Unix server using `find` and a `for` loop | |
# Edit this list of directories as necessary | |
rootdirs="bin boot dev etc home lib lib64 lost+found media opt root run sbin srv sys tmp usr var" | |
for dir in $rootdirs ; do (echo -e -n "Dir: $dir : \t"; find /$dir -print | wc -l ) ; done | |
# Example output | |
# Dir: bin : 149 | |
# Dir: boot : 288 | |
# Dir: dev : 403 | |
# Dir: etc : 1645 | |
# Dir: home : 3441 | |
# Dir: lib : 1460 | |
# Dir: lib64 : 2 | |
# Dir: lost+found : 1 | |
# Dir: media : 1 | |
# Dir: opt : 968 | |
# Dir: root : 7 | |
# Dir: run : 317 | |
# Dir: sbin : 175 | |
# Dir: srv : 1 | |
# Dir: sys : 20142 | |
# Dir: tmp : 313 | |
# Dir: usr : 73235 | |
# Dir: var : 2698 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment