Re: Anyone Know How to Make uname -n Return Non-FQDN?



Eric Robinson :
Normally, uname -n returns myhost.mydomain.com. I need it to return just
myhost. Anybody know how to do that? I have CentOS 4.3 (which is RHEL4).

Oddness.

Wed Aug 30 09:33:36 ~> uname -n
jason
Wed Aug 30 09:33:38 ~>


From the man page:

-n, --nodename
print the network node hostname

So above, uname -n prints the machines name, as advertised. Perhaps your
manpage is different.

At any rate:

uname -n | cut -d. -f1

should do the trick.

--
Where there's no emotion, there's no motive for violence.
-- Spock, "Dagger of the Mind", stardate 2715.1

http://www.websterscafe.com
.



Relevant Pages

  • Whats in a uname
    ... Both of these are solaris 10 machines. ... The prod box is a sun v1280 the ... I assume that if the patch level is the same then the uname -a output ...
    (SunManagers)
  • Re: Help~ Can I script the autofs, auto_direct??
    ... CPU The output of uname -p processor type. ... Machines that don't know what $HW is will mount server:export/local/L_ ... After changing auto_direct, you must run automount to re-read the map, ...
    (comp.unix.solaris)
  • Re: 6.2?
    ... On Tuesday 12 September 2006 07:12, kama wrote: ... I just updated the sources on two of my machines and found: ... $ uname -sr ... FreeBSD 6.2-PRERELEASE ...
    (freebsd-current)
  • Re: 6.2? (fwd)
    ... On Tuesday 12 September 2006 07:12, kama wrote: ... I just updated the sources on two of my machines and found: ... $ uname -sr ... FreeBSD 6.2-PRERELEASE ...
    (freebsd-stable)
  • Re: Mathematica 5.2 (Solaris 10, Sparc) excessive CPU use
    ... does anyone know what other machines it might effect? ... Solaris 10 1/06 s10s_u1wos_19a SPARC ... Use is subject to license terms. ... I also forgot to post the uname earlier, ...
    (comp.unix.solaris)