How to find out the machine ID on various UNIXes

Nov 21, 2007 / By Darrin Leboeuf

Tags:

It recently came up that it would be helpful if we had a cheat sheet to find out the machine names for any given UNIX. I knew these off the top of my head but it would be great if people added more as comments.

HP/HP-UX: /bin/uname -i
IBM/AIX: /bin/uname -m
SGI/IRIX: /sbin/sysinfo -s
Sun/Solaris: /usr/ucb/hostid

6 comments on “How to find out the machine ID on various UNIXes

  1. Matthew Montgomery on said:

    Linux : uname -n

  2. Darrin Leboeuf on said:

    Thanks Matt! Just to clarify – uname will typically print some system information and things like kernel name, node name processor architechture etc… The “HostID” is like a MAC address for a server in that is unique for each server.

    The command for Linux is also: hostid

  3. David Edwards on said:

    Don’t forget the Unix Rosetta Stone as a key to things like this. I believe there are more than one of these now, so try a search for it: http://www.google.com/search?q=unix+rosetta+stone .

  4. Darrin Leboeuf on said:

    Great point Dave…

    Here is one that I like to refer to as well: http://bhami.com/rosetta.html

    -D

  5. I just learned this a month or so ago myself…..On Linux (I haven’t tried on other machines) /etc/issue will give you a more human readable result than uname -a will.

    For instance:

    > uname -a
    Linux hostname 2.4.32-grsec+f6b+gr217+nfs+a32+fuse23+tg+++opt+c8+gr2b-v6.194 #1 SMP [date timezone time] i686 GNU/Linux

    > cat /etc/issue
    Debian GNU/Linux 3.1 n l

    The n and l as well as other features are described here:
    http://www.cyberciti.biz/faq/howto-change-login-message/

    Since there are so many flavors of Linux, this can come in handier than uname -a — with uname -a I had a hard time telling the differences among fedora versions.

  6. David Edwards on said:

    Sheeri:

    /etc/lsb-release should be useful for that, and is less likely to be edited by a system admin. The “lsb” in the filename stands for “Linux Standard Base”; but I’m not sure how widely this file is implemented yet, even in distributions that aim for LSB-compliance.

    On my Ubuntu 7.04 box, it reads,

    DISTRIB_ID=Ubuntu
    DISTRIB_RELEASE=7.04
    DISTRIB_CODENAME=feisty
    DISTRIB_DESCRIPTION=”Ubuntu 7.04″

Leave a Reply

Your email address will not be published. Required fields are marked *

*

HTML tags are not allowed.