티스토리 뷰

OS/Linux

[Ubuntu] df 명령시 loop device 제외하는 방법

행복한브라운 2020. 9. 25. 10:05
(base) brown@brown-dev:~$ df -h
Filesystem      Size  Used Avail Use% Mounted on
udev             32G     0   32G   0% /dev
tmpfs           6.3G  2.6M  6.3G   1% /run
/dev/nvme0n1p2  234G  192G   30G  87% /
tmpfs            32G  453M   31G   2% /dev/shm
tmpfs           5.0M  4.0K  5.0M   1% /run/lock
tmpfs            32G     0   32G   0% /sys/fs/cgroup
/dev/loop1      801M  801M     0 100% /snap/android-studio/91
/dev/loop2       55M   55M     0 100% /snap/barrier/384
/dev/loop3      147M  147M     0 100% /snap/code/43
/dev/loop0      801M  801M     0 100% /snap/android-studio/90
/dev/loop5       97M   97M     0 100% /snap/core/9804
/dev/loop4      144M  144M     0 100% /snap/code/44
/dev/loop6      256M  256M     0 100% /snap/gnome-3-34-1804/36
/dev/sdb        458G  6.6G  428G   2% /media/brown/workspace2
/dev/loop7       55M   55M     0 100% /snap/core18/1880
/dev/sda1       440G  210G  208G  51% /media/brown/workspace
/dev/nvme0n1p1  511M  7.8M  504M   2% /boot/efi
/dev/loop8      2.3M  2.3M     0 100% /snap/gnome-system-monitor/148
/dev/loop9       56M   56M     0 100% /snap/protobuf/37
/dev/loop10      50M   50M     0 100% /snap/barrier/83
/dev/loop11      40M   40M     0 100% /snap/remmina/4324
/dev/loop12     194M  194M     0 100% /snap/mailspring/488
/dev/loop14      98M   98M     0 100% /snap/core/9993
/dev/loop13      63M   63M     0 100% /snap/gtk-common-themes/1506
/dev/loop15     162M  162M     0 100% /snap/gnome-3-28-1804/128
/dev/loop16      65M   65M     0 100% /snap/netron/118
/dev/loop17      56M   56M     0 100% /snap/core18/1885
/dev/loop18     355M  355M     0 100% /snap/pycharm-community/209
/dev/loop20     2.3M  2.3M     0 100% /snap/gnome-system-monitor/145
/dev/loop19      55M   55M     0 100% /snap/gtk-common-themes/1502
/dev/loop21     355M  355M     0 100% /snap/pycharm-community/211
/dev/loop22     173M  173M     0 100% /snap/qt551/30
/dev/loop23      65M   65M     0 100% /snap/netron/117
/dev/loop24     256M  256M     0 100% /snap/gnome-3-34-1804/33
tmpfs           6.3G   20K  6.3G   1% /run/user/121
tmpfs           6.3G   84K  6.3G   1% /run/user/1000

위 처럼 보기 안좋은 loop device들을 모두 안나오게 하기 위해서는 -x 옵션을 이용하며 된다.

alias df='df -h -x squashfs -x tmpfs -x devtmpfs'

위 alias를 .bashrc 또는 .bash_aliases 에 추가하고 source 명령을 통해 반영하면 된다.

(base) brown@brown-dev:~$ echo "alias df='df -h -x squashfs -x tmpfs -x devtmpfs'" >> ~/.bash_aliases
(base) brown@brown-dev:~$ source ~/.bashrc 
(base) brown@brown-dev:~$ df -h
Filesystem      Size  Used Avail Use% Mounted on
/dev/nvme0n1p2  234G  193G   30G  87% /
/dev/sdb        458G  6.6G  428G   2% /media/brown/workspace2
/dev/sda1       440G  210G  208G  51% /media/brown/workspace
/dev/nvme0n1p1  511M  7.8M  504M   2% /boot/efi
Comments
댓글쓰기 폼