On Ubuntu 18.04, I have a C++ compiled program MyServer. top -c shows the "command line" correctly as ./MyServer, but the "command name" with top is shown as "main".

I wanted to know how to get the command name to be MyServer.

1 Answer 1


It appears to be getting the command name from the main thread's name set by pthread_setname_np.

  • The answer is using knowledge that is not present in the question. If you could reformulate the question in such a way that this answer would have been possible to give without psychic powers, then it would be ok.
    – Kusalananda
    Commented Nov 16, 2019 at 13:10
  • @Kusalananda But I thought that being psychic was required in order to reach a certain rep on the site...
    – doneal24
    Commented Nov 16, 2019 at 13:43

You must log in to answer this question.

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