Posts Tagged bash

quick post: split files on linux

This is a short post, so lets see, imagine you have a file called file_to_share of 1.5gb and you want to move that file to another PC using a 1gb usb flash drive, obviously the file just don’t fit in the flash drive available space, so an easy and fast way to cut that file into smaller ones that fit on the flash drive is to use the command split
split -db 900M file_to_share splitted
-d use numeric suffixes instead of alphabetic
-b 900M this is the desirable size for the output files, M is for Megabytes, K for kilobytes and b for bytes
file_to_share input file
splitted is the prefix for the output files, if you don’t use a prefix, the files will be named 00, 01, 02…
After the command finish, you will have two files splitted00 and splitted01, for join this files you can use the cat command
cat splitted01 >> splitted00
and the original-size file will be splitted00.

For deeper info, you can take a look on man split

2 comments March 22, 2009


Blogroll

Tags

bash dbus Debian glp Gnome GNU/Linux Humor Opinion Personal Programacion python Rails reunion Ruby scaffolding shell scripting Software Libre songbird Variado Web Web 2.0 WTF! xchat