当前位置: 首页 > news >正文

在Ubuntu或linux中为coreutils工具包的cp和mv命令添加进度条

1、查看当前最新的coreutils版本:

http://ftp.gnu.org/gnu/coreutils/

2、安装coreutils过程
# wget http://ftp.gnu.org/gnu/coreutils/coreutils-9.4.tar.xz
# tar -xJf coreutils-9.4.tar.xz
# cd coreutils-9.4/

对照上面的,下载对应coreutils版本的advcpmv版本。

https://github.com/jarun/advcpmv
# wget https://raw.githubusercontent.com/jarun/advcpmv/master/advcpmv-0.9-9.4.patch

# patch -p1 -i advcpmv-0.9-9.4.patch
# ./configure FORCE_UNSAFE_CONFIGURE=1

configure: creating ./config.status
config.status: creating Makefile
config.status: creating po/Makefile.in
config.status: creating gnulib-tests/Makefile
config.status: creating lib/config.h
config.status: executing depfiles commands
config.status: executing po-directories commands
config.status: creating po/POTFILES
config.status: creating po/Makefile

# make

make[4]: Leaving directory '/root/coreutils-9.4/gnulib-tests'
make[3]: Leaving directory '/root/coreutils-9.4/gnulib-tests'
make[2]: Leaving directory '/root/coreutils-9.4/gnulib-tests'
make[1]: Leaving directory '/root/coreutils-9.4'
注:直接编译会出错,需要增加FORCE_UNSAFE_CONFIGURE=1 参数配置。

checking whether mknod can create fifo without root privileges... configure: error: in '/root/coreutils-9.4':
configure: error: you should not run configure as root (set FORCE_UNSAFE_CONFIGURE=1 in environment to bypass this check)
See 'config.log' for more details

替代当前系统命令,有必要可以先备份一下原来的,替换测试后,再将原有版本删除。

$ sudo cp src/cp /usr/local/bin/cp
$ sudo cp src/mv /usr/local/bin/mv

接着我们只需要在使用cp和mv命令的时候加上-g参数就可以显示进度条了。

为了方便起见我们可以在.bashrc文件中设置alias
alias cp='cp -ig'
alias mv='mv -ig'

至此,完成。

http://www.lryc.cn/news/234645.html

相关文章:

  • 力扣-58. 最后一个单词的长度
  • 快递鸟荣获全球电子商务创业创新大赛总决赛一等奖
  • 阶段七-Day02-SpringMVC
  • YOLOv5独家原创改进:最新原创WIoU_NMS改进点,改进有效可以直接当做自己的原创改进点来写,提升网络模型性能精度
  • 【深度学习】pytorch快速得到mobilenet_v2 pth 和onnx
  • 高防CDN安全防护系统在业务方面的应用
  • opencv(3):控制鼠标,创建 tackbar控件
  • UE4动作游戏实例RPG Action解析二:GAS系统播放武器绑定的技能,以及GE效果
  • 做完这些_成为机器学习方面的专家
  • kubernetes|云原生| 如何优雅的重启和更新pod---pod生命周期管理实务
  • 【总结】坐标变换和过渡矩阵(易忘记)
  • 第十一周任务总结
  • Java Web——JavaScript基础
  • Vue3 toRaw 和 markRaw
  • 麒麟信安助力长沙市就业与社保数据服务中心政务系统向自主创新演进
  • 【LeetCode刷题-双指针】--16.最接近的三数之和
  • Mac 安装 protobuf 和Android Studio 使用
  • MongoDB入门级别教程全(Windows版,保姆级教程)
  • 基于机器学习的居民消费影响因子分析预测
  • Qt HTTP 摘要认证(海康球机摄像机ISAPI开发)
  • srs webrtc推拉流环境搭建(公网)
  • 【Flutter】设计原则(2)深入解析 SOLID 原则的应用
  • python爬虫概述及简单实践:获取豆瓣电影排行榜
  • ts视频文件转为mp4(FFmpeg)
  • 2023年咸阳市《网络建设与运维》赛题解析------四、安全配置
  • 什么是java枚举?为什么要用java枚举?
  • USB复合设备构建CDC+HID鼠标键盘套装
  • 准备篇(四)HTTP 基本原理
  • 模板初阶笔记分享
  • 使用Spring Boot实现大文件断点续传及文件校验