What is the '.tee_history' file?

This is a plaintext file, apparently limited to 300 lines. I use tee frequently on my system.

$ file .tee_history
.tee_history: Unicode text, UTF-8 text
$ wc -l .tee_history
300 .tee_history
$ tee --version
tee (GNU coreutils) 9.3

I have no use for the history. Can this logging be easily disabled or would periodically truncating (> .tee_history) or removing the file be the most sensible solutions?

Asked By: user598527


I’m assuming that this relates to an answer given to one of your previous questions, where the following piece of code was suggested:

a() {
  rlwrap -pblue -S 'add> ' tee --output-error=warn -a -- "$@" > /dev/null

The a shell function declared here uses rlwrap (a wrapper around the Readline library) to provide a blue add> prompt for the (GNU coreutil’s) tee utility. When rlwrap is used, it creates a history file similar to your shell’s history file, usually named ~/.<name>_history, where <name> is the executed utility’s name.

You can’t turn off this history functionality completely it seems, but you can either use /dev/null as the history file (-H /dev/null or --history-filename /dev/null) or set the history file size to negative zero (-s -0 or --histsize -0). In the latter case, the file will still be created if it does not already exist (and if it exists, it will be read), but it is treated as read-only.

So, for example,

a() {
  rlwrap -pblue -S 'add> ' -H /dev/null -s -0 tee --output-error=warn -a -- "$@" > /dev/null
Answered By: Kusalananda
Categories: Answers Tags: , ,
Answers are sorted by their score. The answer accepted by the question owner as the best is marked with
at the top-right corner.