$ stat -c "%u %g" /proc/$pid/
1000 1000
ou
$ egrep "^(U|G)id" /proc/$pid/status
Uid: 1000 1000 1000 1000
Gid: 1000 1000 1000 1000
ou com apenas builtins bash:
$ while read -r line;do [ "${line:1:2}" = "id" ] && echo $line;done < /proc/17359/status
Pid: 17359
Uid: 1000 1000 1000 1000
Gid: 1000 1000 1000 1000