Get certain parts of command parameters from ps -ef using grep

خرید بک لینک

I need help building a grep from ps -ef to retu only java paths.

Say we have the following runnning process:

bash> ps -ef | grep java
user  pid#      1  1 00:00 ?        00:04:00 /path/to/java/jdk_1.8/bin/java -foo=bar -foo2=bar2 ... etc.

What i was from this is to display:

bash> ps -ef | grep 'some regex or patte here'
/path/to/java/jdk_1.8/bin/java

Here is the goal; I have multiple servers running different versions from different locations. I want to be able to determine all of the running versions of java by putting this grep into a for loop which will ssh to each server and run said grep:

bash> for in $(cat serverlist.txt); do ssh -q $i 'ps -ef | grep 'the patte' ; done

Thanks all.

Recent Questions...

ما را در سایت Recent Questions دنبال می‌کنید

برچسب: نویسنده: استخدام کار بازدید: 338 تاريخ: پنجشنبه 30 ارديبهشت 1395 ساعت: 22:20

صفحه بندی