03 开始使用openEuler操作系统

03 开始使用openEuler操作系统

3.1 目标

开始使用openEuler操作系统,能够区分GUI与CLI、学习Linux的两种登录方式、了解登录界面各项参数的含义、使用了解shell以及一些基础的快捷键、使用命令查看基本的系统信息。

3.2 Linux以及openEuler中的GUI与CLI

  • GUI(Graphical User Interface,图形用户界面),可以让用户使用鼠标作为输入工具,来进行各项操作。
  • CLI(Command Line Interface,命令行界面),用户界面字符化,用户可以使用键盘作为输入工具,来使用命令进行各项操作。
  • openEuler目前默认没有GUI界面,使用bash shell作为默认shell的CLI环境。
  • openEuler支持安装UKUI、DDE、XFCE、GNOME的GUI环境。

3.3 Linux的两种登录方式

3.3.1 本地登录

  • 控制台打开显示器,便可在本地输入账号密码进行登录。(**注意:**Linux在输入密码时为不显示状态,这属于正常情况)。
  • 对于没有启用或者安装GUI的,我们可以使用Ctrl+Alt+F[1-6]在1-6号虚拟控制台进行切换(默认登录为1号控制台)。
  • 对于安装了GUI的操作系统,1号控制台为用户选择界面,2号控制台为GUI桌面,3-6号为4个CLI虚拟控制台,一样可以使用Ctrl+Alt+F[1-6]进行切换。

3.3.2 远程登陆

  • openEuler等诸多linux都支持ssh的远程登陆,当然也可以关闭。

  • 在SecureCRT、Xshell、PuTTY及各种linux cli使用”ssh username@ip/主机名/域名(其中“/”为或的关系,如果要使用主机名,则要保证hosts文件中有定义,如果要使用域名进行登录,则要保证域名解析可达)。

  • 远程登陆端口默认为22,如果有做修改,在linux中可以使用”ssh username@ip/主机名/域名 -p 端口号”来进行登录。

  • 一些系统为了增强远程登陆的系统安全性,会不允许使用账号以及密码进行登陆,而使用公钥进行身份验证,当设置密钥配对成功时,则不需要密码便可以登陆成功。

3.4 退出登录(注销)

  • 值得注意的是,不管是远程登陆还是本地登录想要退出当前登录时,我们可以使用 exit 或者 Ctrl+d 进行退出。

3.5 openEuler登录界面参数解析

Authorized users only. All activities may be monitored and reported.

Authorized users only. All activities may be monitored and reported.
Activate the web console with: systemctl enable --now cockpit.socket

Last login: Mon Nov 28 22:28:57 2022


Welcome to 5.10.0-60.18.0.50.oe2203.x86_64

System information as of time:  2022年 11月 28日 星期一 22:33:35 CST

System load:    0.00
Processes:      153
Memory used:    8.5%
Swap used:      0%
Usage On:       7%
IP address:     192.168.0.21
IP address:     192.168.122.1
Users online:   2


[root@scfuture-21 ~]#
  • System load为系统最近1分钟的平均负载(越接近n代表负载越高,n代表操作系统cpu的核数);

  • Processes代表正在跑的进程数量;

  • Memory used代表内存使用量的百分比;

  • Swap used 代表Swap交换分区使用量的百分比;

  • Usage On代表了根分区的使用率;

  • IP address代表当前ip地址;

  • Users online代表当前连接的用户数。

此开机脚本被定义在/etc/profile.d/system-info.sh中。

[root@scfuture-21 ~]# cat /etc/profile.d/system-info.sh
#/bin/bash
#Copyright (c) [2019] Huawei Technologies Co., Ltd.
#generic-release is licensed under the Mulan PSL v2.
#You can use this software according to the terms and conditions of the Mulan PSL v2.
#You may obtain a copy of Mulan PSL v2 at:
#     http://license.coscl.org.cn/MulanPSL2
#THIS SOFTWARE IS PROVIDED ON AN "AS IS" BASIS, WITHOUT WARRANTIES OF ANY KIND, EITHER EXPRESS OR
#IMPLIED, INCLUDING BUT NOT LIMITED TO NON-INFRINGEMENT, MERCHANTABILITY OR FIT FOR A PARTICULAR
#PURPOSE.
#See the Mulan PSL v2 for more details.

# Welcome
welcome=$(uname -r)

