Linux hardware information query command

Source: Internet
Author: User
Tags dmesg

Linux hardware information query command

System

Uname-# View kernel/operating system/CPU Information
Linux hostname 2.6.18-128.el5 #1 SMP Wed Dec 17 11:41:38 EST 2008 x86_64 x86_64 x86_64 GNU/Linux
Head-n 1/etc/issue# View the operating system version
Red Hat Enterprise Linux Server release 5.3 (Tikanga)
Cat/proc/cpuinfo# Viewing CPU Information
processor       : 0vendor_id       : GenuineIntelcpu family      : 6model           : 44model name      : Intel(R) Xeon(R) CPU           X5670  @ 2.93GHzstepping        : 2cpu MHz         : 2933.582cache size      : 12288 KBphysical id     : 1siblings        : 12core id         : 0cpu cores       : 6apicid          : 32fpu             : yesfpu_exception   : yescpuid level     : 11wp              : yesflags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss ht tm syscall nx pdpe1gb rdtscp lm constant_tsc ida pni monitor ds_cpl vmx smx est tm2 cx16 xtpr popcnt lahf_lmbogomips        : 5871.13clflush size    : 64cache_alignment : 64address sizes   : 40 bits physical, 48 bits virtualpower management:
Hostname# Viewing the Host Name of a computer
hostname.com.cn
Lspci-TV# List all PCI devices
-[0000:00]-+-00.0  Intel Corporation 5500 I/O Hub to ESI Port           +-01.0-[02]--+-00.0  Broadcom Corporation NetXtreme II BCM57711E 10-G                       igabit PCIe           |            \-00.1  Broadcom Corporation NetXtreme II BCM57711E 10-G                       igabit PCIe           +-02.0-[0d]--           +-03.0-[03-05]--           +-07.0-[06-08]--           +-08.0-[11]--           +-09.0-[09-0b]--+-00.0  QLogic Corp. ISP2432-based 4Gb Fibre Channel  
Lsusb-TV# List all USB devices
Bus#  6`-Dev#   1 Vendor 0x0000 Product 0x0000`-Dev#   2 Vendor 0x03f0 Product 0x1027Bus#  5`-Dev#   1 Vendor 0x0000 Product 0x0000Bus#  4`-Dev#   1 Vendor 0x0000 Product 0x0000Bus#  3`-Dev#   1 Vendor 0x0000 Product 0x0000Bus#  2`-Dev#   1 Vendor 0x0000 Product 0x0000Bus#  1`-Dev#   1 Vendor 0x0000 Product 0x0000
Lsmod# List loaded Kernel Modules Env# Viewing environment variable resources
_=/bin/envCVS_RSH=sshG_BROKEN_FILENAMES=1HISTSIZE=1000HOME=/rootINPUTRC=/etc/inputrcKDEDIR=/usrKDE_IS_PRELINKED=1KDE_NO_IPV6=1LANG=en_US.UTF-8LESSOPEN=|/usr/bin/lesspipe.sh %sLOGNAME=rootMAIL=/var/spool/mail/rootPATH=/usr/lib64/qt-3.3/bin:/usr/kerberos/sbin:/usr/kerberos/bin:/usr/local/sbin:/usr/local/bin:/sbin:/bin:/usr/sbin:/usr/bin
Free-m# View memory usage and swap zone usage
             total       used       free     shared    buffers     cachedMem:         48295       9647      38648       0       1165        4067-/+ buffers/cache:       4413      43881Swap:         3999          0       3999 
Df-h# View the usage of each partition

 

Filesystem            Size  Used   Avail   Use%      Mounted on/dev/mapper/rootVG-root                       83G  7.4G   72G     10%      //dev/mapper/rootVG-tmp                      3.9G  137M  3.6G     4%       /tmp/dev/mapper/rootVG-var                       31G  5.1G   24G     18%      /var
Du-sh <Directory Name># View the size of a specified directory

 

