Last active
December 20, 2015 08:19
-
-
Save somian/6099523 to your computer and use it in GitHub Desktop.
Bash user function (typically executed from an interactive shell while doing system work or just stuff) on GNU-Linux. Point is see mounted disk devices neatly printed.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
## earlier version was fubar | |
function diskmounts { | |
cat /proc/mounts | perl -nawl \ | |
-e 'if ($F[0]=~ m{/dev/(loop[[:digit:]]+ | sd[a-z][[:digit:]]? | sr[[:digit:]]+) | UUID= | LABEL=}x) {' \ | |
-e ' push @dp=>[@F[0,1]]' \ | |
-e '} END {print for map { $_->[1] } sort {$a->[0] cmp $b->[0]} map { [$_->[0], join (qq[\t\t],@$_)] }@dp}' | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Output looks like this:
/dev/sda1 /boot
/dev/sda4 /
/dev/sda5 /var
/dev/sdb1 /media/usb0
/dev/sdb5 /media/usb3