Sometimes you may want to extract just a few files from ISO image. Typically, ISO images contain large files or many files and directories. But you may not want to extract all of them to your disk. In this article, we have learnt how to extract & copy files from ISO image in Linux.
How to Extract & Copy Files from ISO Image in Linux
There are several ways to extract & copy files from ISO image in Linux. We will look at 3 simple ways to extract & copy files from ISO image in Linux.
1. Mount or Extract ISO File in Linux
Open terminal and run the following command to mount or extract ISO file in Linux.
$ sudo mkdir /mnt/iso
Once the directory has been mounted, you can easily mount the ISO file and verify its content. We have used Ubuntu 16.10’s ISO image.
$ sudo mount -o loop ubuntu-16.10-server-amd64.iso /mnt/iso $ ls /mnt/iso/
For example, you can go inside mounted directory /mnt/iso and access files or copy files to /tmp directory using cp command.
$ cd /mnt/iso $ sudo cp md5sum.txt /tmp/ $ sudo cp -r ubuntu /tmp/
2. Using 7Zip Command
If you don’t want to mount ISO image, you can use 7Zip, which is a free archive program, used to pack or unpack different file formats such as TAR, XZ, GZIP, ZIP and more.
$ sudo apt-get install p7zip-full p7zip-rar [On Debian/Ubuntu systems] $ sudo yum install p7zip p7zip-plugins [On CentOS/RHEL systems]
Once 7zip is installed, run the following command to extract ISO file’s contents.
$ 7z x ubuntu-16.10-server-amd64.iso
3. Using ISOinfo Command
IsoInfo command is used for directory listing of ISO9660 images. But it can be used to extract files. Here is the command to list contents of ISO file.
$ isoinfo -i ubuntu-16.10-server-amd64.iso -l
Here is the command to extract single file from ISO image. We use -x option so that the output is redirected to desired file, instead of standard output.
$ isoinfo -i ubuntu-16.10-server-amd64.iso -x MD5SUM.TXT > MD5SUM.TXT
In this article, we have learnt how to extract one or more files from ISO image. ISO images are disk images that contain everything that you would normally write to an optical disc, including a file system. It is also used to store operating system and create bootable disks. Often we may need to download just one or a few files from them. In such cases, you can use the above steps to extract & copy ISO’s files to your disk.