How to find out the machine ID on various UNIXes

By Darrin Leboeuf November 21st, 2007 at 2:10 pm
Posted in MySQLOraclePostgreSQLSysAdmin
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

These icons link to social bookmarking sites where readers can share and discover new web pages.
  • Google
  • del.icio.us
  • Facebook
  • bodytext
  • Technorati
  • TwitThis
  • Reddit

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

  1. Matthew Montgomery Says:

    Linux : uname -n

  2. Darrin Leboeuf Says:

    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 Says:

    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 Says:

    Great point Dave…

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

    -D

  5. Sheeri Says:

    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 Says:

    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

Filling out the following captcha not only allows us to cut down on automated blogspam but also helps digitize books. Please feel free to send comments on this approach directly to Paul at vallee@pythian.com.

NOTE: After submitting your comment, verify that it is added to the blog. New comments will be marked as "waiting for moderation" (we only moderate for spam). If the level of spam is as low as we hope, we will bypass this step.