STRING-TRIM(1)

🌸 STRING-TRIM(1) β€” the fish-shell one, bestie 🌸

okay so this is a page from the fish-shell manual set, and it's lowkey one of the cutest little commands ever. it's called string-trim, and it does exactly one thing but it does it iconically. let's get into it πŸ’…


✨ NAME ✨

string-trim β€” literally just: remove trailing whitespace πŸŽ€


✨ SYNOPSIS ✨

string trim [-l | --left] [-r | --right] [(-c | --chars) CHARS]
            [-q | --quiet] [STRING ...]

look at her. so tidy. so composed. main character energy fr fr πŸ¦‹


✨ DESCRIPTION ✨

string trim removes the leading and trailing whitespace from each STRING. like, both ends. the whole glow-up. no cap.

but wait, you can be picky about it πŸ‘‘

  • -l, --left β€” only the leading whitespace gets removed. left side only, bestie. the right side stays exactly as it is.
  • -r, --right β€” only the trailing whitespace gets trimmed. right side only this time.

and then there's the switch that changes the whole vibe:

  • -c, --chars CHARS β€” this makes the set of characters in CHARS get removed instead of whitespace. and listen, this is the part that gets people: it's a set of characters, not a string. so if you pass -c foo, it will remove any "f" or "o" β€” not "foo" as a whole unit. it's giving "individual letters, not the squad" 😭 so keep that in mind before you go shipping a whole word into it.
πŸ’€ exit status: 0 if at least one character was trimmed, or 1 otherwise. that's it. that's the vibe check.

✨ EXAMPLES ✨

okay these go so hard, watch this πŸ“

>_ string trim ' abc  '
abc

trimmed both sides, ate, left no crumbs πŸ”₯

>_ string trim --right --chars=yz xyzzy zany
x
zan

so here --right means only the right side gets touched, and --chars=yz means the set is y and z β€” so on xyzzy the trailing y and z get nibbled away down to x, and on zany the trailing y and z... well, the trailing ones go, and you're left with zan. iconic behaviour honestly 🌈

oh and also β€” -q / --quiet is right there in the synopsis. this page doesn't elaborate on it beyond that, so I'm not gonna make stuff up, bestie. it's in the synopsis, it's part of the command, periodt πŸ’œ


fish-shell developers 🫢 β€” shoutout to the whole crew, they understood the assignment.


and that's the whole page!! go trim something, you're gonna slay πŸ’–βœ¨πŸŽ€πŸ¦‹πŸŒΈ

this was page 4.9, dated Sep 08, 2026 β€” mwah, see you in the next manpage 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