学习是一个逐步发现自己无知的过程!

Linux服务器信息

查看linux系统信息

一、查看Linux系统版本

[root@sirliu ~]# cat /etc/redhat-release 
CentOS Linux release 7.6.1810 (Core) 

二、查看Linux内核版本

//方法一
[root@sirliu ~]# cat /proc/version 
Linux version 3.10.0-957.1.3.el7.x86_64 (mockbuild@kbuilder.bsys.centos.org) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-36) (GCC) ) #1 SMP Thu Nov 29 14:49:43 UTC 2018
//方法二
[root@sirliu ~]# uname -a
Linux sirliu 3.10.0-957.1.3.el7.x86_64 #1 SMP Thu Nov 29 14:49:43 UTC 2018 x86_64 x86_64 x86_64 GNU/Linux

三、查看系统磁盘 / 分区 / 目录挂载

//查看磁盘分区挂载
[root@sirliu ~]# lsblk -a
NAME            MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT
sda               8:0    0  100G  0 disk 
├─sda1            8:1    0    2G  0 part /boot
└─sda2            8:2    0   98G  0 part 
  ├─centos-root 253:0    0   96G  0 lvm  /
  └─centos-swap 253:1    0    2G  0 lvm  [SWAP]
sr0              11:0    1 1024M  0 rom 
//主要查看硬件设备在系统上的命名(都是在/dev目录下的设备名称)
[root@sirliu ~]# cat /proc/partitions 
major minor  #blocks  name

   8        0  104857600 sda
   8        1    2097152 sda1
   8        2  102759424 sda2
  11        0    1048575 sr0
 253        0  100659200 dm-0
 253        1    2097152 dm-1
 //系统上所有的存储设备
 [root@sirliu ~]# blkid -o list
device                           fs_type      label         mount point                          UUID
-------------------------------------------------------------------------------------------------------------------------------------
/dev/sda1                        xfs                        /boot                                9c8b09ec-a1e2-46f7-869a-0889e53fdef8
/dev/sda2                        LVM2_member                (in use)                             WsOoz9-IP5k-oF2d-b892-mRxF-pzWH-KMKTRu
/dev/mapper/centos-root          xfs                        /                                    a5f70ca0-df49-4d75-b8a6-8719da937e2e
/dev/mapper/centos-swap
//查看当前系统上的所有存储设备
[root@sirliu ~]# fdisk -l

Disk /dev/sda: 107.4 GB, 107374182400 bytes, 209715200 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk label type: dos
Disk identifier: 0x000bdc6d

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048     4196351     2097152   83  Linux
/dev/sda2         4196352   209715199   102759424   8e  Linux LVM

Disk /dev/mapper/centos-root: 103.1 GB, 103075020800 bytes, 201318400 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes


Disk /dev/mapper/centos-swap: 2147 MB, 2147483648 bytes, 4194304 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
//查看磁盘IO
[root@sirliu ~]# iostat -x 10
Linux 3.10.0-957.1.3.el7.x86_64 (sirliu)    02/24/2019  _x86_64_    (4 CPU)

avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           0.01    0.00    0.03    0.00    0.00   99.95

Device:         rrqm/s   wrqm/s     r/s     w/s    rkB/s    wkB/s avgrq-sz avgqu-sz   await r_await w_await  svctm  %util
sda               0.00     0.01    0.09    0.05     3.66     0.50    58.68     0.00    3.48    2.30    5.36   1.45   0.02
dm-0              0.00     0.00    0.06    0.06     3.18     0.47    62.88     0.00    4.45    3.41    5.38   1.70   0.02
dm-1              0.00     0.00    0.00    0.00     0.05     0.00    54.14     0.00    0.73    0.73    0.00   0.59   0.00

四、查看Linux系统的CPU

//查看物理CPU个数
[root@sirliu ~]# cat /proc/cpuinfo |grep "physical "|sort |uniq |wc -l
2
//查看系统CPU型号和核心数
[root@sirliu ~]# cat /proc/cpuinfo |grep "name"
model name  : Intel(R) Core(TM) i5-6300HQ CPU @ 2.30GHz
model name  : Intel(R) Core(TM) i5-6300HQ CPU @ 2.30GHz
model name  : Intel(R) Core(TM) i5-6300HQ CPU @ 2.30GHz
model name  : Intel(R) Core(TM) i5-6300HQ CPU @ 2.30GHz
//查看逻辑CPU的个数
[root@sirliu ~]# cat /proc/cpuinfo |grep "processor"|wc -l
4

五、查看系统内存

//默认是以KB为单位显示
[root@sirliu ~]# free 
              total        used        free      shared  buff/cache   available
Mem:        3861520      143516     3390124       29812      327880     3438636
Swap:       2097148           0     2097148
//加上 -h 参数以人类可读显示
[root@sirliu ~]# free -h
              total        used        free      shared  buff/cache   available
Mem:           3.7G        139M        3.2G         29M        320M        3.3G
Swap:          2.0G          0B        2.0G
赞(1)
未经允许不得转载:劉大帥 » Linux服务器信息

你的评论可能会一针见血! 抢沙发

登录

找回密码

注册