Laz*_*zer 16 kernel desktop-environment system-information
我一直发现很难在 Unix 中找到有关系统本身的信息,无论是
我正在使用哪个操作系统(版本号和所有版本,将其与最新的可用版本进行比较)?
我使用的是哪个桌面环境?如果我使用 KDE,大多数程序都以 K 开头,我可以说我使用的是 KDE,但是应该有某种方式来查询它,比如从脚本中查询。
我使用的是哪个内核版本?(比如我用的是Fedora,我想知道我用的是什么Linux内核版本)
基本上,我想念的是一个可以为我获取所有这些信息的单点/实用程序。大多数情况下,上述问题的解决方案本身就是特定于操作系统的。然后,你被卡住了。
Jan*_*anC 19
除了uname -a
为您提供内核版本的 之外,您还可以尝试:
lsb_release -idrc # distro, version, codename, long release name
Run Code Online (Sandbox Code Playgroud)
大多数桌面环境(如 GNOME 或 KDE)都有一个“关于”或“信息”菜单选项,可以告诉您当前使用的内容,因此实际上不需要命令行。
正如@milk 指出的那样,您可以使用它uname -a
,它会告诉您有关我可以访问的所有 UNIX 的信息。例如,在 Linux 上:
Linux localhost 2.6.33.6-147.2.4.fc13.x86_64 #1 SMP Fri Jul 23 17:14:44 UTC 2010 x86_64 x86_64 x86_64 GNU/Linux
Run Code Online (Sandbox Code Playgroud)
在 FreeBSD 上:
FreeBSD localhost 6.3-RELEASE-p3-jc1 FreeBSD 6.3-RELEASE-p3-jc1 #2: Thu Aug 7 14:36:29 PDT 2008 user@jail7.johncompanies.com:/usr/obj/usr/src/sys/jail7 i386
Run Code Online (Sandbox Code Playgroud)
在 OpenSolaris 上:
SunOS localhost 5.11 snv_134 i86pc i386 i86pc
Run Code Online (Sandbox Code Playgroud)
就桌面环境问题而言,您应该能够echo $DESKTOP_SESSION
在 KDE 或 GNOME 中找到正确的答案。
如果您想了解您正在运行的发行版,作弊者的捷径是cat /etc/*-version /etc/*-release
.
要收集有关 Unix (GNU/Linux) 系统的信息,您需要了解几个有用的命令。
\n\n有关操作系统的信息
\n\n$ lsb_release -idrc \nDistributor ID: Debian\nDescription: Debian GNU/Linux 8.6 (jessie)\nRelease: 8.6\nCodename: jessie\n
Run Code Online (Sandbox Code Playgroud)\n\n有关 CPU 架构的信息,例如 CPU\xe2\x80\x99 数量、核心、CPU 系列型号、CPU 缓存、线程、处理器
\n\n$ lscpu\nArchitecture: x86_64\nCPU op-mode(s): 32-bit, 64-bit\nByte Order: Little Endian\nCPU(s): 2\nOn-line CPU(s) list: 0,1\nThread(s) per core: 1\nCore(s) per socket: 2\nSocket(s): 1\nNUMA node(s): 1\nVendor ID: GenuineIntel\nCPU family: 6\nModel: 42\nModel name: Intel(R) Pentium(R) CPU B960 @ 2.20GHz\nStepping: 7\nCPU MHz: 1416.335\nCPU max MHz: 2200.0000\nCPU min MHz: 800.0000\nBogoMIPS: 4390.07\nL1d cache: 32K\nL1i cache: 32K\nL2 cache: 256K\nL3 cache: 2048K\nNUMA node0 CPU(s): 0,1\n
Run Code Online (Sandbox Code Playgroud)\n\n有关内核、机器硬件名称和操作系统的信息
\n\n$ uname -a\nLinux localhost 3.16.0-4-amd64 #1 SMP Debian 3.16.36-1+deb8u2 (2016-10-19) x86_64 GNU/Linux\n
Run Code Online (Sandbox Code Playgroud)\n\n主机名
\n\n$ hostname\nlocalhost\n
Run Code Online (Sandbox Code Playgroud)\n\n私有IP地址(ipv4版本)(我将自己的IP的最后一位隐藏为XX)
\n\n$ hostname -I\n192.168.1.XX\n
Run Code Online (Sandbox Code Playgroud)\n\n公共IP地址(ipv4版本)(需要连接互联网)
\n\n$ dig +short myip.opendns.com @resolver1.opendns.com\n91.202.144.118\n
Run Code Online (Sandbox Code Playgroud)\n\n有关系统(硬件)的信息(精简)
\n\n$ sudo dmidecode -t system\n\nSystem Information\n Manufacturer: Acer\n Product Name: Aspire E1-531G\n Version: V2.11\n Serial Number: NXM7BEU0013010B0EF1601\n UUID: 332A4CE1-CB4B-E211-87F5-20898452C545\n Wake-up Type: Power Switch\n SKU Number: Aspire E1-531G_064A_V2.11\n Family: Type1Family\n
Run Code Online (Sandbox Code Playgroud)\n\n有关处理器的信息(精简)
\n\n$sudo dmidecode -t processor\n\nProcessor Information\n Socket Designation: U3E1\n Type: Central Processor\n Family: Pentium\n Manufacturer: Intel(R) Corporation\n ID: A7 06 02 00 FF FB EB BF\n Signature: Type 0, Family 6, Model 42, Stepping 7\n Flags:\n FPU (Floating-point unit on-chip)\n\n ********\n\n VME (Virtual mode extension)\n Version: Intel(R) Pentium(R) CPU B960 @ 2.20GHz\n Voltage: 1.1 V\n External Clock: 100 MHz\n Max Speed: 4000 MHz\n Current Speed: 2200 MHz\n Status: Populated, Enabled\n Upgrade: Socket rPGA988B\n L1 Cache Handle: 0x000B\n L2 Cache Handle: 0x000C\n L3 Cache Handle: 0x000D\n Serial Number: To Be Filled By O.E.M.\n Asset Tag: To Be Filled By O.E.M.\n Part Number: To Be Filled By O.E.M.\n Core Count: 2\n Core Enabled: 2\n Thread Count: 2\n Characteristics:\n 64-bit capable\n Multi-Core\n Execute Protection\n Power/Performance Control\n
Run Code Online (Sandbox Code Playgroud)\n\n桌面环境
\n\n保存在环境变量“DESKTOP_SESSION”中的桌面环境名称。但是,如果环境变量“DESKTOP_SESSION”是“默认”(如我的情况),请尝试从环境变量“XDG_CURRENT_DESKTOP”获取值。
\n\n$ echo $DESKTOP_SESSION\ndefault\n$ echo $XDG_CURRENT_DESKTOP\nGNOME\n
Run Code Online (Sandbox Code Playgroud)\n\n要检测桌面环境的版本,您需要付出更多努力,因为没有内置实用程序。该命令仅测试了我的带有 Gnome shell 的计算机,但必须与其他流行的图形桌面环境一起使用:KDE、Mate、Cinnamon、LXDE、Xfce。
\n\n$ pgrep -l "gnome|kde|mate|cinnamon|lxde|xfce" | egrep "-shell$" | awk \'{print $2}\' | xargs apt-cache show\nPackage: gnome-shell\nVersion: 3.14.4-1~deb8u1\nInstalled-Size: 6910\nMaintainer: Debian GNOME Maintainers <pkg-gnome-maintainers@lists.alioth.debian.org>\nArchitecture: amd64\nDepends: 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\nRecommends: gkbd-capplet, gnome-contacts, gnome-control-center, gnome-user-guide, unzip, gdm3 (>= 3.10.0.1-3~)\nConflicts: gnome-screensaver (<< 3.6)\nBreaks: 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)\nDescription-en: graphical shell for the GNOME desktop\n The GNOME Shell provides core interface functions like switching\n windows, launching applications or see your notifications. It takes\n advantage of the capabilities of modern graphics hardware and\n introduces innovative user interface concepts to provide a\n delightful and easy to use experience. GNOME Shell is the defining\n technology of the GNOME 3 user experience.\nDescription-md5: 51a5a94e6b632e350489b7b8d27ab9fc\nHomepage: http://live.gnome.org/GnomeShell\nTag: implemented-in::c, implemented-in::ecmascript, interface::x11,\n role::program, uitoolkit::gtk\nSection: gnome\nPriority: optional\nFilename: pool/main/g/gnome-shell/gnome-shell_3.14.4-1~deb8u1_amd64.deb\nSize: 637652\nMD5sum: 183a6bdcd8b34c6a56c09add66301d4a\nSHA1: a11964152940a4a70e3d9ce93a6f21bb0a661379\nSHA256: ff2ce3aa442012971ba5526f488568bbde6d53a8dbb71b95a587792e903033e3\n
Run Code Online (Sandbox Code Playgroud)\n\n有关屏幕的信息
\n\n$ xrandr --current \nScreen 0: minimum 320 x 200, current 1366 x 768, maximum 8192 x 8192\nLVDS1 connected primary 1366x768+0+0 (normal left inverted right x axis y axis) 344mm x 194mm\n 1366x768 60.00*+\n 1360x768 59.80 59.96 \n 1024x768 60.00 \n 800x600 60.32 56.25 \n 640x480 59.94 \nVGA1 disconnected (normal left inverted right x axis y axis)\nHDMI1 disconnected (normal left inverted right x axis y axis)\nDP1 disconnected (normal left inverted right x axis y axis)\n
Run Code Online (Sandbox Code Playgroud)\n\n如果您需要一个好工具来完成类似的任务和更多功能,我推荐“HardInfo” - https://github.com/lpereira/hardinfo。它很容易安装在基于 Debian 的系统中。
\n\n\n\n\n\n\n适用于 Linux 系统的系统分析器和基准测试工具
\n
基于
\n\n