Use the standard mount command to mount an ISO image in read-only mode using the loop device and then copy the files to another directory.


Mount or Extract ISO File in Linux


To do so, you must have an ISO file (I used ubuntu-16.10-server-amd64.iso ISO image) and mount point directory to mount or extract ISO files.


First create a mount point directory, where you will going to mount the image as shown:

$ sudo mkdir /mnt/iso


Once the directory has been created, you can easily mount ubuntu-16.10-server-amd64.iso file and verify its content by running the following command.

$ sudo mount -o loop ubuntu-16.10-server-amd64.iso /mnt/iso
$ ls /mnt/iso/


Now you can go inside the mounted directory (/mnt/iso) and access the files or copy the files to /tmp directory using cp command.

$ cd /mnt/iso
$ sudo cp md5sum.txt /tmp/
$ sudo cp -r ubuntu /tmp/


Note: The -r option used to copy directories recursively if you want you can also monitor the progress of copy command.


Extract ISO Content Using 7zip Command


If you don’t want to mount ISO file, you can simply install 7zip, is an open-source archive program used to pack or unpack the different number of formats including TAR, XZ, GZIP, ZIP, BZIP2, etc..

$ sudo apt-get install p7zip-full p7zip-rar [On Debian/Ubuntu systems]
$ sudo yum install p7zip p7zip-plugins      [On CentOS/RHEL systems]


Once 7zip program has been installed, you can use 7z command to extract ISO file contents.

$ 7z x ubuntu-16.10-server-amd64.iso


Note: As compared to Linux mount command, 7zip seems much faster and smart enough to pack or unpack any archive formats.


Extract ISO Content Using isoinfo Command


The isoinfo command is used for directory listings of iso9660 images, but you can also use this program to extract files.


As I said isoinfo program perform directory listing, so first list the content of ISO file.

$ isoinfo -i ubuntu-16.10-server-amd64.iso -l


Now you can extract a single file from an ISO image like so:

$ isoinfo -i ubuntu-16.10-server-amd64.iso -x MD5SUM.TXT > MD5SUM.TXT


Note: The redirection is needed as -x option extracts to stdout.


Well, there are many ways to do, if you know any useful command or program to extract or copy files from ISO file do share us via comment section.

Esta resposta foi útil? 0 Utilizadores acharam útil (0 Votos)