2

My default df invocation prints way too much information for my needs. I can't find a way to hide this in the man page. It says use the -i flag to include it. But when I execute /usr/local/bin/df I get this:

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

How do I hide all these extra columns? (come to think of it, how do I get rid of those useless map -static rows too?)

Extra info:

uname -a output:

Darwin myusername-Mac-mini.local 15.3.0 Darwin Kernel Version 15.3.0: Thu Dec 10 18:40:58 PST 2015; root:xnu-3248.30.4~1/RELEASE_X86_64 x86_64 i386 Macmini6,1 Darwin

1 Answer 1

1

The standard macOS df supports an -P option (which suppresses most of the things you don't want) so you could run

df -P | grep -v 'map -static'

Explanation of option (from man df):

-i  Include statistics on the number of free inodes.
    This option is now the default to conform
    to Version 3 of the Single UNIX Specification
    (``SUSv3'') Use -P to suppress this output.

-P  Explicitly  use 512 byte blocks, overriding any BLOCKSIZE specifi-
    cation from the environment.  This  is the same as the -b option.
    The -k option overrides this option.
4
  • Perfect, I'll accept as soon as the site allows me to. I'd forgotten about grep -v :) As for -P, it seems like a bit of a mistake that this isn't the default mode. Commented Dec 3, 2016 at 18:59
  • 1
    The man page says: -i "is now the default to conform to Version 3 of the Single UNIX Specification (``SUSv3'') Use -P to suppress this output."
    – nohillside
    Commented Dec 3, 2016 at 19:02
  • Doesn't seem to work on GNU coreutils 8.28 September 2017 DF(1) Commented Dec 30, 2017 at 22:47
  • 2
    @Sridhar-Sarnobat The standard macOS df is different from the GNU version, the answer refers to the macOS version.
    – nohillside
    Commented Dec 30, 2017 at 23:34

You must log in to answer this question.

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