I don’t like the truncate command line tool. I use it way to often to want to type the flags. And I have never, ever used it for anything but to completely truncate a file.
So I hacked up my own little trunc-func.
And just to check, here’s a little performance test. I create a huge file and then truncate it.
So we have a 7.5 GB file here. That’s about as big as anything I ever touch in my file system at once. It took over a minute to do a wourd count in it. Let’s make sure it doesn’t take forever to truncate. I will print the date, truncate, hit y quick, and the print the date again.
It took about a second, including me hitting a key. I’d say that’s good enough.