要收集有关Unix(GNU / Linux)中系统的信息,您需要知道几个有用的命令。
有关操作系统的信息
$ lsb_release -idrc
Distributor ID: Debian
Description: Debian GNU/Linux 8.6 (jessie)
Release: 8.6
Codename: jessie
有关CPU体系结构的信息,例如CPU数量,内核,CPU系列模型,CPU缓存,线程,处理器
$ lscpu
Architecture: x86_64
CPU op-mode(s): 32-bit, 64-bit
Byte Order: Little Endian
CPU(s): 2
On-line CPU(s) list: 0,1
Thread(s) per core: 1
Core(s) per socket: 2
Socket(s): 1
NUMA node(s): 1
Vendor ID: GenuineIntel
CPU family: 6
Model: 42
Model name: Intel(R) Pentium(R) CPU B960 @ 2.20GHz
Stepping: 7
CPU MHz: 1416.335
CPU max MHz: 2200.0000
CPU min MHz: 800.0000
BogoMIPS: 4390.07
L1d cache: 32K
L1i cache: 32K
L2 cache: 256K
L3 cache: 2048K
NUMA node0 CPU(s): 0,1
有关内核,机器硬件名称和操作系统的信息
$ uname -a
Linux localhost 3.16.0-4-amd64 #1 SMP Debian 3.16.36-1+deb8u2 (2016-10-19) x86_64 GNU/Linux
主机名
$ hostname
localhost
专用IP地址(ipv4版本)(我隐藏的最后几位自己的IP为XX)
$ hostname -I
192.168.1.XX
公用IP地址(ipv4版本)(需要连接到Internet)
$ dig +short myip.opendns.com @resolver1.opendns.com
91.202.144.118
有关系统(硬件)的信息(已缩减)
$ sudo dmidecode -t system
System Information
Manufacturer: Acer
Product Name: Aspire E1-531G
Version: V2.11
Serial Number: NXM7BEU0013010B0EF1601
UUID: 332A4CE1-CB4B-E211-87F5-20898452C545
Wake-up Type: Power Switch
SKU Number: Aspire E1-531G_064A_V2.11
Family: Type1Family
有关处理器的信息(已缩减)
$sudo dmidecode -t processor
Processor Information
Socket Designation: U3E1
Type: Central Processor
Family: Pentium
Manufacturer: Intel(R) Corporation
ID: A7 06 02 00 FF FB EB BF
Signature: Type 0, Family 6, Model 42, Stepping 7
Flags:
FPU (Floating-point unit on-chip)
********
VME (Virtual mode extension)
Version: Intel(R) Pentium(R) CPU B960 @ 2.20GHz
Voltage: 1.1 V
External Clock: 100 MHz
Max Speed: 4000 MHz
Current Speed: 2200 MHz
Status: Populated, Enabled
Upgrade: Socket rPGA988B
L1 Cache Handle: 0x000B
L2 Cache Handle: 0x000C
L3 Cache Handle: 0x000D
Serial Number: To Be Filled By O.E.M.
Asset Tag: To Be Filled By O.E.M.
Part Number: To Be Filled By O.E.M.
Core Count: 2
Core Enabled: 2
Thread Count: 2
Characteristics:
64-bit capable
Multi-Core
Execute Protection
Power/Performance Control
桌面环境
桌面环境的名称,保留在环境变量“ DESKTOP_SESSION”中。但是,如果环境变量“ DESKTOP_SESSION”为“默认”(在我的情况下),请尝试从环境变量“ XDG_CURRENT_DESKTOP”获取值。
$ echo $DESKTOP_SESSION
default
$ echo $XDG_CURRENT_DESKTOP
GNOME
要检测桌面环境的版本,您需要付出更多的努力,因为还没有内置实用程序。此命令仅使用Gnome Shell测试了我的计算机,但必须与其他流行的图形桌面环境一起使用:KDE,Mate,Cinnamon,LXDE,Xfce。
$ pgrep -l "gnome|kde|mate|cinnamon|lxde|xfce" | egrep "-shell$" | awk '{print $2}' | xargs apt-cache show
Package: gnome-shell
Version: 3.14.4-1~deb8u1
Installed-Size: 6910
Maintainer: Debian GNOME Maintainers <pkg-gnome-maintainers@lists.alioth.debian.org>
Architecture: amd64
Depends: gir1.2-clutter-1.0 (>= 1.17), gir1.2-glib-2.0 (>= 1.39.90-4~), gir1.2-gtk-3.0 (>= 3.8), gir1.2-mutter-3.0 (>= 3.14.4), gir1.2-networkmanager-1.0, gir1.2-soup-5
Recommends: gkbd-capplet, gnome-contacts, gnome-control-center, gnome-user-guide, unzip, gdm3 (>= 3.10.0.1-3~)
Conflicts: gnome-screensaver (<< 3.6)
Breaks: fglrx-driver (<< 1:11-10), gdm3 (<< 3.10.0.1-3~), gnome-control-center (<< 1:3.0), gnome-session (<< 3.0), gnome-tweak-tool (<< 3.5)
Description-en: graphical shell for the GNOME desktop
The GNOME Shell provides core interface functions like switching
windows, launching applications or see your notifications. It takes
advantage of the capabilities of modern graphics hardware and
introduces innovative user interface concepts to provide a
delightful and easy to use experience. GNOME Shell is the defining
technology of the GNOME 3 user experience.
Description-md5: 51a5a94e6b632e350489b7b8d27ab9fc
Homepage: http://live.gnome.org/GnomeShell
Tag: implemented-in::c, implemented-in::ecmascript, interface::x11,
role::program, uitoolkit::gtk
Section: gnome
Priority: optional
Filename: pool/main/g/gnome-shell/gnome-shell_3.14.4-1~deb8u1_amd64.deb
Size: 637652
MD5sum: 183a6bdcd8b34c6a56c09add66301d4a
SHA1: a11964152940a4a70e3d9ce93a6f21bb0a661379
SHA256: ff2ce3aa442012971ba5526f488568bbde6d53a8dbb71b95a587792e903033e3
屏幕信息
$ xrandr --current
Screen 0: minimum 320 x 200, current 1366 x 768, maximum 8192 x 8192
LVDS1 connected primary 1366x768+0+0 (normal left inverted right x axis y axis) 344mm x 194mm
1366x768 60.00*+
1360x768 59.80 59.96
1024x768 60.00
800x600 60.32 56.25
640x480 59.94
VGA1 disconnected (normal left inverted right x axis y axis)
HDMI1 disconnected (normal left inverted right x axis y axis)
DP1 disconnected (normal left inverted right x axis y axis)
如果您需要用于完成类似任务和更多功能的好工具,建议您使用“ HardInfo”-https : //github.com/lpereira/hardinfo。它很容易在基于Debian的系统中安装。
Linux系统的系统概述和基准测试工具
基于
- http://www.tecmint.com/commands-to-collect-system-and-hardware-information-in-linux/
- https://zh.wikibooks.org/wiki/Guide_to_Unix/Commands/System_Information
- https://www.cyberciti.biz/faq/how-to-find-my-public-ip-address-from-command-line-on-a-linux/
- 有没有办法检索桌面环境的名称?
- /ubuntu/125062/how-can-i-find-which-desktop-enviroment-i-am-using
- /unix//a/2673/202463