Hostname
Jump to navigation
Jump to search
A Hostname is the name given either to localhost, a computer on a LAN, or a node in the DNS hierarchy.
To find out your hostname, use the following command:
$ uname -n
or
$ hostname
The hostname of a computer can be changed in several different ways. In Red Hat, to permanently change the hostname, modify the HOSTNAME value in: /etc/sysconfig/network
To immediately (but not permanently) change the hostname:
$ hostname newhostname
Problems
Changing the hostname can make X WindoWing programs not start any longer:
tweedleburg:~ # xclock ^C tweedleburg:~ # hostname bla tweedleburg:~ # xclock No protocol specified Error: Can't open display: :0.0
Provided by
Not all distributions provide this command, but most (all?) of the ones that do incorporate this from the GNU Coreutils: and use its man page
Related Commands
All of these relate to system-wide information.
- date - set or show the time.
- arch - show CPU hardware details.
- nproc - Show the number of cores.
- uname - Show host and kernel information.
- hostid - Show the host's numeric ID.
- uptime - Show system uptime and recent load averages.