Linux中常用的查看系统信息的操作指令

本文介绍如何使用Linux命令行工具查询系统的基本信息,包括内核版本、系统版本、内存使用情况、CPU参数及硬盘信息等。

摘要生成于 C知道 ,由 DeepSeek-R1 满血版支持, 前往体验 >

uname ->查看系统内核版本

[root@noker ~]#uname -a
Linux linuxprobe.com 2.6.32-358.el6.x86_64 #1 SMP Tue Jan 29 11:47:41 EST 2013 x86_64 x86_64 x86_64 GNU/Linux
[root@noker ~]#

lsb_release 或者cat /etc/issue->查看系统版本

[root@noker ~]# lsb_release -a
LSB Version: :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
Distributor ID: RedHatEnterpriseServer
Description: Red Hat Enterprise Linux Server release 6.4 (Santiago)
Release: 6.4
Codename: Santiago
[root@noker ~]#cat /etc/issue
Red Hat Enterprise Linux Server release 6.4 (Santiago)
Kernel \r on an \m
[root@noker ~]#

free ->查看内存

[root@noker~]# free
             total       used       free     shared    buffers     cached
Mem:       5228872     669360    4559512          0      28060     266936
-/+ buffers/cache:     374364    4854508
Swap:      4194296          0    4194296
[root@noker~]# free -m
             total       used       free     shared    buffers     cached
Mem:          5106        653       4452          0         27        260
-/+ buffers/cache:        365       4740
Swap:         4095          0       4095
[root@noker~]# free -g
             total       used       free     shared    buffers     cached
Mem:             4          0          4          0          0          0
-/+ buffers/cache:          0          4
Swap:            3          0          3
[root@noker~]#

查看CPU

uptime ->系统平衡负载
[root@noker~]# uptime
 20:09:48 up 43 min,  3 users,  load average: 0.35, 0.25, 0.11    //系统的平均负载,1分钟,5分钟,15分钟
top ->实时监控系统CPU和内存
[root@noker~]# top
top - 20:15:41 up 49 min,  3 users,  load average: 0.41, 0.38, 0.21
Tasks: 236 total,   1 running, 235 sleeping,   0 stopped,   0 zombie
Cpu(s):  0.2%us,  0.5%sy,  0.0%ni, 98.8%id,  0.5%wa,  0.0%hi,  0.0%si,  0.0%st
Mem:   5228872k total,   671136k used,  4557736k free,    28324k buffers
Swap:  4194296k total,        0k used,  4194296k free,   267360k cached

   PID USER      PR  NI  VIRT  RES  SHR S %CPU %MEM    TIME+  COMMAND                    
     1 root      20   0 19360 1536 1224 S  0.0  0.0   0:05.37 init                        
     2 root      20   0     0    0    0 S  0.0  0.0   0:00.02 kthreadd                    
     3 root      RT   0     0    0    0 S  0.0  0.0   0:00.07 migration/0                 
     4 root      20   0     0    0    0 S  0.0  0.0   0:00.14 ksoftirqd/0                 
     5 root      RT   0     0    0    0 S  0.0  0.0   0:00.00 migration/0                 
     6 root      RT   0     0    0    0 S  0.0  0.0   0:00.01 watchdog/0                  
     7 root      RT   0     0    0    0 S  0.0  0.0   0:00.69 migration/1                 
     8 root      RT   0     0    0    0 S  0.0  0.0   0:00.00 migration/1                 
     9 root      20   0     0    0    0 S  0.0  0.0   0:00.10 ksoftirqd/1                 
    10 root      RT   0     0    0    0 S  0.0  0.0   0:00.00 watchdog/1                  
    11 root      RT   0     0    0    0 S  0.0  0.0   0:00.10 migration/2                 
    12 root      RT   0     0    0    0 S  0.0  0.0   0:00.00 migration/2                 
    13 root      20   0     0    0    0 S  0.0  0.0   0:00.01 ksoftirqd/2                 
    14 root      RT   0     0    0    0 S  0.0  0.0   0:00.00 watchdog/2                  
    15 root      RT   0     0    0    0 S  0.0  0.0   0:00.17 migration/3                 
    16 root      RT   0     0    0    0 S  0.0  0.0   0:00.00 migration/3                 
    17 root      20   0     0    0    0 S  0.0  0.0   0:00.06 ksoftirqd/3                 
    18 root      RT   0     0    0    0 S  0.0  0.0   0:00.00 watchdog/3                  
    19 root      20   0     0    0    0 S  0.0  0.0   0:00.41 events/0  

