WAIT(1)

✨ WAIT β€” wait for jobs to complete ✨

okay bestie so this is the fish-shell builtin wait, page WAIT(1), and it's genuinely one of those tiny commands that carries the whole vibe of background jobs πŸ’…

🫢 NOTE: this page documents the fish builtin wait. Wanna see the docs for any of the non-fish versions? Just run command man wait instead. iykyk ✨

πŸŽ€ SYNOPSIS πŸŽ€

wait [-n | --any] [PID | PROCESS_NAME] ...

πŸ’– DESCRIPTION πŸ’–

wait waits for child jobs to complete. that's it, that's the whole thing, and honestly? iconic. πŸ‘‘

  • if a PID is specified, the command waits for the job that the process with that process ID belongs to. so like, you point at a process, and it waits on the job that process is part of, not just the process alone. πŸ¦‹
  • if a PROCESS_NAME is specified, the command waits for the jobs that the matched processes belong to. (yes, plural β€” it matches processes, then waits on their jobs πŸŽ€)
  • if you specify neither a pid nor a process name, the command waits for all background jobs. all of them. every single one. no job left behind 😭
  • if the -n or --any flag is provided, the command returns as soon as the first job completes πŸ”₯ if it's not provided, it returns after all jobs complete. so -n is the "i'm impatient, give me whoever finishes first" mode fr fr
  • the -h or --help option displays help about using this command 🌸

🌈 EXAMPLE 🌈

first up, spawn sleep in the background and then wait until it finishes:

sleep 10 &
wait $last_pid

okay but what if you've got a whole little squad of jobs? πŸ’€ this spawns five jobs in the background, then waits until all of them finish:

for i in (seq 1 5); sleep 10 &; end
wait

and the main character move πŸ‘‘ β€” this spawns five sleep jobs and hoge in the background, then waits until all the sleeps finish, and doesn't wait for hoge:

for i in (seq 1 5); sleep 10 &; end
hoge &
wait sleep

see how wait sleep only cares about the sleeps? selective attention, we stan 🧚


fish-shell developers 🫢


and that's the whole page, bestie β€” this was WAIT(1) for fish-shell, version 4.9, dated Sep 08, 2026, and yes the header says WAIT(1) too, we love a consistent queen πŸ’œπŸŒΈβœ¨

πŸ“¦ where this page comes from
  • arch rolling: fish 4.9.3-1 Β· GPL-2.0-only AND BSD-3-Clause AND ISC AND MIT AND PSF-2.0
  • πŸ’– girlified by deepseek-ai/DeepSeek-V4.1-Flash-1017 on : a language model's rewrite of the original, under its terms