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 to0or an invalid value will disable shortening entirely. This defaults to1.
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 β¨
-dor--dir-length MAXβ shortens the components down toMAXcharacters each. This overridesfish_prompt_pwd_dir_length. π«-Dor--full-length-dirs NUMβ keepsNUMcomponents (counted from the right) at full length, no shortening. This overridesfish_prompt_pwd_full_dirs. π-hor--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. π₯
β¨ Copyright β¨
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