I am running an application with command $ grails run-app which prints log in terminal like below.


What I want is search a particular text (say user authorities) in this log so that I can verify further. One way using Logging Apis to write in text file but I want to search it in a terminal at the moment.

I found similar question at how to make search a text on the terminal directly which suggests screen command, but I have no idea how screen works in this case. I tried $ screen grails run-app but couldn't move ahead.

I can see screen lists with

prayag@prayag:~/zlab/nioc2egdelonk$ screen -list
There is a screen on:
    8076.pts-2.prayag   (10/06/2013 12:13:25 PM)    (Attached)
1 Socket in /var/run/screen/S-prayag.

6 Answers 6


If you use Konsole (KDE terminal emulator), you can use Ctrl + Shift + F. This might work also in other (Linux) terminal emulators; it has been confirmed to work in GNOME Terminal, the Xfce terminal, Alacritty, and Terminator.

  • @Augustin where did you find such shortcut? Commented Apr 26, 2021 at 12:55
  • @Rodrigo: See the Konsole Handbook: docs.kde.org/stable5/en/konsole/konsole/…. Alternatively, if you have Konsole on your machine, have a look in the Edit menu – the keyboard shortcut should be listed next to the Find... entry.
    – Augustin
    Commented Apr 28, 2021 at 9:46
  • Working for Mobaxterm[Windows] ... Thanks mate Commented Nov 16, 2021 at 12:12

Ctrl+a (default screen command prefix), [ (enter copy mode) followed by ?SEARCH_TEXT seems to work. Press n to go to the next occurrence. From there, you can copy words, lines, regions, etc to dump into files or paste later on (with Ctrl+a, ]).

enter image description here

  • 5
    I cannot do this. So you need to press 3 keys at once? ctrl, a, [?
    – Capaj
    Commented Mar 17, 2015 at 10:13
  • 49
    use shift+ctrl+f
    – Ja8zyjits
    Commented Jun 3, 2016 at 13:25
  • @Ja8zyjits where did you find such shortcut? Commented Apr 26, 2021 at 12:55
  • @Rodrigo check terminator. I should have made this an answer. Oh, i didnt have enough karma to post answer back then.
    – Ja8zyjits
    Commented Apr 26, 2021 at 14:55
  • 1
    This command worked on Terminator Commented Jun 26, 2023 at 19:02

You can use grep after the grails command: grails run-app | grep "user authorities". However, you will have to re-run your command.

  • 3
    This answer shouldn't be voted down, its absolutely correct.
    – amrx
    Commented Jun 1, 2015 at 2:22
  • 6
    While correct, it's more useful to have something one can do after the output has already been printed.
    – Ludwik
    Commented Sep 27, 2016 at 13:13
  • 3
    @Baron I'm even pretty sure that the asker meant to imply that the command is already running, so this doesn't answer the question.
    – Nobody
    Commented Jan 5, 2018 at 21:44

Redirect output of your command to vim-editor: grails run-app | vim -

Several tips for search using Vim:

  • type / then enter your search string user authorities
  • type :set hlsearch to highlight search results
  • type n to search forward or Shift+n to search backward
  • remember you're in editor now, so if you did some changes accidentally you can revert, just press ESC once to exit edit-mode, then press u to undo one edit
  • type :q! to exit Vim and discard your search results
  • you can do whatever you want :-D http://vim.wikia.com/wiki/Vim_Tips_Wiki

Redirect the output to pipe and send it to a grep command:

grails run-app | grep user authorities

Use Shift+Ctrl+f to search in terminal.

Got this from the comment above by @Ja8zyjits.

This worked for me.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .