Breaking Linux files into pieces

 


  

  Simple Linux commands allow you to break up files and reassemble them as needed in order to accommodate size restrictions.



    Linux provide a very easy-to-use command for breaking files into pieces. This is something that you might need to do prior to uploading your files to some storage site that limits file sizes or emailing them as attachments. To split a file into pieces, you simply use the split command.

$ split filename

By default, the split command uses a very simple naming scheme. The file chunks will be named xaa, xab, xac, etc., and, presumably, if you break up a file that is sufficiently large, you might even get chunks named xza and xzz.dsc

You can also contribute to the file naming by providing a prefix. For example, to name all the pieces of your original file bigfile.xaa, bigfile.xab and so on, you would add your prefix to the end of your split command like so:

image

Note that a dot is added to the end of the prefix shown in the above command. Otherwise, the files would have names like bigfilexaa rather than bigfile.xaa.

Also, note that the split command does not remove your original file, just creates the chunks. If you want to specify the size of the file chunks, you can add that to your command using the -b option. For example:

split -b100M your_file

If you want your file to be split based on number of bytes, you can use the -b option. In this example, each file will 50b chuncks.

$ split --verbose -b50K zip zip.
creating file 'zip.aa'
creating file 'zip.ab'
creating file 'zip.ac'

If you need to reassemble your file from pieces on a remote site, you can do that fairly easily using a cat command like one of these:


cat x?? > original.file
cat log.?? > original.file


"Do you already know my Linux training !?" Available in portuguese only.


"Você já conhece meu treimanento de linux!?"

Neste treinamento vamos abordar de forma simples, rápida e sem “enrolação”  como instalar o Linux CentOS 8 utilizando o VirtualBox e a nuvem da Amazon AWS do zero.



Nenhum comentário:

Postar um comentário