Reputation: 401
i want to save the PID of a background process and save it to a file along with the process name in linux. What is the command to do so? Can anybody help me out?
Upvotes: 1
Views: 412
Reputation: 18960
I am not sure what you call the “process name” but in Bourne shells you get the PID of a background process with the shell variable $!
. For example:
sleep 1000 &
echo "$! sleep 1000" >>/tmp/save_file.txt
Upvotes: 1