I'm on a CentOS 6 system.
I'd like to know the pid of a curl command I'm running. Usually to get the pid of a process I use ps
or pidof
or pgrep
or the like. But I generally use those for long running processes...often for processing running too long in fact and I want to kill them.
This situation is different. In my context, curl runs very quickly because the requests and responses are small. But I still need to know the pid of that process. Is there a way to execute a quickly running command so that it will tell you what pid it ran with? Or is there a way to retrospectively tell what the pid of your previous command was?