[每天一个Linux小技巧] cpio 解压到当前目录

使用 cpio 解压文件中要非常注意一点,就是打包的文件是绝对路径时有可能

会覆盖系统路径的文件。那就非常悲催了,比如当前用户有root权限的话,那

你的/bin/ls被会被直接替换成arm的ls,那就这个系统就有的整了。

所以使用cpio时要记得追加下面的选项:

--no-absolute-filenames


用于解压文件到当前目录.

例:

cpio --no-absolute-filenames -idumv < ./initrd.img


对应的参数说明:

`-i'
`--extract'
     Run in copy-in mode.  *Note Copy-in mode::.

`-d'
`--make-directories'
     Create leading directories where needed.

`-u'
`--unconditional'
     Replace all files, without asking whether to replace existing
     newer files with older files.

`-m'
`--preserve-modification-time'
     Retain previous file modification times when creating files.

`-v'
`--verbose'
     List the files processed, or with `-t', give an `ls -l' style
     table of contents listing.  In a verbose table of contents of a
     ustar archive, user and group names in the archive that do not
     exist on the local system are replaced by the names that
     correspond locally to the numeric UID and GID stored in the
     archive.

  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值