Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

I am in the Unix/Linux terminal right now and I'm not in any kind of editor such as vi or emacs. Now when I type in the "df" command, I get the amount of disk free space in KILOBYTES. I want to change the default so that when I type in "df" only, I get the disk free space all listed in MEGABYTES. I already know that "df -m" and "df -h" commands give the values in MEGABYTES, but I just want to strictly type in "df" so that I get all the values listed in MEGABYTES. Once again, I'm in the tcsh shell. I really would like the most basic step by step explanation to this since I have asked this several times before in the clearest way possible and still couldn't understand. I the need an extremely clear answer to this immediately since it is an emergency.

share|improve this question

migrated from stackoverflow.com Sep 8 '12 at 1:55

This question came from our site for professional and enthusiast programmers.

5  
alias df='df -m' –  Paul Tomblin Sep 8 '12 at 1:51
add comment

1 Answer

My df takes a -m flag:

$ df -m
Filesystem                  1M-blocks   Used Available Capacity  Mounted on
/dev/disk0s2                   380516 311007     69258    82%    /
devfs                               0      0         0   100%    /dev
map -hosts                          0      0         0   100%    /net
map auto_home                       0      0         0   100%    /home
/dev/disk0s3                    96094  42464     53630    45%    /Volumes/BOOTCAMP

You can also use df -h to get 'human-readable' values:

$ df -h
Filesystem                    Size   Used  Avail Capacity  Mounted on
/dev/disk0s2                 372Gi  304Gi   68Gi    82%    /
devfs                        124Ki  124Ki    0Bi   100%    /dev
map -hosts                     0Bi    0Bi    0Bi   100%    /net
map auto_home                  0Bi    0Bi    0Bi   100%    /home
/dev/disk0s3                  94Gi   41Gi   52Gi    45%    /Volumes/BOOTCAMP

You can also set the environment variable BLOCKSIZE to 1M, and save that in your .profile to make it the default.

$ BLOCKSIZE=1M df
Filesystem                  1M-blocks   Used Available Capacity  Mounted on
/dev/disk0s2                   380516 311008     69257    82%    /
devfs                               0      0         0   100%    /dev
map -hosts                          0      0         0   100%    /net
map auto_home                       0      0         0   100%    /home
/dev/disk0s3                    96094  42464     53630    45%    /Volumes/BOOTCAMP
share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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