Linux系统 查看系统版本CPU内存主频等信息

Posted 九章_

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Linux系统 查看系统版本CPU内存主频等信息相关的知识,希望对你有一定的参考价值。

1、显示操作系统的内核版本号

root@ATK-IMX6U:~# uname -a
Linux ATK-IMX6U 4.1.15 #2 SMP PREEMPT Sat Jun 5 00:26:20 PDT 2021 armv7l armv7l armv7l GNU/Linux

2、查看系统主机名

root@ATK-IMX6U:~# cat /etc/hostname
ATK-IMX6U

3、查看系统登录信息

root@ATK-IMX6U:~# cat /etc/issue
Freescale i.MX Release Distro 4.1.15-2.1.0 \\n \\l

4、查看CPU相关信息

root@ATK-IMX6U:~# cat /proc/cpuinfo
processor       : 0
model name      : ARMv7 Processor rev 5 (v7l)
BogoMIPS        : 12.00
Features        : half thumb fastmult vfp edsp neon vfpv3 tls vfpv4 idiva idivt vfpd32 lpae
CPU implementer : 0x41
CPU architecture: 7
CPU variant     : 0x0
CPU part        : 0xc07
CPU revision    : 5

Hardware        : Freescale i.MX6 Ultralite (Device Tree)
Revision        : 0000
Serial          : 0000000000000000

5、查看内存相关信息

root@ATK-IMX6U:~# cat /proc/meminfo
MemTotal:         506884 kB
MemFree:          311732 kB
MemAvailable:     325904 kB
Buffers:            7424 kB
Cached:            84268 kB
SwapCached:            0 kB
Active:            73800 kB
Inactive:          69444 kB
Active(anon):      51752 kB
Inactive(anon):     3716 kB
Active(file):      22048 kB
Inactive(file):    65728 kB
Unevictable:           0 kB
Mlocked:               0 kB
HighTotal:             0 kB
HighFree:              0 kB
LowTotal:         506884 kB
LowFree:          311732 kB
SwapTotal:             0 kB
SwapFree:              0 kB
Dirty:                 0 kB
Writeback:             0 kB
AnonPages:         51548 kB
Mapped:            57708 kB
Shmem:              3920 kB
Slab:              10744 kB
SReclaimable:       3816 kB
SUnreclaim:         6928 kB
KernelStack:        1216 kB
PageTables:          940 kB
NFS_Unstable:          0 kB
Bounce:                0 kB
WritebackTmp:          0 kB
CommitLimit:      253440 kB
Committed_AS:     237584 kB
VmallocTotal:    1548288 kB
VmallocUsed:        3820 kB
VmallocChunk:    1367964 kB
CmaTotal:         131072 kB
CmaFree:           97240 kB

6、查看芯片内部内置传感器

root@ATK-IMX6U:~# cat /sys/class/thermal/thermal_zone0/temp
60710

温度值:60710/1000 = 60.710°C
7、系统时钟与RTC

查看系统时钟

root@ATK-IMX6U:~# date
Sat Jun  5 19:15:21 UTC 2021

设置系统时钟

root@ATK-IMX6U:~# date -s "2021-06-05 20:00:00"
Sat Jun  5 20:00:00 UTC 2021

查看硬件(RTC)时钟

root@ATK-IMX6U:~# hwclock
Sat Jun  5 19:16:07 2021  0.000000 seconds

将系统时间写入硬件 hwclock -w

root@ATK-IMX6U:~# hwclock -w
root@ATK-IMX6U:~# hwclock
Sat Jun  5 20:00:10 2021  0.000000 seconds

8、查看CPU主频

root@ATK-IMX6U:~# cat /sys/devices/system/cpu/cpu0/cpufreq/scaling_available_freq
198000 396000 528000 792000

输出的主频有198MHz,396MHz,528MHz,792MHz

1)查看CPU运行的主频

root@ATK-IMX6U:~# cpufreq-info
cpufrequtils 008: cpufreq-info (C) Dominik Brodowski 2004-2009
Report errors and bugs to cpufreq@vger.kernel.org, please.
analyzing CPU 0:
  driver: imx6q-cpufreq
  CPUs which run at the same hardware frequency: 0
  CPUs which need to have their frequency coordinated by software: 0
  maximum transition latency: 91.0 us.
  hardware limits: 198 MHz - 792 MHz
  available frequency steps: 198 MHz, 396 MHz, 528 MHz, 792 MHz
  available cpufreq governors: interactive, conservative, userspace, powersave, performance
  current policy: frequency should be within 198 MHz and 792 MHz.
                  The governor "performance" may decide which speed to use
                  within this range.
  current CPU frequency is 792 MHz (asserted by call to hardware).
  cpufreq stats: 198 MHz:0.00%, 396 MHz:0.00%, 528 MHz:0.00%, 792 MHz:100.00%  (1)

current CPU frequency is 792 MHz (asserted by call to hardware).并且有 792 MHz:100.00%

2)修改主频(不重新编译程序如何修改主频,临时修改系统重启失效)

  • 申请用户空间控制CPU主频
echo userspace > /sys/devices/system/cpu/cpu0/cpufreq/scaling_governor
  • 修改主频为198M
echo 198000 > /sys/devices/system/cpu/cpu0/cpufreq/scaling_setspeed

查询修改后的值

root@ATK-IMX6U:~# cat /sys/devices/system/cpu/cpu0/cpufreq/cpuinfo_cur_freq
198000
root@ATK-IMX6U:~# cpufreq-info
...
  current CPU frequency is 198 MHz (asserted by call to hardware).
  cpufreq stats: 198 MHz:1.02%, 396 MHz:0.00%, 528 MHz:0.00%, 792 MHz:98.98%  (2)

CPU主频已经修改为198M,并且主频使用已经1.02% ,系统运行会比较卡。

以上是关于Linux系统 查看系统版本CPU内存主频等信息的主要内容,如果未能解决你的问题,请参考以下文章

linux系统查看CPU内存磁盘版本等信息

Linux 系统版本查询命令

Linux 基础-查看 cpu内存和环境等信息

查询linux版本信息

Linux 系统版本查询命令

tensorflow 安装 CentOS查看CPU内存版本等系统信息