SitePoint Sponsor

User Tag List

Results 1 to 4 of 4

Thread: Unix math

  1. #1
    SitePoint Wizard Defender1's Avatar
    Join Date
    Apr 2001
    Location
    My Computer
    Posts
    2,808
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Unix math

    I'm trying to calculated the amount of space "used" space on some of our Unix boxes.

    My results of a df -k yield the following columns:
    Code:
    Filesystem  1024-blocks  Free  %Used  Iused  %Iused  Mounted on
    Now, I can find the percent and value of used, via the following formula:
    (1024-blocks - Free) / 1024-blocks = % Used.
    But, it's my understanding that block size varies by OS, and this needs to be OS independant.

    So, if anyone knows a way to get the amound of space used on a filesystem, or a formula to calculate it then please let me know

    If my algebra serves me, you could substitute 1024-blocks for X, then solve the equation for X, but I'll be damned if I can remember that far back.
    Defender's Designs
    I'm Getting Married!

    Not-so-patiently awaiting Harry Potter Book 7 *sigh*

  2. #2
    Can we go to a 48 hour day?
    Join Date
    May 2002
    Location
    MI
    Posts
    906
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    why not juts use df -h?
    mitechie.com
    "Techies just think a little differently
    ...at least that is what they keep telling me."

  3. #3
    SitePoint Addict
    Join Date
    Sep 2003
    Location
    Europe
    Posts
    222
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    du

  4. #4
    SitePoint Wizard Defender1's Avatar
    Join Date
    Apr 2001
    Location
    My Computer
    Posts
    2,808
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    df -h just converts the values returned into human reable format. (Instead of showing bytes or kilobytes, it puts converts it to mb, gb etc.)
    That's not what I meant/need. The actual columns of data returned are different on different OS's.
    Also note that the -h flag doesn't exist on AIX.

    I'm not sure what du does, but it doesn't return information on the filesystems, just the current directory structure (current directory and down).
    That's useless unless you're logged in as root (which I don't have, and can't have).

    Any other ideas?
    Defender's Designs
    I'm Getting Married!

    Not-so-patiently awaiting Harry Potter Book 7 *sigh*


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •