They are not aliases, command
outputs the full command and comm
only the command name, so it is possible that the outputs are different. It all depends on what you want to extract the grep command.
An example:
$ ps -A -o pid,command | grep 9600
376 /sbin/agetty --keep-baud 115200 38400 9600 ttyS0 vt220
and the output for the following is empty:
ps -A -o pid,comm | grep 9600
The string 9600
is part of the complete command but the command name.
command
, and cmd
are aliases to args
, with prints the command with all its arguments as string. comm
is a different sorting code that prints only the executable name. Manpage snippet:
args COMMAND command with all its arguments as a string.
cmd CMD see args. (alias args, command).
comm COMMAND command name (only the executable name).
command COMMAND see args. (alias args, cmd).
pgrep
for stuff like this – Eric Renouf Jan 25 '16 at 13:25