Tricks for extracting and copying files from an ISO image (Linux)

Source: Internet
Author: User

Tricks for extracting and copying files from an ISO image (Linux)
GuideSuppose your Linux server has an oversized ISO image file. You want to open it and extract or copy one of the files. What would you do? In fact, in Linux, there are many ways to achieve this requirement.

For example, you can use the traditional mount command to load the ISO image file as a loop device in read-only mode, and then copy the file to another directory.

Extracting ISO image files in Linux

To complete this test, you have to have an ISO image file (I am using a ubuntu-16.10-server-amd64.iso system image file) and a directory for mounting and extracting ISO image files.

First, use the following command to create a mount directory to mount the ISO image file:

$ sudo mkdir /mnt/iso

After the directory is created, you can run the following command to easily mount the ubuntu-16.10-server-amd64.iso system image file and view its contents.

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

Mounting ISO images in Linux

Now you can go to the Mount directory/mnt/iso to view the file or use the cp command to copy the file to the/tmp directory.

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

Copy an ISO image file in a Linux System

Note: The "-r" option is used to recursively copy contents in the directory. If necessary, you can also monitor the progress of the replication command.

Use the 7zip command to extract content from the ISO Image

If you do not want to mount an ISO image, you can simply install a 7zip tool, which is a free and open-source decompression software used to compress or decompress files of different formats, including TAR, XZ, GZIP, ZIP, and BZIP2.

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

After the 7zip software is installed, you can use the 7z command to extract the content from the ISO image file.

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

Use the 7zip tool to Extract files from the ISO image in Linux

Note: compared with the Linux mount command, 7zip is faster and smarter when compressing and extracting files in any format.

Use the isoinfo command to extract the content of an ISO Image File

Although the isoinfo command is used to list the content of the iso9660 image file in the form of a directory, you can also use this program to Extract files.
As I said, the isoinfo program will display the directory list, so the content of the ISO image file will be listed first.

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

List ISO files in Linux

Now you can extract a single file from an ISO image file as follows:

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

Note: Because "-x" is extracted to the standard output, you must use redirection to extract the specified file.

Extract A single file from an ISO Image File

There are still many ways to achieve this. If you know other useful commands or tools to extract and copy files from an ISO image file, please share with you in the following comments.



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.