系統版本信息
常用的是 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