1

I want the full path of the original iso file which was mounted into a (lets say /media/iso) directory. I don't know how to get that iso file path.

I tried lsblk,sudo blkid commands but nothing seems to work.

How do i find the path of an iso file which is currently mounted? Is there any command for that?

2

Run the below command on terminal to view the original iso file path which is mounted inside /media/iso directory,

mount | awk '/\/media\/iso/ { print $1}'

To see the whole line(iso path location and the mount point),

mount | awk '/\/media\/iso/ { print $0}'

OR

mount | grep /media/iso

In the above /media/iso is the mountpoint where the iso file is actually mounted./\/media\/iso/ in the awk command is a regular expression to grab a line which contains the name /media/iso.You have to escape the forward slahes(like /\/media\/iso/) while you give it on an awk search regex.

$ mount | grep /media/iso
/usr/share/virtualbox/VBoxGuestAdditions.iso on /media/iso type iso9660 (ro)
$ mount | awk '/\/media\/iso/ { print $1}'
/usr/share/virtualbox/VBoxGuestAdditions.iso
$ mount | awk '/\/media\/iso/ { print $0}'
/usr/share/virtualbox/VBoxGuestAdditions.iso on /media/iso type iso9660 (ro)

You can also search by the file type as,

$ mount | awk '/iso9660/ { print $1}'
/usr/share/virtualbox/VBoxGuestAdditions.iso
$ mount | awk '/iso9660/'
/usr/share/virtualbox/VBoxGuestAdditions.iso on /media/iso type iso9660 (ro)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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