Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

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
up vote 5 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

I am not sure whether this would help you:

dvdtitle=$(isoinfo  -i isofile.iso -d | grep "Volume id:" | awk '{print $3}')
share|improve this answer
(1) The question title is “Read the title from a DVD?” and the last sentence in the question says, “I’d like to simply get the name of any disk currently in the drive …”, so you should probably start off by suggesting isoinfo -i /dev/cdrom -d   …, and then add, as a postscript, the fact that the command can be used to examine an ISO image in a file by specifying …   -i iso_image_filename  .  … (Cont’d) – G-Man Oct 2 '15 at 18:56
(Cont’d) …  (2) awk is a powerful text processing tool; you hardly ever need to use it in conjunction with another text processing tool such as grep.  Your pipeline, grep "Volume id:" | awk '{print $3}', can be simplified to awk '/Volume id: / {print $3}'.  (3) Volume IDs can be multiple words, and this print $3 approach displays only the first one.  There are ways of handling this in awk, but an easier approach is to pipe the output from isoinfo into sed -n 's/Volume id: //p'.  (4) As a sanity check, it would be better to search for /^Volume id: /. – G-Man Oct 2 '15 at 18:59

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.