# du -sh /tmp84K     /tmp
Grep MemTotal/proc/meminfo# View total memory

 

<pre name="code" class="plain"># <span style="font-family: Arial, Helvetica, sans-serif;">grep MemTotal /proc/meminfo</span>
MemTotal: 16432172 kB

Grep MemFree/proc/meminfo# View the Amount of idle memory

# grep MemFree /proc/meminfoMemFree:      12647164 kB
Uptime# View system running time, number of users, and load
14:15:28 up 4 days,  2:56,  1 user,  load average: 1.17, 1.15, 1.10
Cat/proc/loadavg# Viewing System Loads
# cat /proc/loadavg1.11 1.14 1.09 1/546 5175

Disks and partitions

Mount | column-t# View the status of the mounted Partition
/dev/mapper/rootVG-root     on  /         type  ext3    (rw)proc                        on  /proc     type  proc    (rw)sysfs                       on  /sys      type  sysfs   (rw)devpts                      on  /dev/pts  type  devpts  (rw,gid=5,mode=620)/dev/mapper/rootVG-tmp      on  /tmp      type  ext3    (rw)
Fdisk-l# View all partitions
Disk /dev/cciss/c0d0: 146.7 GB, 146778685440 bytes255 heads, 63 sectors/track, 17844 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytes           Device Boot      Start         End      Blocks   Id  System/dev/cciss/c0d0p1   *           1          19      152586   83  Linux/dev/cciss/c0d0p2              20       17844   143179312+  8e  Linux LVMDisk /dev/sdc: 384.3 GB, 384399572992 bytes255 heads, 63 sectors/track, 46733 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytesDisk /dev/sdc doesn't contain a valid partition tableDisk /dev/sde: 225.4 GB, 225485783040 bytes255 heads, 63 sectors/track, 27413 cylindersUnits = cylinders of 16065 * 512 = 8225280 bytes
Swapon-s# View all swap partitions
Filename                                Type            Size    Used    Priority/dev/mapper/rootVG-swap                 partition       16777208        0       -1
Hdparm-I/dev/hda# View disk parameters (only applicable to IDE devices) Dmesg | grep IDE# View the IDE Device Detection Status at startup
Uniform Multi-Platform E-IDE driver Revision: 7.00alpha2Probing IDE interface ide0...Probing IDE interface ide1... 

Network

