Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

uname -n question

Status
Not open for further replies.

Marksmen

Technical User
Feb 4, 2003
36
US
Where does uname -n get it's hostname information from. On one of our servers the results from "uname -n" and "hostname" commands are different.
 
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.
 
i think what he wants to know is...

/etc/rc.net sets it like hyuh:
uname -S `hostname`

likewise with hostid.

IBM Certified -- AIX 4.3 Obfuscation
 
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.

So it is possible they are different.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top