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 ~]# 
目录
相关文章
|
30天前
|
安全 Linux
Linux Centos通过mail向QQ邮箱发邮件
【8月更文挑战第20天】在 CentOS 上配置使用 `mail` 命令向 QQ 邮箱发送邮件涉及几个步骤。首先确保已安装 `mailx`;接着编辑 `/etc/mail.rc` 文件来配置发件信息,包括设置发件邮箱、SMTP 服务器及授权码。最后,通过 `echo` 命令结合 `mail` 发送邮件。需登录 QQ 邮箱开启 SMTP 服务并获取授权码用于安全验证。
|
30天前
|
安全 关系型数据库 MySQL
Linux(CentOS6)安装MySQL5.6
Linux(CentOS 6)系统上安装MySQL 5.6版本的详细步骤,包括准备数据存放目录、创建用户、下载安装包、初始化数据库、配置服务脚本、设置环境变量等操作。
99 1
|
1月前
|
Ubuntu 网络协议 Linux
【附安装包】CentOS7(Linux)详细安装教程(手把手图文详解版)
【附安装包】CentOS7(Linux)详细安装教程(手把手图文详解版)
199 2
|
1月前
|
Linux C语言
成功解决 在Linux CentOS 7 中安装gcc
这篇文章介绍了如何在Linux CentOS 7系统中安装gcc (g++) 8工具集。由于CentOS 7默认的gcc版本是4.8,而这个版本与Qt 5.14、Qt 5.15或更高版本不兼容,可能会导致编译时出现系统头文件错误。文章中提到,即使在项目配置中添加了`CONFIG+=c++11`,如果仍然报错,那么很可能是gcc版本的问题。为了解决这个问题,文章提供了使用CentOS的Software Collections (scl)来安装更新版本的gcc的步骤。
成功解决 在Linux CentOS 7 中安装gcc
|
25天前
|
Linux PHP
Linux CentOS 宝塔 Suhosin禁用php5.6版本eval函数详细图文教程
【8月更文挑战第27天】本文介绍两种禁用PHP执行的方法:使用`PHP_diseval_extension`禁用和通过`suhosin`禁用。由于`suhosin`不支持PHP8,仅适用于PHP7及以下版本,若服务器安装了PHP5.6,则需对应安装`suhosin-0.9.38`版本。文章提供了详细的安装步骤,并强调了宝塔环境下与普通环境下的PHP路径差异。安装完成后,在`php.ini`中添加`suhosin.so`扩展并设置`executor.disable_eval = on`以禁用执行功能。最后通过测试代码验证是否成功禁用,并重启`php-fpm`服务生效。
18 2
|
29天前
|
关系型数据库 MySQL Linux
Linux(CentOS7)搭建LAMP服务环境
本文介绍了在Linux (CentOS 7) 上搭建LAMP服务环境的详细步骤,包括安装Apache HTTPd、解决编译时依赖问题、配置Apache服务、安装PHP以及处理PHP与Apache集成时遇到的问题。同时,还涉及了防火墙设置和SELinux权限调整,确保Web服务能够正常运行。
47 2
|
1月前
|
关系型数据库 MySQL Linux
在CentOs7虚拟机Linux离线安装mysql5.6(亲测可用)
该博客文章详细记录了在CentOS 7虚拟机上离线安装MySQL 5.6版本的完整过程,包括下载安装包、导入虚拟机、卸载MariaDB、配置文件设置、服务启动和权限配置等步骤。
在CentOs7虚拟机Linux离线安装mysql5.6(亲测可用)
|
1月前
|
Web App开发 缓存 Ubuntu
Linux中yum、rpm、apt-get、wget的区别,yum、rpm、apt-get常用命令,CentOS、Ubuntu中安装wget
Linux中yum、rpm、apt-get、wget的区别,yum、rpm、apt-get常用命令,CentOS、Ubuntu中安装wget
122 11
|
19天前
|
Linux
centos linux内核下载
centos linux内核下载