Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 720
Waqas Avatar asked Mar 25 '14 20:03

Waqas


People also ask

How do I search for a word in Linux?

Grep is a Linux / Unix command-line tool used to search for a string of characters in a specified file. The text search pattern is called a regular expression. When it finds a match, it prints the line with the result. The grep command is handy when searching through large log files.

How do I search for a word in terminal?

5 Answers. It's Shift + Ctrl + F . Now, you can press the arrow keys to go up,down, left and right (usually you only use the first two). You can also type /word so search for a word (or a regex) after the cursor.

How do I search in Linux terminal?

You can use the find command with -name option followed by the file name that you want to search. You can use the following option if you want to search for a specific file type: f – regular file. d – directory.


1 Answers

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.

like image 115
Ian Petts Avatar answered Sep 20 '22 02:09

Ian Petts