I would like to know how to search particular text on the terminal. If I do cat of log files, I would like to find certain words like job or summary so that I don't have to read through the entire log file.

I know there have been a similar post about this. The answer from that post is Ctrl + A + [ <text> which doesn't seem to work for me. When I press that I get a message No bracket in top line (press Return) or If I press those keys together I get the message ESC.

It there a way to do this with PuTTY? Alternatively, is there a generic way to search for text in the output of commands?

  • It helps if you tell us which terminal emulator you're using.
    – Joseph R.
    Oct 16 '13 at 2:14
  • I am using putty to access remote linux machines..
    – Ashwin
    Oct 16 '13 at 2:29
  • What are the commands you're looking to search output from? Just general commands or is there a log file that a server/service is writing messages to that you want to search through?
    – slm
    Oct 16 '13 at 2:31
  • konsole supports this with ctrl+shift+f
    – jordanm
    Oct 16 '13 at 4:37

You can also right click the title bar at the top of the window and select Copy All to Clipboard, then paste into a text editor and use that to search.


The Ctrl + a + [ is meant for use within the application screen (an app for multiplexing consoles).


Generally the easiest method to do this is to use tools such as less and to pipe the output from whatever application is generating the messages on the console, and search within the application less. You can do so using the forward slash (/) followed by whatever string you're searching for. Hit return to execute the search.


$ less filename.log

...then in less, type a forward slash followed by string to search, foo


In the same vain as above with using less, you can also use tools such as tail to print the lats few lines of a applications log file messages, and also use grep to search for only lines that contain a matching string/pattern.

$ grep "somestring" filename.log
  • I didnt quite get it. After I do cat filename.log | less how can I find particular text from the whole screen, if at all its possible.
    – Ashwin
    Oct 16 '13 at 2:32
  • @Ashwin - you can just do less filename.log and then use the forward slash key to begin search mode, type a string such as foo, and hit return to search. You can keep repeating it by hitting the n key.
    – slm
    Oct 16 '13 at 2:34
  • Cool this is what I was looking for. I can find it by executing cat filename.log | grep Summary or less filename
    – Ashwin
    Oct 16 '13 at 2:34
  • 1
    @Ashwin - glad it worked for you, see my updates, for shorter versions of using both tools so you can skip having to use cat.
    – slm
    Oct 16 '13 at 2:39
  • how to search for next number 2 search item(for ex second "error" in file) Apr 16 '18 at 16:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.