Nicolai's answer is probably closest to what you asked for, but have you thought about using tmux?
In my tmux sessions, I like to tail -f
logs, then simply enter tmux's copy mode to search up and down exactly like searching in less, then exit copy mode to find my tail -f
still going.
Create a tmux session:
tmux
Tail the log file and the last 1000 lines to start:
tail -f -n1000 /var/log/syslog
Enter copy mode using the leader key and a left bracket:
[ctrl+leader] + [
the default tmux leader key is the letter b, so for example:
[ctrl+b] [
Now you can scroll and search up and down just like in less.
Exit copy mode to return to your tail -f
with:
[crtl+c]
Bonus material: Open a second terminal prompt:
[ctrl+leader] + c
Switch between the two terminal prompts:
[ctrl+leader] + l