How can I adjust the name of a process I run?

Kakki asked:

I have a rack/ruby application on a server. I run it as follows:

  nohup rackup -o 0.0.0.0 -p 1234 &

In the output of “top” command it appears as simply “ruby”

PID   USERNAME    THR PRI NICE   SIZE    RES STATE    TIME    WCPU COMMAND

98421  my_user123       3  20    0   140M 29576K select   0:29   0.01% ruby

How can I adjust its name in the “top”? What if I run 5 such web apps, how would I distinguish which is which if they’re all “ruby”?

My answer:


It’s not the process name you need to adjust, but your tool.

Press c while top is running, or just start it with -c to see full command lines.

For example, without -c:

12329 error     20   0  618748 202472  19424 S   0.0 20.0   7:49.32 ruby

And with -c:

12329 error     20   0  618748 202472  19424 S   0.0 20.0   7:49.32 ruby /home/error/.rvm/gems/ruby-2.2.7@app/bin/thin start -a ::1 -p 8008

View the full question and answer on Server Fault.

Creative Commons License
This work is licensed under a Creative Commons Attribution-ShareAlike 3.0 Unported License.