what is the difference between 'comm' file and 'cmdline' file in a /proc/<pid> directory?

127 views Asked by At

Read the docs, couldn't really figure out what is the difference. It seems like cmdline is just the absolute path to the process binary and comm is just the name of the binary Am I right?

1

There are 1 answers

0
n. m. could be an AI On BEST ANSWER

/proc/pid/cmdline

This read-only file holds the complete command line for the process

It is the complete command line. If your command is ls -l /tmp, then this file will hold ls -l /tmp (separated by null characters, not spaces).

/proc/pid/comm

This file exposes the process's comm value—that is, the command name associated with the process. Different threads in the same process may have different comm values, accessible via /proc/pid/task/tid/comm. A thread may modify its comm value

This field typically starts as the filename of the executable truncated to some 15 chars or so, but it can be changed to anything by the process itself.