PSUB(1)
π PSUB(1) β like, the actual manual page, bestie
okay so this is psub, and it lives in the fish-shell universe, which is honestly the most iconic manual section name ever. sit down, grab a strawberry π, and let me tell you about process substitution because it's giving genius and you're gonna be obsessed.
β¨ NAME β¨
psub β perform process substitution. that's it. that's the whole name. short, sweet, main character energy π
π SYNOPSIS π
COMMAND1 ( COMMAND2 | psub [-F | --fifo] [-f | --file] [(-s | --suffix) SUFFIX] )
literally just memorize that shape and you're set, no cap.
π¦ DESCRIPTION π¦
okay so some shells β we're talking ksh, bash, the classics β have this syntax that's like a mashup between command substitution and piping. it's called process substitution, and it's used to send the output of a command into the calling command, much like command substitution does. BUT π
here's the twist: the output is not sent through commandline arguments. instead it goes through a named pipe, and the filename of that named pipe gets sent as an argument to the calling program. iykyk.
and here's where psub comes in: psub combined with a regular command substitution gives you the exact same functionality. so you're not missing out on anything, bestie.
the following options are available, and yes we're going through all of them:
-f,--fileβ use a regular file instead of a named pipe to communicate with the calling process. lowkey this makespsubsignificantly slower when large amounts of data are involved π but the glow-up is that the reading process canseekin the stream. and fun fact: this is the default. it's iconic like that.-F,--fifoβ use a named pipe rather than a file. π«Ά you should only use this if the command produces no more than8 KiBof output. the limit on how much data a FIFO can buffer varies with the OS but is typically8 KiB,16 KiBor64 KiB. and if you use this option and the command on the left of thepsubpipeline produces more output, a deadlock is likely to occur π like, actually. be careful.
β οΈ bestie i'm serious about that -F one. deadlock is not a vibe. it's not flirty, it's not cute, it's a hang. π
-s,--suffix_SUFFIX_ β append _SUFFIX_ to the filename. cute little name tag π-h,--helpβ displays help about using this command. the classic. the icon. the one we all press first π
πΈ EXAMPLE πΈ
this is where it gets good. look at these:
diff (sort a.txt | psub) (sort b.txt | psub)
# shows the difference between the sorted versions of files ``a.txt`` and ``b.txt``.
source-highlight -f esc (cpp main.c | psub -f -s .c)
# highlights ``main.c`` after preprocessing as a C source.
the way that first one shows the difference between the sorted versions of files a.txt and b.txt?? literally ate. π₯ and the second one highlights main.c after preprocessing as a C source β note the -f and -s .c combo, that's the whole trick right there. chef's kiss π
π§ Copyright π§
fish-shell developers. respect the devs, they made the shell and the fish, periodt. π
okay so that's the page!! π this was fish-shell version 4.9, dated Sep 08, 2026 β so mark your calendar, screenshot it, put it in the group chat, because that's the tea. now go forth and psub responsibly, bestie π«Άβ¨π
π¦ 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