Search code examples
shellhostnamefish

Where is hostname value being sourced


I have a prompt on this mac mini that looks like the output below. I can seem to find where the priscilla-cs-iphone value is coming from.

mando@priscilla-cs-iphone ~> cat .config/fish/fish_variables | grep hostname
mando@priscilla-cs-iphone ~ [0|1]> cat .config/fish/fish_variables | grep home
mando@priscilla-cs-iphone ~ [0|1]> cat .config/fish/fish_variables | grep priscilla
mando@priscilla-cs-iphone ~ [0|1]> cat .config/fish/fish_variables | grep "priscilla"
mando@priscilla-cs-iphone ~ [0|1]> cat ~/.config/fish/fishd.(ifconfig en0 | awk '/ether/{print $2}' | tr -d ':')
cat: /Users/mando/.config/fish/fishd.1498773cea14: No such file or directory

System configuration...

mando@priscilla-cs-iphone ~ [1]> defaults read /Library/Preferences/SystemConfiguration/com.apple.smb.server
{
    DOSCodePage = 437;
    LocalKerberosRealm = "LKDC:SHA1.30D481C6036FC8F8B589EFF8E37B513D08753210";
    NetBIOSName = mandalarian;
    ServerDescription = mandalarian;
}
mando@priscilla-cs-iphone ~>

My etc/hosts file reads:

##
# Host Database
#
# localhost is used to configure the loopback interface
# when the system is booting.  Do not change this entry.
##
127.0.0.1   localhost
255.255.255.255 broadcasthost
::1             localhost

Im on a mac mini:

> sw_vers
ProductName:    macOS
ProductVersion: 11.2.3
BuildVersion:   20D91

I understand that I can reset it but I would like to know where the value is coming and how it might have been set to that. This is fresh BigSur install and I have never connected to an iphone that I am aware of in the last 24 hours.


Solution

  • Fish calls your operating system's gethostname(3) function.

    Where that gets the value depends on the system. Where macOS gets it, I have absolutely no clue.