Running a Linux terminal, I have a long-running tail
background process which produces terminal output from time to time to notify me of log changes. Since it's in the background, I want to be able to run it and continue working on the terminal. However, whenever tail
outputs while I'm typing, the output inserts itself after whatever text I'd already typed on that line, and I have to abandon the line and start over. For instance, typing abcdefghijklmnop
, with a tail
message of Log Updated!
gives:
user@server:~$ abcdefghijklmLog Updated!
nop
-bash: abcdefghijklmnop: command not found
Is there any way to pipe the tail
output to print while still preserving my half-written input lines? Bash does somehow distinguish between what I typed and what tail
output, so there is an input buffer of some kind that's preserved - is there a way to have tail
erase the characters which have been written, print, and then print those characters to the standard input?
tail
won't do what you are asking, but the hint about sed
is useful. If you run in screen
, and the tail
process is running in another window (and piping through sed
to append a \a
ASCII BEL to the end of each line), screen
will notify you in its status line when the BEL is seen on the other window.
I use this in some build-scripts, to remind me when the (partly interactive) task is done.
A Window manager is less useful for this sort of thing if your connection to the machine doing the work is via ssh
, no GUI.