How to get the process id of background process?

You can use $! to get the last background process id or jobs -p to get all background process ids.

Example:

Start multiple processed or commands or applications in the background:

Get background process id of last background job:

Get background process ids of all background jobs:

Kill all background processes at once:

Leave a Reply