網(wǎng)卡信息
1) dmesg | grep -i 'eth'
2) cat /etc/sysconfig/hwconf | grep -i eth
3) lspci | grep -i 'eth'
6, 鼠標(biāo)鍵盤和USB信息
查看鍵盤和鼠標(biāo):cat /proc/bus/input/devices
查看USB設(shè)備:cat /proc/bus/usb/devices
查看各設(shè)備的中斷請求(IRQ):cat /proc/interrupts
7, 顯卡信息
1)lspci |grep -i 'VGA'
linux下如何查看硬件配置和常用的命令
7弱左、解決linux默認(rèn)root用戶不能直接遠(yuǎn)程登錄問題?
linux下如何查看硬件配置和常用的命令
由于公司用的linux服務(wù)器挺多,大家不像用widows那樣常用胞皱,很多新同事可能對linux不是很熟悉,而要安裝好多軟件又不像windows那樣直接雙擊就行九妈,需要了解機(jī)器的硬件信息和系統(tǒng)版本等榜田,故寫了本文音诈,希望能拋磚引玉。
[root@testes5 etc]# uname –a(此命令在UNIX下也通用)
Linux testes5 2.6.18-92.el5 #1 SMP Tue Apr 29 13:16:12 EDT 2008 i686 i686 i386 GNU/Linux
2.6.18-92.el5這里顯示了系統(tǒng)內(nèi)核的版本,el5說明本系統(tǒng)是Enterprise Linux5垃喊,對于redhat linux也可以用下面的命令查看到系統(tǒng)的詳細(xì)版本號:
[root@testes5 etc]# more /etc/redhat-release
Red Hat Enterprise Linux Server release 5.2 (Tikanga)
[root@testes5 etc]# cat /etc/issue | grep Linux
Red Hat Enterprise Linux Server release 5.2 (Tikanga)
或是:[root@testes5 ~]# lsb_release -a
LSB Version: ???:core-3.1-ia32:core-3.1-noarch:graphics-3.1-ia32:graphics-3.1-noarch
Distributor ID: RedHatEnterpriseServer
Description: ???Red Hat Enterprise Linux Server release 5.2 (Tikanga)
Release: ???????5.2
Codename: ??????Tikanga
2吧恃、查看機(jī)器型號
[root@testes5 etc]# ?dmidecode | grep "Product Name"
????????Product Name: VMware Virtual Platform
????????Product Name: 440BX Desktop Reference Platform
[root@testes5 ~]# dmidecode | more
# dmidecode 2.7
SMBIOS 2.31 present.
45 structures occupying 1654 bytes.
Table at 0x000E0010.
Handle 0x0000, DMI type 0, 20 bytes.
BIOS Information
????????Vendor: Phoenix Technologies LTD
????????Version: 6.00
????????Release Date: 12/06/2006
????????Address: 0xE78A0
????????Runtime Size: 100192 bytes
????????ROM Size: 64 kB
????????Characteristics:
????????????????ISA is supported
????????????????PCI is supported
????????????????PC Card (PCMCIA) is supported
????????????????PNP is supported
????????????????APM is supported
????????????????BIOS is upgradeable
????????????????BIOS shadowing is allowed
????????????????ESCD support is available
????????????????USB legacy is supported
????????????????Smart battery is supported
????????????????BIOS boot specification is supported
Handle 0x0001, DMI type 1, 25 bytes.
System Information
????????Manufacturer: VMware, Inc.
????????Product Name: VMware Virtual Platform
????????Version: None
????????Serial Number: VMware-56 4d 35 c4 fd a8 d4 12-f5 82 c5 a7 17 c6 24 7e
????????UUID: 564D35C4-FDA8-D412-F582-C5A717C6247E
????????Wake-up Type: Power Switch
Handle 0x0002, DMI type 2, 8 bytes.
Base Board Information
????????Manufacturer: Intel Corporation
????????Product Name: 440BX Desktop Reference Platform
????????Version: None
????????Serial Number: None
Handle 0x0003, DMI type 3, 17 bytes.
Chassis Information
????????Manufacturer: No Enclosure
????????Type: Other
????????Lock: Not Present
????????Version: N/A
????????Serial Number: None
--More—
[root@testes5 ~]# cat /proc/meminfo|more
MemTotal: ??????515492 kB
MemFree: ????????33968 kB
Buffers: ????????33924 kB
Cached: ????????278224 kB
SwapCached: ?????????0 kB
Active: ????????197136 kB
Inactive: ??????253448 kB
HighTotal: ??????????0 kB
HighFree: ???????????0 kB
LowTotal: ??????515492 kB
LowFree: ????????33968 kB
SwapTotal: ?????786424 kB
SwapFree: ??????786424 kB
Dirty: ?????????????16 kB
Writeback: ??????????0 kB
AnonPages: ?????138440 kB
Mapped: ?????????42928 kB
Slab: ???????????21492 kB
PageTables: ??????3860 kB
NFS_Unstable: ???????0 kB
Bounce: ?????????????0 kB
CommitLimit: ??1044168 kB
Committed_AS: ??537668 kB
VmallocTotal: ??507896 kB
VmallocUsed: ?????4316 kB
VmallocChunk: ??503420 kB
HugePages_Total: ????0
HugePages_Free: ?????0
HugePages_Rsvd: ?????0
Hugepagesize: ????4096 kB
Processor Information
[root@testes5 ~]# cat /proc/cpuinfo
processor ??????: 0
vendor_id ??????: GenuineIntel
cpu family ?????: 6
model ??????????: 15
model name ?????: Intel(R) Core(TM)2 Duo CPU ????T7250 ?@ 2.00GHz
stepping ???????: 8
cpu MHz ????????: 1994.661
cache size ?????: 2048 KB
fdiv_bug ???????: no
hlt_bug ????????: no
f00f_bug ???????: no
coma_bug ???????: no
fpu ????????????: yes
fpu_exception ??: yes
cpuid level ????: 10
wp ?????????????: yes
flags ??????????: fpu vme de pse tsc sr pae mce cx8 apic mtrr pge mca cmov pat pse36 clflush dts acpi mmx fxsr sse sse2 ss nx lm constant_tsc up ida pni ds_cpl cx16 lahf_lm
bogomips ???????: 3994.07
這樣可以完整的看到當(dāng)前機(jī)器的cpu信息
[root@localhost ~]# ?cat /proc/cpuinfo | grep name | cut -f2 -d: | uniq -c
Intel(R) Xeon(TM) CPU 3.00GHz
這里能看到CPU的型號和邏輯cpu的個數(shù)是4個
[root@localhost ~]# ?cat /proc/cpuinfo | grep physical | uniq -c
??????2 physical id ????: 0
??????2 physical id ????: 3
從這里可以看出該機(jī)器有兩顆物理cpu
[root@testes5 ~]# getconf LONG_BIT
32
這里顯示32說明CPU當(dāng)前運(yùn)行在32位模式下寒匙,但不能憑這個說該CPU不支持64位零如。
[root@testes5 ~]# cat /proc/cpuinfo | grep flags | grep ' lm ' | wc -l
1
結(jié)果大于0,說明支持64位計算. lm指long?mode,支持lm則是支持64位。
[root@testes5 /etc]# fdisk -l
Disk /dev/hda: 6442 MB, 6442450944 bytes
255 heads, 63 sectors/track, 783 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Device Boot ?????Start ????????End ?????Blocks ??Id ?System
/dev/hda1 ??* ??????????1 ?????????13 ?????104391 ??83 ?Linux
/dev/hda2 ?????????????14 ????????783 ????6185025 ??8e ?Linux LVM
[root@testes5 etc]# ?dmesg | grep -i eth
eth0: registered as PCnet/PCI II 79C970A
eth0: link up
eth0: no IPv6 routers present
eth0: link up
eth0: no IPv6 routers present
eth0: link up
eth0: no IPv6 routers present
eth0: link up
eth0: no IPv6 routers present
eth0: link up
eth0: no IPv6 routers present
查看網(wǎng)絡(luò)配置信息:
[root@testes5 etc]# ifconfig -a
eth0 ?????Link encap:Ethernet ?HWaddr 00:0C:29:C6:24:7E ?
??????????inet addr:10.87.58.71 ?Bcast:10.87.58.255 ?Mask:255.255.255.0
??????????inet6 addr: fe80::20c:29ff:fec6:247e/64 Scope:Link
??????????UP BROADCAST RUNNING MULTICAST ?MTU:1500 ?Metric:1
??????????RX packets:3364 errors:0 dropped:0 overruns:0 frame:0
??????????TX packets:1347 errors:0 dropped:0 overruns:0 carrier:0
??????????collisions:0 txqueuelen:1000
??????????RX bytes:248507 (242.6 KiB) ?TX bytes:201769 (197.0 KiB)
??????????Interrupt:169 Base address:0x2000
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:2526 errors:0 dropped:0 overruns:0 frame:0
??????????TX packets:2526 errors:0 dropped:0 overruns:0 carrier:0
??????????collisions:0 txqueuelen:0
??????????RX bytes:3806446 (3.6 MiB) ?TX bytes:3806446 (3.6 MiB)
sit0 ?????Link encap:IPv6-in-IPv4 ?
??????????NOARP ?MTU:1480 ?Metric:1
??????????RX packets:0 errors:0 dropped:0 overruns:0 frame:0
??????????TX packets:0 errors:0 dropped:0 overruns:0 carrier:0
??????????collisions:0 txqueuelen:0
??????????RX bytes:0 (0.0 b) ?TX bytes:0 (0.0 b)
或是查看如下文件:
[root@testes5 network-scripts]# more /etc/sysconfig/network-scripts/ifcfg-eth0
# Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE]
DEVICE=eth0
BOOTPROTO=none
BROADCAST=10.87.58.255
HWADDR=00:0C:29:C6:24:7E
IPADDR=10.87.58.71
NETMASK=255.255.255.0
NETWORK=10.87.58.0
ONBOOT=yes
TYPE=Ethernet
USERCTL=no
IPV6INIT=no
PEERDNS=yes
查看機(jī)器名:
[root@testes5 etc]# hostname
testes5
或:[root@testes5 network-scripts]# more /etc/sysconfig/network
NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME=testes5
查看機(jī)器的DNS配置:
[root@testes5 network-scripts]# more /etc/resolv.conf
nameserver 202.102.224.68
nameserver 202.102.227.68
Linux下最常用的查看機(jī)器性能的命令是top会宪,具體顯示如下肖卧,能看到cpu和內(nèi)存負(fù)載
?[root@testes5 /etc]# top
top - 02:11:32 up ?1:38, ?3 users, ?load average: 0.07, 0.06, 0.18
Tasks: 133 total, ??2 running, 126 sleeping, ??4 stopped, ??1 zombie
Cpu(s): ?0.0%us, ?0.7%sy, ?0.0%ni, 98.7%id, ?0.3%wa, ?0.3%hi, ?0.0%si, ?0.0%st
Mem: ???515492k total, ??509400k used, ????6092k free, ???26300k buffers
Swap: ??786424k total, ???????0k used, ??786424k free, ??287908k cached
PID USER ?????PR ?NI ?VIRT ?RES ?SHR S %CPU %MEM ???TIME+ ?COMMAND ???????????????????????????????????????????????????????????????
?8377 root ?????15 ??0 35692 ?10m 5892 S ?0.3 ?2.0 ??1:22.50 Xorg ??????????????????????????????????????????????????????????????????
?8606 root ?????15 ??0 98052 ?12m 9756 S ?0.3 ?2.5 ??0:01.49 mixer_applet2 ?????????????????????????????????????????????????????????
????1 root ?????15 ??0 ?2060 ?648 ?556 S ?0.0 ?0.1 ??0:00.67 init ??????????????????????????????????????????????????????????????????
????2 root ?????RT ?-5 ????0 ???0 ???0 S ?0.0 ?0.0 ??0:00.00 migration/0 ???????????????????????????????????????????????????????????
????3 root ?????34 ?19 ????0 ???0 ???0 S ?0.0 ?0.0 ??0:00.00 ksoftirqd/0 ???????????????????????????????????????????????????????????
????4 root ?????RT ?-5 ????0 ???0 ???0 S ?0.0 ?0.0 ??0:00.00 watchdog/0 ????????????????????????????????????????????????????????????
????5 root ?????10 ?-5 ????0 ???0 ???0 S ?0.0 ?0.0 ??0:00.06 events/0 ??????????????????????????????????????????????????????????????
????6 root ?????16 ?-5 ????0 ???0 ???0 S ?0.0 ?0.0 ??0:00.00 khelper ???????????????????????????????????????????????????????????????
????7 root ?????10 ?-5 ????0 ???0 ???0 S ?0.0 ?0.0 ??0:00.00 kthread ???????????????????????????????????????????????????????????????
???10 root ?????10 ?-5 ????0 ???0 ???0 S ?0.0 ?0.0 ??0:00.23 kblockd/0 ?????????????????????????????????????????????????????????????
???11 root ?????20 ?-5 ????0 ???0 ???0 S ?0.0 ?0.0 ??0:00.00 kacpid ????????????????????????????????????????????????????????????????
???72 root ?????20 ?-5 ????0 ???0 ???0 S ?0.0 ?0.0 ??0:00.00 cqueue/0 ??????????????????????????????????????????????????????????????
???75 root ?????10 ?-5 ????0 ???0 ???0 S ?0.0 ?0.0 ??0:00.00 khubd ?????????????????????????????????????????????????????????????????
???77 root ?????10 ?-5 ????0 ???0 ???0 S ?0.0 ?0.0 ??0:00.00 kseriod ???????????????????????????????????????????????????????????????
??141 root ?????25 ??0 ????0 ???0 ???0 S ?0.0 ?0.0 ??0:00.00 pdflush ???????????????????????????????????????????????????????????????
??142 root ?????15 ??0 ????0 ???0 ???0 S ?0.0 ?0.0 ??0:00.15 pdflush ???????????????????????????????????????????????????????????????
??143 root ?????10 ?-5 ????0 ???0 ???0 S ?0.0 ?0.0 ??0:00.15 kswapd0 ???????????????????????????????????????????????????????????????
??144 root ?????20 ?-5 ????0 ???0 ???0 S ?0.0 ?0.0 ??0:00.00 aio/0 ?????????????????????????????????????????????????????????????????
??301 root ?????11 ?-5 ????0 ???0 ???0 S ?0.0 ?0.0 ??0:00.00 kpsmoused ?????????????????????????????????????????????????????????????
??325 root ?????16 ?-5 ????0 ???0 ???0 S ?0.0 ?0.0 ??0:00.00 ata/0 ?????????????????????????????????????????????????????????????????
??326 root ?????16 ?-5 ????0 ???0 ???0 S ?0.0 ?0.0 ??0:00.00 ata_aux ???????????????????????????????????????????????????????????????
??337 root ?????20 ?-5 ????0 ???0 ???0 S ?0.0 ?0.0 ??0:00.00 ksnapd ????????????????????????????????????????????????????????????????
??340 root ?????10 ?-5 ????0 ???0 ???0 S ?0.0 ?0.0 ??0:01.38 kjournald ?????????????????????????????????????????????????????????????
??373 root ?????10 ?-5 ????0 ???0 ???0 S ?0.0 ?0.0 ??0:00.00 kauditd ???????????????????????????????????????????????????????????????
??407 root ?????14 ?-4 ?2988 1572 ?488 S ?0.0 ?0.3 ??0:01.48 udevd ?????????????????????????????????????????????????????????????????
??868 root ?????15 ?-5 ????0 ???0 ???0 S ?0.0 ?0.0 ??0:00.00 kgameportd ????????????????????????????????????????????????????????????
?3780 root ?????14 ?-5 ????0 ???0 ???0 S ?0.0 ?0.0 ??0:00.00 kmpathd/0 ?????????????????????????????????????????????????????????????
?3804 root ?????11 ?-5 ????0 ???0 ???0 S ?0.0 ?0.0 ??0:00.00 kjournald ?????????????????????????????????????????????????????????????
?6374 root ?????15 ??0 ?5768 1464 1188 S ?0.0 ?0.3 ??0:00.25 bash ??????????????????????????????????????????????????????????????????
?7202 root ?????12 ?-5 ????0 ???0 ???0 S ?0.0 ?0.0 ??0:00.00 ib_mcast ??????????????????????????????????????????????????????????????
?7203 root ?????12 ?-5 ????0 ???0 ???0 S ?0.0 ?0.0 ??0:00.00 ib_inform ?????????????????????????????????????????????????????????????
?7204 root ?????12 ?-5 ????0 ???0 ???0 S ?0.0 ?0.0 ??0:00.00 local_sa ??????????????????????????????????????????????????????????????
?7210 root ?????10 ?-5 ????0 ???0 ???0 S ?0.0 ?0.0 ??0:00.00 ib_addr ???????????????????????????????????????????????????????????????
?7216 root ?????12 ?-5 ????0 ???0 ???0 S ?0.0 ?0.0 ??0:00.00 iw_cm_wq ??????????????????????????????????????????????????????????????
?7222 root ?????12 ?-5 ????0 ???0 ???0 S ?0.0 ?0.0 ??0:00.00 ib_cm/0 ???????????????????????????????????????????????????????????????
?7228 root ?????13 ?-5 ????0 ???0 ???0 S ?0.0 ?0.0 ??0:00.00 rdma_cm ???????????????????????????????????????????????????????????????
?7258 root ?????12 ?-5 ????0 ???0 ???0 S ?0.0 ?0.0 ??0:00.00 ipoib ?????????????????????????????????????????????????????????????????
?7264 root ?????12 ?-5 ????0 ???0 ???0 S ?0.0 ?0.0 ??0:00.00 sdp ???????????????????????????????????????????????????????????????????
?7547 root ?????16 ?-3 12128 ?648 ?488 S ?0.0 ?0.1 ??0:00.03 auditd ????????????????????????????????????????????????????????????????
?7549 root ?????12 ?-3 12048 ?648 ?556 S ?0.0 ?0.1 ??0:00.02 audispd ???????????????????????????????????????????????????????????????
?7566 root ?????15 ??0 10240 8576 ?244 S ?0.0 ?1.7 ??0:00.01 restorecond ???????????????????????????????????????????????????????????
?7577 root ?????18 ??0 ?1716 ?612 ?516 S ?0.0 ?0.1 ??0:00.16 syslogd ???????????????????????????????????????????????????????????????
?7580 root ?????15 ??0 ?1668 ?396 ?332 S ?0.0 ?0.1 ??0:00.03 klogd ?????????????????????????????????????????????????????????????????
此命令可以看到包括機(jī)器的cpu和內(nèi)存的負(fù)載情況
[root@testes5 /etc]# free -m
?????????????total ??????used ??????free ????shared ???buffers ????cached
Mem: ???????503 ???????497 ???????6 ????????0 ??????25 ???????280
-/+ buffers/cache: ?????????190 ???????312
Swap: ???????767 ????????0 ????????767
參數(shù)解釋:這里的大小是按M顯示的
Total:內(nèi)存總數(shù)
Used:已經(jīng)使用的內(nèi)存數(shù)
free:空閑的內(nèi)存數(shù)
shared:多個進(jìn)程共享的內(nèi)存總額
buffers:Buffer Cache和cached Page Cache 磁盤緩存的大小
buffers/cache (已用)的內(nèi)存數(shù):used - buffers - cached
+buffers/cache(可用)的內(nèi)存數(shù):free + buffers + cached
可用的內(nèi)存=free?memory+buffers+cached
另一個命令可以用top
有時感覺硬盤反應(yīng)很慢塞帐,或需要查看日志所在分區(qū)時拦赠,下列命令可以查看磁盤的使用情況,很有用:
A壁榕、查看當(dāng)前硬盤使用情況
[root@testes5 /etc]# df -h
文件系統(tǒng)容量已用可用已用%掛載點(diǎn)
/dev/mapper/VolGroup00-LogVol00
??????????????????????5.0G ?3.9G ?907M ?82% /
/dev/hda1 ?????????????99M ??12M ??83M ?13% /boot
tmpfs ????????????????252M ????0 ?252M ??0% /dev/shm
/dev/hdc ?????????????950M ?950M ????0 100% /media/syshbkcd
B矛紫、查看硬盤性能:
[root@localhost ~]# iostat -x 1 10
Linux 2.6.9-34.ELsmp (localhost.localdomain) ???12/14/2010
avg-cpu: ?%user ??%nice ???%sys %iowait ??%idle
???????????0.03 ???0.00 ???0.01 ???0.02 ??99.95
Device: ???rrqm/s wrqm/s ??r/s ??w/s ?rsec/s ?wsec/s ???rkB/s ???wkB/s avgrq-sz avgqu-sz ??await ?svctm ?%util
cciss/c0d0 ??0.00 ??0.36 ?0.01 ?0.24 ???0.86 ???4.83 ????0.43 ????2.42 ???22.89 ????0.01 ??46.80 ??5.29 ??0.13
dm-0 ????????0.00 ??0.00 ?0.01 ?0.60 ???0.86 ???4.83 ????0.43 ????2.42 ????9.27 ????0.02 ??32.07 ??2.14 ??0.13
參數(shù)解釋:
Tps該設(shè)備每秒I/O傳輸?shù)拇螖?shù)(每秒的I/O請求)
Blk_read/s表求從該設(shè)備每秒讀的數(shù)據(jù)塊數(shù)量
Blk_wrth/s表示從該設(shè)備每秒寫的數(shù)據(jù)塊數(shù)量
感覺到系統(tǒng)壓力較大時用可top或uptime查看下服務(wù)器的平均負(fù)載牌里。
[root@localhost ~]# uptime
15:01:56 up 245 days, ?1:32, ?3 users, ?load average: 0.00, 0.00, 0.00
uptime的另一個用法是查看你的Linux服務(wù)器已經(jīng)穩(wěn)定運(yùn)行多少天沒有重啟了.
如果感覺系統(tǒng)比較繁忙,可以用vmstat查看系統(tǒng)整體性能情況牡辽。vmstat不僅僅適應(yīng)于linux系統(tǒng)喳篇,它同樣適用于unix系統(tǒng)。
[root@localhost ~]# vmstat 1 2
procs -----------memory---------- ---swap-- -----io---- --system-- ----cpu----
?r ?b ??swpd ??free ??buff ?cache ??????si ??so ????bi ???bo ??in ???cs ?us ?sy ?id??wa
?0 ?0 ?????0 112032 ?74456 3758984 ????0 ???0 ????0 ????0 ???0 ????0 ?0 ??0 ?100 ?0
?0 ?0 ?????0 112032 ?74456 3758984 ????0 ???0 ????0 ????0???1006 ??20 ?0 ?0 ?100 ?0
如果r經(jīng)常大于 4 态辛,且id經(jīng)常少于40麸澜,表示cpu的負(fù)荷很重。
如果pi奏黑,po 長期不等于0炊邦,表示內(nèi)存不足。
如果disk經(jīng)常不等于0熟史,且在 b中的隊列 大于3馁害,表示io性能不好.
Linux操作系統(tǒng)的核心具有模塊化的特性蹂匹,因此在編譯核心時碘菜,務(wù)須把全部的功能都放入核心∠弈可以用以下命令查看linux已經(jīng)加載的模塊:
[root@testes5 ~]# lsmod
Module ?????????????????Size ?Used by
nls_utf8 ???????????????6209 ?1
autofs4 ???????????????24517 ?2
hidp ??????????????????23105 ?2
rfcomm ????????????????42457 ?0
l2cap ?????????????????29505 ?10 hidp,rfcomm
bluetooth ?????????????53797 ?5 hidp,rfcomm,l2cap
sunrpc ???????????????144893 ?1
ib_iser ???????????????34453 ?0
libiscsi ??????????????30401 ?1 ib_iser
scsi_transport_iscsi ???31689 ?2 ib_iser,libiscsi
ib_srp ????????????????32729 ?0
ib_sdp ????????????????51593 ?0
ib_ipoib ??????????????74345 ?0
rdma_ucm ??????????????16449 ?0
ib_ucm ????????????????19653 ?0
ib_uverbs ?????????????34921 ?2 rdma_ucm,ib_ucm
ib_umad ???????????????19049 ?0
rdma_cm ???????????????34293 ?3 ib_iser,ib_sdp,rdma_ucm
ib_cm ?????????????????34861 ?4 ib_srp,ib_ipoib,ib_ucm,rdma_cm
iw_cm ?????????????????13125 ?1 rdma_cm
ib_addr ???????????????11845 ?1 rdma_cm
ib_sa ?????????????????38581 ?4 ib_srp,ib_ipoib,rdma_cm,ib_cm
ib_mad ????????????????37717 ?3 ib_umad,ib_cm,ib_sa
ib_core ???????????????54465 ?13 ib_iser,ib_srp,ib_sdp,ib_ipoib,rdma_ucm,ib_ucm,ib_uverbs,ib_umad,rdma_cm,ib_cm,iw_cm,ib_sa,ib_mad
dm_multipath ??????????22089 ?0
video ?????????????????21193 ?0
sbs ???????????????????18533 ?0
backlight ?????????????10049 ?1 video
i2c_ec ?????????????????9025 ?1 sbs
button ????????????????10705 ?0
battery ???????????????13637 ?0
asus_acpi ?????????????19288 ?0
ac ?????????????????????9157 ?0
ipv6 ?????????????????258273 ?17 ib_ipoib
xfrm_nalgo ????????????13765 ?1 ipv6
crypto_api ????????????11969 ?1 xfrm_nalgo
lp ????????????????????15849 ?0
floppy ????????????????57125 ?0
snd_ens1371 ???????????28513 ?1
gameport ??????????????18633 ?1 snd_ens1371
snd_rawmidi ???????????26561 ?1 snd_ens1371
snd_ac97_codec ????????93025 ?1 snd_ens1371
ac97_bus ???????????????6337 ?1 snd_ac97_codec
snd_seq_dummy ??????????7877 ?0
snd_seq_oss ???????????32577 ?0
snd_seq_midi_event ????11073 ?1 snd_seq_oss
snd_seq ???????????????49585 ?5 snd_seq_dummy,snd_seq_oss,snd_seq_midi_event
snd_seq_device ????????11725 ?4 snd_rawmidi,snd_seq_dummy,snd_seq_oss,snd_seq
snd_pcm_oss ???????????42945 ?0
snd_mixer_oss ?????????19009 ?1 snd_pcm_oss
snd_pcm ???????????????72005 ?3 snd_ens1371,snd_ac97_codec,snd_pcm_oss
pcnet32 ???????????????35141 ?0
mii ????????????????????9409 ?1 pcnet32
i2c_piix4 ?????????????12237 ?0
snd_timer ?????????????24517 ?2 snd_seq,snd_pcm
snd ???????????????????52421 ?12 snd_ens1371,snd_rawmidi,snd_ac97_codec,snd_seq_oss,snd_seq,snd_seq_device,snd_pcm_oss,snd_mixer_oss,snd_pcm,snd_timer
soundcore ?????????????11553 ?1 snd
snd_page_alloc ????????14281 ?1 snd_pcm
pcspkr ?????????????????7105 ?0
i2c_core ??????????????23745 ?2 i2c_ec,i2c_piix4
ide_cd ????????????????40033 ?1
parport_pc ????????????29157 ?1
cdrom ?????????????????36705 ?1 ide_cd
parport ???????????????37513 ?2 lp,parport_pc
serio_raw ?????????????10693 ?0
dm_snapshot ???????????21477 ?0
dm_zero ????????????????6209 ?0
dm_mirror ?????????????29125 ?0
dm_mod ????????????????61405 ?9 dm_multipath,dm_snapshot,dm_zero,dm_mirror
ata_piix ??????????????22341 ?0
libata ???????????????143997 ?1 ata_piix
sd_mod ????????????????24897 ?0
scsi_mod ?????????????134605 ?6 ib_iser,libiscsi,scsi_transport_iscsi,ib_srp,libata,sd_mod
ext3 ?????????????????123593 ?2
jbd ???????????????????56553 ?1 ext3
uhci_hcd ??????????????25421 ?0
ohci_hcd ??????????????23261 ?0
ehci_hcd ??????????????33357 ?0
例如以下用法查看是否被正確加載:
[root@testes5 ~]# lsmod | grep ipv6
ipv6 ?????????????????258273 ?17 ib_ipoib
xfrm_nalgo ????????????13765 ?1 ipv6
有時需要在Linux下查找PCI設(shè)置,可用lspci命令:
[root@testes5 ~]# lspci
00:00.0 Host bridge: Intel Corporation 440BX/ZX/DX - 82443BX/ZX/DX Host bridge (rev 01)
00:01.0 PCI bridge: Intel Corporation 440BX/ZX/DX - 82443BX/ZX/DX AGP bridge (rev 01)
00:07.0 ISA bridge: Intel Corporation 82371AB/EB/MB PIIX4 ISA (rev 08)
00:07.1 IDE interface: Intel Corporation 82371AB/EB/MB PIIX4 IDE (rev 01)
00:07.2 USB Controller: Intel Corporation 82371AB/EB/MB PIIX4 USB
00:07.3 Bridge: Intel Corporation 82371AB/EB/MB PIIX4 ACPI (rev 08)
00:0f.0 VGA compatible controller: VMware Inc Abstract SVGA II Adapter
00:10.0 SCSI storage controller: BusLogic BT-946C (BA80C30) [MultiMaster 10] (rev 01)
00:11.0 PCI bridge: VMware Inc Unknown device 0790 (rev 01)
02:00.0 Ethernet controller: Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE] (rev 10)
02:01.0 Multimedia audio controller: Ensoniq ES1371 [AudioPCI-97] (rev 02)
02:02.0 USB Controller: VMware Inc Abstract USB2 EHCI Controller
它可以列出機(jī)器中的PCI設(shè)備履植,比如聲卡计雌、顯卡、Modem静尼、網(wǎng)卡等白粉,主板集成設(shè)備也能列出來。這個命令最常見的用法是查看網(wǎng)卡型號:
[root@testes5 ~]# ?lspci | grep Ethernet
02:00.0 Ethernet controller: Advanced Micro Devices [AMD] 79c970 [PCnet32 LANCE] (rev 10)
7鼠渺、解決linux默認(rèn)root用戶不能直接遠(yuǎn)程登錄問題
[root@localhost pam.d]#vi /etc/pam.d/login
#%PAM-1.0
auth ??????required ????pam_securetty.so
auth ??????required ????pam_stack.so service=system-auth
auth ??????required ????pam_nologin.so
account ???required ????pam_stack.so service=system-auth
password ??required ????pam_stack.so service=system-auth
# pam_selinux.so close should be the first session rule
session ???required ????pam_selinux.so close
session ???required ????pam_stack.so service=system-auth
session ???required ????pam_loginuid.so
session ???optional ????pam_console.so
# pam_selinux.so open should be the last session rule
session ???required ????pam_selinux.so open
注釋掉這行?
#auth ???????required ????pam_securetty.so ???//該行注釋掉
注意:linux默認(rèn)的登錄協(xié)議是ssh2鸭巴,不是telnet,如果要用telnet登錄linux則需要先確認(rèn)你的服務(wù)器安裝并開啟了telnet server的服務(wù)拦盹,并且確認(rèn)配置了允許telnet登錄鹃祖,具體命令如下:
[root@testes5 hda]# rpm -qa telnet
telnet-0.17-39.el5
[root@testes5 hda]# rpm -qa telnet-server
telnet-server-0.17-39.el5
[root@testes5 hda]# more /etc/xinetd.d/telnet
# default: on
# description: The telnet server serves telnet sessions; it uses \
# ??????unencrypted username/password pairs for authentication.
service telnet
{
????????disable =yes
????????flags ??????????= REUSE
????????socket_type ????= stream ???????
????????wait ???????????= no
????????user ???????????= root
????????server ?????????= /usr/sbin/in.telnetd
????????log_on_failure ?+= USERID
????????#disable ???????????????= yes
}
默認(rèn){后面是disable=yes,需要加#注釋掉普舆,或者改為disable=no disable = no
首先需要注意的是linux的命令參數(shù)是區(qū)分大小寫的校读。
[shutdown]停止系統(tǒng)
[halt]停止系統(tǒng)
[reboot]重啟動
[poweroff]切斷電源
[sync]把內(nèi)存里的內(nèi)容寫入磁盤
[init]將系統(tǒng)啟動到對應(yīng)的運(yùn)行級別
[csh]?[bash]?切換Shell
[history]?顯示歷史命令
[which]?顯示命令所在位置
[echo]?顯示字符串或者變量內(nèi)容
[set]?設(shè)置/顯示Shell變量
[printenv]?顯示環(huán)境變量
[export]?設(shè)置環(huán)境變量
[env]?設(shè)置臨時環(huán)境變量
[setenv]?設(shè)置環(huán)境變量
[unsetenv]釋放環(huán)境變量
[man]查詢命令或是幫助歉秫,經(jīng)常用來查看某個命令的手冊或是具體使用示例,例如:
[root@testes5 hda]# man ls
LS(1) ???????????????????????????User Commands ??????????????????????????LS(1)
NAME
???????ls - list directory contents
SYNOPSIS
???????ls [OPTION]... [FILE]...
DESCRIPTION
???????List ?information ?about ?the FILEs (the current directory by default). ?Sort entries alphabetically if none of
???????-cftuvSUX nor --sort.
???????Mandatory arguments to long options are mandatory for short options too.
???????-a, --all
??????????????do not ignore entries starting with .
[su] 切換到其他用戶
[useradd] 追加用戶
[userdel] 刪除用戶
[usermod] 修改用戶設(shè)置
[groupadd] 添加用戶組
[groupdel] 刪除用戶組
[groupmod] 修改組設(shè)置
[passwd] 更改密碼
[id] 顯示指定用戶的ID信息
[date]顯示/設(shè)置當(dāng)前時間
[last]顯示用戶登錄/登出信息
[lastb]顯示非法登錄信息
[df]查詢磁盤使用信息
[du]查詢磁盤使用信息
[dmesg]顯示系統(tǒng)啟動消息
[sysunconfig]取消或是還原系統(tǒng)的一些基礎(chǔ)配置并進(jìn)行重新配置,例如主機(jī)名钞螟,IP兔甘,時區(qū),語言等
[ls]顯示文件列表
常用參數(shù)解釋:
-l以長格式列出文件洞焙,包括文件大小、日期和時間拯啦、屬性
-t對文件以時間排序
-S對文件以大小排序
-r與一個排序開關(guān)組合起來使用澡匪,逆序排列。
-t將最新的文件顯示在列表的頂部褒链。
-h使用 k仙蛉、M、G 等來標(biāo)識文件的大小碱蒙,而不是以字節(jié)為單位。
-a顯示目錄中所有的文件夯巷,包括隱藏文件
[pwd]顯示當(dāng)前路徑
[cd]更改當(dāng)前路徑
[mkdir]創(chuàng)建路徑
[rmdir]刪除路徑
[cp]復(fù)制文件/目錄
常用參數(shù)解釋:
-R?遞歸地復(fù)制文件;當(dāng)需要復(fù)制整個目錄時會用到
-f?強(qiáng)制復(fù)制并覆蓋已有的文件赛惩,不詢問用戶
-l?鏈接文件,而不是復(fù)制;見下面的說明
[rm]刪除文件/目錄
常用參數(shù)解釋:
-d?刪除目錄
-r或是-R強(qiáng)制刪除目錄及目錄中的文件
[mv]移動文件/目錄趁餐,修改文件名
[chown]更改文件/目錄的所有者
[chgrp]修改文件/目錄的所有組
[chmod]修改文件/目錄的權(quán)限
[ln]建立文件/目錄鏈接
ln默認(rèn)創(chuàng)建的是硬鏈接喷兼。使用-s參數(shù)可以創(chuàng)建符號鏈接。
[find]查找文件
[whereis]顯示文件存在的路徑名
[file]查詢文件種類
[cat]顯示文件內(nèi)容
[more]分屏顯示文件內(nèi)容
[head]顯示文件頭部內(nèi)容
[tail]顯示文件尾部內(nèi)容
[sort]排列文件的行季惯,本命令經(jīng)常用來做系統(tǒng)文件系統(tǒng)滿了查找大文件進(jìn)行刪除,非常有用
[wc]統(tǒng)計文本單詞數(shù)臀突,文件大小等勉抓,也經(jīng)常用來統(tǒng)計進(jìn)程數(shù),和ps合用
[vi] vi文字編輯器候学,修改文件內(nèi)容藕筋,很好用的一個編輯器
[tar]壓縮/解壓縮文件
[compress]壓縮/解壓縮文件
[uncompress]解壓縮
[gzip]壓縮/解壓縮文件
[gunzip]解壓縮
[mount] 掛載設(shè)備隐圾,經(jīng)常用來掛載陣列或是磁盤
[umount]解除已經(jīng)mount上的設(shè)備
[eject]彈出(CD/DVD等)
[fdisk]配置/顯示硬盤分區(qū)
[mkfs]格式化磁盤分區(qū)
[fsck]檢查/修復(fù)磁盤錯誤伍掀,這個在機(jī)器突然斷電或是重啟后硬盤報錯時比較常用,對磁盤壞塊進(jìn)行修復(fù)
[ifconfig]顯示/設(shè)定NIC配置暇藏,主要用來查看和配置網(wǎng)卡蜜笤,也常用來進(jìn)行臨時設(shè)置機(jī)器的IP地址
[ps]顯示正在運(yùn)行的進(jìn)程
[kill]中止進(jìn)程或任務(wù)
[killall]中止進(jìn)程或任務(wù)
[nohup]在后臺執(zhí)行任務(wù)盐碱,Logout之后也不退出把兔,經(jīng)常和&連用,將進(jìn)程置于后臺運(yùn)行
[crontab]設(shè)置程序或是腳本定期或是運(yùn)行甸各,類似windows的計劃任務(wù)垛贤,對于自動化維護(hù)服務(wù)器或是定時執(zhí)行程序非常有用
10、網(wǎng)絡(luò)類相關(guān)命令
[netstat]顯示當(dāng)前網(wǎng)絡(luò)連接狀況趣倾,常見的用法是:
netstat –an查看主機(jī)上開放的端口
netstat –rn查看主機(jī)上網(wǎng)絡(luò)和路由配置
[route]顯示/設(shè)置路由
[host]顯示網(wǎng)絡(luò)主機(jī)情況
[hostname]顯示/設(shè)置當(dāng)前主機(jī)的名字
[ping]確認(rèn)和遠(yuǎn)程機(jī)器的連接情況
[traceroute]顯示路由信息
[telnet]用telnet登陸到遠(yuǎn)程機(jī)器
[ftp]用ftp傳輸文件
[setup] 配置系統(tǒng)一些參數(shù)聘惦,一般這個命令經(jīng)常用來打開或是關(guān)閉linux的防火墻,或是配置主機(jī)IP儒恋,或是配置或取消開機(jī)要運(yùn)行的服務(wù)
網(wǎng)卡信息
1) dmesg | grep -i 'eth'
2) cat /etc/sysconfig/hwconf | grep -i eth
3) lspci | grep -i 'eth'
6,鼠標(biāo)鍵盤和USB信息
查看鍵盤和鼠標(biāo):cat /proc/bus/input/devices
查看USB設(shè)備:cat /proc/bus/usb/devices
查看各設(shè)備的中斷請求(IRQ):cat /proc/interrupts
7,顯卡信息
1)lspci |grep -i 'VGA'
1. lshw
lshw命令顯示詳細(xì)硬件信息善绎。如果要用概要方式顯示,可以加上short參數(shù):lshw -short
要顯示指定硬件信息诫尽,加上class(或C)參數(shù):lshw -class memory
2. sysstat
3.查看PCI信息:lspci -v (相比cat /proc/pci更直觀)禀酱。lspci 是讀取 hwdata 數(shù)據(jù)庫,hwdata 由軟件包 hwdata 提供牧嫉。
4.查看系統(tǒng)體系結(jié)構(gòu):uname -a
5. dmidecode查看硬件信息剂跟,包括bios、cpu酣藻、內(nèi)存等信息
6. dmesg是一個顯示內(nèi)核緩沖區(qū)系統(tǒng)控制信息的工具曹洽;比如系統(tǒng)在啟動時的信息會寫到/var/log/.
注:dmesg工具并不是專門用來查看硬件芯片組標(biāo)識的工具,但通過這個工具能讓我們知道機(jī)器中的硬件的一些參數(shù)辽剧;因為系統(tǒng)在啟動的時候送淆,會寫一些硬件相關(guān)的日志到 /var/log/message* 或 /var/log/boot* 文件中。
7. lshal和 hal-device-manager
8.查看 /proc
對于“/proc”中文件可使用文件查看命令瀏覽其內(nèi)容怕轿,文件中包含系統(tǒng)特定信息:
Cpuinfo主機(jī)CPU信息
Dma主機(jī)DMA通道信息
Filesystems文件系統(tǒng)信息
Interrupts主機(jī)中斷信息
Ioprots主機(jī)I/O端口號信息
Meninfo主機(jī)內(nèi)存信息
Version Linux內(nèi)存版本信息
查看CPU信息:cat /proc/cpuinfo
查看板卡信息:cat /proc/pci
查看內(nèi)存信息:cat /proc/meminfo
查看USB設(shè)備:cat /proc/bus/usb/devices
查看鍵盤和鼠標(biāo):cat /proc/bus/input/devices
查看各設(shè)備的中斷請求(IRQ):cat /proc/interrupts
?# cat /etc/issue | grep Linux
????Red Hat Enterprise Linux AS release 4 (Nahant Update 5)
(查看當(dāng)前操作系統(tǒng)發(fā)行版信息