Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am using Putty to connect to Linux server .

I opened a Log file in Linux server using the $ tail -f error_log

A log file has been displayed .

Please tell me how can i do ps –ef|grep java on to the opened Log file

Thank you .

share|improve this question

migrated from Sep 30 '11 at 7:14

This question came from our site for professional and enthusiast programmers.

What, from within tail? Quit tail, and run grep java < error_log. – new123456 Sep 29 '11 at 11:13
@new123456: Sidenote, grep -options "searchterm" [file] – Bobby Sep 29 '11 at 11:22
@new123456 grep java error_log works too – Carlos Campderrós Sep 29 '11 at 11:22
I'd be easier if you told us exactly what is that you are trying to achieve... – racic Sep 29 '11 at 11:26
up vote 2 down vote accepted

Your question is hard to understand but I think I know what you're asking.

Doing this:

tail -f logfile | grep java

will show you lines with the text java in the file as the file is updated.

share|improve this answer

If you just want a regularly updated list of java processes, you can use watch:

watch 'ps -ef | grep [j]ava'
share|improve this answer
Thanks a lot for helping – yyy i 777 Sep 29 '11 at 15:54

And if you don't want a regularly updated list of the process you are looking for you can do so:

vim error_log

and when inside the file reading, just do a simple search for what are you looking for.


and press 'n' for next result.

Check this link: for vim Search & replace cheatsheet

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.