# Memory
memory_total=$(cat /proc/meminfo | awk '/^MemTotal:/ {printf($2)}')
memory_free=$(cat /proc/meminfo | awk '/^MemFree:/ { printf($2)}')
buffers=$(cat /proc/meminfo | awk '/^Buffers:/ { printf($2)}')
cached=$(cat /proc/meminfo | awk '/^Cached:/ { printf($2)}')
sreclaimable=$(cat /proc/meminfo | awk '/^SReclaimable:/ { printf($2)}')
swap_total=$(cat /proc/meminfo | awk '/^SwapTotal:/ { printf($2)}')
swap_free=$(cat /proc/meminfo | awk '/^SwapFree:/ { printf($2)}')


if [ $memory_total -gt 0 ]
then
    memory_usage=`echo "scale=1; ($memory_total - $memory_free - $buffers - $cached - $sreclaimable) * 100.0 / $memory_total" |bc`
    memory_usage="$1.19MB%"
else
    memory_usage=0.0%
fi

# Swap memory
if [ $swap_total -gt 0 ]
then
    swap_mem=`echo "scale=1; ($swap_total - $swap_free) * 100.0 / $swap_total" |bc`
    swap_mem="${swap_mem}%"
else
    swap_mem=0.0%
fi

# Usage
usageof=$(df -h / | awk '/// {print $(NF-1)}')

# System load
load_average=$(awk '{print $1}' /proc/loadavg)

# WHO I AM
whoiam=$(whoami)

# Time
time_cur=$(date)

# Processes
processes=$(ps aux | wc -l)

# Users
user_num=$(users | wc -w)

# Ip address
ip_pre=""
if [ -x "/sbin/ip" ]
then
    ip_pre=$(/sbin/ip a | grep inet | grep -v "127.0.0.1" | grep -v inet6 | awk '{print $2}')
fi

