/etc insider

since 1999 (and still editing)

Uncluttering df

| Comments

Typically, on a busy server with a bunch of OpenVZ or possibly LXC containers run, df output is cluttered with lots of tmpfs, devtmpfs and/or simfs entries:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
none                      tmpfs     410M  1.1M  409M   1% /var/lib/vz/root/1060/run
none                      tmpfs     5.0M     0  5.0M   0% /var/lib/vz/root/1060/run/lock
none                      tmpfs     2.0G     0  2.0G   0% /var/lib/vz/root/1060/run/shm
none                      tmpfs     100M     0  100M   0% /var/lib/vz/root/1060/run/user
none                      tmpfs     4.0K     0  4.0K   0% /var/lib/vz/root/12020/sys/fs/cgroup
none                      tmpfs     1.0G     0  1.0G   0% /var/lib/vz/root/12020/tmp
none                      tmpfs     410M  1.1M  409M   1% /var/lib/vz/root/12020/run
none                      tmpfs     5.0M     0  5.0M   0% /var/lib/vz/root/12020/run/lock
none                      tmpfs     2.0G     0  2.0G   0% /var/lib/vz/root/12020/run/shm
none                      tmpfs     100M     0  100M   0% /var/lib/vz/root/12020/run/user
none                      tmpfs     4.0K     0  4.0K   0% /var/lib/vz/root/10800/sys/fs/cgroup
none                      tmpfs     1.0G     0  1.0G   0% /var/lib/vz/root/10800/tmp
none                      tmpfs     308M  1.1M  307M   1% /var/lib/vz/root/10800/run
none                      tmpfs     5.0M     0  5.0M   0% /var/lib/vz/root/10800/run/lock
none                      tmpfs     1.5G     0  1.5G   0% /var/lib/vz/root/10800/run/shm
none                      tmpfs     100M     0  100M   0% /var/lib/vz/root/10800/run/user
none                      tmpfs     4.0G     0  4.0G   0% /var/lib/vz/root/1040/dev/shm

– of course one can use grep (or, better fgrep) to filter out that entries, but df itself has own filtering capabilites allowing to exclude unneeded filesystems. Plus shell (both bash and zsh) allows for shortening such a command with the brace expansion. As a result, you may have something simple and concise as this:

df -Th -x{{dev,}tmp,sim}fs

Not an easy oneliner to memorize, so actually would be best recalled with Ctrl_R it when needed.

Comments