Truncate命令通常用于将文件缩小或扩展到指定的大小。如果文件大于指定的大小,则会丢失额外的数据。如果文件较短,则会对其进行扩展,并且扩展部分的读数为零字节。 |
系统环境
安装
通常操作系统会安装truncate命令,该命令在coreutils安装包里面,如果没有安装可以使用下面命令安装:
[root@localhost ~]# yum provides truncate Loaded plugins: fastestmirror, product-id, search-disabled-repos, subscription-manager This system is not registered with an entitlement server. You can use subscription-manager to register. Loading mirror speeds from cached hostfile * base: mirrors.huaweicloud.com * extras: mirrors.aliyun.com * updates: mirrors.aliyun.com coreutils-8.22-24.el7.x86_64 : A set of basic GNU tools commonly used in