How to search any word in linux 'screen'
Once you are in scrollback mode with Ctrl + A, ESC, you should be able to search backwards through the buffer as described in the manual.
So to search for the word "string", press Ctrl + A, ESC, enter ?string
and press Enter. It will take you backwards through the buffer to the word string. Pressing N will go to the next match (backwards) in the buffer.
To search forwards, the cursor should be anywhere but the end of the buffer, then use /string
to search down.
Waqas
Updated on June 17, 2021Comments
-
Waqas almost 3 years
I am going screen logs of devstack with following command.
screen -x stack
I find searching in screens very difficult. Currently I start copy mode withCtrl
A
Esc
and read all the logs, sometimes it is very irritating to go through all logs while searching for a single word.Is there a good way for searching a word in screens?
from
man screen
I foundSearching: / Vi-like search forward. ? Vi-like search backward. C-a s Emacs style incremental search forward. C-r Emacs style reverse i-search.
but screens do not support vi-like forward search.
-
Mario Olivio Flores about 6 yearsThis might be my most visited Q/As on SO.
-
mwfearnley over 5 yearsScrollback mode seems to work a lot like
less
-/string
and?string
search downwards and upwards.n
/N
find the next/previous match.g
/G
jump to the top/bottom of the output. -
Martin Klosi about 5 yearsN aborts the copy mode for me. It does not reverse the search.
-
ebarrere about 4 years
N aborts the copy mode for me. It does not reverse the search.
Same here — any ideas how to reverse search? -
Peaceful James almost 4 years@martin-klosi @ebarrere If
N aborts the copy mode for me. It does not reverse the search.
then you can try usingControl + R
instead ofN
. That should do the same thing. -
Waqas almost 3 yearsthis does not work if you are in the screens for example byobu. Answer from @ian-petts works perfectly. Thanks :)