How To Get System Info In Linux

本文提供了一系列命令、技巧和信息,涵盖了从获取系统基本信息到高级管理操作的多个方面。内容包括硬件信息查询、系统信息展示、设备管理、内存、CPU、磁盘使用情况检查,以及进程管理、文件系统信息、内存使用情况、交换分区状态等。通过这些工具和方法,用户可以深入理解并有效管理自己的计算机或操作系统。

Here's a list of commands, tips and info that I've compiled from several different sources. I use this as a quick reference when I need to find info about my computer or my operating system.

General System Info

Note: Most hardware info commands should be run as root. Some even show more info when run as root.

Run qtparted or GParted for hard drive and partition info!!!
Also, see KDiskFree. And fdisk -l for info on all partitions.

hardinfo - good report to run; also, check the Details tab.

Ko's Method For Getting A Hardware Report:
This report runs a series of reports, some of which are listed individually further on in this document.
Install through Synaptic the package installation-report.
Then run in a maximized konsole:
report-hw
or
report-hw > hwreport (Sends the output to a textfile called hwreport in your home folder)

sysinfo a nice graphical display, run it from a terminal.

hal-device-manager
kde-hal-device-manager

These packages can be installed from Synaptic. Use kde-hal-device-manager by clicking KMenu > System > Device Manager.

dmidecode -t memory (as root) The dmidecode tool dumps your system’s DMI (Desktop Management Interface) table contents in a human-readable format. This table contains information regarding system’s hardware components, as well as BIOS revisions etc. dmidecode output not only describes system current configuration, but also reports the BIOS limitations on supported CPU speed, Maximum Memory allowed and more.
dmidecode | less (as root) BIOS info and system info (space to page down, q to quit)

uname -a (info on your server)
uname -m machine number (i.e. - i686)
uname -r kernel version

lshw (as root) - list hardware; might want to run lshw | less (space to page-down, q to quit)
lshw-gtk (as root) - download this from Synaptic; it can be started from the terminal; click on any item for info; double click on the the items in bold to drill down; excellent front-end for lshw.

