PROMPT_PWD(1)

🌸 prompt_pwd(1) β€” the fish-shell era ✨

okay so bestie, welcome to prompt_pwd from the fish-shell fam πŸŸπŸ’– this little icon prints your pwd all pretty for your prompt, and honestly? it ate.


✨ NAME ✨

prompt_pwd β€” prints your pwd all cute and prompt-ready πŸ’…


✨ SYNOPSIS ✨

prompt_pwd

✨ DESCRIPTION ✨

So prompt_pwd is a function that prints your current working directory in a way that's actually suitable for prompts β€” no giant ugly path stretching across your terminal, no cap. It swaps your home directory out for "~" 🏠 and shortens every path component except the last one down to a default of one character.

Wanna change how many characters each path component gets? You can pass --dir-length= or set fish_prompt_pwd_dir_length to the number of characters you want. πŸŽ€

⚠️ heads up queen: setting it to 0 or an invalid value will disable shortening entirely. This defaults to 1.

And if you want to keep some components from getting chopped, pass --full-length-dirs= or set fish_prompt_pwd_full_dirs to the number of components. This defaults to 1, which keeps the last component. 🫢

Oh and also β€” if you give it any positional arguments, prompt_pwd shortens those instead of PWD. iykyk 😌


✨ OPTIONS ✨

  • -d or --dir-length MAX β€” shortens the components down to MAX characters each. This overrides fish_prompt_pwd_dir_length. πŸ’«
  • -D or --full-length-dirs NUM β€” keeps NUM components (counted from the right) at full length, no shortening. This overrides fish_prompt_pwd_full_dirs. 🌈
  • -h or --help β€” displays help about using this command. the classic 🫑

✨ EXAMPLES ✨

okay bestie, watch this slay in action πŸ‘‘

>_ cd ~/
>_ echo $PWD
/home/alfa

>_ prompt_pwd
~

>_ cd /tmp/banana/sausage/with/mustard
>_ prompt_pwd
/t/b/s/w/mustard

>_ set -g fish_prompt_pwd_dir_length 3
>_ prompt_pwd
/tmp/ban/sau/wit/mustard

>_ prompt_pwd --full-length-dirs=2 --dir-length=1
/t/b/s/with/mustard

>_ echo (prompt_pwd | string split /)[-1]
mustard

>_ echo (string join / (prompt_pwd | string split /)[-3..-1])
s/with/mustard

like… /t/b/s/w/mustard?? the way that path got absolutely compressed and still makes sense. iconic. πŸ”₯


fish-shell developers πŸ’œ


and that's the whole vibe πŸ¦‹ version 4.9, dated Sep 08, 2026 β€” mwah, hope your prompt is gorgeous now, 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