- Community Home
- >
- Servers and Operating Systems
- >
- Operating Systems
- >
- Operating System - HP-UX
- >
- Re: Counting file sizes ???
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
08-25-2001 10:31 AM
08-25-2001 10:31 AM
And is there a way I can run the ll command to come out with megs as output ?
Richard
Solved! Go to Solution.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-25-2001 11:04 AM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-25-2001 12:26 PM
08-25-2001 12:26 PM
Re: Counting file sizes ???
you could do something like
du -kx * |sort -n
The last file/directory would be the biggest size in KB.
If you only want the biggest size in files (in KB)then
ls -al | grep '^-' | sort +4 |tail -1 | awk '{print $5, $9}'
-HTH
Ramesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-25-2001 12:51 PM
08-25-2001 12:51 PM
Re: Counting file sizes ???
If you want the size in MB
ls -al | grep '^-' | sort +4 |tail -1 | awk '{print $5/1048576, $9}'
Ofcourse you do lots of formating, and this is not the only way to do it.
-Regards
Ramesh
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-25-2001 07:12 PM
08-25-2001 07:12 PM
Re: Counting file sizes ???
2,097,151.999 KB / 1024 =
2,047.999 MB / 1024 =
1.999 GB
So this file is essentially a 2 GB file. You are reading the number and doing the math correctly.
As far as I know there is no option to tell 'll' to put output in MB directly. You have been given some other good ideas though.
By the way, if the file hit this size and didn't grow any more, I would guess that do not have the 'large files' option turned on for this LV.
You can use fsadm to check and to turn on largefiles if you wish. Do a 'man fsadm' for more info.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-26-2001 02:39 AM
08-26-2001 02:39 AM
Re: Counting file sizes ???
What Pat says is correct, and 1KB = 1024Bytes(not 1000Bytes) so 1GB = 1073741824 Bytes..... and there is no option for ll cmd to tell u size in MB.
Cheers...
Satish.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-27-2001 03:14 AM
08-27-2001 03:14 AM
Re: Counting file sizes ???
You are right, it's a 2 gigs file.
To calculate directory size in kilobytes :
#du -sk /dir
To calculate size of selective files inkilobytes :
a=`ls -al *.log ? awk '{print $5}'`
result=0
for c in $a
do
result=`expr $result + $c`
done
sizeInKilo=`expr $result \/ 1024`
sizeInMega=`expr $sizeInKilo \/ 1024`
sizeInGiga=`expr $sizeInMega \/ 1024`
echo "Size in KB = $sizeInKilo"
echo "Size in MB = $sizeInMega"
echo "Size in GB = $sizeInGiga"
Magdi
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-27-2001 03:17 AM
08-27-2001 03:17 AM
Re: Counting file sizes ???
in the expr command, you may see a strange signe some how like a V, but it is not :
It is a back slash followed immediately by slash.
Magdi