免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 1709 | 回复: 7
打印 上一主题 下一主题

改路径untar? [复制链接]

论坛徽章:
0
跳转到指定楼层
1 [收藏(0)] [报告]
发表于 2005-10-01 18:32 |只看该作者 |倒序浏览
有tar 文件内容路径是/etc/passwd
untar 会覆盖本机的/etc/passwd. 有没有办法untar 去其他路径。?

论坛徽章:
8
摩羯座
日期:2014-11-26 18:59:452015亚冠之浦和红钻
日期:2015-06-23 19:10:532015亚冠之西悉尼流浪者
日期:2015-08-21 08:40:5815-16赛季CBA联赛之山东
日期:2016-01-31 18:25:0515-16赛季CBA联赛之四川
日期:2016-02-16 16:08:30程序设计版块每日发帖之星
日期:2016-06-29 06:20:002017金鸡报晓
日期:2017-01-10 15:19:5615-16赛季CBA联赛之佛山
日期:2017-02-27 20:41:19
2 [报告]
发表于 2005-10-01 19:54 |只看该作者

改路径untar?

gnu tar的缺省行为是帮用户去掉/的,除非你使用-P显示指定使用绝对路径

论坛徽章:
0
3 [报告]
发表于 2005-10-01 20:01 |只看该作者

改路径untar?

版主,是SunOS, 没有Gnu tar.

论坛徽章:
8
摩羯座
日期:2014-11-26 18:59:452015亚冠之浦和红钻
日期:2015-06-23 19:10:532015亚冠之西悉尼流浪者
日期:2015-08-21 08:40:5815-16赛季CBA联赛之山东
日期:2016-01-31 18:25:0515-16赛季CBA联赛之四川
日期:2016-02-16 16:08:30程序设计版块每日发帖之星
日期:2016-06-29 06:20:002017金鸡报晓
日期:2017-01-10 15:19:5615-16赛季CBA联赛之佛山
日期:2017-02-27 20:41:19
4 [报告]
发表于 2005-10-01 20:26 |只看该作者

改路径untar?

呵呵,如果这样,俺能想出的方法就只有两个了
一种:chroot
另一种是装个gnu tar

论坛徽章:
0
5 [报告]
发表于 2005-10-01 20:40 |只看该作者

改路径untar?

1 WINRAR
2 FTP

论坛徽章:
0
6 [报告]
发表于 2005-10-02 12:34 |只看该作者

改路径untar?

solaris的tar应该有这样的功能,你man一下

论坛徽章:
0
7 [报告]
发表于 2005-10-02 12:54 |只看该作者

改路径untar?

原帖由 "waker" 发表:
呵呵,如果这样,俺能想出的方法就只有两个了
一种:chroot
另一种是装个gnu tar


one supplementary method in Unix .
pax -r -s '/\/etc/\/tmp' <passwd.tar

论坛徽章:
1
技术图书徽章
日期:2013-12-05 23:25:45
8 [报告]
发表于 2005-10-02 14:17 |只看该作者

改路径untar?

Usage: /usr/local/bin/untar [options] archive.tgz [filename] ...
   or: /usr/local/bin/untar [options] -d filename.gz ...

Options: -t   Test -- list contents but don't extract
         -f   Force -- allow existing files to be overwritten
         -q   Quiet -- suppress the normal chatter
         -v   Verbose -- output extra information about each file
         -p   Path -- allow absolute pathnames (don't strip leading '/')
         -c   Convert -- convert files to local text format
         -d   Decompress -- perform "gunzip" but not "tar x"
         -n   No-name -- with "-d", ignore original name in gzip header

This program lists/extracts files from a "*.tar" or "*.tgz" archive.  You can
optionally specify certain files or directories to list/extract; otherwise it
will list/extract them all.  File attributes are preserved, and linked files
will be restored as links.  This program can also be used (with -d) to gunzip
non-tar files.

THIS PROGRAM IS IN THE PUBLIC DOMAIN, AND IS FREELY REDISTRIBUTABLE.
Report bugs to kirkenda@cs.pdx.edu
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP