首页 > 系统相关 >如何对Linux系统进行基准测试5工具UnixBench

如何对Linux系统进行基准测试5工具UnixBench

时间:2024-07-13 09:29:35浏览次数:6  
标签:UnixBench bufsize 测试 maxblocks 基准 samples File Linux Copy

UnixBench

UnixBench是一款跨平台基准测试工具,用于评估各种类Unix系统(包括Linux、BSD和macOS)的系统性能。它提供了一套全面的测试套件,可评估系统性能的不同方面,包括:

  • 系统调用: 此测试衡量进行系统调用的开销,系统调用是应用程序与操作系统内核交互的主要方式。
  • 文件系统: 此测试评估文件系统操作的性能,例如读取、写入和创建文件。
  • 进程: 此测试评估进程创建、上下文切换和进程间通信 (IPC) 的效率。
  • 管道: 此测试衡量使用管道(一种简单的 IPC 形式)在进程之间传输数据的性能。
  • 数学: 此测试评估基本数学运算的性能,例如加、减、乘、除。
  • 字符串: 此测试评估字符串操作操作的性能,例如复制、搜索和比较字符串。
  • 2D 图形: 此测试衡量基本 2D 图形操作的性能,例如绘制线条、填充多边形和图像操作。
  • 3D 图形: 此测试评估 3D 图形操作的性能,例如三角形渲染、纹理映射和照明计算。
  • C 库: 此测试评估 C 标准库中常用函数的性能。
  • 网络: 此测试衡量网络操作的性能,例如发送和接收数据以及建立连接。

UnixBench为每个测试生成分数和总体系统分数,可用于比较不同系统的性能。分数越高,性能越好。但是,需要注意的是,基准测试结果会受到各种因素的影响,例如硬件配置、操作系统版本和特定工作负载。

UnixBench对于系统管理员和性能爱好者来说是个宝贵的工具,用于评估类Unix系统的整体性能并识别潜在的瓶颈。它还可以用于跟踪随着时间的推移的性能改进或比较不同硬件配置的性能。

以下是一些有关UnixBench的其他注意事项:

  • 开源: UnixBench是一款开源工具(GPLv2),可供任何人免费使用和修改。这促进了透明度,并允许社区贡献来改进工具。
  • 跨平台: UnixBench可在各种类Unix系统上运行,使其成为跨平台比较性能的通用工具。
  • 定制: UnixBench允许自定义测试套件以专注于特定感兴趣的领域,例如CPU密集型或I/O约束型任务。
  • 解释: 基准测试结果应与其他因素(例如特定工作负载和硬件配置)结合起来解释,以全面了解系统性能。

如果您的系统有多个CPU,默认情况下会将所选测试运行两次,一次运行每个测试程序的一个副本,另一次运行N个副本,其中N是CPU的数量。这样做的目的是让您能评估

  • 运行单个任务时的系统性能
  • 运行多个任务时的系统性能
  • 系统实施并行处理的收益

UnixBench的具体测试项:

  • Dhrystone 2 using register variables

用于评估处理器的整数性能。它通过运行一系列模拟实际应用程序中常见操作的程序来衡量处理器执行整数运算的速度。

在Dhrystone 2基准测试中,使用寄存器变量可以潜在提高代码性能,方法是减少访问数据所需的时间。寄存器变量存储在CPU的寄存器中,而寄存器的访问速度比内存位置快得多。通过将经常使用的变量声明为寄存器变量,编译器可以优化代码以将这些变量保存在寄存器中,从而减少对内存的访问需求并提高整体性能。

使用寄存器变量的有效性取决于多个因素,包括特定的编译器、CPU架构以及代码本身的特性。过度激进地使用寄存器声明甚至会导致性能下降,如果寄存器没有得到有效管理。

该基准用于测量和比较计算机的性能。由于没有浮点运算,因此测试重点是字符串处理。硬件和软件设计、编译器和链接器选项、代码优化、高速缓冲存储器、等待状态和整数数据类型对其影响很大。

  • Double-Precision Whetstone

测量浮点运算的速度和效率。该测试包含多个模块,旨在体现科学应用中通常执行的各种操作。使用了各种C函数,包括 sin、cos、sqrt、exp和log,以及整数和浮点数学运算、数组访问、条件分支和过程调用。该测试同时测量整数和浮点运算。

  • Execl Throughput(执行吞吐量):

