When I mentioned that there were useful and interesting tools in coreutils and util-linux and bsd-games (and I should probably add binutils), I wasn’t exactly thinking of truncate
.
truncate
wasn’t on my list when it began five years ago, or even in later additions. I can see why: It’s a rather arbitrary and vicious tool, snapping off files at predetermined lengths and leaving the remainder to flutter away in the wind.
I can’t think of any exact use for truncate
aside from determining an exact, to-the-byte length of a file, perhaps for some sort of network testing or disk performance check. And considering the leftovers are summarily discarded, it’s a lethal decision to use it.
truncate
follows the same flags for size and units as split and some other toys from coreutils. If you’re familiar with much of what’s in the suite, it will only take you a second to get used to truncate
.
And that’s about all I can think of to say about truncate
. Use wisely. π