Df -h command use on Linux

While using df -h command to get human readable output that print disk space usage sizes in powers of 1024 on Ubuntu Linux, I noticed 78 entries mostly made of /dev/loop.

df -h

See all those /dev/loop0, /dev/loop1… entries:

Filesystem                 Size  Used Avail Use% Mounted on
udev                        16G     0   16G   0% /dev
tmpfs                      3.2G  3.0M  3.2G   1% /run
/dev/sda                   378G   41G  319G  12% /
tmpfs                       16G  326M   16G   3% /dev/shm
tmpfs                      5.0M  4.0K  5.0M   1% /run/lock
tmpfs                       16G     0   16G   0% /sys/fs/cgroup
/dev/loop0                 128K  128K     0 100% /snap/bare/5
/dev/loop1                  44M   44M     0 100% /snap/certbot/2772
/dev/loop2                 150M  150M     0 100% /snap/chromium/2333
/dev/loop3                  19M   19M     0 100% /snap/chromium-ffmpeg/30
/dev/loop60                 50M   50M     0 100% /snap/snapd/18357
tmpfs                      3.2G   24K  3.2G   1% /run/user/125
tmpfs                      1.0M     0  1.0M   0% /var/snap/lxd/common/ns
tmpfs                      3.2G   96K  3.2G   1% /run/user/1000
tmpfs                      3.2G     0  3.2G   0% /run/user/0

How can I get rid of /dev/loop* while using df -h command usage on Linux?

The -h or --human-readable option is passed to the df command to show you Linux filesystem disk space usage in a human-readable format. All types of filesystems are displayed by default, including ext3, ext4, zfs, tmpfs, loopback and more.

Limiting listing to file systems usage with df -h command on Linux

Try passing the -t TYPE option to see df usage just for ext4 file system. For example:

df -h -t ext4

Want both zfs and ext4?

df -h -t ext4 -t zfs

Another quick and dirty solution is to pass the outputs of df -h to the grep command or egrep command to filter out unwanted filesystems. For instance:

df -h | grep -v '^/dev/loop'
df -h | grep -E -v 'loop|tmpfs|zfs'

See also

Read my tutorial for more info on df and co under Linux:

  1. How to use df command in Linux / Unix {with examples} - nixCraft
  2. Why command df and du reports different output? - nixCraft
  3. Linux Check Disk Space Command To View Disk Usage - nixCraft
  4. Shell script to watch the disk space and send an email - nixCraft

Hello Raj,

There is no simpler solution than:

                 df -h  |  grep  -v  ^/dev/loop