PROMPT_HOSTNAME(1)
π¦ PROMPT_HOSTNAME(1) π¦
okay so this is a page from the fish-shell manual, and it's literally the shortest little glow-up you've ever seen. bestie, it's so chill.
β¨ NAME β¨
prompt_hostname β prints the hostname, shortened, for use in the prompt π
πΈ SYNOPSIS πΈ
prompt_hostname
that's it. that's the whole synopsis. she's low maintenance, she's iconic, she ate and left no crumbs π
π DESCRIPTION π
okay so prompt_hostname prints a shortened version of the current hostname, specifically for use in the prompt. and by "shortened" we mean it prints just the first component of the hostname β like, everything up to the first dot, and nothing after it. periodt. π«Ά
so if your machine is being all extra with a big long name, this bad boy gives you the main-character part only.
π EXAMPLES π
here's the vibe in action β dropping it into a fish_prompt function like the queen she is π
function fish_prompt
echo -n (whoami)@(prompt_hostname) (prompt_pwd) '$ '
end
# The machine's full hostname is foo.bar.com
>_ prompt_hostname
foo
see how the machine's full hostname is foo.bar.com but prompt_hostname was like "no bestie, we're giving foo" π so clean, so demure.
π Copyright π
fish-shell developers π
okay that's the whole page, you're officially a prompt_hostname expert, no cap π this little gem is from fish-shell 4.9, dated Sep 08, 2026, and the copyright belongs to the fish-shell developers β go forth and shorten those hostnames, 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