• Skip to primary navigation
  • Skip to main content
  • Skip to primary sidebar

The Geek Diary

CONCEPTS | BASICS | HOWTO

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • Linux Services
    • VCS
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
    • Data Guard
  • DevOps
    • Docker
    • Shell Scripting
  • Interview Questions
  • Big Data
    • Hadoop
    • Cloudera
    • Hortonworks HDP

How to split iso or file using ‘split’ command in Linux

By admin

You may need to cut down or split a file into smaller pieces sometimes. This is very useful when you want to cut down a large iso to fit into a DVD or CD. or can also be used to transfer over a network. To split the file into smaller pieces, we can use the split command.

The syntax for the split command is :

# split -b [size of split pieces] [file to split] [split file prefix]

For example to split an iso file image.iso of size 4.6GB into smaller chunks of 2000MB use the below command:

# split -b 1200M image.iso split-file

SIZE of the smaller files to be created may be one of the following, or an integer optionally followed by one of following multipliers:

suffix multiplier
KB 1000
K 1024
MB 1000 x 1000
M 1024 x 1024

This will generate 3 files with the following file sizes. You can specify the file prefix for the smaller files.

# du -sh chunks-a*
2.0G	chunks-aa
2.0G	chunks-ab
0.6G	chunks-ac

To recreate the file, use the cat command.

# cat split-imga* > new-image.iso

The split and cat commands are provided by the coreutils package.

Verify the integrity of the file

Note: To verify that the file has been correctly restored, use the command md5sum before and after splitting the file. Syntax:

# md5sum [filename]

Before spliting

# md5sum image.iso
06caba513738f3af0ac475910e7f8a0f  image.iso

After recreating the file from split pieces

# md5sum new-image.iso
06caba513738f3af0ac475910e7f8a0f  new-image.iso

Filed Under: Linux

Some more articles you might also be interested in …

  1. CentOS/RHEL – How to Remove stale ISCSI Target Node Information from ISCSI Initiator Server
  2. CentOS / RHEL 7 : How to remove rescue image using grubby
  3. CentOS / RHEL : How to restore/recover a deleted volume group in LVM
  4. LVM error “WARNING: Inconsistent metadata found” – How to resolve in CentOS / RHEL
  5. NFSv4 mountpoint shows incorrect ownerships as nobody:nobody in CentOS/RHEL
  6. How to Configure Early-kdump Support Feature in CentOS/RHEL 8
  7. Beginners Guide to SELinux
  8. Managing Clustered Logical Volumes in RHEL Cluster (pacemaker)
  9. How to create virtual block device (loop device/filesystem) in Linux
  10. CentOS / RHEL : How to install Open Virtual Machine Tools for Virtual machines Hosted on VMWare

You May Also Like

Primary Sidebar

Recent Posts

  • MySQL: how to figure out which session holds which table level or global read locks
  • Recommended Configuration of the MySQL Performance Schema
  • MySQL: Identify what user and thread are holding on to a meta data lock that is preventing other queries from running
  • MySQL: How to kill a Long Running Query using max_execution_time
  • Archives
  • Contact Us
  • Copyright

© 2021 · The Geek Diary