About Me

header ads

How to divide a file in Ubuntu

Introduction

Although today's email services whenever possible to send larger files, or even always, you can use other services from Dropbox, any other solution, there are moments when you may need to split a file into smaller files.

There are many ways to do it, but probably the quickest and easiest is through the terminal, and is split

Split
Split is a simple command that allows you to split a file into smaller ones. Its use is as simple as:
split [OPTION]... [INPUT [PREFIX]]
The options are:
  • -Suffix-length=N use suffixes of length N (default is 2)
  • -Bytes=SIZE sets the size of split files into SIZE
  • -Line-bytes=SIZE sets a maximum file size divided as SIZE
  • -Numeric-suffixes use numeric suffixes instead of alphabetic
  • -Lines=NUMBER puts the number of lines per file split
  • -Verbose prints a diagnostic after each split file is created
  • -Help show help
  • -Version prints the version of split
The size, SIZE, may be one of the following: KB 1000, K 1024, MB 1000*1000, M 1024*1024, and so on for G, T, P, E, Z, Y.

For example:
split --bytes=10M --suffix-length=3 --numeric-suffixes prueba DIV
the file "test" has a size of just over 79 MB or so, with this command will divide in 7 files of 10 MB and one with the rest, which begin with the prefix DIV, and the suffix is numeric and 3 characters length, as you can see in the image below:


Unite
Once the files have arrived and you did what you had to do with them, we have to do the reverse: "link" and is a simple operation like the above simply

cat DIV* > prueba
Conclusion
Indeed, there are graphical tools can do wonders when it comes to split a file and then attach it again, however, with this pair of command "split" and "cat", simplicity and speed is absolute. If you're still seems awkward to use split, you can always create an alias for it and simplify it further.

Post a Comment

0 Comments