show only physical disks when using df and mount
You can solve the df1
argument issue by using the following alias:
alias df1='df --type btrfs --type ext4 --type ext3 --type ext2 --type vfat --type iso9660'
make sure to add any other type (xfs
, fuseblk
(for modern NTFS support, as @Pandya pointed out), etc) you're interested in. With that you
can do df1 -h
and get the expected result.
mount
does have a -t
option but you cannot specify it multiple times (only the last is taken), there I would use:
alias mount1="mount | /bin/grep -E '^/'"
I am using grep -E
as egrep
is deprecated and using /bin/grep
makes sure you're not using --colour=auto
from an alias for grep
/egrep
If switching to a different df
is an option, use pydf
instead, as it doesn't show filesystems having 0 blocks by default, and has a gauge, colors, and some other properties enabled by default. It works fairly well aliased to df
, and the original is always available using \df
anyway.
You can define the function as follows:
function df1() { df "$@" | grep -E '^/'; }
Example output:
$ df1 -h
/dev/sda8 25G 8.1G 16G 35% /
/dev/sda4 25G 20G 5.8G 78% /media/pandya/Documents+Edu
/dev/sda3 9.5G 7.1G 2.0G 79% /media/pandya/Ext4
/dev/sda7 24G 17G 6.9G 71% /media/pandya/Extra+Other
/dev/sda6 26G 25G 448M 99% /media/pandya/Media+Game
/dev/sda10 15G 7.9G 7.1G 53% /media/pandya/Miscellaneous
/dev/sda5 36G 22G 14G 63% /media/pandya/Software+OS
Here $@
lets you to input your arguments! [Note that $@
should always be written within double quotation marks unless you have a concrete reason not to. -ed]