1

I would like to convert "df -g" from solaris to linux. Would like to know what is the linux equivalent of "df -g"

On solaris man df will give option -g as such:

Print the entire statvfs(2) structure. This option is used only for mounted file systems. It cannot be used with the -o option. This option will override the -b, -e, -k, -n, -P, and -t options.

I am currently unable to find -g for linux and would like to know if -g is now obsolete.

1

This is not a standard (or widely adopted) option, and not present in any other df implementation except Solaris. (For example, OpenBSD's df uses -g for a completely different purpose.)

For Linux, you can get a text version of the statvfs() results using stat -f on each mountpoint individually.

$ stat -f / /boot
  File: "/"
    ID: 9a1f066700795d36 Namelen: 255     Type: zfs
Block size: 131072     Fundamental block size: 131072
Blocks: Total: 13928460   Free: 13756444   Available: 13756444
Inodes: Total: 3521952399 Free: 3521649824
  File: "/boot"
    ID: 38db9d923fe678d5 Namelen: 255     Type: ext2/ext3
Block size: 1024       Fundamental block size: 1024
Blocks: Total: 247591     Free: 128457     Available: 124361
Inodes: Total: 65024      Free: 64652

$ stat -f -c %n:%i,%s / /boot
/:9a1f066700795d36,131072
/boot:38db9d923fe678d5,1024
  • stat -f is a pretty good substitute but do you know of commands that can give all these in 1 command? Block size, Frag size, Total blocks, Free blocks, Available, Total files, Free files, Flag, Filename length – frymyberries Nov 11 at 7:13
  • That's literally in the stat -f output already. – grawity Nov 11 at 7:15
-1

As an alternative in Linux systems, df can be used with the combination of "h" to be human readable and "P" to fix the alignment.

df -hP

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.