PROMPT\_HOSTNAME(1) fish-shell PROMPT\_HOSTNAME(1)

# [NAME](#NAME)

prompt\_hostname - print the hostname, shortened for use in the prompt

# [SYNOPSIS](#SYNOPSIS)

```
prompt_hostname
```

# [DESCRIPTION](#DESCRIPTION)

**prompt\_hostname** prints a shortened version the current hostname for use in the prompt. It will print just the first component of the hostname, everything up to the first dot.

# [EXAMPLES](#EXAMPLES)

```
function fish_prompt


    echo -n (whoami)@(prompt_hostname) (prompt_pwd) '$ '
end
```

```
# The machine's full hostname is foo.bar.com
>_ prompt_hostname
foo
```

# [Copyright](#Copyright)

fish-shell developers

October 15, 2026 4.9

---

Document: prompt_hostname(1) from fish 4.9.3-r3 (Chainguard OS)
Source: https://github.com/fish-shell/fish-shell
