Thursday, October 3, 2013

Inode space issue , finding largest inode entry direcotry

 

The find command searches for files, starting at a directory named on the command line. It looks for files that match whatever criteria you wish, such as all regular files, all files that end in .trash, or any file older than a particular date. When it finds a file that matches the criteria, it performs whatever task you specify, such as removing the file, printing the name of the file, changing the file's permissions, and so forth.

For example:

# find /usr -local -type f -mtime +60 -print > /usr/tmp/deadfiles &
-mtime +60
Says you are interested only in files that have not been modified in 60 days.
As another example, you can use the find command to find files over 7 days old in the temporary directories and remove them. Use the following commands:

# find /var/tmp -local -type f -atime 7 -exec rm {} \;
# find /tmp -local -type f -atime 7 -exec rm {} \;
then this bash command may help you:

sudo find . -xdev -type f | cut -d "/" -f 2 | sort | uniq -c | sort -n
And yes, this will take time, but you can locate the directory with the most files

for i in /*; do echo $i; find $i -type f | wc -l; done

 

 

No comments:

Post a Comment