How to split GB file in parts

Command for split file

#split -b sizeM filename.tar.gz split-file

Syntax :
-b : size in MB put 1024M, size in GB put 1G

Note : You must put spilt-file as a name in end because it will create spilt-fileaa, spilt-fileab, spilt-fileac,… so on. Or it will create xaa,xab,xac,…so on.

Note : site for more help

http://linux.101hacks.com/unix/split/

Example :

Split the file into 20 MB files as shown below with -b option.

$ split -b 20M logdata

$ ls -lh | tail -n +2

-rw——- 1 sathiya sathiya 102M Jul 25 18:47 logdata

-rw——- 1 sathiya sathiya  20M Jul 25 19:20 xaa

-rw——- 1 sathiya sathiya  20M Jul 25 19:20 xab

-rw——- 1 sathiya sathiya  20M Jul 25 19:20 xac

-rw——- 1 sathiya sathiya  20M Jul 25 19:20 xad

-rw——- 1 sathiya sathiya  20M Jul 25 19:20 xae

-rw——- 1 sathiya sathiya 1.6M Jul 25 19:20 xaf

Split the file into 50 MB pieces with the given prefix

Split the file into 50 MB files as shown below with –bytes option which is similar as the -b option, and give the prefix as second argument.

$ split –bytes=50M logdata mydatafile

$ ls -lh

total 204M

-rw——- 1 sathiya sathiya 102M Jul 25 18:47 logdata

-rw——- 1 sathiya sathiya  50M Jul 25 19:23 mydatafileaa

-rw——- 1 sathiya sathiya  50M Jul 25 19:23 mydatafileab

-rw——- 1 sathiya sathiya 1.6M Jul 25 19:23 mydatafileac

 

Join file after split

If you are copy that split files on linux machine put following command :

# cat spilt-file* > filename.tar.gz

If you are copy that split files on windows machine put following command:

C:\>copy /b largefile_part_* largefile_joined.iso

Note : if you want for all platform use HJsplit

Download from following site

http://www.hjsplit.org/

Advertisements
Posted in Linux

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: