3

I'm logging the output of a command with

command | tee file

This causes tee to actually write to the disk every second or so. I'd like to reduce the frequency of the writes, by caching the output more.

I know this can be done at the system level, for all processes, but is there a simple way to do this at the user level, just for this process?

(Having tee write to ramdisk and then having another process periodically copy the output; or modifying tee itself seem overly complicated)

MWB
  • 187
  • 8

1 Answers1

4

Try

command | stdbuf -o5M cut -b-

For 5MiB output buffering. See man stdbuf for a list of options. Note this doesn't work with tee which overrides the the buffer modes.

Matthew Ife
  • 22,927
  • 2
  • 54
  • 71