该测试测量每秒可执行的 Execl 调用次数。Execl 是 exec 系列函数的一部分,可将当前进程映像替换为新进程映像。它和许多其他类似命令都是 execve() 函数的前端。

  • 文件复制:

它使用不同的缓冲区大小来测量数据从一个文件传输到另一个文件的速度。文件读取、写入和复制测试捕捉在指定时间(默认为 10 秒)内可写入、读取和复制的字符数。

  • 管道吞吐量:

管道是进程间最简单的通信形式。管道吞吐量是指进程向管道写入512字节并读回的次数(每秒)。管道吞吐量测试在实际编程中并不存在。

  • 基于管道的上下文切换:

该测试测量两个进程通过管道交换递增整数的次数。基于管道的上下文切换测试更像现实世界中的应用。测试程序会生成一个子进程,与之进行双向管道对话。

  • 进程创建:

该测试测量进程分叉并产生一个立即退出的子进程的次数。进程创建指的是为新进程实际创建进程控制块和内存分配,因此这直接关系到内存带宽。通常,该基准用于比较操作系统进程创建调用的各种实现。

  • shell 脚本

shell脚本测试测量的是进程每分钟可启动和获取一组1、2、4和8个并发 shell 脚本副本的次数,其中shell脚本将对数据文件进行一系列转换。

  • System Call Overhead(系统调用开销):

估算进入和离开操作系统内核的成本,即执行系统调用的开销。它包括一个重复调用 getpid(返回调用进程的进程ID)系统调用的简单程序。执行此类调用的时间可用于估算进入和退出内核的成本。

  • 图形测试:

提供二维和三维图形测试;目前,三维测试套件非常有限,只有"ubgears"程序。这些测试旨在为系统的2D和3D图形性能提供一个非常粗略的概念。当然,请记住,报告的性能不仅取决于硬件,还取决于系统是否有相应的驱动程序。

您可以从这里下载最新版本:https://github.com/kdlucas/byte-unixbench

安装和运行测试:

$ git clone https://github.com/kdlucas/byte-unixbench
$ cd byte-unixbench/UnixBench
$ make
$ sudo ./Run
$ sudo ./Run
[sudo] password for xurongzhong:
make all
make[1]: Entering directory `/home/xurongzhong/byte-unixbench/UnixBench'
make distr
make[2]: Entering directory `/home/xurongzhong/byte-unixbench/UnixBench'
Checking distribution of files
./pgms  exists
./src  exists
./testdir  exists
./tmp  exists
./results  exists
make[2]: Leaving directory `/home/xurongzhong/byte-unixbench/UnixBench'
make programs
make[2]: Entering directory `/home/xurongzhong/byte-unixbench/UnixBench'
make[2]: Nothing to be done for `programs'.
make[2]: Leaving directory `/home/xurongzhong/byte-unixbench/UnixBench'
make[1]: Leaving directory `/home/xurongzhong/byte-unixbench/UnixBench'
sh: 3dinfo: command not found

   #    #  #    #  #  #    #          #####   ######  #    #   ####   #    #
   #    #  ##   #  #   #  #           #    #  #       ##   #  #    #  #    #
   #    #  # #  #  #    ##            #####   #####   # #  #  #       ######
   #    #  #  # #  #    ##            #    #  #       #  # #  #       #    #
   #    #  #   ##  #   #  #           #    #  #       #   ##  #    #  #    #
    ####   #    #  #  #    #          #####   ######  #    #   ####   #    #

   Version 5.1.3                      Based on the Byte Magazine Unix Benchmark

   Multi-CPU version                  Version 5 revisions by Ian Smith,
                                      Sunnyvale, CA, USA
   January 13, 2011                   johantheghost at yahoo period com

------------------------------------------------------------------------------
   Use directories for:
      * File I/O tests (named fs***) = /home/xurongzhong/byte-unixbench/UnixBench/tmp
      * Results                      = /home/xurongzhong/byte-unixbench/UnixBench/results
------------------------------------------------------------------------------


1 x Dhrystone 2 using register variables  1 2 3 4 5 6 7 8 9 10

1 x Double-Precision Whetstone  1 2 3 4 5 6 7 8 9 10

1 x Execl Throughput  1 2 3

1 x File Copy 1024 bufsize 2000 maxblocks  1 2 3

1 x File Copy 256 bufsize 500 maxblocks  1 2 3

1 x File Copy 4096 bufsize 8000 maxblocks  1 2 3

1 x Pipe Throughput  1 2 3 4 5 6 7 8 9 10

1 x Pipe-based Context Switching  1 2 3 4 5 6 7 8 9 10

1 x Process Creation  1 2 3

1 x System Call Overhead  1 2 3 4 5 6 7 8 9 10

1 x Shell Scripts (1 concurrent)  1 2 3

1 x Shell Scripts (8 concurrent)  1 2 3

56 x Dhrystone 2 using register variables  1 2 3 4 5 6 7 8 9 10

56 x Double-Precision Whetstone  1 2 3 4 5 6 7 8 9 10

56 x Execl Throughput  1 2 3

56 x File Copy 1024 bufsize 2000 maxblocks  1 2 3

56 x File Copy 256 bufsize 500 maxblocks  1 2 3

56 x File Copy 4096 bufsize 8000 maxblocks  1 2 3

56 x Pipe Throughput  1 2 3 4 5 6 7 8 9 10

56 x Pipe-based Context Switching  1 2 3 4 5 6 7 8 9 10

56 x Process Creation  1 2 3

56 x System Call Overhead  1 2 3 4 5 6 7 8 9 10

56 x Shell Scripts (1 concurrent)  1 2 3

56 x Shell Scripts (8 concurrent)  1 2 3

========================================================================
   BYTE UNIX Benchmarks (Version 5.1.3)

   System: localhost.localdomain: GNU/Linux
   OS: GNU/Linux -- 3.10.0-1160.119.1.el7.x86_64 -- #1 SMP Tue Jun 4 14:43:51 UTC 2024
   Machine: x86_64 (x86_64)
   Language: en_US.utf8 (charmap="UTF-8", collate="UTF-8")
   CPU 0: Intel(R) Xeon(R) Gold 6348 CPU @ 2.60GHz (5200.0 bogomips)
          Hyper-Threading, x86-64, MMX, Physical Address Ext, SYSENTER/SYSEXIT, SYSCALL/SYSRET, Intel virtualization
   ...

   CPU 55: Intel(R) Xeon(R) Gold 6348 CPU @ 2.60GHz (5234.1 bogomips)
          Hyper-Threading, x86-64, MMX, Physical Address Ext, SYSENTER/SYSEXIT, SYSCALL/SYSRET, Intel virtualization
   17:47:27 up 2 days, 21:44, 10 users,  load average: 1.86, 2.10, 1.68; runlevel 2024-07-09

------------------------------------------------------------------------
Benchmark Run: Fri Jul 12 2024 17:47:27 - 18:16:27
56 CPUs in system; running 1 parallel copy of tests

Dhrystone 2 using register variables       37086745.6 lps   (10.0 s, 7 samples)
Double-Precision Whetstone                     4004.8 MWIPS (9.5 s, 7 samples)
Execl Throughput                               1246.1 lps   (29.6 s, 2 samples)
File Copy 1024 bufsize 2000 maxblocks        598492.2 KBps  (30.0 s, 2 samples)
File Copy 256 bufsize 500 maxblocks          163845.8 KBps  (30.0 s, 2 samples)
File Copy 4096 bufsize 8000 maxblocks       2035859.6 KBps  (30.0 s, 2 samples)
Pipe Throughput                             1396781.3 lps   (10.0 s, 7 samples)
Pipe-based Context Switching                  55716.4 lps   (10.0 s, 7 samples)
Process Creation                               1856.3 lps   (30.0 s, 2 samples)
Shell Scripts (1 concurrent)                   2251.3 lpm   (60.0 s, 2 samples)
Shell Scripts (8 concurrent)                   2065.8 lpm   (60.0 s, 2 samples)
System Call Overhead                        1422058.9 lps   (10.0 s, 7 samples)

System Benchmarks Index Values               BASELINE       RESULT    INDEX
Dhrystone 2 using register variables         116700.0   37086745.6   3178.0
Double-Precision Whetstone                       55.0       4004.8    728.1
Execl Throughput                                 43.0       1246.1    289.8
File Copy 1024 bufsize 2000 maxblocks          3960.0     598492.2   1511.3
File Copy 256 bufsize 500 maxblocks            1655.0     163845.8    990.0
File Copy 4096 bufsize 8000 maxblocks          5800.0    2035859.6   3510.1
Pipe Throughput                               12440.0    1396781.3   1122.8
Pipe-based Context Switching                   4000.0      55716.4    139.3
Process Creation                                126.0       1856.3    147.3
Shell Scripts (1 concurrent)                     42.4       2251.3    531.0
Shell Scripts (8 concurrent)                      6.0       2065.8   3442.9
System Call Overhead                          15000.0    1422058.9    948.0
                                                                   ========
System Benchmarks Index Score                                         849.2

------------------------------------------------------------------------
Benchmark Run: Fri Jul 12 2024 18:16:27 - 18:44:39
56 CPUs in system; running 56 parallel copies of tests

Dhrystone 2 using register variables     2097477411.1 lps   (10.0 s, 7 samples)
Double-Precision Whetstone                   226690.9 MWIPS (9.9 s, 7 samples)
Execl Throughput                              33437.2 lps   (29.5 s, 2 samples)
File Copy 1024 bufsize 2000 maxblocks       1533720.9 KBps  (30.0 s, 2 samples)
File Copy 256 bufsize 500 maxblocks          382616.6 KBps  (30.0 s, 2 samples)
File Copy 4096 bufsize 8000 maxblocks       6047258.8 KBps  (30.0 s, 2 samples)
Pipe Throughput                            77978504.1 lps   (10.0 s, 7 samples)
Pipe-based Context Switching                2748800.6 lps   (10.0 s, 7 samples)
Process Creation                             170992.2 lps   (30.0 s, 2 samples)
Shell Scripts (1 concurrent)                 204598.7 lpm   (60.0 s, 2 samples)
Shell Scripts (8 concurrent)                  24199.0 lpm   (60.0 s, 2 samples)
System Call Overhead                       79596405.6 lps   (10.0 s, 7 samples)

System Benchmarks Index Values               BASELINE       RESULT    INDEX
Dhrystone 2 using register variables         116700.0 2097477411.1 179732.4
Double-Precision Whetstone                       55.0     226690.9  41216.5
Execl Throughput                                 43.0      33437.2   7776.1
File Copy 1024 bufsize 2000 maxblocks          3960.0    1533720.9   3873.0
File Copy 256 bufsize 500 maxblocks            1655.0     382616.6   2311.9
File Copy 4096 bufsize 8000 maxblocks          5800.0    6047258.8  10426.3
Pipe Throughput                               12440.0   77978504.1  62683.7
Pipe-based Context Switching                   4000.0    2748800.6   6872.0
Process Creation                                126.0     170992.2  13570.8
Shell Scripts (1 concurrent)                     42.4     204598.7  48254.4
Shell Scripts (8 concurrent)                      6.0      24199.0  40331.7
System Call Overhead                          15000.0   79596405.6  53064.3
                                                                   ========
System Benchmarks Index Score                                       19616.4

以上操作系统:CentOS Linux release 7.9.2009 (Core),服务器:Supermicro Super Server SMC X12

  • 广电五舟发布鲲鹏服务器S627K2测试

操作系统:openEuler release 22.03 (LTS-SP4)

   BYTE UNIX Benchmarks (Version 5.1.3)

   System: localhost.localdomain: GNU/Linux
   OS: GNU/Linux -- 5.10.0-216.0.0.115.oe2203sp4.aarch64 -- #1 SMP Thu Jun 27 15:22:10 CST 2024
   Machine: aarch64 (aarch64)
   Language: en_US.utf8 (charmap="UTF-8", collate="UTF-8")
   CPU 0:  (200.0 bogomips)
...

   CPU 127:  (200.0 bogomips)

   19:03:20 up 3 days,  2:19,  5 users,  load average: 1.02, 1.12, 1.07; runlevel 2024-07-10

------------------------------------------------------------------------
Benchmark Run: Fri Jul 12 2024 19:03:20 - 19:31:28
128 CPUs in system; running 1 parallel copy of tests

Dhrystone 2 using register variables       42056424.6 lps   (10.0 s, 7 samples)
Double-Precision Whetstone                     4475.6 MWIPS (10.0 s, 7 samples)
Execl Throughput                               3271.3 lps   (30.0 s, 2 samples)
File Copy 1024 bufsize 2000 maxblocks        743479.4 KBps  (30.0 s, 2 samples)
File Copy 256 bufsize 500 maxblocks          222004.0 KBps  (30.0 s, 2 samples)
File Copy 4096 bufsize 8000 maxblocks       2161717.7 KBps  (30.0 s, 2 samples)
Pipe Throughput                              984465.6 lps   (10.0 s, 7 samples)
Pipe-based Context Switching                 164087.2 lps   (10.0 s, 7 samples)
Process Creation                               6467.8 lps   (30.0 s, 2 samples)
Shell Scripts (1 concurrent)                   6613.3 lpm   (60.0 s, 2 samples)
Shell Scripts (8 concurrent)                   4519.1 lpm   (60.0 s, 2 samples)
System Call Overhead                         778479.8 lps   (10.0 s, 7 samples)

System Benchmarks Index Values               BASELINE       RESULT    INDEX
Dhrystone 2 using register variables         116700.0   42056424.6   3603.8
Double-Precision Whetstone                       55.0       4475.6    813.8
Execl Throughput                                 43.0       3271.3    760.8
File Copy 1024 bufsize 2000 maxblocks          3960.0     743479.4   1877.5
File Copy 256 bufsize 500 maxblocks            1655.0     222004.0   1341.4
File Copy 4096 bufsize 8000 maxblocks          5800.0    2161717.7   3727.1
Pipe Throughput                               12440.0     984465.6    791.4
Pipe-based Context Switching                   4000.0     164087.2    410.2
Process Creation                                126.0       6467.8    513.3
Shell Scripts (1 concurrent)                     42.4       6613.3   1559.7
Shell Scripts (8 concurrent)                      6.0       4519.1   7531.9
System Call Overhead                          15000.0     778479.8    519.0
                                                                   ========
System Benchmarks Index Score                                        1290.2

------------------------------------------------------------------------
Benchmark Run: Fri Jul 12 2024 19:31:28 - 20:01:04
128 CPUs in system; running 128 parallel copies of tests

Dhrystone 2 using register variables     4264071560.6 lps   (10.0 s, 7 samples)
Double-Precision Whetstone                   453663.9 MWIPS (8.8 s, 7 samples)
Execl Throughput                              28547.4 lps   (29.9 s, 2 samples)
File Copy 1024 bufsize 2000 maxblocks      48631837.6 KBps  (30.0 s, 2 samples)
File Copy 256 bufsize 500 maxblocks        24668291.9 KBps  (30.0 s, 2 samples)
File Copy 4096 bufsize 8000 maxblocks     100610677.0 KBps  (30.0 s, 2 samples)
Pipe Throughput                           120629456.6 lps   (10.0 s, 7 samples)
Pipe-based Context Switching               18063898.2 lps   (10.0 s, 7 samples)
Process Creation                              68547.0 lps   (30.0 s, 2 samples)
Shell Scripts (1 concurrent)                 133329.3 lpm   (60.0 s, 2 samples)
Shell Scripts (8 concurrent)                  18785.4 lpm   (60.2 s, 2 samples)
System Call Overhead                       98134546.0 lps   (10.0 s, 7 samples)

System Benchmarks Index Values               BASELINE       RESULT    INDEX
Dhrystone 2 using register variables         116700.0 4264071560.6 365387.5
Double-Precision Whetstone                       55.0     453663.9  82484.3
Execl Throughput                                 43.0      28547.4   6638.9
File Copy 1024 bufsize 2000 maxblocks          3960.0   48631837.6 122807.7
File Copy 256 bufsize 500 maxblocks            1655.0   24668291.9 149053.1
File Copy 4096 bufsize 8000 maxblocks          5800.0  100610677.0 173466.7
Pipe Throughput                               12440.0  120629456.6  96969.0
Pipe-based Context Switching                   4000.0   18063898.2  45159.7
Process Creation                                126.0      68547.0   5440.2
Shell Scripts (1 concurrent)                     42.4     133329.3  31445.6
Shell Scripts (8 concurrent)                      6.0      18785.4  31309.1
System Call Overhead                          15000.0   98134546.0  65423.0
                                                                   ========
System Benchmarks Index Score                                       56115.2

基准值

UnixBench中的基准值是指每个子测试项的参考值,用来衡量该子测试项的性能水平。基准值通常是该子测试项在特定硬件平台上的预期性能。例如在 Dhrystone测试中基准值为 1750 MIPS。

UnixBench中的基准值最初是在1995年由UnixBench的作者Michael Bach设定的。他使用一台SPARCstation 20-61工作站作为参考平台,并测量了该平台上各个子测试项的性能。然后,他将这些性能值作为基准值。

UnixBench中的基准值并不是固定的,它们会随着硬件技术的进步而不断更新。例如UnixBench 5.1.2版本中,Dhrystone测试的基准值从1750 MIPS更新为2200MIPS。

以下是UnixBench 5.1.2版本中各个子测试项的基准值:

子测试项 基准值
Dhrystone 2200 MIPS
Whetstone 56000 WIPS
Execl Throughput 33000 calls/sec
File Copy 1024 bufsize 10000000 bytes/sec
File Copy 256 bufsize 5000000 bytes/sec
File Copy 4096 bufsize 20000000 bytes/sec
Pipe Throughput 10000000 bytes/sec
Pipe-based Context Switching 5000000 switches/sec
Process Creation 5000 processes/sec
Shell Scripts (1 concurrent) 10000000 instructions/sec
Shell Scripts (8 concurrent) 80000000 instructions/sec
System Call Overhead 10000000 calls/sec

参考资料

System Benchmarks Index Score的计算

UnixBench的System Benchmarks Index Score是通过对各个子测试项的单项性能分数进行加权平均计算得出的。每个子测试项的单项性能分数又通过对原始测试结果进行指数运算得到。

具体来说,计算步骤如下:

  • 计算每个子测试项的原始测试结果: 每个子测试项都会输出一个原始测试结果,该结果通常表示为每秒执行的操作数或每秒传输的数据量。例如,在 File Copy 测试中,原始测试结果表示每秒复制的文件大小。

  • 计算每个子测试项的单项性能分数: 对于每个子测试项,根据其原始测试结果和基准值,使用指数运算计算其单项性能分数。指数运算公式:score = exp(product / 2)。其中:score 是单项性能分数;product 是原始测试结果和基准值的乘积;exp是自然指数函数。

基准值是每个子测试项的参考值,用来衡量该子测试项的性能水平。基准值通常是该子测试项在特定硬件平台上的预期性能。例如,在 Dhrystone 测试中,基准值为 1750 MIPS。

  • 计算 System Benchmarks Index Score: 将每个子测试项的单项性能分数乘以其对应的权重,然后求和,最后再进行指数运算,得 System Benchmarks Index Score。指数运算公式:Score = exp(average(score * weight))。其中:Score是 System Benchmarks Index Score;average 是加权平均函数;score 是每个子测试项的单项性能分数;weight 是每个子测试项的权重。

权重是每个子测试项在 System Benchmarks Index Score 中所占的比例。权重值通常根据每个子测试项的重要性来分配。例如,在UnixBench中,Dhrystone 和 Whetstone 测试的权重较高,因为它们衡量的是 CPU 的整数和浮点性能,而这些性能在许多应用程序中都很重要。

以下是 UnixBench 中各个子测试项的权重:

子测试项 权重
Dhrystone 0.17
Whetstone 0.17
Execl Throughput 0.10
File Copy 1024 bufsize 0.05
File Copy 256 bufsize 0.05
File Copy 4096 bufsize 0.05
Pipe Throughput 0.05
Pipe-based Context Switching 0.05
Process Creation 0.05
Shell Scripts (1 concurrent) 0.05
Shell Scripts (8 concurrent) 0.05
System Call Overhead 0.10

System Benchmarks Index Score 只是一个综合性指标,并不能完全反映所有类型的应用程序性能。在评估计算机性能时,应综合考虑多种因素,包括 CPU 性能、内存带宽、存储性能和 I/O 性能等。

其他

如果不需要进行图形测试或者不在图形化界面下测试,则将Makefile文件中GRAPHIC_TESTS = defined注释掉,默认是关闭的。

默认测试完成后测试结果存放在results目录:

UnixBench由于多年没有更新,已经廉颇老矣,建议综合参考Sysbench、GeekBench等工具。

标签:UnixBench,bufsize,测试,maxblocks,基准,samples,File,Linux,Copy
From: https://www.cnblogs.com/testing-/p/18299319

相关文章

  • Linux fileformat error: bad interpreter: No such file or directory
    背景在windows下新建的sh文件,copy到linux下有的会报错,一般是格式问题默认情况下windows格式会在段落末尾有CR、LF,但是Unix格式只有LF示例执行sh脚本文件./file.sh-bash:./file.sh:/bin/sh^M:坏的解释器:没有那个文件或目录或者报badinterpreter:Nosuchfileordire......
  • 【Linux】构建项目
    cmake--build<dir>[<options>][--<build-tool-options>]cmake--build--preset<preset>[<options>][--<build-tool-options>]命令选项1、--build<dir>构建项目,这个选项是必须的(除非指定preset)而且必须是第一个。2、--preset<p......
  • Linux权限理解
    Linux用户的概念Linux下有两种用户:超级用户(root)、普通用户。超级用户:可以再linux系统下做任何事情,不受限制普通用户:在linux下做有限的事情。超级用户的命令提示符是“#”,普通用户的命令提示符是“$”。角色切换普通用户切换到超级用户[yuan@VM_0_12_centos......
  • 【香菇带你学Linux】Linux系统中磁盘管理LVM与挂载
    Linux系统中磁盘管理LVM与挂载本文以属于Linux系统基本概念,如果以查找教程教程,解决问题为主,只需要查看本文后半部分。如需要系统性学习请查看本文前半部分。本文操作极容易导致主机无法自动重启,请慎重操作。操作前务必要进行备份操作!文章目录Linux系统中磁盘管理LVM与......
  • 应急响应命令(Linux)
    netstat-anultp查看进程(用来判断开启了哪些服务等)ls-al查看目录下所有文件,包括隐藏文件ls-alt查看目录下所有文件,包括隐藏文件,按时间顺序排序cataccess.log|wc-l查看文件的行数wc-l是查看文件行数的意思cat-eaccess.log|grep1.php查找a......
  • Linux入门---(一)
    VIM编辑器1.一般模式:2.编辑模式3.命令模式:%s/old/new/g替换当前匹配到的所有old为new小tips:......
  • 【Linux】Linux操作系统
    Linux基本指令os概念与定位本节内容:Linux操作系统讲解os概念与定位操作系统(OperatingSystem,简称OS)是管理和控制计算机硬件与软件资源的计算机程序。总的来讲,操作系统是一款做软硬件管理的软件。了解操作系统的同时,需要对计算机上的其他部分有一定的了解:从硬......
  • Linux 使用结构化命令--练习
    练习一用elif语句为某用户创建账户检查该用户名是否存在,如果存在返回“该用户已存在”,并输出该用户的信息如果不存在,检查/home下是否有该用户的文件夹如果有该用户名称的文件夹,输出文件夹下内容如果没有该用户文件夹,为该用户名创建新用户每一步都需要返回提示信息如“该用户......
  • Linux命令行之文本处理awk
    处理有分隔符的文本文档,默认分隔符是空格。awk的一些内置变量NF:字段数量(NumberofFields)NR:当前记录号(NumberofRecords)$0:当前记录(整行)$1,$2,...:当前记录的第1个、第2个等字段FS:字段分隔符(FieldSeparator),默认为空格或制表符OFS:输出字段分隔符(OutputFieldSeparator),默......
  • Linux下IIO子系统驱动
    1引入IIO子系统随着手机、物联网、工业物联网和可穿戴设备的爆发,传感器的需求越来越多。比如手机或者手环里面的加速度计、光传感器、陀螺仪、气压计、磁力计等,这些传感器本质上都是ADC。这些传感器对外通过IIC或者SPI接口来发送ADC转换后的原始数据。Linux内核为了管理......