df hide ifree etc (GNU)

0

(analogous to https://apple.stackexchange.com/questions/263437/df-hide-ifree-iused-512-blocks-customize-column-format-dont-show-inode-info for BSD)

How can I hide the columns beginning with i (iused, ifree) and/or 512-blocks? I just want to know how close to full my disks are, I don't want their life story.

$ /bin/df

Filesystem                                512-blocks       Used Available Capacity  iused    ifree %iused  Mounted on
/dev/disk0s2                               975093952  719904648 254677304    74% 90052079 31834663   74%   /
devfs                                            368        368         0   100%      637        0  100%   /dev
map -hosts                                         0          0         0   100%        0        0  100%   /net
map auto_home                                      0          0         0   100%        0        0  100%   /home
/dev/disk3s1                               242555008  206423680  36131328    86%        0        0  100%   /Volumes/SERIALS
map -static                                        0          0         0   100%        0        0  100%   /Volumes/ubuntu
map -static                                        0          0         0   100%        0        0  100%   /Volumes/Large_backup
map -static                                        0          0         0   100%        0        0  100%   /Volumes/Large
map -static                                        0          0         0   100%        0        0  100%   /Volumes/Unsorted
map -static                                        0          0         0   100%        0        0  100%   /Volumes/Record
map -static                                        0          0         0   100%        0        0  100%   /Volumes/Documentaries
192.168.1.2:/                              115345392   86998112  22441976    80%   421924  3249100   11%   /Volumes/ubuntu
192.168.1.2:/media/myusername/Documentaries  488397160  446990432  41406728    92%    15979 20720153    0%   /Volumes/Documentaries
192.168.1.2:/media/myusername/Record         625121216  625121216         0   100%   125517    38323   77%   /Volumes/Record
192.168.1.2:/media/myusername/Unsorted       625137280  604966376  20170904    97%   346496 10099404    3%   /Volumes/Unsorted
192.168.1.2:/media/myusername/Large         1953520000 1949403312   4116688   100%  1379836  2218604   38%   /Volumes/Large
192.168.1.2:/media/myusername/Large_backup   115345392   86998112  22441976    80%   421924  3249100   11%   /Volumes/Large_backup

Version info

Undesired beheavior (excess info) found on each of the following systems:

  • GNU coreutils 8.28 September 2017 DF(1) - Darwin Kernel Version 17.2.0
  • BSD . May 8, 1995 BSD - Darwin Kernel Version 16.7.0:

Desired behavior (not displayed by default) IS observed on:

  • GNU coreutils 8.25 February 2016 DF(1) - on Ubuntu 16.04.1 LTS, 4.4.0-104-generic #127-Ubuntu

Sridhar Sarnobat

Posted 2018-01-05T03:16:20.973

Reputation: 870

df man page you're already using parameters to show that information so leave them out. Check whenever you have an alias set up for those commands. – Seth – 2018-01-05T07:23:23.223

There is no alias, I am running /bin/df – Sridhar Sarnobat – 2018-01-05T18:25:55.183

environment variables might affect the behaviour too. – msb – 2018-01-05T18:37:20.737

env | grep POSIXLY_CORRECT returns nothing for me. Any other ideas? – Sridhar Sarnobat – 2018-01-05T18:38:17.753

Looking at the source code on github, it seems df usually doesn't show both blocks and inodes. My guess is that your build is personalized, it's weird. I tried fiddling with options locally to show both and couldn't. It's possible that you don't have the option of not showing both... unless you compile df yourself. :-/ – msb – 2018-01-05T18:51:23.610

Answers

1

If you're willing to do pipes, you can try this:

df | rev | awk '{$2=$3=$4=$8=""}' | rev

That is, if you have rev and awk.

msb

Posted 2018-01-05T03:16:20.973

Reputation: 1 167

I appreciate the suggestion even if I'd rather not accept that as the answer. It seems like this is a bug, so a temporary key binding (or alias, though I don't like aliases) of this could be my solution for now. – Sridhar Sarnobat – 2018-01-05T18:36:03.617