Ubuntu is using snaps, shown below

Core applications packaged as snaps

Shown here

enter image description here

So, my question is, that since snaps are shown using the df command, and they apparently flood df.

It's just flooding df, and makes it harder to use. Is there a way to stop it? I'm assuming since snap is planning on being used more frequently it will either no show in df, or df will become a much longer command with more pipes.

  • 7
    You can perhaps do df | grep -v "/snap" or similar, but aside from that, no,. Snaps are mounted and so will show up in things which show what is mounted.
    – dobey
    Apr 29, 2018 at 2:28
  • 2
    Perhaps you could open a bug report at launchpad.net/+ubuntu/source/coreutils about installed snaps being unhelpful in the output.
    – dobey
    Apr 29, 2018 at 2:41
  • 2
    You can prevent df from listing snaps with the following: df $(cut -d' ' -f3 /proc/mounts | sort -u | grep -v 'squashfs' | sed 's/^/-t /') May 1, 2018 at 14:20
  • 2
    I setup an alias: alias df='df | grep -v "/snap"' Sep 19, 2018 at 14:19
  • 4
    Instead of piping df results to grep & removing snaps, the cleaner solution is IMHO to use grep's grep -v option to exclude file systems. Snaps use squashfs. Thus you can define an alias like alias df='df -l -BM -Tx"squashfs"' to get the non-snap-list as a default. See [docs.snapcraft.io/the-snap-format/698] for a definition.
    – Marcus
    Oct 28, 2018 at 10:31

4 Answers 4


You can use df's df -x option to exclude certain file systems from the results. Since snaps use the squashfs filesystem, you can define an alias like

alias df='df -x"squashfs"'

to get the non-snap-list as a default.

BTW, see this link for a definition of the snap format.

  • 3
    I'm generally against using alias', but I may make an exception here. Thanks! Nov 1, 2018 at 22:08
  • 1
    I still prefer the grep solution as this would remove all squashfs filesystems, which is not limited to snaps. Nov 25, 2018 at 13:04
  • 3
    the difference is that the grep solution prevents other arguments to df from working.
    – tedder42
    Feb 19, 2019 at 23:30
  • 1
    how is this better than the proper use of df as listed in the answer, @mxmlnkn?
    – tedder42
    Mar 24, 2020 at 17:57
  • 5
    The previous function also removes lines which just happen to contain /snap. My function improves this as well as hide some other 'filesystems' I'm not interested in: function df() { command df $@ | grep -vE "(% /snap/)|(^tmpfs )|(^udev )"; } Apr 17, 2020 at 10:33

All the snap filesystems start as /snap/ so one can use the following command:

df | grep -v /snap

The -v inverses the grep search (list things that don't match).

The advantage of this is that it will still show squashfs filesystems if you want them.

You can still use an alias if you wish:

alias df='df | grep -v /snap'

Works With Other Tools (Pydf)

Also, because this is using a pipe to grep, rather than an option of df, you can use it for other tools such as pydf.


pydf | grep -v /snap
  • Using an alias means that you lose access to flags (df -h), so I tweaked this solution to use a function instead: df() { command df "$*" | command grep -v /snap; } and added it to my ~/.bashrc. This way I can still use df -h (or other flags) while still removing the annoyingly large list of snap mountpoints.
    – Compholio
    Feb 3, 2022 at 19:29

I find this one quite handy;

df -Thx squashfs

The number of way to do this is astronomical ;)

df | sed /snap/d

You must log in to answer this question.

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