The ps (1) man page says that you can use the psr field:
psr PSR processor that process is currently assigned to.
$ ps -o pid,psr,comm PID PSR COMMAND 7871 1 bash 9953 3 ps
Or you can use the cpuid field, which does the same.
$ ps -o pid,cpuid,comm PID CPUID COMMAND 7871 1 bash 10746 3 ps
The reason for the two names is compatibility with Solaris ( psr ) and NetBSD / OpenBSD ( cpuid ).
To get streams, add the -L option (and the lwp field if you use -o ).
Without threads:
$ ps -U $USER -o pid,psr,comm | egrep 'chromi|PID' | head -4 PID PSR COMMAND 6457 3 chromium-browse 6459 0 chromium-browse 6461 2 chromium-browse
With threads:
$ ps -U $USER -L -o pid,lwp,psr,comm | egrep 'chromi|PID' | head -4 PID LWP PSR COMMAND 6457 6457 3 chromium-browse 6457 6464 1 chromium-browse 6457 6465 2 chromium-browse
There is also an undocumented -P option that adds psr to normal fields:
$ ps -U $USER -LP | egrep 'chromi|PID' | head -4 PID LWP PSR TTY TIME CMD 6457 6457 3 ? 00:01:19 chromium-browse 6457 6464 1 ? 00:00:00 chromium-browse 6457 6465 2 ? 00:00:00 chromium-browse
Mikel source share