(Bash) `jobs` options

  • Adding -l flag also prints out the PID of each job in addition to job ID, which may be handy for e.g. subsequent kill -9. Specifying -p instead ONLY prints out the PIDs.
  • Adding -s flag lets jobs only print out the stopped jobs, e.g. below kills all stopped jobs:
    sudo kill -9 `jobs -p -s`
    

    The opposite is -r which prints out only the running jobs.

References:

Written on October 19, 2021