Linux CentOS查看硬件信息大全

简介: 今天总结一下在安全运维中对于硬件信息收集过程会用到的linux命令。演示环境:CentOS 71.CentOS常用命令查看 CPU[root@localhost ~]# more /proc/cpuinfo | grep "model name...

今天总结一下在安全运维中对于硬件信息收集过程会用到的linux命令。

演示环境:CentOS 7

1.CentOS常用命令查看 CPU

[root@localhost ~]# more /proc/cpuinfo | grep "model name"
model name  : Intel(R) Core(TM) i5-4210U CPU @ 1.70GHz
[root@localhost ~]# 

2.CentOS常用命令查看内存

[root@localhost ~]# free -m
              total        used        free      shared  buff/cache   available
Mem:            976         678          70           3         227          82
Swap:          2047           4        2043
[root@localhost ~]#

3.CentOS常用命令查看cpu是32位还是64位​

[root@localhost ~]# getconf LONG_BIT
64
[root@localhost ~]#

4.使用CentOS常用命令查看当前linux的版本​

[root@localhost ~]# cat /etc/redhat-release 
CentOS Linux release 7.4.1708 (Core) 
[root@localhost ~]#

5.使用CentOS常用命令查看内核版本​

[root@localhost ~]# uname -a
Linux localhost.localdomain 3.10.0-693.el7.x86_64 #1 SMP Tue Aug 22 21:09:27 UTC 2017 x86_64 x86_64 x86_64 GNU/Linux
[root@localhost ~]# uname -r
3.10.0-693.el7.x86_64
[root@localhost ~]# 

6.使用CentOS常用命令查看硬盘和分区​​

[root@localhost ~]# df -h
文件系统                 容量  已用  可用 已用% 挂载点
/dev/mapper/centos-root   17G  8.0G  9.1G   47% /
devtmpfs                 473M     0  473M    0% /dev
tmpfs                    489M     0  489M    0% /dev/shm
tmpfs                    489M  7.2M  482M    2% /run
tmpfs                    489M     0  489M    0% /sys/fs/cgroup
/dev/sda1               1014M  161M  854M   16% /boot
tmpfs                     98M  4.0K   98M    1% /run/user/42
tmpfs                     98M   36K   98M    1% /run/user/0
/dev/sr0                 4.3G  4.3G     0  100% /run/media/root/CentOS 7 x86_64
[root@localhost ~]#

7.使用CentOS常用命令查看selinux情况​

[root@localhost ~]# sestatus 
SELinux status:                 enabled
SELinuxfs mount:                /sys/fs/selinux
SELinux root directory:         /etc/selinux
Loaded policy name:             targeted
Current mode:                   enforcing
Mode from config file:          enforcing
Policy MLS status:              enabled
Policy deny_unknown status:     allowed
Max kernel policy version:      28
[root@localhost ~]# 

8.查看IP地址

[root@localhost ~]# ifconfig

9.使用CentOS常用命令查看所属时区和是否使用UTC时间

  • CentOS 7查看方法:
[root@localhost ~]# timedatectl 
      Local time: 三 2018-10-03 17:17:22 UTC
  Universal time: 三 2018-10-03 17:17:22 UTC
        RTC time: 三 2018-10-03 17:17:22
       Time zone: Universal (UTC, +0000)
     NTP enabled: no
NTP synchronized: no
 RTC in local TZ: no
      DST active: n/a
[root@localhost ~]# date 
2018年 10月 03日 星期三 17:17:39 UTC
[root@localhost ~]# timedatectl set-timezone Asia/Shanghai
[root@localhost ~]# timedatectl 
      Local time: 四 2018-10-04 01:18:46 CST
  Universal time: 三 2018-10-03 17:18:46 UTC
        RTC time: 三 2018-10-03 17:18:46
       Time zone: Asia/Shanghai (CST, +0800)
     NTP enabled: no
NTP synchronized: no
 RTC in local TZ: no
      DST active: n/a
[root@localhost ~]# date 
2018年 10月 04日 星期四 01:20:02 CST
[root@localhost ~]# rm -rf /etc/localtime 
[root@localhost ~]# ln -s /usr/share/zoneinfo/Universal /etc/localtime
[root@localhost ~]# timedatectl 
      Local time: 三 2018-10-03 17:22:44 UTC
  Universal time: 三 2018-10-03 17:22:44 UTC
        RTC time: 三 2018-10-03 17:22:43
       Time zone: Universal (UTC, +0000)
     NTP enabled: no
NTP synchronized: no
 RTC in local TZ: no
      DST active: n/a
[root@localhost ~]# date 
2018年 10月 03日 星期三 17:22:51 UTC
[root@localhost ~]# 
  • CentOS 6查看方法:
# cat /etc/sysconfig/clock

10.使用CentOS常用命令查看主机名​

[root@localhost ~]# hostname
localhost.localdomain
[root@localhost ~]# 

11.使用CentOS常用命令查看开机运行时间

