On Mon, 28 Feb 2000, Jonathan Lupa wrote:

> Is there a built in command, or shell command to retrieve the process
> name from a pid?

ps ax | awk '$1 == <pid> {print $5}'

There's no builtin command to do this.  I don't know if Perl can do it or
not.  I doubt it, though.

> The best I could come up with is slurping the stuff from /proc/cmdline
> or something like ps|cut, but it seems to me there is probably a
> better way I am ignorant of.

/proc/<pid>/cmdline won't work on anything except linux; you should use
ps.

Reply via email to