Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Welcome To Ask or Share your Answers For Others

Categories

0 votes
158 views
in Technique[技术] by (71.8m points)

How to search any word in linux 'screen'

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 with Ctrl 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 found

    Searching:
     / 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.

question from:https://stackoverflow.com/questions/22645066/how-to-search-any-word-in-linux-screen

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome To Ask or Share your Answers For Others

1 Answer

0 votes
by (71.8m points)

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.


与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
Welcome to OStack Knowledge Sharing Community for programmer and developer-Open, Learning and Share
Click Here to Ask a Question

...