- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- ** Getting Space Utilization on a Directory **
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
Discussions
Discussions
Discussions
Forums
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
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
тАО01-17-2002 06:23 AM
тАО01-17-2002 06:23 AM
** Getting Space Utilization on a Directory **
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-17-2002 06:28 AM
тАО01-17-2002 06:28 AM
Re: ** Getting Space Utilization on a Directory **
live free or die
harry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-17-2002 06:28 AM
тАО01-17-2002 06:28 AM
Re: ** Getting Space Utilization on a Directory **
du -ks
To see how much space, in KB, each sub-directory in a directory is using do:
du -k
To find the largest files in a directory you could do:
ll | sort +4n --> To sort in ascending size order
ll | sort +4nr --> To sort in descending size order
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-17-2002 06:30 AM
тАО01-17-2002 06:30 AM
Re: ** Getting Space Utilization on a Directory **
For the first request:
# du -k ( this will give you the space utilization in KB; this -k option will not list in the man pages of 10.20 but included in 11.X man pages, but it will work in both)
For finding out large files in directory:
# find /dir_path -xdev -size +10000 -exec ll {} \;
( this will list all files bigger than 10000 blocks. For more bigger files put big values)
HTH,
Shiju
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-17-2002 06:33 AM
тАО01-17-2002 06:33 AM
Re: ** Getting Space Utilization on a Directory **
It depends on the system administrator. Some administrators are used to blocks while some are to MBs. I prefer the metrics in MBs. To check a directory for utilization, I would do the following.
#cd /directory
#du -sk * |sort -n
I will find the biggest file/directory and will try to trim it.
-Sri
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-17-2002 06:34 AM
тАО01-17-2002 06:34 AM
Re: ** Getting Space Utilization on a Directory **
ls -l | tr -s " " ""|cut -d" " -f5|xargs echo|sed "s/ / + /g"|bc
There are TWO SPACES in the first quoted string for "tr", and ONE SPACE in the second quoted string. "cut" also has a SINGLE SPACE quoted string for the "-d" option.
live free or die
harry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-17-2002 06:37 AM
тАО01-17-2002 06:37 AM
Re: ** Getting Space Utilization on a Directory **
it will give the total of the directory only
du -k
will give the size of all the sub-directories also
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-17-2002 06:39 AM
тАО01-17-2002 06:39 AM
Re: ** Getting Space Utilization on a Directory **
[root]pbctst: ls -l /tmp | tr -s " " ""|cut -d" " -f5|xargs echo|sed "s/ / +>
42374586
[root]pbctst: du -sk /tmp
44020 /tmp
[root]pbctst: echo "44020 * 1024"|bc
45076480
[root]pbctst: bdf /tmp
Filesystem kbytes used avail %used Mounted on
/dev/vg00/lvol4 65536 45329 19015 70% /tmp
live free or die
harry
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-17-2002 06:40 AM
тАО01-17-2002 06:40 AM
Re: ** Getting Space Utilization on a Directory **
#du -sk * will list space used by directories in current directory.
With sort you can arrange the output in ascending/descending order.
#du -sk |sort -nr (for reverse)
#du -sk |sort -n
Thanks.
Prashant.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО01-17-2002 06:41 AM
тАО01-17-2002 06:41 AM
Re: ** Getting Space Utilization on a Directory **
To search a directory within a filesystem, use something like:
find directory -type f -xdev | xargs ll | sort +4n | awk '{print $5,$NF}' | tail -n number_of_lines
Rgds, Robin.