You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Apr 26, 2024. It is now read-only.
hostname and hostname -f return the same value on most modern GNU/Linux systems with an actual FQDN applied. Here's an example without redacting anything but my PS1.
why not utilizing hostname -s, which is exactly made for this (and indeed on arch returns the shortname, even if hostname without parameters returns the fqdn-hostname).
Sign up for freeto subscribe to this conversation on GitHub.
Already have an account?
Sign in.
hostname
andhostname -f
return the same value on most modern GNU/Linux systems with an actual FQDN applied. Here's an example without redacting anything but my PS1.As you can see, the outputs of the two commands are identical and non-empty. The environment variable
$HOSTNAME
also evaluates to the same string.A better way to get the short hostname and ensure no domain information leaks is to do the following:
hostname=$(hostname | cut -d. -f1)
That guarantees that no domain information leaks by trimming all but the leftmost element in a hostname.
The text was updated successfully, but these errors were encountered: