网站首页 美食营养 游戏数码 手工爱好 生活家居 健康养生 运动户外 职场理财 情感交际 母婴教育 生活知识 知识问答

linux常用命令(十二)

时间:2024-11-11 04:29:09

1、cut参数: -d 接分隔符(默认是以tab键为分隔符) -f 指定取第几列 -c 从哪开始截取到哪结束但是其不能与-d选项共存。[root@elk-03 ~]# cat testfileI am wahaha,my address beijing

linux常用命令(十二)

2、-d 参数-f 参数[root@elk-03 ~]# cat testfile | cut -d" " -f1,2I am

linux常用命令(十二)

3、-c 按字符参数[root@elk-03 ~]# cat testfile |cut -c 3-4am

linux常用命令(十二)

4、[root@elk-03 ~]# cat testfile | cut -c 3-4,6-amwahaha,my address beijing

linux常用命令(十二)

5、tar命令用于备份文件。mkdir testcd test/touch {1..5}.txtlltotal 0-rw-r--r-- 1 root root 0 Aug 14 18:14 1.txt-rw-r--r-- 1 root root 0 Aug 14 18:14 2.txt-rw-r--r-- 1 root root 0 Aug 14 18:14 3.txt-rw-r--r-- 1 root root 0 Aug 14 18:14 4.txt-rw-r--r-- 1 root root 0 Aug 14 18:14 5.txt

linux常用命令(十二)

6、-z或--gzip或--ungzip 通过gzip指令处理备份文件。-c或--create 秃赈沙嚣建立新的备份文件。-f<备份文件>或--fil髫潋啜缅e=<备份文件> 指定备份文件。[root@elk-03 ~]# tar zcf test.tar.gz test[root@elk-03 ~]# lltotal 12-rw-------. 1 root root 1219 Jun 23 19:05 anaconda-ks.cfgdrwxr-xr-x 2 root root 71 Aug 14 18:14 test-rw-r--r-- 1 root root 31 Aug 14 18:04 testfile-rw-r--r-- 1 root root 166 Aug 14 18:15 test.tar.gzdrwxr-xr-x 3 root root 89 Aug 13 18:48 tools

linux常用命令(十二)

7、-tf 查看压缩包里面的内容[root@elk-03 ~]# tar -tf test.tar.gztest/test/1.txttest/2.txttest/3.txttest/4.txttest/5.txt

linux常用命令(十二)
© 2026 阿力知识库
信息来自网络 所有数据仅供参考
有疑问请联系站长 site.kefu@gmail.com