系统版本信息
常用的是 lsb_release -a
。
root@DESKTOP-QRQH8GS:/proc# lsb_release -a
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 18.04.2 LTS
Release: 18.04
Codename: bionic
系统内核信息
常用uname -a
root@DESKTOP-QRQH8GS:/proc# uname -a
Linux DESKTOP-QRQH8GS 4.4.0-18362-Microsoft #836-Microsoft Mon May 05 16:04:00 PST 2020 x86_64 x86_64 x86_64 GNU/Linux
查看cpu信息
包括型号、主频、内核信息等
cat /etc/cpuinfo
root@DESKTOP-QRQH8GS:/proc# pwd
/proc
root@DESKTOP-QRQH8GS:/proc# cat cpuinfo
processor : 0
vendor_id : GenuineIntel
cpu family : 6
model : 60
model name : Intel(R) Core(TM) i7-4710MQ CPU @ 2.50GHz
stepping : 3
/proc
目录介绍
Linux系统上的/proc目录是一种文件系统,即proc文件系统。与其它常见的文件系统不同的是,/proc是一种伪文件系统(也即虚拟文件系统),存储的是当前内核运行状态的一系列特殊文件,用户可以通过这些文件查看有关系统硬件及当前正在运行进程的信息,甚至可以通过更改其中某些文件来改变内核的运行状态。
基于/proc文件系统如上所述的特殊性,其内的文件也常被称作虚拟文件,并具有一些独特的特点。例如,其中有些文件虽然使用查看命令查看时会返回大量信息,但文件本身的大小却会显示为0字节。此外,这些特殊文件中大多数文件的时间及日期属性通常为当前系统时间和日期,这跟它们随时会被刷新(存储于RAM中)有关。
为了查看及使用上的方便,这些文件通常会按照相关性进行分类存储于不同的目录甚至子目录中,如/proc/scsi
目录中存储的就是当前系统上所有SCSI设备的相关信息,/proc/N
中存储的则是系统当前正在运行的进程的相关信息,其中N为正在运行的进程(可以想象得到,在某进程结束后其相关目录则会消失)。
- 关于每一个文件的含义,可以使用下面的命令查看帮助信息:
man proc
/proc/loadavg
保存了系统负载的平均值,其前三列分别表示最近1分钟、5分钟及15分的平均负载。反映了当前系统的繁忙情况。/proc/meminfo
当前内存使用的统计信息,常由free命令使用;可以使用文件查看命令直接读取此文件,其内容显示为两列,前者为统计属性,后者为对应的值;/proc/diskstats
磁盘设备的磁盘I/O统计信息列表;/proc/net/dev
网络流入流出的统计信息,包括接收包的数量、发送包的数量,发送数据包时的错误和冲突情况等。
/proc
目录下的文件
root@DESKTOP-QRQH8GS:/proc# ls -l /proc/
total 0
dr-xr-xr-x 7 root root 0 May 19 21:11 1
dr-xr-xr-x 7 root root 0 May 19 21:11 10
dr-xr-xr-x 7 root root 0 May 19 21:25 14
dr-xr-xr-x 7 root root 0 May 19 21:46 496
dr-xr-xr-x 7 root root 0 May 19 21:11 9
dr-xr-xr-x 2 root root 0 May 19 21:11 bus
-r--r--r-- 1 root root 0 May 19 21:11 cgroups
-r--r--r-- 1 root root 0 May 19 21:11 cmdline
-r--r--r-- 1 root root 0 May 19 21:11 cpuinfo
-r--r--r-- 1 root root 0 May 19 21:11 filesystems
-r--r--r-- 1 root root 0 May 19 21:11 interrupts
-r--r--r-- 1 root root 0 May 19 21:11 loadavg
-r--r--r-- 1 root root 0 May 19 21:11 meminfo
lrwxrwxrwx 1 root root 0 May 19 21:11 mounts -> self/mounts
lrwxrwxrwx 1 root root 0 May 19 21:11 net -> self/net
lrwxrwxrwx 1 root root 0 May 19 21:11 self -> 496
-r--r--r-- 1 root root 0 May 19 21:11 stat
dr-xr-xr-x 6 root root 0 May 19 21:11 sys
dr-xr-xr-x 2 root root 0 May 19 21:11 tty
-r--r--r-- 1 root root 0 May 19 21:11 uptime
-r--r--r-- 1 root root 0 May 19 21:11 version
-r--r--r-- 1 root root 0 May 19 21:11 version_signature
常用指令手册
lsb_release
root@DESKTOP-QRQH8GS:/proc# lsb_release --help
Usage: lsb_release [options]
Options:
-h, --help show this help message and exit
-v, --version show LSB modules this system supports
-i, --id show distributor ID
-d, --description show description of this distribution
-r, --release show release number of this distribution
-c, --codename show code name of this distribution
-a, --all show all of the above information
-s, --short show requested information in short format
uname
root@DESKTOP-QRQH8GS:/proc# uname --help
Usage: uname [OPTION]...
Print certain system information. With no OPTION, same as -s.
-a, --all print all information, in the following order,
except omit -p and -i if unknown:
-s, --kernel-name print the kernel name
-n, --nodename print the network node hostname
-r, --kernel-release print the kernel release
-v, --kernel-version print the kernel version
-m, --machine print the machine hardware name
-p, --processor print the processor type (non-portable)
-i, --hardware-platform print the hardware platform (non-portable)
-o, --operating-system print the operating system
--help display this help and exit
--version output version information and exit