Last Updated: February 25, 2016
·
520
· fpietka

Display running jobs (if any) in the shell prompt

To have in your shell prompt how many jobs are running (if any), add the following function to your .bashrc:

function j() {
    jobs | wc -l | egrep -v ^0 | sed -r 's/^([0-9]+)/ (\1) /'
}

And then add the function call $(j) to your PS1.