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

The Geek Diary

  • OS
    • Linux
    • CentOS/RHEL
    • Solaris
    • Oracle Linux
    • VCS
  • Interview Questions
  • Database
    • oracle
    • oracle 12c
    • ASM
    • mysql
    • MariaDB
  • DevOps
    • Docker
    • Shell Scripting
  • 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. pgrep: command not found
  2. partprobe Command Examples in Linux
  3. Unable to Run X Applications Through SSH in Linux
  4. debootstrap: command not found
  5. LVM Configuration : Logical Volume (LV) Operations/Utilities
  6. firejail Command Examples in Linux
  7. How to enable Debug Option For CIFS Module in CentOS/RHEL 7 and 8
  8. lftp Command Examples in Linux
  9. kdialog Command Examples in Linux
  10. lvmconf Command Examples in Linux

You May Also Like

Primary Sidebar

Recent Posts

  • pw-cat Command Examples in Linux
  • pvs: command not found
  • pulseaudio: command not found
  • pulseaudio Command Examples in Linux

© 2023 · The Geek Diary

  • Archives
  • Contact Us
  • Copyright