Show total disk space on all partitions

df -h --total | awk 'NR==1; END{print}'
show off how big your disks are
Sample Output
Filesystem                  Size  Used Avail Use% Mounted on
total                       7.5T  2.7T  4.9T  36% -

1
By: PROJAK_SX
2014-03-01 19:52:50

These Might Interest You

  • Used this after cloning a disk with dd to make the newly written partitions show up in /dev/


    1
    echo "w" | fdisk /dev/sdb
    BCK · 2010-09-07 13:42:59 1
  • Adds up the used disk space on all hard drives that are directly connected to the machine (i.e. no network mounts etc.) Assumes there are no IDE drives present. Show Sample Output


    0
    echo $(df -BG | grep sd | awk '{print $3}' | paste -sd+ | tr -d G | bc) GiB used in total
    thureduehrsen · 2016-08-09 10:08:35 0
  • If you want to mount partitions of an disk image, you need the offsets and sizes of the partitions. This command prints them in the format that losetup understands. Show Sample Output


    1
    /sbin/parted -m /dev/sdX unit b print | grep '^[1234]' | sed 's/:/ --offset=/; s/B:[[:digit:]]*B:/ --sizelimit=/; s/B:/ [/; s/:.*/]/'
    gabriel · 2011-09-09 15:51:28 1
  • Show the UUID-based alternate device names of ZEVO-related partitions on Darwin/OS X. Adapted from the lines by dbrady at http://zevo.getgreenbytes.com/forum/viewtopic.php?p=700#p700 and following the disk device naming scheme at http://zevo.getgreenbytes.com/wiki/pmwiki.php?n=Site.DiskDeviceNames Show Sample Output


    1
    ls /dev/disk* | xargs -n 1 -t sudo zdb -l | grep GPTE_
    grahamperrin · 2012-10-06 20:19:45 0

What do you think?

Any thoughts on this command? Does it work on your machine? Can you do the same thing with only 14 characters?

You must be signed in to comment.

What's this?

commandlinefu.com is the place to record those command-line gems that you return to again and again. That way others can gain from your CLI wisdom and you from theirs too. All commands can be commented on, discussed and voted up or down.

Share Your Commands



Stay in the loop…

Follow the Tweets.

Every new command is wrapped in a tweet and posted to Twitter. Following the stream is a great way of staying abreast of the latest commands. For the more discerning, there are Twitter accounts for commands that get a minimum of 3 and 10 votes - that way only the great commands get tweeted.

» http://twitter.com/commandlinefu
» http://twitter.com/commandlinefu3
» http://twitter.com/commandlinefu10

Subscribe to the feeds.

Use your favourite RSS aggregator to stay in touch with the latest commands. There are feeds mirroring the 3 Twitter streams as well as for virtually every other subset (users, tags, functions,…):

Subscribe to the feed for: