cp命令显示拷贝的速度

在window平台上复制一个文件时可以即时查看文件复制时的速度。
在linux平台上查看了cp命令的参数,没有相关参数可以实现此功能,所以需要借助工具来实现此功能。
我平时用的linux版本是centos 7.5 ,系统默认没有安装iotop软件。所以需要安装此软件。

yum  install iotop

安装完成后运行即可显示如下界面:

Total DISK READ :       0.00 B/s | Total DISK WRITE :       0.00 B/s
Actual DISK READ:       0.00 B/s | Actual DISK WRITE:       0.00 B/s
  TID  PRIO  USER     DISK READ  DISK WRITE  SWAPIN     IO>    COMMAND                                                                                                                                                                                          
    1 be/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % systemd --switched-root --system --deserialize 22
    2 be/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [kthreadd]
    3 be/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [ksoftirqd/0]
    5 be/0 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [kworker/0:0H]
    7 rt/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [migration/0]
    8 be/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [rcu_bh]
    9 be/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [rcu_sched]
   10 be/0 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [lru-add-drain]
   11 rt/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [watchdog/0]
   12 rt/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [watchdog/1]
   13 rt/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [migration/1]
   14 be/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [ksoftirqd/1]
 1039 be/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % python -Es /usr/sbin/firewalld --nofork --nopid [gmain]
 1040 be/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % NetworkManager --no-daemon [gmain]
   17 rt/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [watchdog/2]
   18 rt/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [migration/2]
   19 be/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [ksoftirqd/2]
   21 be/0 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [kworker/2:0H]
   22 rt/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [watchdog/3]
   23 rt/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [migration/3]
   24 be/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [ksoftirqd/3]
  819 be/2 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % audispd
   26 be/0 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [kworker/3:0H]
 8731 be/4 mysql       0.00 B/s    0.00 B/s  0.00 %  0.00 % mysqld
   28 be/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [kdevtmpfs]
   29 be/0 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [netns]
   30 be/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [khungtaskd]
   31 be/0 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [writeback]
   32 be/0 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [kintegrityd]
   33 be/0 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [bioset]
   34 be/0 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [kblockd]
   35 be/0 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [md]
   36 be/0 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [edac-poller]
  549 be/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % systemd-journald
  308 be/0 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [scsi_tmf_1]        
  860 be/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % smartd -n -q never
   42 be/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [kswapd0]
   43 be/5 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [ksmd]
   44 be/7 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [khugepaged]
  557 be/0 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [kworker/3:1H]
  558 be/0 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % [kworker/1:1H]
 8239 be/4 root        0.00 B/s    0.00 B/s  0.00 %  0.00 % -bash

开启另一个终端窗口,使用cp命令复制一个大文件

cp cn_windows_10_consumer_editions_version_1903_2019_x64_dvd.iso  cn-----b.iso

回到运行iotop命令的窗口,查看执行cp命令拷贝文件时的速度

Total DISK READ :     324.58 M/s | Total DISK WRITE :     324.46 M/s
Actual DISK READ:     324.64 M/s | Actual DISK WRITE:       0.00 B/s
  TID  PRIO  USER     DISK READ  DISK WRITE  SWAPIN     IO>    COMMAND                                                                                                                                                                                          
15394 be/4 root      324.58 M/s  324.46 M/s  0.00 % 60.99 % cp -i cn_windows_10_consumer_editions_version_1903_2019_x64_dvd.iso cn-----b.iso
Logo

为开发者提供学习成长、分享交流、生态实践、资源工具等服务,帮助开发者快速成长。

更多推荐