Skip to Content
Navigation:

A stick figure smiling

Here's a preview from my zine, Bite Size Bash!! If you want to see more comics like this, sign up for my saturday comics newsletter or browse more comics!

Image of a comic. To read the full HTML alt text, click "read the transcript".

browse more comics! get the zine!
read the transcript!

scripts can run many processes in parallel

python -m http.server & 
curl localhost:8080

& starts python in the “background”, so it keeps running while curl runs

wait waits for all background processes to finish

command1 &
command2 & 
wait

this waits for both command1 and command2 to finish

concurrency is easy* in bash

in other languages:
smiling stick figure with short curly hair, thinking: threads? how do I do that again?

in bash:

thing1 &
thing2 &
wait

* (if you keep it very simple)

background processes sometimes exit when you close your terminal

you can keep them running with nohup or by using tmux/screen.

$ nohup ./command &

panel 5:

person: jobs, fg, bg, and disown let you juggle many processes in the same terminal, but I almost always just use multiple terminals instead

panel 6:

  • jobs: list shell’s background processes
  • disown: like nohup, but after process has started
  • fg and bg: move process to foreground/background

Saturday Morning Comics!

Want another comic like this in your email every Saturday? Sign up here!

I'll send you one of my favourite comics from my archives every Saturday.
© Julia Evans 2024 | All rights reserved (see the FAQ for notes about licensing)