20 basic Linux newbie commands to identify the system - Redhat

This is a discussion on 20 basic Linux newbie commands to identify the system - Redhat ; ************************************************** ************************** How best to determine important stuff about a RedHat Enterprise Linux machine Revision 1.01 For the benefit of Linux users on the USENET (please improve). ************************************************** ************************** Many thanks to: Daeron, Michael Heiming, John Gianni, Chris F.A. Johnson, ...

+ Reply to Thread
Results 1 to 3 of 3

Thread: 20 basic Linux newbie commands to identify the system

  1. 20 basic Linux newbie commands to identify the system

    ************************************************** **************************
    How best to determine important stuff about a RedHat Enterprise Linux machine
    Revision 1.01 For the benefit of Linux users on the USENET (please improve).
    ************************************************** **************************
    Many thanks to: Daeron, Michael Heiming, John Gianni, Chris F.A. Johnson,
    spike1@freenet.co.uk, Nico Kadel-Garcia, Holger Petersen,
    Lew Pitcher, Daniel Rudy, mike, Joe Sixpack, Nico Kadel-Garcia
    See also: http://www.talug.org/howto/sysinfo.html
    Note: All paths are /bin unless specified otherwise.
    All commands are in a presumed preference order (mine).
    All examples were based on a single Linux IBM X335 server.
    ftp://ftp.software.ibm.com/common/ss...6/GM130196.PDF
    http://www.pc.ibm.com/us/eserver/xseries/x335.html
    ----------------------------------------------------------------------------
    0. To determine the Linux kernel (in decreasing order of preference):
    tcsh% uname -r
    REPORTS: 2.4.21-9.ELsmp

    tcsh% uname -a
    REPORTS: Linux hostname.Domain.COM 2.4.21-9.ELsmp #1 SMP
    Thu Jan 8 17:08:56 EST 2004 i686 i686 i386 GNU/Linux

    tcsh% cat /proc/sys/kernel/osrelease
    REPORTS: 2.4.21-9.ELsmp

    tcsh% uname -r|sed s/smp//
    REPORTS: 2.4.21-9.EL
    ----------------------------------------------------------------------------
    1. To determine the Redhat release (in this case, RHE 3.0):
    tcsh% cat /etc/redhat-release
    REPORTS: Red Hat Enterprise Linux WS release 3 (Taroon Update 1)

    Note: To Sun users long wary of the easily editable /etc/motd message
    of the day file, get used to this as this is the only known method
    of determining the Redhat release.
    ----------------------------------------------------------------------------
    2. To determine just the number of processors (including hyperthreading):
    tcsh% grep -c "processor" /proc/cpuinfo
    tcsh% grep "processor" /proc/cpuinfo | wc -l
    tcsh% cat /proc/cpuinfo | grep "processor" | wc -l
    REPORTS: 4 (but it could be half that due to hyperthreading)

    To determine the number & type of processors (including hyperthreading):
    tcsh% cat /proc/cpuinfo | egrep "processor|vendor_id|model name|cpu MHz"
    tcsh% egrep "processor|vendor_id|model name|cpu MHz" /proc/cpuinfo
    REPORTS: processor : 0
    vendor_id : GenuineIntel
    model name : Intel(R) Xeon(TM) CPU 3.06GHz
    cpu MHz : 3056.620
    processor : 1
    vendor_id : GenuineIntel
    model name : Intel(R) Xeon(TM) CPU 3.06GHz
    cpu MHz : 3056.620
    processor : 2
    vendor_id : GenuineIntel
    model name : Intel(R) Xeon(TM) CPU 3.06GHz
    cpu MHz : 3056.620
    processor : 3
    vendor_id : GenuineIntel
    model name : Intel(R) Xeon(TM) CPU 3.06GHz
    cpu MHz : 3056.620

    To determine if hyperthreading is doubling the number of processors:
    tcsh% egrep "processor|flags" /proc/cpuinfo | sed -e 's/flags.* ht.*/ht/'

    REPORTS: processor : 0
    ht
    processor : 1
    ht
    processor : 2
    ht
    processor : 3
    ht

    Note: In this case, there are really only 2 CPUs, hyperthreaded as 4.

    Note: To produce one line per CPU:
    tcsh% awk -F: '/^processor/ { ++pr }
    /^vendor_id/ { vid[pr] = $2 }
    /^model/ { model[pr] = $2 }
    /^cpu/ { mhz[pr]=$2 }
    END { for ( cpu in vid ) print vid[cpu], model[cpu], mhz[cpu] }'
    /proc/cpuinfo

    REPORTS: GenuineIntel Intel(R) Xeon(TM) CPU 3.06GHz 2
    GenuineIntel Intel(R) Xeon(TM) CPU 3.06GHz 2
    GenuineIntel Intel(R) Xeon(TM) CPU 3.06GHz 2
    GenuineIntel Intel(R) Xeon(TM) CPU 3.06GHz 2

    It would be nice to add hyperthreading YES/NO checks if possible.
    ----------------------------------------------------------------------------
    3. To determine installed RAM:
    tcsh% free -m | awk '/Mem:/{print $2,"KB"}'
    tcsh% free -m | awk '$1 ~ /Mem/ { print $2 "KB" } '
    REPORTS: 8063 KB

    tcsh% awk '/MemT/{print $2/1024,"KB"}' /proc/meminfo
    REPORTS: 8063.99 KB

    tcsh% free -m |grep "Mem"|awk -F: '{print $2}' |awk '{print $1"MB"}'
    REPORTS: 8MB
    ----------------------------------------------------------------------------
    4. To determine swap (in megabytes):
    tcsh% free -m | awk '$1 ~ /Swap/ { print $2,"MB" }'
    tcsh% free -m |grep "Swap"|awk -F: '{print $2}'|awk '{print $1,"MB"}'
    REPORTS: 24568 MB

    tcsh% free -m | {
    while read a b c
    do
    case $a in
    Mem: ) mem=$b ;;
    Swap: ) swap=$b ;;
    esac
    done
    [ $mem -gt $swap ] && w=${#mem} || w=${#swap}
    printf "Memory: %${w}d MB\n" ${mem}
    printf " Swap: %${w}d MB\n" ${swap}
    ----------------------------------------------------------------------------
    5. To determine the X Server (only works as root, best from the console):
    tcsh% su root
    tcsh# /usr/X11R6/bin/XFree86 -version 2>&1|awk '$1 ~ /XFree86/ {print $3}'
    REPORTS:
    4.3.0

    tcsh% su root
    tcsh# /usr/X11R6/bin/XFree86 -version|grep Version |awk -F/ '{print $1}'
    REPORTS:

    XFree86 Version 4.3.0 (Red Hat Enterprise Linux 3 release: 4.3.0-44.EL)
    Release Date: 15 August 2003
    X Protocol Version 11, Revision 0, Release 6.6
    Build Operating System: Linux 2.4.21-4.ELsmp i686 [ELF]
    Build Date: 28 November 2003
    Build Host: tweety.devel.redhat.com

    Before reporting any problems, please make sure you are using the most
    recent XFree86 packages available from Red Hat by checking for updates
    at http://rhn.redhat.com/errata or by using the Red Hat Network up2date
    tool. If you still encounter problems, please file bug reports in the
    XFree86.org bugzilla at http://bugs.xfree86.org and/or Red Hat
    bugzilla at http://bugzilla.redhat.com

    Module Loader present
    OS Kernel: Linux version 2.4.21-9.ELsmp
    (bhcompile@stripples.devel.redhat.com) (
    gcc version 3.2.3 20030502
    (Red Hat Linux 3.2.3-26)) #1 SMP Thu Jan 8 17:08:56 EST 2004

    bash% xv=`/usr/X11R6/bin/XFree86 -version 2>&1`
    echo ${xv%%/*}
    ----------------------------------------------------------------------------
    6. To determine the platform type:
    tcsh% uname -m
    REPORTS: i686
    ----------------------------------------------------------------------------
    7. To determine important colormap information:
    tcsh% xdpyinfo | sed -n -e '/TrueColor/p' -e '/24 planes/p'\
    | sort -u | grep -v "window:"
    tcsh% xdpyinfo | sed -n -e '/PseudoColor/p' -e '/8 planes/p'\
    | sort -u | grep -v "window:"

    REPORTS: class: TrueColor
    depth: 24 planes

    class: PseudoColor
    depth: 8 planes

    tcsh% xdpyinfo | awk '/class:/ || /depth:/ {if ( ! x[$0]++ ) print}'
    ----------------------------------------------------------------------------
    8. To determine the hostname & IP address:
    tcsh% hostname -v -i
    REPORTS: hostname.Domain.COM hostname 100.100.100.101

    tcsh% echo $HOSTNAME `hostname -i`
    REPORTS: hostname.Domain.COM hostname 100.100.100.101

    Note: This only works for the hostname returned by gethostname(2)
    (which is the one and only value set by the sethostname(2) call).
    It doesn't work for multihomed systems where each IP address
    has a different hostname.
    ----------------------------------------------------------------------------
    9. To determine the hostid:
    tcsh% hostid
    REPORTS: 8c9eb81a

    Note: Typically this isn't a very usefull value. It only reports the
    value set by sethostid(2), which is a locally set value, and not
    something that's actually unique by system (although it's supposed
    to be, and is only by dint of system administration)
    ----------------------------------------------------------------------------
    10. To determine partition information:
    tcsh% su root
    tcsh# fdisk -l
    REPORTS:
    Disk /dev/sda: 73.4 GB, 73407488000 bytes
    255 heads, 63 sectors/track, 8924 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes

    Device Boot Start End Blocks Id System
    /dev/sda1 * 1 13 104391 83 Linux
    /dev/sda2 14 3146 25165822+ 82 Linux swap
    /dev/sda3 3147 4421 10241437+ 83 Linux
    /dev/sda4 4422 8924 36170347+ f Win95 Ext'd (LBA)
    /dev/sda5 4422 892436170316 83 Linux

    Disk /dev/sdb: 73.4 GB, 73407488000 bytes
    255 heads, 63 sectors/track, 8924 cylinders
    Units = cylinders of 16065 * 512 = 8225280 bytes

    Device Boot Start End Blocks Id System
    /dev/sdb1 * 1 8924 71681998+ 83 Linux
    ----------------------------------------------------------------------------
    11. To determine how long the system has been running since the last reboot:
    tcsh% uptime
    REPORTS: 00:15:36 up 1 day, 8:30, 2 users,
    load average: 0.04, 0.01, 0.00
    ----------------------------------------------------------------------------
    12. To determine who is currently logged in and what they are doing:
    tcsh% w
    REPORTS:
    00:17:00 up 1 day, 8:32, 2 users, load average: 0.01, 0.01, 0.00
    USER TTY FROM LOGIN@ IDLE JCPU PCPU WHAT
    bill pts/0 flow 10:11pm 5.00s 0.28s 0.07s rlogin bigboy
    bill pts/1 vpn-235185 11:25pm 0.00s 0.36s 0.01s w
    ----------------------------------------------------------------------------
    13. To determine the SCSI devices attached:
    tcsh% cat /proc/scsi/scsi
    REPORTS:
    Attached devices:
    Host: scsi0 Channel: 00 Id: 00 Lun: 00
    Vendor: IBM-ESXS Model: MAP3735NC FN Rev: B109
    Type: Direct-Access ANSI SCSI revision: 03
    Host: scsi0 Channel: 00 Id: 01 Lun: 00
    Vendor: IBM-ESXS Model: MAP3735NC FN Rev: B109
    Type: Direct-Access ANSI SCSI revision: 03
    Host: scsi0 Channel: 00 Id: 08 Lun: 00
    Vendor: IBM Model: 25P3495a S320 1 Rev: 1
    Type: Processor ANSI SCSI revision: 02
    ----------------------------------------------------------------------------
    14. To determine the USB devices attached:
    tcsh% /sbin/lsusb
    REPORTS: Bus 001 Device 001: ID 0000:0000
    ----------------------------------------------------------------------------
    15. To determine specific hardware installed:
    tcsh% /sbin/lspci
    REPORTS:
    00:00.0 Host bridge: ServerWorks CNB20-HE Host Bridge (rev 31)
    00:00.1 Host bridge: ServerWorks CNB20-HE Host Bridge
    00:00.2 Host bridge: ServerWorks CNB20-HE Host Bridge
    00:01.0 VGA compatible controller: ATI Technologies Inc Rage XL
    (rev 27)
    00:02.0 Ethernet controller: Intel Corp. 82557/8/9
    [Ethernet Pro 100] (rev 08)
    00:0f.0 Host bridge: ServerWorks CSB5 South Bridge (rev 93)
    00:0f.1 IDE interface: ServerWorks CSB5 IDE Controller (rev 93)
    00:0f.2 USB Controller: ServerWorks OSB4/CSB5 OHCI USB Controller
    (rev 05)
    00:0f.3 ISA bridge: ServerWorks GCLE Host Bridge
    00:11.0 Host bridge: ServerWorks: Unknown device 0101 (rev 05)
    00:11.2 Host bridge: ServerWorks: Unknown device 0101 (rev 05)
    01:01.0 SCSI storage controller: LSI Logic / Symbios Logic 53c1030
    PCI-X Fusion-MPT Dual Ultra320 SCSI (rev 07)
    02:01.0 Ethernet controller: Broadcom Corporation NetXtreme BCM5703
    Gigabit Ethernet (rev 02)
    02:02.0 Ethernet controller: Broadcom Corporation NetXtreme BCM5703
    Gigabit Ethernet (rev 02)
    ----------------------------------------------------------------------------
    16. To determine hard disk & removable media identification:
    tcsh% cat /proc/ide/hd*/model
    REPORTS: LG CD-ROM CRN-8245B
    ----------------------------------------------------------------------------
    17. What else can & should a new Linux user run to determine information?
    ----------------------------------------------------------------------------
    ************************************************** **************************
    End of:
    How best to determine important stuff about a RedHat Enterprise Linux machine
    ************************************************** **************************

  2. Re: 20 basic Linux newbie commands to identify the system

    Ellen Spelling wrote:

    ----------------------------------------------------------------------------
    > 0. To determine the Linux kernel (in decreasing order of preference):
    > tcsh% uname -r
    > REPORTS: 2.4.21-9.ELsmp
    >


    cool...my system reports a kernel ( from suse 9.0 ) specific to the athlon:

    jbailo@linux:~> uname -r
    2.4.21-199-athlon
    jbailo@linux:~>


    --
    W '04 <:> Open

  3. Re: 20 basic Linux newbie commands to identify the system

    Ellen Spelling wrote:



    > ----------------------------------------------------------------------------
    > 5. To determine the X Server (only works as root, best from the console):
    > tcsh% su root
    > tcsh# /usr/X11R6/bin/XFree86 -version 2>&1|awk '$1 ~ /XFree86/ {print $3}'


    $ X -version

    .... also works nicely and the user does not have to be root to glean this
    information.




    Regards,

    speedman


+ Reply to Thread