Super User is a question and answer site for computer enthusiasts and power users. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I am developing a node application and there is an option to set the process title (process name). This only sets it in some tools (like ps and top), but not in htop or netstat.

I found this article that explained how most applications do it, but it doesn't change in netstat.

That lead me to wonder where those programs are getting the process name. Would they be getting it from /proc/##/cmdline? (## being the PID of the process)

I figure messing with things in /proc is a bad idea (and probably not possible), so if this is where those programs are getting it, is there a way to change it?

share|improve this question
up vote 5 down vote accepted

There is nothing wrong with reading things from /proc. In fact, that is where those tools get that information from. There are actually three files with the command name.


I believe it is usually obtained from stat.

share|improve this answer
But why do ps and top have the changed process name, whereas netstat doesn't? – tjameson Jun 25 '11 at 7:27
Apparently a process can change it's name, which changes /proc/PID/cmdline, but the stat entry does not change. So it depends on which place the tool looks to get the name. netstat seems to use the stat entry. – Keith Jun 25 '11 at 8:03
Apparently node was changing the values in stat, status, and comm, but not cmdline. I guess programs like htop and netstat read from cmdline. Anyway, thanks for the info! – tjameson Jun 25 '11 at 18:32

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .