linux命令-tar工具详解
2015-11-11 23:24
716 查看
把文件和目录打成一个包
文件打包
[root@wangshaojun ~]# tar -cvf 1.tar 1.txt 123 234 ///-c创建 -v可视化 -f file放最后面
1.txt
123/
123/111/
123/111/234/
123/111/234/22.txt
234/
234/123.txt
//////////////////////////////////////////////////////////
查看tar包的内容
[root@wangshaojun ~]# tar -tf 1.tar
111.txt.xz
123/
123/999/
123/999/888.txt
123/111/
123/111/234/
123/111/234/22.txt
222/
///////////////////////////////////////////////////////////
解包
[root@wangshaojun ~]# tar -xvf 1.tar
1.txt
123/
123/111/
123/111/234/
123/111/234/22.txt
234/
234/123.txt
[root@wangshaojun ~]# ls
不提醒是否覆盖 1.tar不消失
/////////////////////////////////////////////////////////////////
指定目录解包
[root@wangshaojun ~]# tar -C /tmp/ -xvf 1.tar
1.txt
123/
123/111/
123/111/234/
123/111/234/22.txt
234/
234/123.txt
[root@wangshaojun ~]# ls /tmp/
111 1.txt
111.txt 222 233.txt
123 234
文件打包
[root@wangshaojun ~]# tar -cvf 1.tar 1.txt 123 234 ///-c创建 -v可视化 -f file放最后面
1.txt
123/
123/111/
123/111/234/
123/111/234/22.txt
234/
234/123.txt
//////////////////////////////////////////////////////////
查看tar包的内容
[root@wangshaojun ~]# tar -tf 1.tar
111.txt.xz
123/
123/999/
123/999/888.txt
123/111/
123/111/234/
123/111/234/22.txt
222/
///////////////////////////////////////////////////////////
解包
[root@wangshaojun ~]# tar -xvf 1.tar
1.txt
123/
123/111/
123/111/234/
123/111/234/22.txt
234/
234/123.txt
[root@wangshaojun ~]# ls
不提醒是否覆盖 1.tar不消失
/////////////////////////////////////////////////////////////////
指定目录解包
[root@wangshaojun ~]# tar -C /tmp/ -xvf 1.tar
1.txt
123/
123/111/
123/111/234/
123/111/234/22.txt
234/
234/123.txt
[root@wangshaojun ~]# ls /tmp/
111 1.txt
111.txt 222 233.txt
123 234
相关文章推荐
- 内联汇编基础学习
- CentOS6.7 DNS配置
- Namespace机制-概述
- linux命令-xz压缩
- linux YUM
- 全面解析Linux 内核 3.10.x - 开始编译<一>
- 用yum来安装或卸载CentOS图形界面包
- linux系统在往文件写入之后,读出来后面却又乱码原因
- Linux内核模块编程-proc文件系统
- cacti安装配置文档
- linux RPM
- Centos 7.1 RDO 安装 Liberty 问题及解决办法
- dmidecode命令
- linux环境下安装Android SDK
- CentOS6.5系统挂载NTFS分区的移动硬盘
- How install support tool for linux system in vmware
- Linux kernel crash case总结
- linux 批量 替换 namespace缩进
- Linux系统入门学习:在CentOS上安装phpMyAdmin
- Linux crontab命令