Split command

Split is a command which is used to split a file into pieces by default the split command split files in to the 1000 lines, and default PREFIX is `x’. The following arguments are present with the split command.

~~~~~~~~~~~~

-a, –suffix-length=N use suffixes of length N (default 2)
-b, –bytes=SIZE put SIZE bytes per output file
-C, –line-bytes=SIZE put at most SIZE bytes of lines per output file
-d, –numeric-suffixes use numeric suffixes instead of alphabetic
-l, –lines=NUMBER put NUMBER lines per output file
–verbose print a diagnostic to standard error just
before each output file is opened
~~~~~~~~~~~

The latest split version is 5.97 and you can also confirm the split version by using the following command.

split –version

root@linux [~]# split –version
split (GNU coreutils) 5.97
Copyright (C) 2006 Free Software Foundation, Inc.

The most common use of split command is to split the big files into the small files to download in on local machine or on remote server.

For example, if we want to split the 210M file in to the set of 21M files than use the following command.

split –bytes=20971520 FILENAME new-21mb-size

The above command will split the 210M file in to the 10 small files.

About Anant 384 Articles
Senior technical writer