系统

  • 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-root83G  7.4G   72G     10%      /
/dev/mapper/rootVG-tmp3.9G  137M  3.6G     4%       /tmp
/dev/mapper/rootVG-var31G  5.1G   24G     18%      /var
  • du -sh <文件夹名>     # 查看指定文件夹的大小
# du -sh /tmp
84K     /tmp
  • grep MemTotal /proc/meminfo   # 查看内存总量
# grep MemTotal /proc/meminfo
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 bytesDevice 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...

网络

  • ifconfig           # 查看全部网络接口的属性
bond0     Link encap:Ethernet  HWaddr F4:CE:46:7E:D7:68inet addr:10.56.236.101  Bcast:10.56.236.127  Mask:255.255.255.128UP BROADCAST RUNNING MASTER MULTICAST  MTU:1500  Metric:1RX packets:196625663 errors:0 dropped:0 overruns:0 frame:0TX packets:166879878 errors:0 dropped:0 overruns:0 carrier:0collisions:0 txqueuelen:0RX bytes:30475502617 (28.3 GiB)  TX bytes:34248137790 (31.8 GiB)
eth0      Link encap:Ethernet  HWaddr F4:CE:46:7E:D7:68UP BROADCAST RUNNING SLAVE MULTICAST  MTU:1500  Metric:1RX packets:196625663 errors:0 dropped:0 overruns:0 frame:0TX packets:166879878 errors:0 dropped:0 overruns:0 carrier:0collisions:0 txqueuelen:1000RX bytes:30475502617 (28.3 GiB)  TX bytes:34248137790 (31.8 GiB)Interrupt:130 Memory:fb000000-fb7fffff
  • iptables -L       # 查看防火墙设置
Chain INPUT (policy ACCEPT)
target     prot opt source               destination
Chain FORWARD (policy ACCEPT)
target     prot opt source               destination
Chain OUTPUT (policy ACCEPT)
target     prot opt source               destination
  • route -n          # 查看路由表
Kernel IP routing table
Destination     Gateway         Genmask         Flags Metric Ref    Use Iface
10.56.236.0     0.0.0.0         255.255.255.128 U     0      0        0 bond0
169.254.0.0     0.0.0.0         255.255.0.0     U     0      0        0 bond0
0.0.0.0         10.56.236.126   0.0.0.0         UG    0      0        0 bond0
  • netstat -lntp    # 查看全部监听port
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address               Foreign Address                                                  State       PID/Program name
tcp        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 # 查看全部已经建立的连接
Active Internet connections (servers and established)
Proto Recv-Q Send-Q Local Address               Foreign Address                                                  State       PID/Program name
tcp        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
tcp        0      0 0.0.0.0:11111               0.0.0.0:*                                                        LISTEN      15217/ricci
  • netstat -s      # 查看网络统计信息
Ip:195815097 total packets received8 forwarded0 incoming packets discarded195814891 incoming packets delivered167012221 requests sent out3 outgoing packets dropped7 fragments dropped after timeout231 reassemblies required33 packets reassembled ok7 packet reassembles failed8 fragments received ok32 fragments created
Icmp:25034 ICMP messages received16 input ICMP message failed.ICMP input histogram:destination unreachable: 173echo requests: 13025echo replies: 1183625060 ICMP messages sent0 ICMP messages failedICMP output histogram:destination unreachable: 185echo request: 11842echo replies: 13025
IcmpMsg:InType0: 11836InType3: 173InType8: 13025OutType0: 13025OutType3: 185OutType8: 11842OutType10: 8

进程

  • ps -ef       # 查看全部进程
UID        PID  PPID  C STIME TTY      TIME CMD
root         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          # 实时显示进程状态
Tasks: 385 total,   1 running, 384 sleeping,   0 stopped,   0 zombie
Cpu(s):  0.2%us,  0.3%sy,  0.0%ni, 98.6%id,  0.8%wa,  0.0%hi,  0.1%si,  0.0%st
Mem:  16432172k total,  3795132k used, 12637040k free,   800952k buffers
Swap: 16777208k total,        0k used, 16777208k free,  1729708k cachedPID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND7339 root      15   0 11016 1192  700 R  2.0  0.0   0:00.01 top
17378 root      10  -5     0    0    0 D  2.0  0.0   6:50.74 kjournald1 root      15   0 10372  704  596 S  0.0  0.0   0:05.31 init

用户

  • w             # 查看活动用户
 14:33:53 up 4 days,  3:15,  1 user,  load average: 1.17, 1.14, 1.10
USER     TTY      FROM              LOGIN@   IDLE   JCPU   PCPU WHAT
root     pts/0    10.141.41.62     13:11    0.00s  0.05s  0.05s -bash
  • id <username>  # 查看指定用户信息
