Linux HostName is in lowercase, Just curious why its in lower when its all setup as Upper

13,772

Linux does keep the capitalization (Ubuntu 16.04, 4.4.0-31-generic):

root@frisbee:~# hostname FRISBEE
root@frisbee:~# bash
root@FRISBEE:~# sysctl -a | grep hostname
kernel.hostname = FRISBEE
root@FRISBEE:~# cat /proc/sys/kernel/hostname
FRISBEE

/etc/hostname is not the Linux (as in Linux kernel) way of setting the hostname. The Linux kernel has it's hostname set with the sethostname() system call, which is most commonly called from the hostname user space utility.

/etc/hostname and the way it is used to set the hostname at boot would be implemented by the developer of the distribution. It might be that the developers of your specific distribution and version decided to implement RFC 1178:

Don't expect case to be preserved. Upper and lowercase characters look the same to a great deal of internet software, often under the assumption that it is doing you a favor. It may seem appropriate to capitalize a name the same way you might do it in English, but convention dictates that computer names appear all lowercase. (And it saves holding down the shift key.)

In addition, from a technical perspective uppercase hostnames have minimal added value, as DNS is also case insensitive (RFC 4343). Also, a lot of people find a uppercase hostname less legible than a lowercase one (for the same reason as text typed in uppercase is harder to read than with proper capitalization).

Share:
13,772

Related videos on Youtube

John Doe
Author by

John Doe

Updated on September 18, 2022

Comments

  • John Doe
    John Doe almost 2 years

    The hostname set in in uppercase, in /etc/hostname, but the system shows it as lowercase.

    Only some hosts show it as lowercase. When compared to other hosts, there is no difference in release or kernel version.

    sysctl -a | grep kernel.hostname is lowercase

    as well as /proc/sys/kernel/hostname

  • mtak
    mtak almost 8 years
    UpperCase is written as CamelCase, uppercase is UPPERCASE. Still the principles in RFC 1178 and the technical aspect in RFC 4343 is still valid. But there's always some who thinks they're smarter than the guys who write the RFC's. Now for the big advantage of open source: if it really bothers you, change the way your distro sets the hostname from /etc/hostname and add it to the answer :)