Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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
    
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
1  
@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
add comment

migrated from stackoverflow.com Sep 30 '11 at 7:14

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

3 Answers

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
add comment

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
add comment

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.

/java

and press 'n' for next result.

Check this link: http://vim.wikia.com/wiki/Search_and_replace for vim Search & replace cheatsheet

share|improve this answer
add comment

Your Answer

 
discard

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