在 CentOS 7(Linux)上初始化查询、文件操作、系统信息查询
一、查看系统信息
命令实在是不要太多,为了防止选择性障碍,一致选择第一种方式,后面的仅作为补充。
方法1:
[root@centos001 ~]# uname -a
Linux centos001 3.10.0-957.5.1.el7.x86_64 #1 SMP Fri Feb 1 14:54:57 UTC 2019 x86_64 x86_64 x86_64 GNU/Linux
方法2:显示系统程序信息
[root@centos001 ~]# file /bin/ls /bin/ls: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2.6.32,
BuildID[sha1]=ceaf496f3aec08afced234f4f36330d3d13a657b, stripped
方法3:
[root@centos001 ~]# cat /proc/version Linux version 3.10.0-957.5.1.el7.x86_64 (mockbuild@kbuilder.bsys.centos.org) (gcc version 4.8.5 20150623 (Red Hat 4.8.5-36) (GCC) ) #1 SMP Fri Feb 1 14:54:57 UTC 2019
二、查看系统版本
方法1:
[root@centos001 ~]# lsb_release -a LSB Version: :core-4.1-amd64:core-4.1-noarch Distributor ID: CentOS Description: CentOS Linux release 7.6.1810 (Core) Release: 7.6.1810 Codename: Core
方法2:
[root@centos001 ~]# cat /etc/os-release NAME="CentOS Linux" VERSION="7 (Core)" ID="centos" ID_LIKE="rhel fedora" VERSION_ID="7" PRETTY_NAME="CentOS Linux 7 (Core)" ANSI_COLOR="0;31" CPE_NAME="cpe:/o:centos:centos:7" HOME_URL="https://www.centos.org/" BUG_REPORT_URL="https://bugs.centos.org/" CENTOS_MANTISBT_PROJECT="CentOS-7" CENTOS_MANTISBT_PROJECT_VERSION="7" REDHAT_SUPPORT_PRODUCT="centos" REDHAT_SUPPORT_PRODUCT_VERSION="7"
方法3:
[root@centos001 ~]# cat /etc/redhat-release CentOS Linux release 7.6.1810 (Core)
方法4:
[root@centos001 ~]# rpm -q centos-release centos-release-7-6.1810.2.el7.centos.x86_64
三、查看安装软件
方法1:
[root@centos001 ~]# yum list installed Loaded plugins: fastestmirror Determining fastest mirrors base | 3.6 kB 00:00:00 epel | 4.7 kB 00:00:00 extras | 3.4 kB 00:00:00 updates | 3.4 kB 00:00:00 (1/7): epel/x86_64/group_gz | 88 kB 00:00:00 (2/7): base/7/x86_64/group_gz | 166 kB 00:00:00 (3/7): epel/x86_64/updateinfo | 994 kB 00:00:00 (4/7): extras/7/x86_64/primary_db | 201 kB 00:00:00 (5/7): base/7/x86_64/primary_db | 6.0 MB 00:00:00 (6/7): epel/x86_64/primary_db | 6.7 MB 00:00:00 (7/7): updates/7/x86_64/primary_db | 4.2 MB 00:00:00 Installed Packages GeoIP.x86_64 1.5.0-13.el7 @anaconda NetworkManager.x86_64 1:1.12.0-8.el7_6 @updates NetworkManager-libnm.x86_64 1:1.12.0-8.el7_6 @updates

更多精彩