Ifconfig# View the properties of all network interfaces
bond0     Link encap:Ethernet  HWaddr F4:CE:46:7E:D7:68          inet addr:10.56.236.101  Bcast:10.56.236.127  Mask:255.255.255.128          UP BROADCAST RUNNING MASTER MULTICAST  MTU:1500  Metric:1          RX packets:196625663 errors:0 dropped:0 overruns:0 frame:0          TX packets:166879878 errors:0 dropped:0 overruns:0 carrier:0          collisions:0 txqueuelen:0          RX bytes:30475502617 (28.3 GiB)  TX bytes:34248137790 (31.8 GiB)eth0      Link encap:Ethernet  HWaddr F4:CE:46:7E:D7:68          UP BROADCAST RUNNING SLAVE MULTICAST  MTU:1500  Metric:1          RX packets:196625663 errors:0 dropped:0 overruns:0 frame:0          TX packets:166879878 errors:0 dropped:0 overruns:0 carrier:0          collisions:0 txqueuelen:1000          RX bytes:30475502617 (28.3 GiB)  TX bytes:34248137790 (31.8 GiB)          Interrupt:130 Memory:fb000000-fb7fffff
Iptables-L# View firewall settings
Chain INPUT (policy ACCEPT)target     prot opt source               destinationChain FORWARD (policy ACCEPT)target     prot opt source               destinationChain OUTPUT (policy ACCEPT)target     prot opt source               destination
Route-n# Viewing route tables
Kernel IP routing tableDestination     Gateway         Genmask         Flags Metric Ref    Use Iface10.56.236.0     0.0.0.0         255.255.255.128 U     0      0        0 bond0169.254.0.0     0.0.0.0         255.255.0.0     U     0      0        0 bond00.0.0.0         10.56.236.126   0.0.0.0         UG    0      0        0 bond0
Netstat-lntp# View all listening ports
Active Internet connections (only servers) Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program nametcp 0 0 0.0.0.0: 2049 0.0.0.0: * LISTEN-tcp 0 0 0.0.0.0: 389 0.0.0.0: * LISTEN 12782/ns-slapd # netstat-antp # view all established connections Active Internet connections (servers and established) proto Recv-Q Send-Q Local Address Foreign Address State PID/Program nametcp 0 0 0.0.0.0: 2049 0.0.0.0: * LISTEN-tcp 0 0 0.0.0.0: 389 0.0.0.0: * LISTEN 12782/ns-slapdtcp 0 0 0.0.0.0: 11111 0.0.0.0: * LISTEN 15217/ricci
Netstat-s# Viewing network statistics
Ip:    195815097 total packets received    8 forwarded    0 incoming packets discarded    195814891 incoming packets delivered    167012221 requests sent out    3 outgoing packets dropped    7 fragments dropped after timeout    231 reassemblies required    33 packets reassembled ok    7 packet reassembles failed    8 fragments received ok    32 fragments createdIcmp:    25034 ICMP messages received    16 input ICMP message failed.    ICMP input histogram:        destination unreachable: 173        echo requests: 13025        echo replies: 11836    25060 ICMP messages sent    0 ICMP messages failed    ICMP output histogram:        destination unreachable: 185        echo request: 11842        echo replies: 13025IcmpMsg:        InType0: 11836        InType3: 173        InType8: 13025        OutType0: 13025        OutType3: 185        OutType8: 11842        OutType10: 8

Process

Ps-ef# View all processes

UID        PID  PPID  C STIME TTY      TIME CMDroot         1     0  0 Jul10 ?        00:00:05 init [3]root         2     1  0 Jul10 ?        00:00:03 [migration/0]root         3     1  0 Jul10 ?        00:00:00 [ksoftirqd/0]root         4     1  0 Jul10 ?        00:00:00 [watchdog/0]

Top# Display Process status in real time

Tasks: 385 total,   1 running, 384 sleeping,   0 stopped,   0 zombieCpu(s):  0.2%us,  0.3%sy,  0.0%ni, 98.6%id,  0.8%wa,  0.0%hi,  0.1%si,  0.0%stMem:  16432172k total,  3795132k used, 12637040k free,   800952k buffersSwap: 16777208k total,        0k used, 16777208k free,  1729708k cached  PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND 7339 root      15   0 11016 1192  700 R  2.0  0.0   0:00.01 top17378 root      10  -5     0    0    0 D  2.0  0.0   6:50.74 kjournald    1 root      15   0 10372  704  596 S  0.0  0.0   0:05.31 init

User

W# Viewing active users
 14:33:53 up 4 days,  3:15,  1 user,  load average: 1.17, 1.14, 1.10USER     TTY      FROM              LOGIN@   IDLE   JCPU   PCPU WHATroot     pts/0    10.141.41.62     13:11    0.00s  0.05s  0.05s -bash
Id <User Name># Viewing specified user information
uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel)
Last# Viewing user logon logs
root     pts/0        10.141.41.62     Mon Jul 14 13:11   still logged inroot     pts/0        10.141.41.62     Mon Jul 14 10:38 - 12:34  (01:56)root     pts/0        10.141.152.51    Sun Jul 13 07:14 - 11:55  (04:41)root     pts/2        10.140.2.76      Fri Jul 11 17:50 - 18:38  (00:47)
Cut-d:-f1/etc/passwd# View all users in the system
# cut -d: -f1 /etc/passwdrootbindaemonadm
Cut-d:-f1/etc/group# View all groups in the system
rootbindaemonsysadmttydisk
Crontab-l# View the scheduled tasks of the current user