lsb_release -a (release info) (don't forget the underscore) (or see /etc/lsb_release)
***In Mepis Linux 6.5, this command returns:
No LSB modules are available.
Distributor ID: Ubuntu
Description: Ubuntu 6.06.1 LTS
Release: 6.06
Codename: dapper

In Mepis 6.5, one solution for finding the version that you're running is to go to take a look at the login screen.

lspci (as root) (controllers, etc.) (VERY good report; -v is verbose, -vv is very verbose
lspci -tv (as root) shows tree
lsusb, lsusb -tv - list usb devices
lsmod (at root, shows kernel modules currently loaded. Also try lsmod | less)

/proc - there's important info located in this directory! cd /proc, then ls; use cat to read the files in /proc such as cpuinfo, devices, filesystems, meminfo, partitions, swaps, uptime, version, etc.; also, you can cd into the subdirectories in /proc, for example cd driver.
Examples:
cat /proc/cpuinfo (or cat cpuinfo from inside /proc)
cat /proc/version (or cat verson from inside /proc) - version info
cat /proc/swaps (or cat swaps from inside /proc) will show info on each swap partition.

top - display Linux tasks, real-time; system summary info and a list of tasks currently being managed by the kernel - includes a live report on swap being used; type Shift-f to get sort options while running (default sort is k - CPU usage)

htop - even better than top; interactive process viewer can be used to kill processes.

ctrl-esc (from anywhere in KDE) - brings up the  ProcessTable

procinfo – procinfo is a small program that gathers some system information from diverse files under /proc and prints it to the screen. It duplicates some of the functionality of free(1) and uptime(1). This also includes lsdev for displaying information about installed hardware and socklist for displaying a list of open sockets.

Other Ways To List Processes:
ps aux
ps -e

swapon -s shows swap partitions and info
swapon -a makes all swap partitions available as indicated in /etc/fstab.

fdisk -l gives all partition info on hard disk(s).

/etc/fstab (the fstab file contains file system configuration information)

free (memory usage, in kilobytes.
free -m (memory usage, in MB).

ksysguard application and ksysguard tray applet both show memory usage

df -h (disk info about all mounted file systems, human-readable)
df -hT (disk info about all mounted file systems, human-readable, showing file system type)

du / -bh | more detailed diskusage for each subdirectory starting at root, human readable; use space to page down, q to quit.
du -s /var/log/* - displays space usage of all the files in /var/log

hdparm -t /dev/hda (as root) - display disk performance of hda

This shows what the cpu identifies itself as:
arch
 (but it could be wrong, see command below)
rpm --showrc| grep " arch" (if rpm is installed)

ifconfig -a – displays IP address and other info

Time Info Commands:
date
uptime


Package Info

apt-show-versions > InstalledPkgs (as root) - outputs the text file InstalledPkgs to your home directory. This shows all packages on your system. This list won't be alphabetized. You can copy and paste it into a spreadsheet and then sort it. You can download apt-show-versions with Synaptic. See man apt-show-versions for more info. Another option is to look at the installed packages in Synaptic.

ls /var/cache/apt/archives > AddedPkgs outputs the text file AddedPkgs to your home directory. This shows all of the packages that you've added to your system (unless you've deleted this info, or unless Synaptic has been set to delete it!). There's also a "partial" directory, so
ls /var/cache/apt/archives/partial > PartialPkgs to output a text file called PartialPkgs.

To get a package list sorted by size:
dpkg-query -W --showformat='${Installed-Size} ${Package}\n' | sort -n


Here's a section that I tacked on, just so I'd have a quick reference to some helpful bash commands.

Bash Info

echo $PATH show the content of the environmental variable named PATH
echo $?
 shows the exit code of the last command

help shows a list of shell builtin commands, and help name shows help on the command name; also, see the section on Shell Builtin Commands in man bash

whereis locates the binary, source, and manual page files for a command.

which returns the pathnames of the files which would be executed in the current environment, had its arguments been given as commands in a strictly POSIX-conformant shell. It does this by searching the PATH for executable files matching the names of the arguments. Note: In Mepis Linux, which is an alias for type -path. Although that command is not explicitly defined, try the command help type for more info on the type command. which=type -path may be the same as type -P. In practice, the whichcommand and the type -path command may be equivalent. To see the true which command in action in Mepis Linux, type"which" (use quotes) (or unalias which to permanently remove the alias).

type (name) indicates how it would be interpreted if used as a command name

alias shows a list of all aliases
unalias will remove an alias permanently
"command" quoting the command will run the "true" command (if it exists) instead of the alias

file guesses what type of file
file file
file -i file
 for more info
file -iz file for compressed files
file -s file for block or special character files

tree – list directory structure and content in a tree-like format; by default lists the contents of the directory that you're in.

cal - current month
cal -3 - last month, current month, and next month
cal [month] year - specify month, or month and year [examples: cal august 2007; cal 2006]

<think>我们正在处理一个关于如何获取存储卷的卷ID(Volume ID)的问题。根据之前的引用和常见系统管理知识,卷ID通常与磁盘签名或卷的唯一标识符相关。在Windows系统中,卷ID可以通过多种方式获取。 参考引用[2]中提到了磁盘签名(Signature)存储在注册表路径`SYSTEM\ControlSet00x\Enum\STORAGE\Volume\...`下。这表明我们可以通过注册表来获取卷ID。 另外,在Windows中,我们通常可以使用命令行工具来获取卷信息,例如: 1. 使用`diskpart`命令:运行`diskpart`,然后输入`list volume`,可以列出所有卷及其信息,包括卷号(Volume ###)和卷ID(Volume ID,通常显示为卷标Label,但实际唯一标识符是卷的GUID)。 2. 使用`wmic`命令:`wmic volume get DeviceID, Label` 可以获取卷的设备ID(即卷的GUID)和卷标。 3. 使用PowerShell:`Get-Volume`命令可以获取卷的详细信息,包括文件系统标签、驱动器号以及唯一的对象ID(ObjectId,通常是一个GUID)。 注意:卷ID通常指的是卷的GUID(全局唯一标识符),在Windows中,每个卷都有一个唯一的GUID。 因此,我们可以通过以下步骤获取卷ID: 方法1:使用Diskpart - 打开命令提示符(以管理员身份) - 输入`diskpart` - 在diskpart提示符下输入`list volume` - 查看列出的卷,但注意这里列出的“Volume ###”只是序号,并不是卷ID。实际上,diskpart的list volume并不直接显示卷的GUID。因此,我们可以使用另一种方法。 方法2:使用WMIC - 打开命令提示符 - 输入:`wmic volume get DeviceID, Label` - 输出中,DeviceID就是卷的GUID,格式类似于:`\\?\Volume{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}\` 方法3:使用PowerShell(推荐) - 打开PowerShell(以管理员身份) - 输入:`Get-Volume | Format-List` - 这将列出每个卷的详细信息,包括`UniqueId`(即卷的GUID)和`FileSystemLabel`(卷标)等。 - 或者,为了更简洁,可以输入:`Get-Volume | Select-Object DriveLetter, FileSystemLabel, UniqueId` 注意:UniqueId就是卷的GUID,也就是卷ID。 另外,如果我们需要在程序或脚本中使用卷ID,可以通过PowerShell命令获取,例如: ```powershell (Get-Volume -DriveLetter C).UniqueId ``` 这将返回C盘的卷ID。 总结:在Windows系统中,存储卷的卷ID(即唯一标识符)可以通过PowerShell的`Get-Volume`命令获取,其`UniqueId`属性就是卷的GUID。 相关问题: 1. 如何通过注册表获取Windows磁盘卷的签名? 2. 在Linux系统中如何获取存储卷的卷ID? 3. 卷ID和磁盘签名有什么区别?</think>### 获取存储卷卷ID的方法 在Windows系统中,存储卷的卷ID(Volume ID)通常指卷的唯一标识符(GUID)或磁盘签名(Disk Signature)。以下是几种常用方法: #### 方法1:通过PowerShell获取 ```powershell # 获取所有卷的GUID(推荐方法) Get-Volume | Format-List DriveLetter, FileSystemLabel, UniqueId # 示例输出: DriveLetter : C FileSystemLabel : System UniqueId : \\?\Volume{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}\ # 获取特定卷(如C盘)的GUID (Get-Volume -DriveLetter C).UniqueId ``` #### 方法2:通过磁盘管理工具 1. 按`Win+R`输入`diskmgmt.msc` 2. 右键目标卷 → "属性" → "卷"标签页 3. 在"卷序列号"字段查看标识符(非GUID,但可作为辅助标识) #### 方法3:通过注册表查询(需管理员权限) 1. 打开注册表:`regedit` 2. 导航路径: ``` HKEY_LOCAL_MACHINE\SYSTEM\MountedDevices ``` 3. 查找形如`\??\Volume{xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx}`的键值 #### 方法4:通过命令行工具 ```cmd :: 获取卷序列号(非唯一ID) vol C: :: 通过diskpart获取磁盘签名 diskpart list disk select disk 0 detail disk <-- 查看"磁盘ID"字段 ``` > **注意**: > - 卷ID通常指GUID格式的`Volume{...}`标识 > - 磁盘签名(Disk Signature)是存储在MBR/GPT中的4字节标识符[^2] > - 卷序列号(Volume Serial Number)是文件系统格式化时生成的随机值
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值