I am working on a Linux server, and I running different jobs on different node.
However, when compiling my program, I didn't set their specific name, so they are all a.out
Now I found one of the running a.out
, may be not right, and want to terminated. But the Top
command doesn't show the path to the executable.
How to do it?
Best Answer
You can use
lsof
(available for just about any Unix variant, but often not part of the default installation) to list all the files a process is using. “Using” includes open file descriptors as well as closely related concepts such as which executable the process is running. The executable hastxt
in the FD column, for obscure historical reasons.(made-up output)
On Solaris and Linux, there's a more direct way: the proc filesystem provides information about each process, including which executable it's running. (On Linux at least, that's where
lsof
gets its information.)If you're looking for a process running a given executable, run fuser.