85
$ ps -Awwo pid,comm,args
  PID COMMAND         COMMAND
    1 init            /sbin/init
    2 kthreadd        [kthreadd]
    3 ksoftirqd/0     [ksoftirqd/0]
    5 kworker/u:0     [kworker/u:0]
    6 migration/0     [migration/0]
    7 cpuset          [cpuset]
    8 khelper         [khelper]
    9 netns           [netns]
   10 sync_supers     [sync_supers]
   11 bdi-default     [bdi-default]
   12 kintegrityd     [kintegrityd]
   13 kblockd         [kblockd]
   14 kacpid          [kacpid]
   15 kacpi_notify    [kacpi_notify]
   16 kacpi_hotplug   [kacpi_hotplug]
   17 ata_sff         [ata_sff]
   18 khubd           [khubd]

What do the brackets mean? Does args always return the full path to the process command (e.g. /bin/cat)?

tshepang
  • 65,642
joslinm
  • 971
  • 5
    my arch-nemesis, user626201, has already asked this question on stackoverflow http://stackoverflow.com/questions/7078258/what-do-the-mean-in-ps-and-how-do-you-create-a-process-like-it – joslinm Oct 05 '11 at 22:09
  • 4
    Yes, those are usually kernel threads. – Stéphane Gimenez Oct 05 '11 at 22:23
  • 4
    When would they not be kernel threads? When are "process args unavailable"? – mgalgs May 01 '13 at 17:00
  • 1
    http://superuser.com/questions/389161/what-do-the-mean-in-ps-and-how-do-you-create-a-process-like-it – Ciro Santilli OurBigBook.com Sep 16 '16 at 13:06
  • I think most people would have just been happy not seeing any arguments in the ps list. Square brackets add confusion and should have been reserved for kernel threads because that's what everyone initially thinks it means... – Brain2000 Feb 16 '23 at 16:56

2 Answers2

68

Brackets appear around command names when the arguments to that command cannot be located.

The ps(1) man page on FreeBSD explains why this typically happens to system processes and kernel threads:

If the arguments cannot be located (usually because it has not been set, as is the case of system processes and/or kernel threads) the command name is printed within square brackets.

The ps(1) man page on Linux states similarly:

Sometimes the process args will be unavailable; when this happens, ps will instead print the executable name in brackets.

  • 1
    What does the args not being available have to do with not printing full path to the process command (/bin/cat)? I thought args are the arguments passed after the command. (Although the command itself indeed shows up in argv - I don't quite understand, I thought of it as a convenience feature.) – n611x007 Nov 24 '13 at 21:26
17

From the manual:

Sometimes the process args will be unavailable; when this happens, ps will instead print the executable name in brackets.

Kusalananda
  • 333,661