linux下查看硬件信息的常用命令:
 
uname -a  # 查看内核/操作系统/CPU信息
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      # 查看操作系统版本
Red Hat Enterprise Linux Server release 5.3 (Tikanga) 
cat /proc/cpuinfo     # 查看CPU信息
processor       : 0  
vendor_id       : GenuineIntel  
cpu family      : 6  
model           : 44  
model name      : Intel(R) Xeon(R) CPU           X5670  @ 2.93GHz  
stepping        : 2  
cpu MHz         : 2933.582  
cache size      : 12288 KB  
physical id     : 1  
siblings        : 12  
core id         : 0  
cpu cores       : 6  
apicid          : 32  
fpu             : yes  
fpu_exception   : yes  
cpuid level     : 11  
wp              : yes  
flags           : 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_lm  
bogomips        : 5871.13  
clflush size    : 64  
cache_alignment : 64  
address sizes   : 40 bits physical, 48 bits virtual  
power management:  
hostname              # 查看计算机主机名
hostname.com.cn  
lspci -tv          # 列出所有PCI设备
-[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         # 列出所有USB设备
Bus#  6  
`-Dev#   1 Vendor 0x0000 Product 0x0000  
`-Dev#   2 Vendor 0x03f0 Product 0x1027  
Bus#  5  
`-Dev#   1 Vendor 0x0000 Product 0x0000  
Bus#  4  
`-Dev#   1 Vendor 0x0000 Product 0x0000  
Bus#  3  
`-Dev#   1 Vendor 0x0000 Product 0x0000  
Bus#  2  
`-Dev#   1 Vendor 0x0000 Product 0x0000  
Bus#  1  
`-Dev#   1 Vendor 0x0000 Product 0x0000  
lsmod                # 列出加载的内核模块
env# 查看环境变量资源
_=/bin/env  
CVS_RSH=ssh  
G_BROKEN_FILENAMES=1  
HISTSIZE=1000  
HOME=/root  
INPUTRC=/etc/inputrc  
KDEDIR=/usr  
KDE_IS_PRELINKED=1  
KDE_NO_IPV6=1  
LANG=en_US.UTF-8  
LESSOPEN=|/usr/bin/lesspipe.sh %s  
LOGNAME=root  
MAIL=/var/spool/mail/root  
PATH=/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          # 查看内存使用量和交换区使用量
             total       used       free     shared    buffers     cached  
Mem:         48295       9647      38648       0       1165        4067  
-/+ buffers/cache:       4413      43881  
Swap:         3999          0       3999 
df -h            # 查看各分区使用情况
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 <目录名>     # 查看指定目录的大小
# du -sh /tmp  
84K     /tmp 
grep MemTotal /proc/meminfo   # 查看内存总量
# <span style="font-family: Arial, Helvetica, sans-serif;">grep MemTotal /proc/meminfo</span>  
MemTotal: 16432172 kB
grep MemFree /proc/meminfo    # 查看空闲内存量
# grep MemFree /proc/meminfo  
MemFree:      12647164 kB 
uptime       # 查看系统运行时间、用户数、负载
14:15:28 up 4 days,  2:56,  1 user,  load average: 1.17, 1.15, 1.10 
cat /proc/loadavg             # 查看系统负载
# cat /proc/loadavg  
1.11 1.14 1.09 1/546 5175 
一,磁盘和分区
 
mount | column -t            # 查看挂接的分区状态
/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   # 查看所有分区
Disk /dev/cciss/c0d0: 146.7 GB, 146778685440 bytes  
255 heads, 63 sectors/track, 17844 cylinders  
Units = 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 LVM  
Disk /dev/sdc: 384.3 GB, 384399572992 bytes  
255 heads, 63 sectors/track, 46733 cylinders  
Units = cylinders of 16065 * 512 = 8225280 bytes  
Disk /dev/sdc doesn't contain a valid partition table  
Disk /dev/sde: 225.4 GB, 225485783040 bytes  
255 heads, 63 sectors/track, 27413 cylinders  
Units = cylinders of 16065 * 512 = 8225280 bytes 
swapon -s  # 查看所有交换分区
Filename             Type            Size    Used    Priority  
/dev/mapper/rootVG-swap                 partition       16777208        0       -1 
hdparm -i /dev/hda           # 查看磁盘参数(仅适用于IDE设备)
dmesg | grep IDE             # 查看启动时IDE设备检测状况
Uniform Multi-Platform E-IDE driver Revision: 7.00alpha2  
Probing IDE interface ide0...  
Probing IDE interface ide1...