Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to identify if a process is java or c or c++ process in linux?

Tags:

java

c++

c

ps -eaf | grep java command is not a solution here to identify if a process is a java process or not, as many of my java processes are not listed in the output after executing this command.

like image 440
Charu Avatar asked Jun 07 '16 04:06

Charu


People also ask

How do I know which Java process is running Linux?

On Linux, you can view processes with the ps command. It is the simplest way to view the running processes on your system. You can use the ps command to view running Java processes on a system also by piping output to grep . OpenJDK, however, has its very own specific process monitor.

How do I find out what processes are running in Java?

If you want to check the work of java application, run 'ps' command with '-ef' options, that will show you not only the command, time and PID of all the running processes, but also the full listing, which contains necessary information about the file that is being executed and program parameters.


1 Answers

Short answer (hopefully someone writes a more comprehensive one):

  1. Get process PID

  2. Go to /proc/<pid>

  3. Look up the process binary file from there

  4. Run commands file and ldd on it and see what you can figure out from their output (check man pages of the commands, of course).

  5. Use lsof command to see which files the process has open, and see if those include telltale libraries or similar files.

like image 92
hyde Avatar answered Sep 30 '22 06:09

hyde