sawyl: (Default)
[personal profile] sawyl
Hostname, obviously. According to the docs, hostname "returns the standard host name for the current machine", whereas uname returns "name of this node within an implementation-dependent communications network", whatever that is.

Date: 2005-09-23 08:45 pm (UTC)
From: [identity profile] vincel.livejournal.com
No, hostname is bad, because if run as root there's the danger you can inadvertently change the hostname. I once saw a bug in an IRIX script which resulted in the hostname changing to "-s".

Date: 2005-09-24 09:48 am (UTC)
From: [identity profile] sawyl.livejournal.com
Ok, fair point. Hostname can be risky if you're messing around as root, but at least it always provides consistent information. Uname on the other hand is worryingly fragile and in some cases oddly non-standard.

I seem to remember that uname under Unicos behaves strangely, producing non-standard output and using different options to everyone else in the Unix universe, but at least the stuff it dumps out is consistent. Other super trad versions of unix use a fixed 8 character string hardwired at compile time, so if you build the kernel on one host and copy out to the rest (as recommended by the docs), the nodename is almost always incorrect.

Profile

sawyl: (Default)
sawyl

August 2018

S M T W T F S
   123 4
5 6 7 8910 11
12131415161718
192021222324 25
262728293031 

Most Popular Tags

Style Credit

Expand Cut Tags

No cut tags
Page generated Jul. 13th, 2025 08:21 pm
Powered by Dreamwidth Studios