How to get df linux command output always in GB [closed]

How to get df linux command output always in GB always? ie. I want below 34MB to be displayed in GBs

Filesystem            Size  Used Avail Use% Mounted on
/ttt/pda1              21G   20G   34M 100% /

How can this be achieved ?

Thanks in advance.


Solution 1:

You can use the -B option.

Man page of df:

-B, --block-size=SIZE use SIZE-byte blocks

All together,

df -BG

Solution 2:

If you also want it to be a command you can reference without remembering the arguments, you could simply alias it:

alias df-gb='df -BG'

So if you type:

df-gb

into a terminal, you'll get your intended output of the disk usage in GB.

EDIT: or even use just df -h to get it in a standard, human readable format.

http://www.thegeekstuff.com/2012/05/df-examples/