- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Find No. of files in a filesystem
Categories
Company
Local Language
Forums
Discussions
Forums
- Data Protection and Retention
- Entry Storage Systems
- Legacy
- Midrange and Enterprise Storage
- Storage Networking
- HPE Nimble Storage
Discussions
Forums
Discussions
Discussions
Discussions
Forums
Discussions
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
- BladeSystem Infrastructure and Application Solutions
- Appliance Servers
- Alpha Servers
- BackOffice Products
- Internet Products
- HPE 9000 and HPE e3000 Servers
- Networking
- Netservers
- Secure OS Software for Linux
- Server Management (Insight Manager 7)
- Windows Server 2003
- Operating System - Tru64 Unix
- ProLiant Deployment and Provisioning
- Linux-Based Community / Regional
- Microsoft System Center Integration
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Discussion Boards
Community
Resources
Forums
Blogs
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2003 01:15 PM
02-14-2003 01:15 PM
Find No. of files in a filesystem
How do i find the no. of files in a filesystem?
Thanks
David.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2003 01:17 PM
02-14-2003 01:17 PM
Re: Find No. of files in a filesystem
How about:
# cd
# find . -type f -print|wc -l
Regards!
...JRF...
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2003 01:22 PM
02-14-2003 01:22 PM
Re: Find No. of files in a filesystem
You can use df -i and take a note of used i-nodes.
df -i /file_system |grep used i-nodes
Hardway is
find /file_system |wc -l
-Sri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2003 01:24 PM
02-14-2003 01:24 PM
Re: Find No. of files in a filesystem
# ls -lR|grep \^-|wc -l
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2003 01:36 PM
02-14-2003 01:36 PM
Re: Find No. of files in a filesystem
Goodluck
Govind
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2003 01:48 PM
02-14-2003 01:48 PM
Re: Find No. of files in a filesystem
#cd /
#find . -xdev -type f|wc -l
the -xdev keeps the search within the wanted FS and avoid scan in any other possible mounted FS inside of
If you need include directories as file counter, pls omit "-type f" option.
Rgds
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2003 01:51 PM
02-14-2003 01:51 PM
Re: Find No. of files in a filesystem
# find /filesystem -type f -xdev | wc -l
The solutions using 'df' will tell you the number of inodes used, but you have to remember that a directory, which is really a different type of file, also uses an inode. So if you just want 'files' then the df output will be misleading.
Take the following example on one of my machines.
# find / -type f -print | wc -l
91269
This found ALL files on the system, including those in /var, /usr, /tmp, etc.
Now this:
# find / -type f -xdev -print | wc -l
740
Found just files in /, and not any of the mounted filesystems.
# df -i
...excerpt....
2436 used inodes
That number is pretty close to the number of files and directories in /.
# find / -xdev | wc -l
2475
So, I think your best bet, be it a bit slow maybe, is
# find /filesystem_name -xdev -print | wc -l
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2003 02:07 PM
02-14-2003 02:07 PM
Re: Find No. of files in a filesystem
You can also do df -t and look at used inodes.
Thanks
Giri Sekar.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
02-14-2003 04:43 PM
02-14-2003 04:43 PM
Re: Find No. of files in a filesystem
Jose and Patrick are correct. One should add '-xdef' to the find criteria to avoid crossing mountpoints.
Regards!
...JRF...