[root@localhost ~]# uptime 
 16:49:14 up  2:22,  2 users,  load average: 0.00, 0.01, 0.05
[root@localhost ~]# 

12.查看主板信息

[root@localhost ~]# dmidecode | more
# dmidecode 3.0
Getting SMBIOS data from sysfs.
SMBIOS 2.7 present.
620 structures occupying 29060 bytes.
Table at 0x000E0010.

Handle 0x0000, DMI type 0, 24 bytes
BIOS Information
    Vendor: Phoenix Technologies LTD
    Version: 6.00
    Release Date: 05/19/2017
    Address: 0xEA520
    Runtime Size: 88800 bytes
    ROM Size: 64 kB
    Characteristics:
        ISA is supported
        PCI is supported
        PC Card (PCMCIA) is supported
        PNP is supported
        APM is supported
        BIOS is upgradeable
        BIOS shadowing is allowed
        ESCD support is available
        Boot from CD is supported
        Selectable boot is supported
        EDD is supported
        Print screen service is supported (int 5h)
        8042 keyboard services are supported (int 9h)
        Serial services are supported (int 14h)
        Printer services are supported (int 17h)
        CGA/mono video services are supported (int 10h)
        ACPI is supported
        Smart battery is supported
        BIOS boot specification is supported
        Function key-initiated network boot is supported
        Targeted content distribution is supported
--More--

13.查看磁盘使用情况

[root@localhost ~]# fdisk -l

磁盘 /dev/sda:21.5 GB, 21474836480 字节,41943040 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节
磁盘标签类型:dos
磁盘标识符:0x000d1bd6

   设备 Boot      Start         End      Blocks   Id  System
/dev/sda1   *        2048     2099199     1048576   83  Linux
/dev/sda2         2099200    41943039    19921920   8e  Linux LVM

磁盘 /dev/mapper/centos-root:18.2 GB, 18249416704 字节,35643392 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节


磁盘 /dev/mapper/centos-swap:2147 MB, 2147483648 字节,4194304 个扇区
Units = 扇区 of 1 * 512 = 512 bytes
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节

[root@localhost ~]# 
目录
相关文章
|
1月前
|
Linux 网络安全 Python
linux centos上安装python3.11.x详细完整教程
这篇文章提供了在CentOS系统上安装Python 3.11.x版本的详细步骤,包括下载、解压、安装依赖、编译配置、解决常见错误以及版本验证。
388 1
linux centos上安装python3.11.x详细完整教程
|
2月前
|
安全 Linux
Linux Centos通过mail向QQ邮箱发邮件
【8月更文挑战第20天】在 CentOS 上配置使用 `mail` 命令向 QQ 邮箱发送邮件涉及几个步骤。首先确保已安装 `mailx`;接着编辑 `/etc/mail.rc` 文件来配置发件信息,包括设置发件邮箱、SMTP 服务器及授权码。最后,通过 `echo` 命令结合 `mail` 发送邮件。需登录 QQ 邮箱开启 SMTP 服务并获取授权码用于安全验证。
132 3
|
2月前
|
安全 关系型数据库 MySQL
Linux(CentOS6)安装MySQL5.6
Linux(CentOS 6)系统上安装MySQL 5.6版本的详细步骤,包括准备数据存放目录、创建用户、下载安装包、初始化数据库、配置服务脚本、设置环境变量等操作。
256 1
|
5天前
|
Linux 网络安全 数据安全/隐私保护
Linux系统之Centos7安装cockpit图形管理界面
【10月更文挑战第12天】Linux系统之Centos7安装cockpit图形管理界面
24 1
Linux系统之Centos7安装cockpit图形管理界面
|
11天前
|
Web App开发 网络协议 Linux
linux命令总结(centos):shell常用命令汇总,平时用不到,用到就懵逼忘了,于是专门写了这篇论文,【便持续更新】
这篇文章是关于Linux命令的总结,涵盖了从基础操作到网络配置等多个方面的命令及其使用方法。
36 1
linux命令总结(centos):shell常用命令汇总,平时用不到,用到就懵逼忘了,于是专门写了这篇论文,【便持续更新】
|
18天前
|
Linux Docker 容器
Centos安装docker(linux安装docker)——超详细小白可操作手把手教程,包好用!!!
本篇博客重在讲解Centos安装docker,经博主多次在不同服务器上测试,极其的稳定,尤其是阿里的服务器,一路复制命令畅通无阻。
114 4
Centos安装docker(linux安装docker)——超详细小白可操作手把手教程,包好用!!!
|
5天前
|
存储 网络协议 Linux
AWS实操-EC2-创建购买linux(centos)EC2服务器
AWS实操-EC2-创建购买linux(centos)EC2服务器
|
1月前
|
NoSQL Linux Redis
linux之centos安装redis
linux之centos安装redis
|
1月前
|
Linux Python
Linux之centos安装clinkhouse以及python如何连接
Linux之centos安装clinkhouse以及python如何连接
|
1月前
|
Linux
linux之centos安装dataease数据报表工具
linux之centos安装dataease数据报表工具