what causes processes with no name in htop?

this is a fully up to date debian 8.6 system, running htop 1.0.3 as root, amd64. and unix.stackexchange.com seems to shrink the image to an unreadable size, i recommend opening the image url http://image.prntscr.com/image/5ef407a1f99a4c9692db179a3afb2516.png directly

  • I would cross check it with a ps ax. It maybe just be a curses bug. – Rui F Ribeiro Sep 23 '16 at 13:20

htop displays the process's command line with spaces between the arguments. (The first argument, argument number 0, is conventionally the command name passed by the parent process.)

A process may overwrite its command line arguments with a string of the same length or shorter. A few programs use this to convey information about the state of the program. Screen sets the first argument (command name) to uppercase in the background process that manages the sessions and leaves the usually lowercase command name in the front-end process that runs in a terminal that's attached to the session..

It's also possible to start a process with no command line arguments. It's very unusual: conventionally the first argument is the command name. But it's technically possible.

While this could be a display bug, or the effect of a command name containing carriage returns, the most likely explanation is that this process (currently) has no arguments. You can check by asking the kernel directly:

cat -A /proc/12727/cmdline; echo

This displays the arguments with control characters replaced by a visual representation. The arguments are separated by ^@.

You can find other information by exploring /proc/12727, for example /proc/12727/exe is a symbolic link to the executable that's running in this process and /proc/12727/fd shows what files the process has open. You can also display this information with lsof -p12727.

ps l 12727 will show other information about this process, in particular its parent process ID (PPID). (You can also configure htop to show this information by activating the corresponding column in the settings.)

  • here is a little C script to reproduce it: #include <string.h> int main(int, char * argv[]) { memset(argv[0], '\0', strlen(argv[0])); while (1) { // make it easy to find this process with "sort by cpu usage" } return 0; } – hanshenrik Apr 10 '19 at 10:45

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.