- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- can we use the command "du" (disk usage)
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
тАО03-20-2009 01:21 AM
тАО03-20-2009 01:21 AM
I can use du command in linux for viewing size of the file
Ex:
1) # du -h filename
it will show the size of the file
2) # du -sh directory
It will show the size of the all files available in a directory and the size of whole directory.
but i tried this same command in HP-UX but it is not working.
what is the alternative command in HP-UX
or If it is the same command then tell me the correct syntax.
pls explain me
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-20-2009 01:28 AM
тАО03-20-2009 01:28 AM
Re: can we use the command "du" (disk usage)
#du -sk filename
#du -sk directory
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-20-2009 01:33 AM
тАО03-20-2009 01:33 AM
Solutionyou know I'm really tempted to NOT explain - why can't you help yourself even a little bit??? This would take 2 seconds to figure out if you simply LOOKED AT THE MAN PAGE!
On linux the -h option prints in human-readable format like (1K, 2M, 4G) - this option isn't present on the HP-UX version of the command... but we do have the "-k" option which will print out the disk allocation in KB.
So simply try:
du -k filename
or
du -sk directoryname
Be aware that du does not show you the SIZE of the file, it bshows you the DISK ALLOCATION of the file. Depedning on the size and type of file the disk allocation could be less or more than the actual file size. File sizes are displayed from "ls -l". Try the following to see this:
cd /tmp
echo a > myfile
ls -l myfile
du -k myfile
You will see that vthe size does not match disk allocation.
HTH
Duncan
I am an HPE Employee

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-20-2009 01:38 AM
тАО03-20-2009 01:38 AM
Re: can we use the command "du" (disk usage)
Why don't you use du to know the size of the file when simple ll command gives the result.
ofcourse, for directory size you have to use du command.
Ganesh.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-20-2009 01:47 AM
тАО03-20-2009 01:47 AM
Re: can we use the command "du" (disk usage)
see my comment and example above about the difference between disk allocation and file size...
want to see another example? Try this:
cd /tmp
dd if=/etc/issue of=/tmp/sparse bs=2048k seek=1
ls -l sparse
du -sk sparse
hey my file is 2MB in size, but only takes up 8K on disk?
That's a sparse file... and is just one reason why you should *never* think of du as showing you the "file size"
HTH
Duncan
I am an HPE Employee

- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-20-2009 06:27 AM
тАО03-20-2009 06:27 AM
Re: can we use the command "du" (disk usage)
It's my typo error as careless always..(-
I mean to say that use simple ll instead of du command to know the size of the file.
>>>Why don't you use du to know the size of the file when simple ll command gives the result.<<<
It should have been,
Why do you use du to know the size of the file when simple ll command gives the result.
Again my sincere apologize for that typo mistake..
Ganesh.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-20-2009 12:22 PM
тАО03-20-2009 12:22 PM
Re: can we use the command "du" (disk usage)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
тАО03-20-2009 06:22 PM
тАО03-20-2009 06:22 PM
Re: can we use the command "du" (disk usage)
Please have a look.
http://docs.hp.com/en/B2355-90689/du.1.html
Regards!