Service

Chkconfig -- list# List all system services
httpd           0:off   1:off   2:off   3:off   4:off   5:off   6:offip6tables       0:off   1:off   2:on    3:on    4:on    5:on    6:offnetwork         0:off   1:off   2:on    3:on    4:on    5:on    6:offnfs             0:off   1:off   2:off   3:off   4:off   5:off   6:offnfslock         0:off   1:off   2:off   3:on    4:on    5:on    6:offnscd            0:off   1:off   2:on    3:on    4:on    5:on    6:offntpd            0:off   1:off   2:on    3:on    4:on    5:on    6:offoddjobd         0:off   1:off   2:off   3:off   4:off   5:off   6:offoractl          0:off   1:off   2:off   3:off   4:off   5:off   6:offsnmpd           0:off   1:off   2:on    3:on    4:on    5:on    6:offsnmptrapd       0:off   1:off   2:off   3:off   4:off   5:off   6:offsshd            0:off   1:off   2:on    3:on    4:on    5:on    6:offsyslog          0:off   1:off   2:on    3:on    4:on    5:on    6:off
Chkconfig-list | grep on# List all started system services

Program

Rpm-qa# View all installed software packages
# rpm -qa | grep perlperl-HTML-Parser-3.55-1.fc6perl-Net-Telnet-3.03-5perl-LDAP-0.33-4.el5_8perl-XML-LibXML-1.58-6

Other common commands are as follows::

View the serial number of the motherboard: dmidecode | grep-I 'serial number' use the hardware detection program kuduz to detect the new hardware: service kudzu start (or restart) to view the CPU information: cat/proc/cpuinfo [dmesg | grep-I 'cpu '] [dmidecode-t processor] view memory information: cat/proc/meminfo [free-m] [vmstat] view Board information: cat/proc/pci view graphics card/sound card information: lspci | grep-I 'vga '[dmesg | grep-I 'vga'] to view the NIC information: dmesg | grep-I 'eth '[cat/etc/sysconfig/hwconf | grep-I eth] [lspci | grep-I 'eth'] view PCI information: lspci (compared to cat/proc /Pci more intuitive) view USB devices: cat/proc/bus/usb/devices view keyboard and mouse: cat/proc/bus/input/devices view system hard disk information and usage: fdisk & disk-l & df view interrupt requests of each device (IRQ): cat/proc/interrupts view system architecture: uname-a: View and start the system's 32-bit or 64-bit Kernel Mode: isalist-v [isainfo-v] [isainfo-B] to view hardware information, including bios, cpu, memory, and other information: dmidecode is used to determine the current display refresh frequency:/usr/sbin/ffbconfig-rev? View System Configuration:/usr/platform/sun4u/sbin/prtdiag-v view the patches applied in the current system: showrev-p displays the current running level: who-rH: nslookup-class = chaos-q = txt version. bind view hardware information: dmesg | more display peripheral information, such as usb, Nic and other information: lspci view loaded DRIVER: lsnod lshw view current Processor type and speed (clock speed ): psrinfo-v print the current OBP version: prtconf-v view the hard disk physical information (vendor, RPM, Capacity): iostat-E view the disk geometric parameters and partition information: prtvtoc/dev/rdsk/c0t0d0s shows the number of used and unused I-nodes:

Df-F ufs-o I

Isalist-v

For files in "/proc", you can use the File View command to browse its content. The file contains system-specific information:

Host CPU information: Cpuinfo

Host DMA channel information: Dma

File System Information: Filesystems

Host interruption information: Interrupts

Host I/O port number information: Ioprots

Host memory information: Meninfo

Linux memory Version: Version

Note: proc-process information pseudo-filesystem process information disguise File System

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.