There is a need to split binary files because of the large file sizes containing the compressed data. Many tools can’t access the binary files directly in their original condition and cannot split the binary files. Sometimes, it becomes hard for an average user to split the binary files easily. Therefore, we will explain every method to split the binary files in Linux.
How to Split Binary Files in Linux
You can split the binary file in Linux using the split command. This command can split the binary files containing vast chunks. The split command is straightforward compared to other Linux commands. Here is the basic command to split the binary file:
Or
By default, the split command aids in splitting the file into various pieces that are named starting from xaa, xab, xzz, etc. For example, we want to split the “simple.bin” binary file present in the Downloads directory. We have to execute the following commands to split the binary file:
Or
$ split sample.bin
Verbose Option to View Split Files
If you want to know the names of the split pieces of the binary file, you can view the system by breaking the binary file using “verbose’ in your command. Include “verbose” in front of your filename in the command to use this option. Here, execute the following command:
The system would then split the files and create the sub-files, as illustrated in the previous image.
Use a Prefix to Name the Subfiles
You can also use your prefix to name the different parts of the binary file and the split command. Using the prefix in naming the smaller files would aid in a better identification and accessibility to the files. Here, you can use this command:
For example, if I want to give the prefix “myfile” to split a binary file named “xaa”, then the command will be:
Specifying the Size of the Split Files
You can also specify the size in which you want the smaller files to be after splitting the binary file. Use the command option “-b” followed by the specification of the size of smaller files. We can create smaller files in different sizes, varying from kilobytes to yottabytes, which are identified using the appropriate letters like K or Y.
For example, if I want the smaller files to be created in uniform sizes of 4 GB, the command will be:
In this command, the letters 2G show the size of 2GB. Let’s split the binary file with the 100KB size:
Conclusion
To sum it up, the split command is used to split the binary files in Linux. Besides this command, you can use the verbose option to see the creation of smaller files during the process. You can also specify the size of the files to be created using the “-b” option. Allot a unique prefix to the filenames for an easy identification or even specify the uniform number of lines in each split file.
We hope that the steps shown above helped you in easily splitting binary files in Linux and enabling unique identities for such smaller files.