Print or Set (temporarily) the name of current host system.

   hostname [-fs] [name-of-host]

   -f    Include domain information in the printed name.
         This is the default behavior.

   -s    Trim off any domain information from the printed name.

The super-user can set the hostname by supplying a hastname argument.
To keep the hostname between reboots, run `scutil --set HostName name-of-host'.

If a NetBIOSName has been configured, (it is typically set to = the hostname) the value is stored in a preference file:
$ defaults read /Library/Preferences/SystemConfiguration/ NetBIOSName

You can set the NetBIOSName in System Preferences > Network > active network port > Advanced > WINS tab.


Display the current hostname

$ hostname

The hostname is also stored in a system variable named HOSTNAME

$ echo $HOSTNAME

“ One thing you don't want to do as a host is be running around all evening. Do as much as you can ahead of time, so all you have to do is grill the main ingredients” ~ Bobby Flay


hostname man page -
scutil - Manage system configuration parameters, including hostname
dscacheutil -flushcache

Copyright © 1999-2018
Some rights reserved