Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm trying to change a default for the df command.

When I type the df command, I see the amount of disk free space listed in kilobytes. I want to change the default so that when I type in df alone, I will see the disk free space in Megabytes.

I already know that when I type df -m or df -h I will see it in megabytes, but I strictly just want to type in df so that I can see the values in megabytes.

If I can get a step by step on how to make this possible on changing the default for the df command to megabytes, I would love that. I was told that command line flags also could affect how this command could work, so I would also like clarification on that as well.

share|improve this question

There is a file in your home directory called .bashrc which is executed every time you open a new terminal. In nautilus (the default graphical file browser) you will need to press Ctl+H to see files that start with a .

You can create "aliases" in this file, they will act as commands at the terminal. Edit .bashrc and add alias df="df -m" on its own line, probably best to put this at the top or bottom with a comment above it along the lines of #I added this line to change the behaviour of df.

Open a new terminal and df will now be df -m by default.

N.b. To use df normally you must now type \df

share|improve this answer

Like ls -s, df honors the BLOCKSIZE environmental variable. Put


into the .profile file in your home directory and when you next login df will report disk capacity and availability in megabytes.

If you're using tcsh instead of bash or sh as your shell, put

setenv BLOCKSIZE 1m

into .login in your home directory.

share|improve this answer
Depending on which Unix/Linux, the following variables may perform the same function: DF_BLOCK_SIZE, BLOCK_SIZE, and BLOCKSIZE. The GNU coreutils df defaults to 1K byte blocks, unless POSIXLY_CORRECT is set, in which case it uses 512 byte blocks. – Yedric Sep 10 '12 at 15:45

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .