Per raccogliere informazioni su un sistema in Unix (GNU/Linux) è necessario conoscere diversi comandi utili.
Informazioni su un sistema operativo
$ lsb_release -idrc Distributor ID: DebianDescription: Debian GNU/Linux 8.6 (jessie)Release: 8.6Codename: jessie
Informazioni su un’architettura CPU come il numero di CPU, core, modello di famiglia CPU, cache CPU, thread, processore
$ lscpuArchitecture: x86_64CPU op-mode(s): 32-bit, 64-bitByte Order: Little EndianCPU(s): 2On-line CPU(s) list: 0,1Thread(s) per core: 1Core(s) per socket: 2Socket(s): 1NUMA node(s): 1Vendor ID: GenuineIntelCPU family: 6Model: 42Model name: Intel(R) Pentium(R) CPU B960 @ 2.20GHzStepping: 7CPU MHz: 1416.335CPU max MHz: 2200.0000CPU min MHz: 800.0000BogoMIPS: 4390.07L1d cache: 32KL1i cache: 32KL2 cache: 256KL3 cache: 2048KNUMA node0 CPU(s): 0,1
Informazioni su un kernel, un nome hardware della macchina e un sistema operativo
$ uname -aLinux localhost 3.16.0-4-amd64 #1 SMP Debian 3.16.36-1+deb8u2 (2016-10-19) x86_64 GNU/Linux
Nome host
$ hostnamelocalhost
Indirizzo IP privato (ipv4 versione) (ho nascosto le ultime cifre del proprio IP come XX)
$ hostname -I192.168.1.XX
Indirizzo IP pubblico (versione ipv4) (necessità di connessione a Internet)
$ dig +short myip.opendns.com @resolver1.opendns.com91.202.144.118
Informazioni su un sistema (hardware) (ridotto)
$ sudo dmidecode -t systemSystem 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
Informazioni su un processore (ridotto ridotto)
$sudo dmidecode -t processorProcessor 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
Ambiente desktop
Un nome di ambiente desktop mantenuto nella variabile d’ambiente “DESKTOP_SESSION”. Ma se la variabile d’ambiente “DESKTOP_SESSION” è “default” (come nel mio caso), provare a ottenere un valore dalla variabile d’ambiente “XDG_CURRENT_DESKTOP”.
$ echo $DESKTOP_SESSIONdefault$ echo $XDG_CURRENT_DESKTOPGNOME
Per rilevare una versione di ambiente desktop è necessario più sforzi, perché non ci ha built-in utility. Questo comando ha testato solo il mio computer con la shell Gnome, ma deve funzionare con altri popolari ambienti desktop grafici: KDE, Mate, Cinnamon, LXDE, Xfce.
$ pgrep -l "gnome|kde|mate|cinnamon|lxde|xfce" | egrep "-shell$" | awk '{print $2}' | xargs apt-cache showPackage: gnome-shellVersion: 3.14.4-1~deb8u1Installed-Size: 6910Maintainer: Debian GNOME Maintainers <[email protected]>Architecture: amd64Depends: 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-5Recommends: 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: 51a5a94e6b632e350489b7b8d27ab9fcHomepage: http://live.gnome.org/GnomeShellTag: implemented-in::c, implemented-in::ecmascript, interface::x11, role::program, uitoolkit::gtkSection: gnomePriority: optionalFilename: pool/main/g/gnome-shell/gnome-shell_3.14.4-1~deb8u1_amd64.debSize: 637652MD5sum: 183a6bdcd8b34c6a56c09add66301d4aSHA1: a11964152940a4a70e3d9ce93a6f21bb0a661379SHA256: ff2ce3aa442012971ba5526f488568bbde6d53a8dbb71b95a587792e903033e3
Informazioni su uno schermo
$ xrandr --current Screen 0: minimum 320 x 200, current 1366 x 768, maximum 8192 x 8192LVDS1 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)
Se avete bisogno di un buon strumento per compiti simili e più funzioni, vi consiglio “HardInfo” – https://github.com/lpereira/hardinfo. È facile da installare nei sistemi basati su Debian.
Profiler di sistema e strumento di benchmark per sistemi Linux
Basato su
- http://www.tecmint.com/commands-to-collect-system-and-hardware-information-in-linux/
- https://en.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/
- C’è un modo per recuperare il nome dell’ambiente desktop?
- https://askubuntu.com/questions/125062/how-can-i-find-which-desktop-enviroment-i-am-using
- https://unix.stackexchange.com/a/2673/202463