The uname command uses a structure as defined in sys/utsname.h and contains these fields and displays the name of the current operating system.:
char sysname[SYS_NMLN];
char nodename[SYS_NMLN];
char release[SYS_NMLN];
char version[SYS_NMLN];
char machine[SYS_NMLN];
and the hostname command uses unistd.h and sets or displays the name of the current host system.
uname -n is returned by the string in the nodename field of the structure for utsname.h. The hostname or nodename are often the same, but the gethostname subroutine allows a process to determine the internal hostname for a machine on a network.
This site uses cookies to help personalise content, tailor your experience and to keep you logged in if you register.
By continuing to use this site, you are consenting to our use of cookies.