I'm trying to grab the owner of a process from a list.
I have the command pidof nmap
to get the then ps -u <PID> | grep USER
that I'm currently playing around with. But when I run it, it ends up just printing the titles (top line):
How can I grab the name of the owner given the process ID?
ps -u <PID>
actually selects processes by effective user id, not PID. See man7.org/linux/man-pages/man1/ps.1.html