查看linux主机系统的基本信息.pdf
查看 linux 主机系统的基本信息 一、硬件信息 1.CPU a.Cat /proc/cpuinfo 例:rootlinux victor#cat/proc/cpuinfo processor :0 vendor_id :GenuineIntel cpu family :6 model :13 model name :Intel(R)Celeron(R)M processor 1.50GHz stepping :8 cpu MHz :1500.000 cache size :1024 KB fdiv_bug :no hlt_bug :no f00f_bug :no coma_bug :no fpu :yes fpu_exception :yes cpuid level :2 wp :yes flags :fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov clflush dts acpi mmx fxsr sse sse2 ss tm pbe nx up bts bogomips :2999.83 clflush size :64 power management:b.Dmesg|grep i cpu 例:rootlinux victor#dmesg|grep-i cpu Initializing cgroup subsys cpuset Initializing cgroup subsys cpu KERNEL supported cpus:Transmeta TransmetaCPU PAT not supported by CPU.ACPI:SSDT 1bdf645d 001FB(v01 PmRef CpuPm 00003000 INTL 20030224)SMP:Allowing 1 CPUs,0 hotplug CPUs NR_CPUS:32 nr_cpumask_bits:32 nr_cpu_ids:1 nr_node_ids:1 PERCPU:Embedded 15 pages at c1382000,static data 37788 bytes Initializing CPU#0 SLUB:Genslabs=13,HWalign=64,Order=0-3,MinObjects=0,CPUs=1,Nodes=1 Initializing cgroup subsys cpuacct CPU:L1 I cache:32K,L1 D cache:32K CPU:L2 cache:1024K mce:CPU supports 5 MCE banks CPU0:Thermal monitoring enabled(TM1)CPU0:Intel(R)Celeron(R)M processor 1.50GHz stepping 08 Brought up 1 CPUs CPU0 attaching NULL sched-domain.ACPI:CPU0(power states:C1C1 C2C2 C3C3)processor LNXCPU:00:registered as cooling_device0 ACPI:Processor CPU0(supports 8 throttling states)Switched to high resolution mode on CPU 0 cpuidle:using governor ladder cpuidle:using governor menu microcode:CPU0 sig=0 x6d8,pf=0 x20,revision=0 x20 p4-clockmod:P4/Xeon(TM)CPU On-Demand Clock Modulation available c.Dmidecode -t processor 例:rootlinux victor#dmidecode-t processor#dmidecode 2.10 SMBIOS version fixup(2.31-2.3).SMBIOS 2.3 present.Handle 0 x0004,DMI type 4,35 bytes Processor Information Socket Designation:Socket 479M Type:Central Processor Family:Unknown Manufacturer:Intel ID:D8 06 00 00 FF FB E9 AF Version:Intel(R)Celeron(R)M processor Voltage:3.3 V External Clock:400 MHz Max Speed:1500 MHz Current Speed:1500 MHz Status:Populated,Enabled Upgrade:ZIF Socket L1 Cache Handle:Not Provided L2 Cache Handle:0 x0008 L3 Cache Handle:Not Provided Serial Number:Not Specified Asset Tag:Not Specified Part Number:Not Specified 2.硬盘 a.fdisk 查看分区信息,能够查看到所有的硬盘分区。例:rootlinux victor#fdisk-l Disk/dev/sda:40.0 GB,40007761920 bytes 255 heads,63 sectors/track,4864 cylinders Units=cylinders of 16065*512=8225280 bytes Disk identifier:0 xe7e0e7e0 Device Boot Start End Blocks Id System/dev/sda1 1 1963 15767766 7 HPFS/NTFS/dev/sda2 1964 3011 8418060 83 Linux/dev/sda3 3012 4135 9028530 f W95 Extd(LBA)/dev/sda4 4136 4864 5855692+83 Linux/dev/sda5 *3012 4059 8418028+83 Linux/dev/sda6 4060 4135 610438+82 Linux swap/Solaris b.df 查看大小情况,只能查看到当前已挂载的分区。例:rootlinux victor#df-h Filesystem Size Used Avail Use%Mounted on/dev/sda5 8.0G 7.4G 173M 98%/tmpfs 217M 780K 216M 1%/dev/shm/dev/sda1 16G 14G 1.9G 88%/media/disk c.du 查看使用情况,相当于 windows 的右键属性看大小了。例:rootlinux victor#ls Desktop Downloads Pictures Templates workspace Documents Music Public Videos rootlinux victor#du-h Downloads/1.2M Downloads/nmon_x86_12a 139M Downloads/3.内存 a.Cat/proc/meminfo 例:rootlinux victor#cat/proc/meminfo MemTotal:443200 kB MemFree:9464 kB Buffers:13736 kB Cached:194672 kB SwapCached:2364 kB Active:156528 kB Inactive:242948 kB Active(anon):65480 kB Inactive(anon):127156 kB Active(file):91048 kB Inactive(file):115792 kB Unevictable:0 kB Mlocked:0 kB HighTotal:0 kB HighFree:0 kB LowTotal:443200 kB LowFree:9464 kB SwapTotal:610428 kB SwapFree:566144 kB Dirty:44 kB Writeback:0 kB AnonPages:189164 kB Mapped:56164 kB Slab:18284 kB SReclaimable:9500 kB SUnreclaim:8784 kB PageTables:8840 kB NFS_Unstable:0 kB Bounce:0 kB WritebackTmp:0 kB CommitLimit:832028 kB Committed_AS:801028 kB VmallocTotal:573496 kB VmallocUsed:1784 kB VmallocChunk:566444 kB HugePages_Total:0 HugePages_Free:0 HugePages_Rsvd:0 HugePages_Surp:0 Hugepagesize:2048 kB DirectMap4k:10176 kB DirectMap2M:446464 kB b.Free m 能查看到当前内存的使用情况 例:rootlinux victor#free-m total used free shared buffers cached Mem:432 423 9 0 13 190-/+buffers/cache:220 212 Swap:596 43 552 c.Vmstat 例:rootlinux victor#vmstat procs-memory-swap-io-system-cpu-r b swpd free buff cache si so bi bo in cs us sy id wast 0 0 44284 8836 14096 194800 1 27 750 100 272 599 12 2 76 10 0 d.Dmidecode|grep I mem 此命令可以显示详细内存相关信息 例:rootlinux victor#dmidecode|grep-i mem Memory Controller Information Maximum Memory Module Size:512 MB 系统目前内存 Maximum Total Memory Size:1024 MB 主板最大内存支持 Supported Memory Types:Memory Module Voltage:3.3 V 内存电压 Associated Memory Slots:2 机器有两个内存插槽 Memory Module Information Memory Module Information Descriptor 2:Single-bit ECC memory error Descriptor 3:Multi-bit ECC memory error Physical Memory Array Use:System Memory Memory Device Memory Device Memory Device 32-bit Memory Error Information Memory Array Address:Unknown Memory Array Mapped Address Memory Device Mapped Address Memory Array Mapped Address Handle:0 x0014 Memory Device Mapped Address Memory Array Mapped Address Handle:0 x0014 Memory Device Mapped Address Memory Array Mapped Address Handle:0 x0014 64-bit Memory Error Information Memory Array Address:0 x0000000080000000 4.查看网卡 a.Dmesg|grep -i eth 例:rootlinux victor#dmesg|grep-i eth eth0:SiS 900 PCI Fast Ethernet at 0 x2000,IRQ 19,00:c0:9f:a5:99:c0 eth0:Media Link On 100mbps full-duplex eth0:no IPv6 routers present b.Cat/etc/sysconfig/hwconf|grep -i eth 例:rootlinux victor#lspci|grep-i eth 00:04.0 Ethernet controller:Silicon Integrated Systems SiS SiS900 PCI Fast Ethernet(rev 91)c.Lspci|grep-i eth 5.查看显卡 a.Lspci|grep -i VGA 例:rootlinux victor#dmesg|grep-i VGA Console:colour VGA+80 x25 vgaarb:device added:PCI:0000:01:00.0,decodes=io+mem,owns=io+mem,locks=none vgaarb:loaded b.Dmesg|gerp-i VGA 例:rootlinux victor#lspci|grep-i VGA 01:00.0 VGA compatible controller:Silicon Integrated Systems SiS 661/741/760 PCI/AGP or 662/761Gx PCIE VGA Display Adapter Dmesg 能够查看机器所有的硬件信息,内容很多,查看的时候可以这样 dmesg|less 这样可以前后翻页。Lspci 主要用来查看主板信息。二、系统信息 1.查看内核版本 Uname a 例:rootlinux victor#uname Linux rootlinux victor#uname-a Linux linux.victor 2.6.31.5-127.fc12.i686.PAE#1 SMP Sat Nov 7 21:25:57 EST 2009 i686 i686 i386 GNU/Linux 2.查看 hostname hostname 例:rootlinux victor#hostname linux.victor rootlinux victor#hostname novots 这样可以直接更改 hostname rootlinux victor#hostname novots 3.查看日前登录账户 W who 例:rootlinux victor#w 00:53:44 up 41 min,3 users,load average:0.05,0.11,0.13 USER TTY FROM LOGIN IDLE JCPU PCPU WHAT victor tty1 :0 00:13?1:33 0.09s pam:gdm-passwor victor pts/0 :0 00:13 39:54 0.00s 0.93s kded4 victor pts/1 :0.0 00:18 0.00s 0.15s 0.03s/bin/bash rootlinux victor#who victor tty1 2010-03-24 00:13(:0)victor pts/0 2010-03-24 00:13(:0)victor pts/1 2010-03-24 00:18(:0.0)4.查看历史账户登录信息 Last 例:rootlinux victor#last victor pts/2 :0.0 Wed Mar 24 00:54 still logged in victor pts/1 :0.0 Wed Mar 24 00:18 still logged in victor pts/0 :0 Wed Mar 24 00:13 still logged in victor tty1 :0 Wed Mar 24 00:13 still logged in reboot system boot 2.6.31.5-127.fc1 Wed Mar 24 00:12-00:55 (00:42)reboot system boot 2.6.31.5-127.fc1 Sat Mar 13 09:54-09:54 (00:00)reboot system boot 2.6.31.5-127.fc1 Tue Feb 16 18:37-18:38 (00:00)victor pts/0 :0 Tue Feb 16 14:02-down (00:37)victor tty1 :0 Tue Feb 16 14:01-down (00:38)reboot system boot 2.6.31.5-127.fc1 Tue Feb 16 14:01-14:40 (00:38)内容过多,省略 5.查看系统运行时间 Uptime 例:rootlinux victor#uptime 00:56:27 up 43 min,4 users,load average:0.20,0.11,0.12 6.查看 IP Ifconfig 例:rootlinux victor#ifconfig eth0 Link encap:Ethernet HWaddr 00:C0:9F:A5:99:C0 inet addr:192.168.0.102 Bcast:192.168.0.255 Mask:255.255.255.0 inet6 addr:fe80:2c0:9fff:fea5:99c0/64 Scope:Link UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1 RX packets:8357 errors:0 dropped:0 overruns:0 frame:0 TX packets:5251 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:1000 RX bytes:12377086(11.8 MiB)TX bytes:374144(365.3 KiB)Interrupt:19 Base address:0 x2000 lo Link encap:Local Loopback inet addr:127.0.0.1 Mask:255.0.0.0 inet6 addr:1/128 Scope:Host UP LOOPBACK RUNNING MTU:16436 Metric:1 RX packets:46 errors:0 dropped:0 overruns:0 frame:0 TX packets:46 errors:0 dropped:0 overruns:0 carrier:0 collisions:0 txqueuelen:0 RX bytes:2740(2.6 KiB)TX bytes:2740(2.6 KiB)7.查看进程 Ps aux 例:rootlinux victor#ps-aux Warning:bad syntax,perhaps a bogus-?See/usr/share/doc/procps-3.2.8/FAQ USER PID%CPU%MEM VSZ RSS TTY STAT START TIME COMMAND root 1 0.0 0.1 2028 512?Ss 00:12 0:00/sbin/init root 2 0.0 0.0 0 0?S 00:12 0:00 kthreadd root 3 0.0 0.0 0 0?S 00:12 0:00 migration/0 root 4 0.0 0.0 0 0?S 00:12 0:00 ksoftirqd/0 root 5 0.0 0.0 0 0?S 00:12 0:00 watchdog/0 root 6 0.0 0.0 0 0?S 00:12 0:00 events/0 内容过多,省略 8.查看时间与日期 Date cal 例:rootlinux victor#date Wed Mar 24 00:58:09 CST 2010 rootlinux victor#cal March 2010 Su Mo Tu We Th Fr Sa 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 参考:http:/