
linux收集系统日志命令
Getting information about system and hardware is important part of System Administration job. There are a lot of different tools that provide information about system and hardware. In this post, we will look at how to get CPU, memory, disk, bus, USB, disk … information simple from a Linux system.
获取有关系统和硬件的信息是系统管理工作的重要部分。 有许多不同的工具可提供有关系统和硬件的信息。 在本文中,我们将研究如何从Linux系统简单地获取CPU,内存,磁盘,总线,USB,磁盘……信息。
打印操作系统 (Print Operating System)
Linux system administrators generally work a different type of Operating systems which are similar to Linux. To get detailed operation system information like Unix, BSD, etc. uname
command can be used.
Linux系统管理员通常使用与Linux类似的不同类型的操作系统。 要获取详细的操作系统信息(例如Unix,BSD等),请使用uname
命令可以使用。
$ uname

打印主机名(Print Hostname)
The hostname is used for the system to identify and name them. Displaying or printing hostname can be done in different ways.
主机名用于系统识别和命名它们。 显示或打印主机名的方法可以不同。
$ hostname
OR
要么
$ uname -n

印刷建筑(Print Architecture)
Computer architecture is generally related with CPU running on the system. There is a different type of CPU’s used in server hardware like x86, Arm, PowerPC, etc.
计算机体系结构通常与系统上运行的CPU有关。 服务器硬件(例如x86,Arm,PowerPC等)中使用的CPU类型不同。
$ uname -m

In this situation, our system is x86 and 64-bit operating system.
在这种情况下,我们的系统是x86和64位操作系统。
打印内核信息 (Print Kernel Information)
The kernel is the core of an operating system. There are different kernel used in Unix like operating systems. Other than Linux, BSD, Solaris are alternative kernels.
内核是操作系统的核心。 像操作系统一样,Unix中使用了不同的内核。 除Linux外,BSD,Solaris是替代内核。
$ uname -r

列出所有硬件(List All Hardware)
To get a fast and furious way about the all hardware lshw
command can be used. This command requires root privileges to probe in detail.
快速而疯狂地了解所有硬件lshw
命令可以使用。 此命令需要root特权才能详细探测。
$ sudo lshw

将硬件列为表格(List Hardware As Table)
The previous output maybe seems a bit untidy. The alternative is sorting the output of lshw
command.
先前的输出似乎有点不整洁。 替代方法是对lshw
的输出进行lshw
命令。
$ sudo lshw -short

列出硬件到HTML(List Hardware To Html)
While working with command-line interface bash and related tools are useful. But if we want to get information in HTML form lshw
provides HTML web page output for the list of hardware.
在使用命令行界面时,bash和相关工具非常有用。 但是,如果我们想获取HTML形式的信息lshw
提供硬件列表HTML Web页面输出。
$ sudo lshw -html > systeminformation.html

打印CPU信息 (Print CPU Information)
CPU related information is important. The performance and capabilities can get from CPU information. CPU’s, core, CPU family, CPU cache, threads, supported instruction sets, hypervisor vendor, virtualization type CPU frequency and speed information can get with the following command.
CPU相关信息很重要。 性能和功能可以从CPU信息中获得。 CPU,内核,CPU系列,CPU缓存,线程,受支持的指令集,虚拟机监控程序供应商,虚拟化类型的CPU频率和速度信息可通过以下命令获取。
$ lscpu

打印块设备/磁盘信息(Print Block Device/Disk Information)
Installed disks can get with lsblk
command. lsblk command will provide information about name, major, minor numbers size, read-write status, type and mount point of currently installed disk devices.
lsblk
可以安装磁盘 命令。 lsblk命令将提供有关名称,主要,次要数字大小,读写状态,当前安装的磁盘设备的类型和安装点的信息。
$ lsblk

