linux收集系统日志命令_Linux命令收集系统和硬件信息

linux收集系统日志命令

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 Operating System
Print Operating System
打印操作系统

打印主机名(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 Host name
Print Hostname
打印主机名

印刷建筑(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
Print Architecture
Print Architecture
印刷建筑

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
Print Kernel Information
Print Kernel Information
打印内核信息

列出所有硬件(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 All Hardware
List All Hardware
列出所有硬件

将硬件列为表格(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
List Hardware As Table
List Hardware As Table
将硬件列为表格

列出硬件到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
List Hardware To Html
List Hardware To Html
列出硬件到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 CPU Information
Print CPU Information
打印CPU信息

打印块设备/磁盘信息(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
Print Block Device/Disk Information
Print Block Device/Disk Information
打印块设备/磁盘信息

打印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
Print USB Information
Print USB Information
打印USB信息

打印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
Print PCI Information
Print PCI Information
打印PCI信息

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总线连接。

LEARN MORE  Atop Command Tutorial With Examples To Monitor Linux System Metrics
在命令教程的顶部获得更多信息,并附带监​​视Linux系统指标的示例

打印详细的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
Print Detailed PCI Information
Print Detailed PCI Information
打印详细的PCI信息

打印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 SATA/Disk Information
Print SATA/Disk Information
打印SATA /磁盘信息

打印文件系统信息(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
Print File System Information
Print File System Information
打印文件系统信息

We can see that the following information is provided with the fdisk command.

我们可以看到fdisk命令提供了以下信息。

  • Units

    单位
  • Sector Size

    行业规模
  • I/O Size

    I / 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 BIOS Information
Print BIOS Information
打印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
Print Chassis Information
Print Chassis Information
打印机箱信息

翻译自: https://www.poftut.com/linux-commands-collect-system-hardware-information/

linux收集系统日志命令

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值