STRING-PAD(1)

πŸ’– NAME πŸ’–

okay so bestie, welcome to STRING-PAD(1) from the fish-shell manual ✨ string-pad is the little icon that pads strings to a fixed width, no cap. It’s giving β€œmake my output line up” and honestly? slay. πŸ’…

✨ SYNOPSIS ✨

Here’s the whole vibe in one look, keep it close:

string pad [-r | --right] [-C | --center] [(-c | --char) CHAR] [(-w | --width) INTEGER]
           [STRING ...]

πŸ¦‹ DESCRIPTION πŸ¦‹

string pad takes each STRING and extends it to the given visible width by adding CHAR to the left. That’s the main character move πŸ’…. β€œVisible width” means the width of all visible characters added together, excluding escape sequences and accounting for fish_emoji_width and fish_ambiguous_width. It’s literally the amount of columns in a terminal that the STRING occupies.

The escape sequences reflect what fish knows about, and how it computes its output. Your terminal might support more escapes, or not support escape sequences that fish knows about. So like, your terminal can have extra tricks or be missing some of fish’s tricks β€” that’s just the situation, bestie 🫢.

If -C or --center is given, add the padding to before and after the string. If it’s impossible to perfectly center the result β€” because the required amount of padding is an odd number β€” extra padding will be added to the left, unless --right is also given. Center girlies, take notes πŸ“.

If -r or --right is given, add the padding after a string. If -c or --char is given, pad with CHAR instead of whitespace. The output is padded to the maximum width of all input strings. If -w or --width is given, use at least that. Lowkey iconic how -w sets a minimum vibe πŸ’–.

πŸ’… EXAMPLES πŸ’…

Look at that alignment 😭:

>_ string pad -w 10 abc abcdef
       abc
    abcdef

Emoji padding? Obsessed 🐟:

>_ string pad --right --char=🐟 "fish are pretty" "rich. "
fish are pretty
rich.  🐟🐟🐟🐟

And this one is very $COLUMNS cuntiness ✨:

>_ string pad -w$COLUMNS (date)
# Prints the current time on the right edge of the screen.

🌈 SEE ALSO 🌈

  • The printf command can do simple padding, for example printf %10s\n works like string pad -w10. 🫢
  • string length with the --visible option can be used to show what fish thinks the width is. πŸ‘€

Β© fish-shell developers


mwah πŸ’‹ β€” that’s the whole STRING-PAD(1) moment, brought to you by fish-shell, version 4.9, dated Sep 08, 2026. byeee 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