Use “procstat” to get process info

On FreeBSD, you can use procstat command to get detailed info of process. E.g.:

  1. # procstat 521
  2. PID PPID PGID SID TSID THR LOGIN WCHAN EMUL COMM
  3. 521 1 521 521 0 1 root select FreeBSD ELF64 syslogd

The above outputs describe the info of process whose PID is 521: its PID, parent PID, command name, etc.

If you want to display all processes’ info, use -a option:

  1. # procstat -a
  2. PID PPID PGID SID TSID THR LOGIN WCHAN EMUL COMM
  3. 0 0 0 0 0 10 - - - kernel
  4. 1 0 1 1 0 1 root wait FreeBSD ELF64 init
  5. 2 0 0 0 0 2 - - - cam
  6. 3 0 0 0 0 1 - idle - mpt_recovery0
  7. 4 0 0 0 0 1 - waiting_ - sctp_iterator
  8. 5 0 0 0 0 2 - umarcl - pagedaemon
  9. 6 0 0 0 0 1 - psleep - vmdaemon
  10. 7 0 0 0 0 1 - pgzero - pagezero

There are many options you can use for procstat, i.e., if you are curious about thread info, use -t option:

  1. # procstat -t 521
  2. PID TID COMM TDNAME CPU PRI STATE WCHAN
  3. 521 100065 syslogd - 0 120 sleep select

For details of every option, please refer the manual.