Sometimes you want to ascertain the space hogs on your system. You might have noticed that a certain top level directory is larger than usual, but you are unsure what subdirectory or subdirectories are the culprits.
Here's an example of what can be done:
#cd /huge_directory
#du -k . (current directory size given in kilobytes)
To find the sizes recursively (subdirectories):
#cd /huge_directory
#sh
#for size in 'ls'
do
du -k $size
echo $size done
done
This blog covers Unix system administration HOWTO tips for using inline for loops, find command, Unix scripting, configuration, SQL, various Unix-based tools, and command line interface syntax. The Unix OS supports tasks such as running hardware, device drivers, peripherals and third party applications. Share tips/comments. Read the comments. But most importantly: Read Disclaimer - Read Disclaimer.
Subscribe to:
Post Comments (Atom)
3 comments:
#find /huge_directory -type d -size +100 -print
is not giving correct results on my machine. I think size for the directory is computed recursively when we check for -size +100 in find.
Correct me I am wrong.
--
~ Devendra...aja
sorry
there was typo in my earlier comment
please replace
"is computed recursively"
as "is NOT computed recursively"
devendra, when I wrote that post awhile ago, I was having problems with other folks putting large files in my root partition.
The (the find) second part was an afterthought (posted a few days later). Apparently I was thinking about files. It shouldn't have been posted. At any rate, I appreciate the correction. (Nowadays I check everything on my UNIX box before posting.) This is a good example for doing just that. Thanks.
Post a Comment