shell - How to get only process ID in specify process name in linux? -
how process id specified process name in linux?
ps -ef|grep java test 31372 31265 0 13:41 pts/1 00:00:00 grep java based on process id write logic. how process id specific process name.
sample program:
pids= ps -ef|grep java if [ -z "$pids" ]; echo "nothing" else mail test@domain.com fi
you can use:
ps -ef | grep '[j]ava' or if pgrep available better use:
pgrep -f java
Comments
Post a Comment