Take the 2-minute tour ×
Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems.. It's 100% free, no registration required.

I've noticed that each DVD image has a semi-unique uppercase name. Is there a standardized way for me to simply read this name as a non-root user in Linux? I'm on an Ubuntu 12.04 derivative running kernel 3.7. I'd like to simply get the name of any disk currently in the drive like so:

DVD_NAME="$( ./read-dvd-name.sh )"
share|improve this question
It's bad practice to use all uppercase variable names for non-environment variables. –  jordanm Jan 18 '13 at 5:02
Thanks, but this doesn't answer my question :) Bad-practice is debatable. –  Naftuli Tzvi Kay Jan 18 '13 at 6:20
That's why it was a comment and not an answer. –  jordanm Jan 18 '13 at 14:38

1 Answer 1

up vote 4 down vote accepted

You could use blkid for that:

DVD_NAME=$(blkid -o value -s LABEL /dev/dvd)

(you need to have read permission to /dev/dvd for that).


DVD_NAME=$(udevadm info -n dvd -q property | sed -n 's/^ID_FS_LABEL=//p')

for which you don't need any special privilege (udev (running as root) queries the label name using blkid and updates a device database which you query with udevadm).

share|improve this answer
Do I need to be root to do that? –  Naftuli Tzvi Kay Feb 1 '13 at 23:57

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.