5

Which bash command shows the volume label?

ajo
  • 945
  • 2
  • 12
  • 20

2 Answers2

5
/sbin/blkid /dev/sdXY                    # needs rootpriv for internal drives
ls -l /dev/disk/by-label/ | grep sdXY    # workaround for unprivileged users
0

To display the label for the currently mounted partition at / use:

lsblk -o LABEL,MOUNTPOINT | grep " /$" | cut -d' ' -f1

Added benefit no sudo required.