打印USB信息(Print USB Information)
USB provides a flexible way to connect devices to the computers. To list USB controllers and connected devices to a Linux system following command can be used. Also, USB devices manufacturer and memory address ranges can be learned with this command.
USB提供了一种将设备连接到计算机的灵活方式。 要列出USB控制器和连接到Linux系统的设备,可以使用以下命令。 同样,可以使用此命令了解USB设备制造商和内存地址范围。
$ lsusb

打印PCI信息(Print PCI Information)
PCI is the main way to connect different type high data rate devices like graphics cards, network adapters, USB ports, etc. PCI bus connected devices can be listed with lspci
PCI是连接不同类型的高数据速率设备(如图形卡,网络适配器,USB端口等)的主要方式。与PCI总线连接的设备可以用lspci
列出。
$ lspci

From this output, we can see that Intel USB controllers are connected to the PCI. QXL graphic controller and Virtio Ethernet controller are also connected from this PCI bus.
从此输出中,我们可以看到Intel USB控制器已连接到PCI。 QXL图形控制器和Virtio以太网控制器也通过此PCI总线连接。
打印详细的PCI信息(Print Detailed PCI Information)
By using previous lspci
command with the -v
parameter more detailed information about the PCI devices can get like below.
通过使用以前的lspci
用-v
命令 参数有关PCI设备的更多详细信息,如下所示。
$ lspci -v

打印SCSI信息(Print SCSI Information)
SCSI is another popular BUS used to connect different type of devices to the Linux systems. SCSI interface devices are pricier than PCI because they are generally used in enterprise server hardware. SCSI information similar to the PCI can be listed with the following command.
SCSI是另一种流行的BUS,用于将不同类型的设备连接到Linux系统。 SCSI接口设备比PCI价格高,因为它们通常用于企业服务器硬件中。 可以使用以下命令列出类似于PCI的SCSI信息。
$ lsscsi
打印SATA /磁盘信息 (Print SATA/Disk Information)
Disk device information can get with the hdparm
command like below.
磁盘设备信息可以通过hdparm
获得 命令如下。
$ sudo hdparm /dev/sda

打印文件系统信息(Print File System Information)
File system information can be gathered by using fdisk
command. Although fdisk
can be used for creating partitions, file systems and other disk-related media also provides file system information with the -l
parameter.
可以使用fdisk
命令收集文件系统信息。 虽然fdisk
可以用于创建分区,文件系统和其他与磁盘相关的介质,还提供带有-l
文件系统信息 参数。
$ sudo fdisk -l

We can see that the following information is provided with the fdisk command.
我们可以看到fdisk命令提供了以下信息。
- Units 单位
- Sector Size行业规模
- I/O SizeI / O大小
- Disklabel type磁盘标签类型
- Disk identifier磁盘标识符
- Device name设备名称
- Boot Enabled启动已启用
- Start Sector Number起始扇区号
- End Sector Number终端部门编号
- Size in human-readable format可读格式的大小
- Partition type id分区类型ID
- Type name 类型名称
打印BIOS信息(Print BIOS Information)
Bios is the first operating system when the computer starts. It is a very basic operating system which provides a baseline for real operating systems like Linux. BIOS provide wealth information about the hardware and itself. This information can get with the following command.
当计算机启动时,BIOS是第一个操作系统。 这是一个非常基本的操作系统,为诸如Linux之类的实际操作系统提供了基准。 BIOS提供有关硬件及其本身的丰富信息。 此信息可以通过以下命令获得。
$ sudo dmidecode -t bios

打印机箱信息(Print Chassis Information)
Chassis is the mainboard and related part of a system. Enterprise server hardware manufacturers put details into its chassis like serial number, model, etc. This information can get with the following command.
机箱是主板和系统的相关部分。 企业服务器硬件制造商在其机架中放入了详细信息,例如序列号,型号等。此信息可通过以下命令获得。
$ sudo dmidecode -t system

翻译自: https://www.poftut.com/linux-commands-collect-system-hardware-information/
linux收集系统日志命令