uid=0(root) gid=0(root) groups=0(root),1(bin),2(daemon),3(sys),4(adm),6(disk),10(wheel)
  • last         # 查看用户登录日志
root     pts/0        10.141.41.62     Mon Jul 14 13:11   still logged in
root     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   # 查看系统全部用户
# cut -d: -f1 /etc/passwd
root
bin
daemon
adm
  • cut -d: -f1 /etc/group    # 查看系统全部组
root
bin
daemon
sys
adm
tty
disk
  • crontab -l                 # 查看当前用户的计划任务

服务

  • chkconfig --list          # 列出全部系统服务
httpd           0:off   1:off   2:off   3:off   4:off   5:off   6:off
ip6tables       0:off   1:off   2:on    3:on    4:on    5:on    6:off
network         0:off   1:off   2:on    3:on    4:on    5:on    6:off
nfs             0:off   1:off   2:off   3:off   4:off   5:off   6:off
nfslock         0:off   1:off   2:off   3:on    4:on    5:on    6:off
nscd            0:off   1:off   2:on    3:on    4:on    5:on    6:off
ntpd            0:off   1:off   2:on    3:on    4:on    5:on    6:off
oddjobd         0:off   1:off   2:off   3:off   4:off   5:off   6:off
oractl          0:off   1:off   2:off   3:off   4:off   5:off   6:off
snmpd           0:off   1:off   2:on    3:on    4:on    5:on    6:off
snmptrapd       0:off   1:off   2:off   3:off   4:off   5:off   6:off
sshd            0:off   1:off   2:on    3:on    4:on    5:on    6:off
syslog          0:off   1:off   2:on    3:on    4:on    5:on    6:off
  • chkconfig –list | grep on  # 列出全部启动的系统服务

程序

  • rpm -qa                       # 查看全部安装的软件包
# rpm -qa | grep perl
perl-HTML-Parser-3.55-1.fc6
perl-Net-Telnet-3.03-5
perl-LDAP-0.33-4.el5_8
perl-XML-LibXML-1.58-6

其它经常使用命令整理例如以下

  • 查看主板的序列号:dmidecode | grep -i 'serial number'
  • 用硬件检測程序kuduz探測新硬件:service kudzu start ( or restart)
  • 查看CPU信息:cat /proc/cpuinfo [dmesg | grep -i 'cpu'][dmidecode -t processor]
  • 查看内存信息:cat /proc/meminfo [free -m][vmstat]
  • 查看板卡信息:cat /proc/pci
  • 查看显卡/声卡信息:lspci |grep -i 'VGA'[dmesg | grep -i 'VGA']
  • 查看网卡信息:dmesg | grep -i 'eth'[cat /etc/sysconfig/hwconf | grep -i eth][lspci | grep -i 'eth']
  • 查看PCI信息:lspci (相比cat /proc/pci更直观)
  • 查看USB设备:cat /proc/bus/usb/devices
  • 查看键盘和鼠标:cat /proc/bus/input/devices
  • 查看系统硬盘信息和使用情况:fdisk & disk – l & df
  • 查看各设备的中断请求(IRQ):cat /proc/interrupts
  • 查看系统体系结构:uname -a
  • 查看及启动系统的32位或64位内核模式:isalist –v [isainfo –v][isainfo –b]
  • 查看硬件信息,包含bios、cpu、内存等信息:dmidecode
  • 測定当前的显示器刷新频率:/usr/sbin/ffbconfig –rev ?
  • 查看系统配置:/usr/platform/sun4u/sbin/prtdiag –v
  • 查看当前系统中已经应用的补丁:showrev –p
  • 显示当前的执行级别:who –rH
  • 查看当前的bind版本号信息:nslookup –class=chaos –q=txt version.bind
  • 查看硬件信息:dmesg | more
  • 显示外设信息, 如usb,网卡等信息:lspci
  • 查看已载入的驱动:  lsnod lshw
  • 查看当前处理器的类型和速度(主频):psrinfo -v
  • 打印当前的OBP版本号号:prtconf -v
  • 查看硬盘物理信息(vendor, RPM, Capacity):iostat –E
  • 查看磁盘的几何參数和分区信息:prtvtoc /dev/rdsk/c0t0d0s
  • 显示已经使用和未使用的i-node数目:

  df –F ufs –o i

  isalist –v

对于“/proc”中文件可使用文件查看命令浏览其内容,文件里包括系统特定信息:

  主机CPU信息:Cpuinfo

  主机DMA通道信息:Dma

  文件系统信息:Filesystems

  主机中断信息:Interrupts

  主机I/Oport号信息:Ioprots

  主机内存信息:Meninfo

  Linux内存版本号信息:Version

  备注: proc – process information pseudo-filesystem 进程信息伪装文件系统