/proc/cpuinfo ->查看CPU参数

[root@noker~]#  cat /proc/cpuinfo | grep "physical id" | uniq | wc -l
2                                              //cpu个数
[root@noker~]# cat /proc/cpuinfo | grep "cpu cores" | uniq
cpu cores	: 2                           //线程数
[root@noker~]# cat /proc/cpuinfo | grep 'model name' |uniq
model name	: Intel(R) Core(TM) i5-3230M CPU @ 2.60GHz
                                             //cpu型号参数

df 或者 fdisk -l->查看系统硬盘信息

[root@noker~]# df
文件系统	         1K-块      已用      可用 已用% 挂载点
/dev/sda2             41284928    469040  38718736   2% /
tmpfs                  2614436       224   2614212   1% /dev/shm
/dev/sda1                99150     32504     61526  35% /boot
/dev/sda6               516040     18016    471812   4% /home
/dev/sda3              4128448   2542976   1375760  65% /usr
[root@noker~]# df -h                     //以简单的看得懂的方式显示
文件系统	      容量  已用  可用 已用%% 挂载点
/dev/sda2              40G  459M   37G   2% /
tmpfs                 2.5G  224K  2.5G   1% /dev/shm
/dev/sda1              97M   32M   61M  35% /boot
/dev/sda6             504M   18M  461M   4% /home
/dev/sda3             4.0G  2.5G  1.4G  65% /usr
[root@noker~]# fdisk -l

Disk /dev/sda: 107.4 GB, 107374182400 bytes
255 heads, 63 sectors/track, 13054 cylinders
Units = cylinders of 16065 * 512 = 8225280 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0x000f0739

   Device Boot      Start         End      Blocks   Id  System
/dev/sda1   *           1          13      102400   83  Linux
Partition 1 does not end on cylinder boundary.
/dev/sda2              13        5235    41943040   83  Linux
/dev/sda3            5235        5757     4194304   83  Linux
/dev/sda4            5757       13055    58616832    5  Extended
/dev/sda5            5757        6280     4194304   82  Linux swap / Solaris
/dev/sda6            6280        6345      524288   83  Linux

[root@noker~]#  fdisk -l | grep Disk
Disk /dev/sda: 107.4 GB, 107374182400 bytes
Disk identifier: 0x000f0739
[root@noker~]# 

iostat ->查看硬盘读写速度

[root@noker~]#  iostat -t 1 3                                     //1s一次,查看3次
Linux 2.6.32-358.el6.x86_64 (twj.baidu.com) 	20160607_x86_64_	(4 CPU)

20160607204003秒
avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           0.17    0.06    0.74    0.84    0.00   98.19

Device:            tps   Blk_read/s   Blk_wrtn/s   Blk_read   Blk_wrtn
sda               8.34       273.82       136.61    1216528     606904

20160607204004秒
avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           0.00    2.10    9.97   13.12    0.00   74.80

Device:            tps   Blk_read/s   Blk_wrtn/s   Blk_read   Blk_wrtn
sda              89.00      3472.00     11208.00       3472      11208

20160607204005秒
avg-cpu:  %user   %nice %system %iowait  %steal   %idle
           0.00    1.99   14.35    9.05    0.00   74.61

Device:            tps   Blk_read/s   Blk_wrtn/s   Blk_read   Blk_wrtn
sda              66.13      1464.52      9800.00       1816      12152

项目推荐



DC3是基于Spring Cloud的开源可分布式物联网(IOT)平台,用于快速开发、部署物联设备接入项目,是一整套物联系统解决方案。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值