echo -e "n"
echo -e "Welcome to $welcomen"
echo -e "System information as of time: t$time_curn"
echo -e "System load: t33[0;33;40m$load_average33[0m"
echo -e "Processes: t$processes"
echo -e "Memory used: t$memory_usage"
echo -e "Swap used: t$swap_mem"
echo -e "Usage On: t$usageof"
for line in $ip_pre
do
    ip_address=${line%/*}
    echo -e "IP address: t$ip_address"
done
echo -e "Users online: t$user_num"
if [ "$whoiam" == "root" ]
then
    echo -e "n"
else
    echo -e "To run a command as administrator(user "root"),use "sudo <command>"."
fi

[root@scfuture-21 ~]# 

3.6 Shell以及openEuler中Shell的简介

  • Shell是一种c语言编写的命令解释程序。

  • 常见的Shell有bash、sh、csh、ksh,通常可以通过输入shell名来切换不同shell,并可以使用exit命令退回原来的shell。

[root@scfuture-21 ~]# sh
sh-5.1# exit
exit
[root@scfuture-21 ~]# 
  • openEuler默认的shell为bash。
[root@scfuture-21 ~]# echo $SHELL
/bin/bash
[root@scfuture-21 ~]# 
  • 值得一提的是,bash shell率先实现了许多高级功能,如tab补全、文件夹&可执行文件高亮等,故一般linux均采用bash为默认shell。同时bash解释程序也足够轻量,只有1.2mb左右。
[root@scfuture-21 ~]# ll -h /bin/bash
-rwxr-xr-x. 1 root root 1.2M 12月  2  2021 /bin/bash
[root@scfuture-21 ~]# 
  • Shell的默认系统提示符为:[username@hostname current_directory]# 或者[username@hostname current_directory]$ (注意,#代表超级用户,KaTeX parse error: Expected 'EOF', got '#' at position 20: …用户,判断是否为超级用户可以从#̲还是来判断,不能使用用户名判断!)。
[root@scfuture-21 ~]# 
[root@scfuture-21 ~]# su - superman


Welcome to 5.10.0-60.18.0.50.oe2203.x86_64

System information as of time:  2022年 11月 28日 星期一 22:40:19 CST

System load:    0.00
Processes:      151
Memory used:    8.6%
Swap used:      0%
Usage On:       7%
IP address:     192.168.0.21
IP address:     192.168.122.1
Users online:   2
To run a command as administrator(user "root"),use "sudo <command>".
[superman@scfuture-21 ~]$

3.7 使用命令查看基本的系统信息

  • 查看系统信息,命令如下:
# cat /etc/os-release

例如,命令和输出如下:

[root@scfuture-21 ~]# cat /etc/os-release
NAME="openEuler"
VERSION="22.03 LTS"
ID="openEuler"
VERSION_ID="22.03"
PRETTY_NAME="openEuler 22.03 LTS"
ANSI_COLOR="0;31"

[root@scfuture-21 ~]# 
  • 查看CPU信息,命令如下:

方法一:

[root@scfuture-21 ~]# lscpu
架构:                   x86_64
  CPU 运行模式:         32-bit, 64-bit
  Address sizes:         45 bits physical, 48 bits virtual
  字节序:               Little Endian
CPU:                     2
  在线 CPU 列表:        0,1
厂商 ID:                GenuineIntel
  BIOS Vendor ID:        GenuineIntel
  型号名称:             Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz
    BIOS Model name:     Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz
    CPU 系列:           6
    型号:               142
    每个核的线程数:     1
    每个座的核数:       2
    座:                 1
    步进:               10
    BogoMIPS:           3600.00
    标记:               fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp
                          lm constant_tsc arch_perfmon nopl xtopology tsc_reliable nonstop_tsc cpuid pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2api
                         c movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch invpcid_single pti ssbd ibrs ibp
                         b stibp fsgsbase tsc_adjust bmi1 avx2 smep bmi2 invpcid rdseed adx smap clflushopt xsaveopt xsavec xgetbv1 xsaves arat md_clear f
                         lush_l1d arch_capabilities
Virtualization features: 
  超管理器厂商:         VMware
  虚拟化类型:           完全
Caches (sum of all):     
  L1d:                   64 KiB (2 instances)
  L1i:                   64 KiB (2 instances)
  L2:                    512 KiB (2 instances)
  L3:                    6 MiB (1 instance)
NUMA:                    
  NUMA 节点:            1
  NUMA 节点0 CPU:       0,1
Vulnerabilities:         
  Itlb multihit:         KVM: Mitigation: VMX unsupported
  L1tf:                  Mitigation; PTE Inversion
  Mds:                   Mitigation; Clear CPU buffers; SMT Host state unknown
  Meltdown:              Mitigation; PTI
  Spec store bypass:     Mitigation; Speculative Store Bypass disabled via prctl and seccomp
  Spectre v1:            Mitigation; usercopy/swapgs barriers and __user pointer sanitization
  Spectre v2:            Mitigation; Full generic retpoline, IBPB conditional, IBRS_FW, STIBP disabled, RSB filling
  Srbds:                 Unknown: Dependent on hypervisor status
  Tsx async abort:       Not affected
[root@scfuture-21 ~]#

方法二:

[root@scfuture-21 ~]# cat /proc/cpuinfo 
processor       : 0
vendor_id       : GenuineIntel
cpu family      : 6
model           : 142
model name      : Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz
stepping        : 10
microcode       : 0xca
cpu MHz         : 1800.003
cache size      : 6144 KB
physical id     : 0
siblings        : 2
core id         : 0
cpu cores       : 2
apicid          : 0
initial apicid  : 0
fpu             : yes
fpu_exception   : yes
cpuid level     : 22
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon nopl xtopology tsc_reliable nonstop_tsc cpuid pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch invpcid_single pti ssbd ibrs ibpb stibp fsgsbase tsc_adjust bmi1 avx2 smep bmi2 invpcid rdseed adx smap clflushopt xsaveopt xsavec xgetbv1 xsaves arat md_clear flush_l1d arch_capabilities
bugs            : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs itlb_multihit srbds
bogomips        : 3600.00
clflush size    : 64
cache_alignment : 64
address sizes   : 45 bits physical, 48 bits virtual
power management:

processor       : 1
vendor_id       : GenuineIntel
cpu family      : 6
model           : 142
model name      : Intel(R) Core(TM) i5-8250U CPU @ 1.60GHz
stepping        : 10
microcode       : 0xca
cpu MHz         : 1800.003
cache size      : 6144 KB
physical id     : 0
siblings        : 2
core id         : 1
cpu cores       : 2
apicid          : 1
initial apicid  : 1
fpu             : yes
fpu_exception   : yes
cpuid level     : 22
wp              : yes
flags           : fpu vme de pse tsc msr pae mce cx8 apic sep mtrr pge mca cmov pat pse36 clflush mmx fxsr sse sse2 ss ht syscall nx pdpe1gb rdtscp lm constant_tsc arch_perfmon nopl xtopology tsc_reliable nonstop_tsc cpuid pni pclmulqdq ssse3 fma cx16 pcid sse4_1 sse4_2 x2apic movbe popcnt tsc_deadline_timer aes xsave avx f16c rdrand hypervisor lahf_lm abm 3dnowprefetch invpcid_single pti ssbd ibrs ibpb stibp fsgsbase tsc_adjust bmi1 avx2 smep bmi2 invpcid rdseed adx smap clflushopt xsaveopt xsavec xgetbv1 xsaves arat md_clear flush_l1d arch_capabilities
bugs            : cpu_meltdown spectre_v1 spectre_v2 spec_store_bypass l1tf mds swapgs itlb_multihit srbds
bogomips        : 3600.00
clflush size    : 64
cache_alignment : 64
address sizes   : 45 bits physical, 48 bits virtual
power management:

[root@scfuture-21 ~]# 

方法三:

[root@scfuture-21 ~]# top
top - 22:47:03 up  1:02,  2 users,  load average: 0.00, 0.00, 0.00
Tasks: 145 total,   1 running, 144 sleeping,   0 stopped,   0 zombie
%Cpu(s):  0.0 us,  0.0 sy,  0.0 ni, 99.8 id,  0.0 wa,  0.2 hi,  0.0 si,  0.0 st
MiB Mem :   3380.5 total,   2539.1 free,    284.5 used,    556.8 buff/cache
MiB Swap:   8192.0 total,   8192.0 free,      0.0 used.   2735.1 avail Mem 

    PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND                                                                           
  13920 root      20   0    9904   3984   3284 R   0.3   0.1   0:00.03 top                                                                               
      1 root      20   0  168900  17020   8780 S   0.0   0.5   0:01.94 systemd                                                                           
      2 root      20   0       0      0      0 S   0.0   0.0   0:00.01 kthreadd                                                                          
      3 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 rcu_gp                                                                            
      4 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 rcu_par_gp                                                                        
      5 root      20   0       0      0      0 I   0.0   0.0   0:02.61 kworker/0:0-ata_sff                                                               
      6 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 kworker/0:0H-events_highpri                                                       
      8 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 mm_percpu_wq                                                                      
      9 root      20   0       0      0      0 S   0.0   0.0   0:00.00 rcu_tasks_rude_                                                                   
     10 root      20   0       0      0      0 S   0.0   0.0   0:00.00 rcu_tasks_trace                                                                   
     11 root      20   0       0      0      0 S   0.0   0.0   0:00.01 ksoftirqd/0                                                                       
     12 root      20   0       0      0      0 I   0.0   0.0   0:02.32 rcu_sched                                                                         
     13 root      rt   0       0      0      0 S   0.0   0.0   0:00.00 migration/0                                                                       
     14 root      20   0       0      0      0 S   0.0   0.0   0:00.00 cpuhp/0                                                                           
     15 root      20   0       0      0      0 S   0.0   0.0   0:00.00 cpuhp/1                                                                           
     16 root      rt   0       0      0      0 S   0.0   0.0   0:00.12 migration/1                                                                       
     17 root      20   0       0      0      0 S   0.0   0.0   0:00.14 ksoftirqd/1                                                                       
     19 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 kworker/1:0H-events_highpri                                                       
     22 root      20   0       0      0      0 S   0.0   0.0   0:00.01 kdevtmpfs                                                                         
     23 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 netns                                                                             
     24 root      20   0       0      0      0 S   0.0   0.0   0:00.00 kauditd                                                                           
     29 root      20   0       0      0      0 S   0.0   0.0   0:00.00 khungtaskd                                                                        
     30 root      20   0       0      0      0 S   0.0   0.0   0:00.00 oom_reaper                                                                        
     31 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 writeback                                                                         
     32 root      20   0       0      0      0 S   0.0   0.0   0:00.04 kcompactd0                                                                        
     33 root      25   5       0      0      0 S   0.0   0.0   0:00.00 ksmd                                                                              
[root@scfuture-21 ~]# 
[root@scfuture-21 ~]# top   -----执行top后输入1
top - 22:47:35 up  1:03,  2 users,  load average: 0.00, 0.00, 0.00
Tasks: 145 total,   1 running, 144 sleeping,   0 stopped,   0 zombie
%Cpu0  :  0.0 us,  0.0 sy,  0.0 ni,100.0 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
%Cpu1  :  0.0 us,  0.3 sy,  0.0 ni, 99.7 id,  0.0 wa,  0.0 hi,  0.0 si,  0.0 st
MiB Mem :   3380.5 total,   2539.1 free,    284.5 used,    556.8 buff/cache
MiB Swap:   8192.0 total,   8192.0 free,      0.0 used.   2735.1 avail Mem 

    PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND                                                                           
     12 root      20   0       0      0      0 I   0.3   0.0   0:02.37 rcu_sched                                                                         
    790 root      20   0   79156   1612   1368 S   0.3   0.0   0:00.31 irqbalance                                                                        
      1 root      20   0  168900  17020   8780 S   0.0   0.5   0:01.94 systemd                                                                           
      2 root      20   0       0      0      0 S   0.0   0.0   0:00.01 kthreadd                                                                          
      3 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 rcu_gp                                                                            
      4 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 rcu_par_gp                                                                        
      5 root      20   0       0      0      0 I   0.0   0.0   0:02.61 kworker/0:0-ata_sff                                                               
      6 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 kworker/0:0H-events_highpri                                                       
      8 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 mm_percpu_wq                                                                      
      9 root      20   0       0      0      0 S   0.0   0.0   0:00.00 rcu_tasks_rude_                                                                   
     10 root      20   0       0      0      0 S   0.0   0.0   0:00.00 rcu_tasks_trace                                                                   
     11 root      20   0       0      0      0 S   0.0   0.0   0:00.01 ksoftirqd/0                                                                       
     13 root      rt   0       0      0      0 S   0.0   0.0   0:00.00 migration/0                                                                       
     14 root      20   0       0      0      0 S   0.0   0.0   0:00.00 cpuhp/0                                                                           
     15 root      20   0       0      0      0 S   0.0   0.0   0:00.00 cpuhp/1                                                                           
     16 root      rt   0       0      0      0 S   0.0   0.0   0:00.12 migration/1                                                                       
     17 root      20   0       0      0      0 S   0.0   0.0   0:00.14 ksoftirqd/1                                                                       
     19 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 kworker/1:0H-events_highpri                                                       
     22 root      20   0       0      0      0 S   0.0   0.0   0:00.01 kdevtmpfs                                                                         
     23 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 netns                                                                             
     24 root      20   0       0      0      0 S   0.0   0.0   0:00.00 kauditd                                                                           
     29 root      20   0       0      0      0 S   0.0   0.0   0:00.00 khungtaskd                                                                        
     30 root      20   0       0      0      0 S   0.0   0.0   0:00.00 oom_reaper                                                                        
     31 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 writeback                                                                         
     32 root      20   0       0      0      0 S   0.0   0.0   0:00.04 kcompactd0                                                                        
[root@scfuture-21 ~]# 
  • 查看内存信息,命令如下:

方法一:

[root@scfuture-21 ~]# free
               total        used        free      shared  buff/cache   available
Mem:         3461636      291740     2600036        9308      569860     2800348
Swap:        8388604           0     8388604
[root@scfuture-21 ~]# 

方法二:

[root@scfuture-21 ~]# top
top - 22:50:07 up  1:05,  2 users,  load average: 0.00, 0.00, 0.00
Tasks: 145 total,   2 running, 143 sleeping,   0 stopped,   0 zombie
%Cpu(s):  0.0 us,  0.2 sy,  0.0 ni, 99.7 id,  0.0 wa,  0.2 hi,  0.0 si,  0.0 st
MiB Mem :   3380.5 total,   2538.6 free,    285.0 used,    556.9 buff/cache
MiB Swap:   8192.0 total,   8192.0 free,      0.0 used.   2734.6 avail Mem 

    PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND                                                                           
  13895 root      20   0       0      0      0 I   0.3   0.0   0:00.56 kworker/1:1-events                                                                
      1 root      20   0  168900  17020   8780 S   0.0   0.5   0:01.94 systemd                                                                           
      2 root      20   0       0      0      0 S   0.0   0.0   0:00.01 kthreadd                                                                          
      3 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 rcu_gp                                                                            
      4 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 rcu_par_gp                                                                        
      5 root      20   0       0      0      0 I   0.0   0.0   0:02.61 kworker/0:0-ata_sff                                                               
      6 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 kworker/0:0H-events_highpri                                                       
      8 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 mm_percpu_wq                                                                      
      9 root      20   0       0      0      0 S   0.0   0.0   0:00.00 rcu_tasks_rude_                                                                   
     10 root      20   0       0      0      0 S   0.0   0.0   0:00.00 rcu_tasks_trace                                                                   
     11 root      20   0       0      0      0 S   0.0   0.0   0:00.01 ksoftirqd/0                                                                       
     12 root      20   0       0      0      0 R   0.0   0.0   0:02.50 rcu_sched                                                                         
     13 root      rt   0       0      0      0 S   0.0   0.0   0:00.00 migration/0                                                                       
     14 root      20   0       0      0      0 S   0.0   0.0   0:00.00 cpuhp/0                                                                           
     15 root      20   0       0      0      0 S   0.0   0.0   0:00.00 cpuhp/1                                                                           
     16 root      rt   0       0      0      0 S   0.0   0.0   0:00.12 migration/1                                                                       
     17 root      20   0       0      0      0 S   0.0   0.0   0:00.14 ksoftirqd/1                                                                       
     19 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 kworker/1:0H-events_highpri                                                       
     22 root      20   0       0      0      0 S   0.0   0.0   0:00.01 kdevtmpfs                                                                         
     23 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 netns                                                                             
     24 root      20   0       0      0      0 S   0.0   0.0   0:00.00 kauditd                                                                           
     29 root      20   0       0      0      0 S   0.0   0.0   0:00.00 khungtaskd                                                                        
     30 root      20   0       0      0      0 S   0.0   0.0   0:00.00 oom_reaper                                                                        
     31 root       0 -20       0      0      0 I   0.0   0.0   0:00.00 writeback                                                                         
     32 root      20   0       0      0      0 S   0.0   0.0   0:00.04 kcompactd0                                                                        
     33 root      25   5       0      0      0 S   0.0   0.0   0:00.00 ksmd                                                                              
[root@scfuture-21 ~]# 
[root@scfuture-21 ~]# top    -----执行top后输入M
top - 22:49:49 up  1:05,  2 users,  load average: 0.00, 0.00, 0.00
Tasks: 145 total,   1 running, 144 sleeping,   0 stopped,   0 zombie
%Cpu(s):  0.0 us,  0.2 sy,  0.0 ni, 99.7 id,  0.0 wa,  0.0 hi,  0.2 si,  0.0 st
MiB Mem :   3380.5 total,   2539.1 free,    284.5 used,    556.9 buff/cache
MiB Swap:   8192.0 total,   8192.0 free,      0.0 used.   2735.1 avail Mem 

    PID USER      PR  NI    VIRT    RES    SHR S  %CPU  %MEM     TIME+ COMMAND                                                                           
    895 root      20   0  132164  42332  17984 S   0.0   1.2   0:00.90 firewalld                                                                         
   1533 root      20   0  331972  26280  12468 S   0.3   0.8   0:00.67 lvmdbusd                                                                          
    999 root      20   0  258036  24972  12012 S   0.0   0.7   0:00.92 tuned                                                                             
    789 polkitd   20   0 2590004  23236  18644 S   0.0   0.7   0:00.18 polkitd                                                                           
    978 root      20   0  258144  20636  17680 S   0.0   0.6   0:00.27 NetworkManager                                                                    
      1 root      20   0  168900  17020   8780 S   0.0   0.5   0:01.94 systemd                                                                           
    756 root      20   0   29400  10068   7028 S   0.0   0.3   0:00.27 systemd-udevd                                                                     
    677 root      20   0   22460   9256   8300 S   0.0   0.3   0:00.16 systemd-journal                                                                   
    818 root      20   0   15852   9004   6556 S   0.0   0.3   0:00.09 systemd-logind                                                                    
   9057 root      20   0   15328   8612   7356 S   0.0   0.2   0:00.03 sshd                                                                              
   1295 root      20   0  163924   7552   3968 S   0.0   0.2   0:00.31 rsyslogd                                                                          
    822 root      20   0   14272   7236   6452 S   0.0   0.2   0:00.03 systemd-machine                                                                   
   3374 root      20   0   13896   6696   5872 S   0.0   0.2   0:00.00 sshd                                                                              
    795 root      20   0   89348   6072   5292 S   0.0   0.2   0:12.29 rngd                                                                              
   9062 root      20   0    9352   6016   3824 S   0.0   0.2   0:00.09 bash                                                                              
   8985 root      20   0   11792   5768   3728 S   0.0   0.2   0:00.02 bash                                                                              
   9061 root      20   0   15328   5488   4200 S   0.3   0.2   0:00.10 sshd                                                                              
   8978 root      20   0    9948   5416   4564 S   0.0   0.2   0:00.01 login                                                                             
    726 rpc       20   0   10884   5116   4444 S   0.0   0.1   0:00.03 rpcbind                                                                           
    777 dbus      20   0    7980   4936   3992 S   0.0   0.1   0:00.25 dbus-daemon                                                                       
   1000 root      20   0   55420   4136   3428 S   0.0   0.1   0:00.00 gssproxy                                                                          
    824 root      20   0   10864   4124   1260 S   0.0   0.1   0:00.00 restorecond                                                                       
  13922 root      20   0    9904   3996   3292 R   0.3   0.1   0:00.03 top                                                                               
   1361 root      20   0    7812   3268   2404 S   0.0   0.1   0:00.03 crond                                                                             
    732 root      16  -4    6984   3228   2680 S   0.0   0.1   0:00.01 sedispatch                                                                        
   2115 dnsmasq   20   0    8828   2444   2064 S   0.0   0.1   0:00.00 dnsmasq                                                                           
[root@scfuture-21 ~]#
  • 查看硬盘信息,命令如下:

方法一:

[root@scfuture-21 ~]# fdisk -l
Disk /dev/sda:50 GiB,53687091200 字节,104857600 个扇区
磁盘型号:VMware Virtual S
单元:扇区 / 1 * 512 = 512 字节
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节
磁盘标签类型:dos
磁盘标识符:0x4ff24c22

设备       启动    起点      末尾      扇区 大小 Id 类型
/dev/sda1  *       2048   2099199   2097152   1G 83 Linux
/dev/sda2       2099200 104857599 102758400  49G 8e Linux LVM


Disk /dev/mapper/vg00-lv_root:41 GiB,44019220480 字节,85975040 个扇区
单元:扇区 / 1 * 512 = 512 字节
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节


Disk /dev/mapper/vg00-lv_swap:8 GiB,8589934592 字节,16777216 个扇区
单元:扇区 / 1 * 512 = 512 字节
扇区大小(逻辑/物理):512 字节 / 512 字节
I/O 大小(最小/最佳):512 字节 / 512 字节
[root@scfuture-21 ~]# 

方法二:

[root@scfuture-21 ~]# df
文件系统                    1K-块    已用     可用 已用% 挂载点
devtmpfs                  1713420       0  1713420    0% /dev
tmpfs                     1730816      12  1730804    1% /dev/shm
tmpfs                      692328    9288   683040    2% /run
tmpfs                        4096       0     4096    0% /sys/fs/cgroup
/dev/mapper/vg00-lv_root 42001520 2532084 37303676    7% /
tmpfs                     1730820       0  1730820    0% /tmp
/dev/sda1                  996780   89696   838272   10% /boot
[root@scfuture-21 ~]# 
[root@scfuture-21 ~]# df -h
文件系统                  容量  已用  可用 已用% 挂载点
devtmpfs                  1.7G     0  1.7G    0% /dev
tmpfs                     1.7G   12K  1.7G    1% /dev/shm
tmpfs                     677M  9.1M  668M    2% /run
tmpfs                     4.0M     0  4.0M    0% /sys/fs/cgroup
/dev/mapper/vg00-lv_root   41G  2.5G   36G    7% /
tmpfs                     1.7G     0  1.7G    0% /tmp
/dev/sda1                 974M   88M  819M   10% /boot
[root@scfuture-21 ~]# 

方法三:

[root@scfuture-21 ~]# mount
proc on /proc type proc (rw,nosuid,nodev,noexec,relatime)
sysfs on /sys type sysfs (rw,nosuid,nodev,noexec,relatime,seclabel)
devtmpfs on /dev type devtmpfs (rw,nosuid,seclabel,size=1713420k,nr_inodes=428355,mode=755)
securityfs on /sys/kernel/security type securityfs (rw,nosuid,nodev,noexec,relatime)
tmpfs on /dev/shm type tmpfs (rw,nosuid,nodev,seclabel)
devpts on /dev/pts type devpts (rw,nosuid,noexec,relatime,seclabel,gid=5,mode=620,ptmxmode=000)
tmpfs on /run type tmpfs (rw,nosuid,nodev,seclabel,size=692328k,nr_inodes=819200,mode=755)
tmpfs on /sys/fs/cgroup type tmpfs (ro,nosuid,nodev,noexec,seclabel,size=4096k,nr_inodes=1024,mode=755)
cgroup on /sys/fs/cgroup/systemd type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,xattr,release_agent=/usr/lib/systemd/systemd-cgroups-agent,name=systemd)
pstore on /sys/fs/pstore type pstore (rw,nosuid,nodev,noexec,relatime,seclabel)
none on /sys/fs/bpf type bpf (rw,nosuid,nodev,noexec,relatime,mode=700)
cgroup on /sys/fs/cgroup/blkio type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,blkio)
cgroup on /sys/fs/cgroup/cpu,cpuacct type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,cpu,cpuacct)
cgroup on /sys/fs/cgroup/net_cls,net_prio type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,net_cls,net_prio)
cgroup on /sys/fs/cgroup/cpuset type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,cpuset)
cgroup on /sys/fs/cgroup/memory type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,memory)
cgroup on /sys/fs/cgroup/pids type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,pids)
cgroup on /sys/fs/cgroup/rdma type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,rdma)
cgroup on /sys/fs/cgroup/hugetlb type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,hugetlb)
cgroup on /sys/fs/cgroup/perf_event type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,perf_event)
cgroup on /sys/fs/cgroup/freezer type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,freezer)
cgroup on /sys/fs/cgroup/devices type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,devices)
cgroup on /sys/fs/cgroup/files type cgroup (rw,nosuid,nodev,noexec,relatime,seclabel,files)
/dev/mapper/vg00-lv_root on / type ext4 (rw,relatime,seclabel)
selinuxfs on /sys/fs/selinux type selinuxfs (rw,nosuid,noexec,relatime)
systemd-1 on /proc/sys/fs/binfmt_misc type autofs (rw,relatime,fd=32,pgrp=1,timeout=0,minproto=5,maxproto=5,direct,pipe_ino=18845)
hugetlbfs on /dev/hugepages type hugetlbfs (rw,relatime,seclabel,pagesize=2M)
tracefs on /sys/kernel/tracing type tracefs (rw,nosuid,nodev,noexec,relatime,seclabel)
mqueue on /dev/mqueue type mqueue (rw,nosuid,nodev,noexec,relatime,seclabel)
debugfs on /sys/kernel/debug type debugfs (rw,nosuid,nodev,noexec,relatime,seclabel)
fusectl on /sys/fs/fuse/connections type fusectl (rw,nosuid,nodev,noexec,relatime)
configfs on /sys/kernel/config type configfs (rw,nosuid,nodev,noexec,relatime)
ramfs on /run/credentials/systemd-sysusers.service type ramfs (ro,nosuid,nodev,noexec,relatime,mode=700)
tmpfs on /tmp type tmpfs (rw,nosuid,nodev,seclabel,size=1730820k,nr_inodes=1048576)
/dev/sda1 on /boot type ext4 (rw,relatime,seclabel)
sunrpc on /var/lib/nfs/rpc_pipefs type rpc_pipefs (rw,relatime)
[root@scfuture-21 ~]# 
  • 查看ip信息,命令如下:

方法一:

[root@scfuture-21 ~]# ifconfig
ens33: flags=4163<UP,BROADCAST,RUNNING,MULTICAST>  mtu 1500
        inet 192.168.0.21  netmask 255.255.255.0  broadcast 192.168.0.255
        inet6 fe80::9393:f6ae:ced9:7759  prefixlen 64  scopeid 0x20<link>
        ether 00:0c:29:96:c9:d7  txqueuelen 1000  (Ethernet)
        RX packets 42632  bytes 60931074 (58.1 MiB)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 9811  bytes 646374 (631.2 KiB)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

lo: flags=73<UP,LOOPBACK,RUNNING>  mtu 65536
        inet 127.0.0.1  netmask 255.0.0.0
        inet6 ::1  prefixlen 128  scopeid 0x10<host>
        loop  txqueuelen 1000  (Local Loopback)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

virbr0: flags=4099<UP,BROADCAST,MULTICAST>  mtu 1500
        inet 192.168.122.1  netmask 255.255.255.0  broadcast 192.168.122.255
        ether 52:54:00:bc:bb:cd  txqueuelen 1000  (Ethernet)
        RX packets 0  bytes 0 (0.0 B)
        RX errors 0  dropped 0  overruns 0  frame 0
        TX packets 0  bytes 0 (0.0 B)
        TX errors 0  dropped 0 overruns 0  carrier 0  collisions 0

[root@scfuture-21 ~]# 

方法二:

[root@scfuture-21 ~]# ip add list
1: lo: <LOOPBACK,UP,LOWER_UP> mtu 65536 qdisc noqueue state UNKNOWN group default qlen 1000
    link/loopback 00:00:00:00:00:00 brd 00:00:00:00:00:00
    inet 127.0.0.1/8 scope host lo
       valid_lft forever preferred_lft forever
    inet6 ::1/128 scope host 
       valid_lft forever preferred_lft forever
2: ens33: <BROADCAST,MULTICAST,UP,LOWER_UP> mtu 1500 qdisc fq_codel state UP group default qlen 1000
    link/ether 00:0c:29:96:c9:d7 brd ff:ff:ff:ff:ff:ff
    altname enp2s1
    inet 192.168.0.21/24 brd 192.168.0.255 scope global noprefixroute ens33
       valid_lft forever preferred_lft forever
    inet6 fe80::9393:f6ae:ced9:7759/64 scope link noprefixroute 
       valid_lft forever preferred_lft forever
3: virbr0: <NO-CARRIER,BROADCAST,MULTICAST,UP> mtu 1500 qdisc noqueue state DOWN group default qlen 1000
    link/ether 52:54:00:bc:bb:cd brd ff:ff:ff:ff:ff:ff
    inet 192.168.122.1/24 brd 192.168.122.255 scope global virbr0
       valid_lft forever preferred_lft forever
4: virbr0-nic: <BROADCAST,MULTICAST> mtu 1500 qdisc fq_codel master virbr0 state DOWN group default qlen 1000
    link/ether 52:54:00:bc:bb:cd brd ff:ff:ff:ff:ff:ff
[root@scfuture-21 ~]# 

方法三:

[root@scfuture-21 ~]# hostname -I
192.168.0.21 192.168.122.1 
[root@scfuture-21 ~]# 

本图文内容来源于网友网络收集整理提供,作为学习参考使用,版权属于原作者。
THE END
分享
二维码
< <上一篇
下一篇>>