silly (non-bsd) split/cat question (solved)

Aleksandr Miroslav alexmiroslav at
Wed Feb 20 22:44:32 UTC 2019

On Wed, Feb 20, 2019 at 11:15 AM Aleksandr Miroslav
<alexmiroslav at> wrote:
> So my question is this: if I have bigfile, which is about 12GiB in
> size, and I have 9GiB left of free disk space, how do I split bigfile
> into files of about 2GiB?

Figured it out. There's a command called "truncate" that will cut off
the end of any file in-place.

Using split, I cut up bigfile, but while the split is still running I
delete the first couple of files.

So for bigfile above, I ran "split -b 2g bigfile &" and then "rm xaa"
and "rm xab" after those files were created, but while the rest of the
files were being created. This left me with xac, xad, xae, and xaf,
ie. the last 4 chunks of the split.

I then used truncate to reduce bigfile to the size of the first two
chunks. I then ran the same split command again to create the first
two chunks.

This solved my problem.

(There's probably an easier way to do this with dd and its skip parameter.)

More information about the freebsd-questions mailing list