转载于:https://www.cnblogs.com/gcczhongduan/p/4283615.html

Linux硬件信息查询命令相关推荐

  1. 查看DAID设备Linux,linux 硬件信息查看命令

    在 Linux 下进行开发时,有时也需要知道当前的硬件信息,比如:CPU几核?使用情况?内存大小及使用情况?USB设备是否被识别?等等类似此类问题.下面良许介绍一些常用的硬件查看命令. lshw ls ...

  2. Linux硬件信息查看命令

    查看磁盘 df 查看CPU信息 cat /proc/cpuinfo 查看显卡 lspci | grep VGA 查看OS采用核心号 lsb_release -cs Linux查看当前操作系统版本信息 ...

  3. LINUX硬件信息查询

    1.查看linux设备型号 [root@rac1 ~]# dmidecode -s system-product-name # SMBIOS implementations newer than ve ...

  4. linux硬件命令大全,Linux硬件信息命令大全

    硬件信息 在linux系统中,有很多命令可以用于查询主机的硬件信息,有些命令仅仅针对于特定的硬件部件,比如cpu,内存等,而有些命令可以查询很多的硬件信息. 这篇帖子简单地带大家了解一下最常用的查询各 ...

  5. linux查看硬件信息的命令(图文)

    linux查看硬件信息的命令(图文) 发布:脚本学堂/Linux命令  编辑:JB02   2013-12-23 21:48:18  [大 中 小] 转自:http://www.jbxue.com/L ...

  6. 查看Linux硬件信息命令的使用

    为什么80%的码农都做不了架构师?>>>    查看Linux硬件信息命令的使用 http://www.xxlinux.com/newxxlinux/syste ... 5/315. ...

  7. lshw linux_Linux lshw命令–获取Linux硬件信息

    lshw linux Linux lshw command lists all the hardware configuration of the system. Linux lshw命令列出了系统的 ...

  8. linux查硬件信息的命令,Linux查看硬件信息的命令

    Linux查看硬件信息的命令 1. lscpu 列出cpu信息 $ lscpu Architecture:          x86_64 CPU op-mode(s):        32-bit, ...

  9. 查看 linux 硬件信息:内存、分区、系统、环境变量、防火墙、路由、端口监听、进程、CPU...

    前些天发现了一个巨牛的人工智能学习网站,通俗易懂,风趣幽默,忍不住分享一下给大家.点击跳转到教程. 一.linux CPU大小: 其实应该通过Physical Processor ID来区分单核和双核 ...

  10. redhat linux 硬件信息查看

    redhat linux 硬件信息查看 查看服务器型号序列号 dmidecode|grep "System Information" -A9 查看主板型号 dmidecode | ...

最新文章

  1. LeetCode中等题之在排序数组中查找元素的第一个和最后一个位置
  2. 1.8 centos7 的PATH、cp/mv/文档查看命令介绍
  3. 机器人大潮中暗藏多少伪命题
  4. h5 解决ios端输入框失去焦点后页面不回弹或者底部留白问题
  5. 学python用什么系统好-初次接触python,怎么样系统的自学呢?
  6. Python超详细的字符串用法大全
  7. 和某ZYC巨佬和XXY巨佬的随机挑战2总结
  8. 创建下标为1-10的整形数组
  9. [JAVA基础]你知道Java的四种引用类型吗
  10. SAP License:SAP ECC6安装系列三:关于SAP你也许想知道的一些事
  11. 2018渭源县计算机老师,2018年甘肃定西渭源县选调教师公告【招60人】
  12. Linux的目录ls命令
  13. Java 服务器端支持断点续传的源代码
  14. sharepoint修改密码
  15. Firefox浏览器个人用的插件
  16. 合宙Air724UG AT指令连接阿里云
  17. uniapp 地址转换经纬度
  18. 多系统折腾记录(老电脑MBR分区)
  19. 盛迈坤电商:退款率高会影响店铺吗
  20. 计算机教师师徒结对师傅总结,师徒结对师傅总结

热门文章

  1. 摄影构图学83年绝版_常用的摄影构图之点线面
  2. origin将柱状图和折线图画一起
  3. vue项目引用QRCode生成二维码扫码实现app登录
  4. 【JavaScript】打印星型金字塔
  5. Pytorch实战——知识点记录(一)
  6. 如何处理给MacBook安装win10双系统时拷贝windows安装文件出错?
  7. 2021 ICCV TIMI-Net 抠图网络论文笔记
  8. 计算机wifi无法打开,电脑中wifi设置网址无法打开的原因和解决方法
  9. wincc逻辑运算符_wincc中表达式及公式
  10. Java--中文转换拼音,jpinyin-1.0.jar