一cpio的介绍

功能:复制文件从或到归档

cpio命令是通过重定向的方式将文件进行打包备份,还原恢复的工具,它可以解压以“.cpio”或者“.tar”结尾的文件。

cpio [选项] > 文件名或者设备名

cpio [选项] < 文件名或者设备名

选项
-o 将文件拷贝打包成文件或者将文件输出到设备上
-i 解包,将打包文件解压或将设备上的备份还原到系统
-t 预览,查看文件内容或者输出到设备上的文件内容
-v 显示打包过程中的文件名称。
-d 解包生成目录,在cpio还原时,自动的建立目录
-c 一种较新的存储方式

二cpio的使用

(一)-o 将文件拷贝打包成文件或者将文件输出到设备上

将etc目录备份:

[root@centos72 ~]# ls  /app/etc/  -ld
drwxr-xr-x 3 root root 23 May 3 10:59 /app/etc/
[root@centos72 ~]# find /app/etc/
/app/etc/
/app/etc/sysconfig
/app/etc/sysconfig/ip6tables-config
/app/etc/sysconfig/iptables-config
/app/etc/sysconfig/cbq
/app/etc/sysconfig/cbq/avpkt
/app/etc/sysconfig/cbq/cbq-0000.example
/app/etc/sysconfig/rdisc
/app/etc/sysconfig/console
/app/etc/sysconfig/init
/app/etc/sysconfig/modules
/app/etc/sysconfig/netconsole
/app/etc/sysconfig/network-scripts
/app/etc/sysconfig/network-scripts/ifcfg-lo
/app/etc/sysconfig/network-scripts/ifdown-bnep
/app/etc/sysconfig/network-scripts/ifdown-eth
/app/etc/sysconfig/network-scripts/ifdown-ippp
/app/etc/sysconfig/network-scripts/ifdown-ipv6
/app/etc/sysconfig/network-scripts/ifdown-isdn
/app/etc/sysconfig/network-scripts/ifdown-post
/app/etc/sysconfig/network-scripts/ifdown-ppp
/app/etc/sysconfig/network-scripts/ifdown-routes
/app/etc/sysconfig/network-scripts/ifdown-sit
/app/etc/sysconfig/network-scripts/ifdown-tunnel
/app/etc/sysconfig/network-scripts/ifup-aliases
/app/etc/sysconfig/network-scripts/ifup-bnep
/app/etc/sysconfig/network-scripts/ifup-eth
/app/etc/sysconfig/network-scripts/ifup-ippp
/app/etc/sysconfig/network-scripts/ifup-ipv6
/app/etc/sysconfig/network-scripts/ifup-isdn
/app/etc/sysconfig/network-scripts/ifup-plip
/app/etc/sysconfig/network-scripts/ifup-plusb
/app/etc/sysconfig/network-scripts/ifup-post
/app/etc/sysconfig/network-scripts/ifup-ppp
/app/etc/sysconfig/network-scripts/ifup-routes
/app/etc/sysconfig/network-scripts/ifup-sit
/app/etc/sysconfig/network-scripts/ifup-tunnel
/app/etc/sysconfig/network-scripts/ifup-wireless
/app/etc/sysconfig/network-scripts/init.ipv6-global
/app/etc/sysconfig/network-scripts/network-functions
/app/etc/sysconfig/network-scripts/network-functions-ipv6
/app/etc/sysconfig/network-scripts/ifdown-Team
/app/etc/sysconfig/network-scripts/ifdown-TeamPort
/app/etc/sysconfig/network-scripts/ifup-Team
/app/etc/sysconfig/network-scripts/ifup-TeamPort
/app/etc/sysconfig/network-scripts/ifcfg-ens33
/app/etc/sysconfig/network-scripts/ifcfg-ens37
/app/etc/sysconfig/network-scripts/ifup
/app/etc/sysconfig/network-scripts/ifdown
/app/etc/sysconfig/readonly-root
/app/etc/sysconfig/crond
/app/etc/sysconfig/run-parts
/app/etc/sysconfig/wpa_supplicant
/app/etc/sysconfig/ebtables-config
/app/etc/sysconfig/irqbalance
/app/etc/sysconfig/man-db
/app/etc/sysconfig/rsyslog
/app/etc/sysconfig/firewalld
/app/etc/sysconfig/kdump
/app/etc/sysconfig/sshd
/app/etc/sysconfig/authconfig
/app/etc/sysconfig/cpupower
/app/etc/sysconfig/kernel
/app/etc/sysconfig/network
/app/etc/sysconfig/anaconda
/app/etc/sysconfig/chronyd
/app/etc/sysconfig/ntpdate
/app/etc/sysconfig/ntpd
/app/etc/sysconfig/keepalived
/app/etc/sysconfig/ipvsadm-config
/app/etc/sysconfig/nginx
/app/etc/sysconfig/nginx-debug
/app/etc/sysconfig/htcacheclean
/app/etc/sysconfig/httpd
/app/etc/sysconfig/grub
/app/etc/sysconfig/selinux

通过管道传输给cpio,并且把文件重定向到一个文件里面

[root@centos72 ~]# find  /app/etc/  |  cpio   -ov   >  /app/etc.cpio
/app/etc/
/app/etc/sysconfig
/app/etc/sysconfig/ip6tables-config
/app/etc/sysconfig/iptables-config
/app/etc/sysconfig/cbq
/app/etc/sysconfig/cbq/avpkt
/app/etc/sysconfig/cbq/cbq-0000.example
/app/etc/sysconfig/rdisc
/app/etc/sysconfig/console
/app/etc/sysconfig/init
/app/etc/sysconfig/modules
/app/etc/sysconfig/netconsole
/app/etc/sysconfig/network-scripts
/app/etc/sysconfig/network-scripts/ifcfg-lo
/app/etc/sysconfig/network-scripts/ifdown-bnep
/app/etc/sysconfig/network-scripts/ifdown-eth
/app/etc/sysconfig/network-scripts/ifdown-ippp
/app/etc/sysconfig/network-scripts/ifdown-ipv6
/app/etc/sysconfig/network-scripts/ifdown-isdn
/app/etc/sysconfig/network-scripts/ifdown-post
/app/etc/sysconfig/network-scripts/ifdown-ppp
/app/etc/sysconfig/network-scripts/ifdown-routes
/app/etc/sysconfig/network-scripts/ifdown-sit
/app/etc/sysconfig/network-scripts/ifdown-tunnel
/app/etc/sysconfig/network-scripts/ifup-aliases
/app/etc/sysconfig/network-scripts/ifup-bnep
/app/etc/sysconfig/network-scripts/ifup-eth
/app/etc/sysconfig/network-scripts/ifup-ippp
/app/etc/sysconfig/network-scripts/ifup-ipv6
/app/etc/sysconfig/network-scripts/ifup-isdn
/app/etc/sysconfig/network-scripts/ifup-plip
/app/etc/sysconfig/network-scripts/ifup-plusb
/app/etc/sysconfig/network-scripts/ifup-post
/app/etc/sysconfig/network-scripts/ifup-ppp
/app/etc/sysconfig/network-scripts/ifup-routes
/app/etc/sysconfig/network-scripts/ifup-sit
/app/etc/sysconfig/network-scripts/ifup-tunnel
/app/etc/sysconfig/network-scripts/ifup-wireless
/app/etc/sysconfig/network-scripts/init.ipv6-global
/app/etc/sysconfig/network-scripts/network-functions
/app/etc/sysconfig/network-scripts/network-functions-ipv6
/app/etc/sysconfig/network-scripts/ifdown-Team
/app/etc/sysconfig/network-scripts/ifdown-TeamPort
/app/etc/sysconfig/network-scripts/ifup-Team
/app/etc/sysconfig/network-scripts/ifup-TeamPort
/app/etc/sysconfig/network-scripts/ifcfg-ens33
/app/etc/sysconfig/network-scripts/ifcfg-ens37
/app/etc/sysconfig/network-scripts/ifup
/app/etc/sysconfig/network-scripts/ifdown
/app/etc/sysconfig/readonly-root
/app/etc/sysconfig/crond
/app/etc/sysconfig/run-parts
/app/etc/sysconfig/wpa_supplicant
/app/etc/sysconfig/ebtables-config
/app/etc/sysconfig/irqbalance
/app/etc/sysconfig/man-db
/app/etc/sysconfig/rsyslog
/app/etc/sysconfig/firewalld
/app/etc/sysconfig/kdump
/app/etc/sysconfig/sshd
/app/etc/sysconfig/authconfig
/app/etc/sysconfig/cpupower
/app/etc/sysconfig/kernel
/app/etc/sysconfig/network
/app/etc/sysconfig/anaconda
/app/etc/sysconfig/chronyd
/app/etc/sysconfig/ntpdate
/app/etc/sysconfig/ntpd
/app/etc/sysconfig/keepalived
/app/etc/sysconfig/ipvsadm-config
/app/etc/sysconfig/nginx
/app/etc/sysconfig/nginx-debug
/app/etc/sysconfig/htcacheclean
/app/etc/sysconfig/httpd
/app/etc/sysconfig/grub
/app/etc/sysconfig/selinux
348 blocks

对比文件的大小

[root@centos72 ~]# ls  /app/etc.cpio
/app/etc.cpio
[root@centos72 ~]# ls /app/etc.cpio -lh
-rw-r--r-- 1 root root 174K May 3 11:51 /app/etc.cpio
[root@centos72 ~]# du -sh /app/etc
368K /app/etc
[root@centos72 ~]# du -sh /app/etc/
368K /app/etc/
[root@centos72 ~]# du  -sh  /app/etc/sysconfig/
368K /app/etc/sysconfig/
[root@centos72 ~]# du -sh /app/etc/sysconfig
368K /app/etc/sysconfig
[root@centos72 ~]# tree /app/etc
/app/etc
└── sysconfig
├── anaconda
├── authconfig
├── cbq
│   ├── avpkt
│   └── cbq-0000.example
├── chronyd
├── console
├── cpupower
├── crond
├── ebtables-config
├── firewalld
├── grub -> ../default/grub
├── htcacheclean
├── httpd
├── init
├── ip6tables-config
├── iptables-config
├── ipvsadm-config
├── irqbalance
├── kdump
├── keepalived
├── kernel
├── man-db
├── modules
├── netconsole
├── network
├── network-scripts
│   ├── ifcfg-ens33
│   ├── ifcfg-ens37
│   ├── ifcfg-lo
│   ├── ifdown -> ../../../usr/sbin/ifdown
│   ├── ifdown-bnep
│   ├── ifdown-eth
│   ├── ifdown-ippp
│   ├── ifdown-ipv6
│   ├── ifdown-isdn -> ifdown-ippp
│   ├── ifdown-post
│   ├── ifdown-ppp
│   ├── ifdown-routes
│   ├── ifdown-sit
│   ├── ifdown-Team
│   ├── ifdown-TeamPort
│   ├── ifdown-tunnel
│   ├── ifup -> ../../../usr/sbin/ifup
│   ├── ifup-aliases
│   ├── ifup-bnep
│   ├── ifup-eth
│   ├── ifup-ippp
│   ├── ifup-ipv6
│   ├── ifup-isdn -> ifup-ippp
│   ├── ifup-plip
│   ├── ifup-plusb
│   ├── ifup-post
│   ├── ifup-ppp
│   ├── ifup-routes
│   ├── ifup-sit
│   ├── ifup-Team
│   ├── ifup-TeamPort
│   ├── ifup-tunnel
│   ├── ifup-wireless
│   ├── init.ipv6-global
│   ├── network-functions
│   └── network-functions-ipv6
├── nginx
├── nginx-debug
├── ntpd
├── ntpdate
├── rdisc
├── readonly-root
├── rsyslog
├── run-parts
├── selinux -> ../selinux/config
├── sshd
└── wpa_supplicant 5 directories, 70 files

(二)内容预览

-t 预览,查看文件内容或者输出到设备上的文件内容

[root@centos72 ~]# cpio   -tv    <  /app/etc.cpio
drwxr-xr-x 3 root root 0 May 3 10:59 /app/etc/
drwxr-xr-x 6 root root 0 May 2 14:46 /app/etc/sysconfig
-rw------- 1 root root 2393 Nov 5 01:03 /app/etc/sysconfig/ip6tables-config
-rw------- 1 root root 2374 Nov 5 01:03 /app/etc/sysconfig/iptables-config
drwxr-xr-x 2 root root 0 Jan 13 00:15 /app/etc/sysconfig/cbq
-rw-r--r-- 1 root root 11 Apr 11 2018 /app/etc/sysconfig/cbq/avpkt
-rw-r--r-- 1 root root 79 Apr 11 2018 /app/etc/sysconfig/cbq/cbq-0000.example
-rw-r--r-- 1 root root 15 Aug 4 2017 /app/etc/sysconfig/rdisc
drwxr-xr-x 2 root root 0 Oct 31 2018 /app/etc/sysconfig/console
-rw-r--r-- 1 root root 798 Oct 31 2018 /app/etc/sysconfig/init
drwxr-xr-x 2 root root 0 Oct 31 2018 /app/etc/sysconfig/modules
-rw-r--r-- 1 root root 634 Oct 31 2018 /app/etc/sysconfig/netconsole
drwxr-xr-x 2 root root 0 May 2 14:45 /app/etc/sysconfig/network-scripts
-rw-r--r-- 1 root root 254 Aug 24 2018 /app/etc/sysconfig/network-scripts/ifcfg-lo
-rwxr-xr-x 1 root root 654 Aug 24 2018 /app/etc/sysconfig/network-scripts/ifdown-bnep
-rwxr-xr-x 1 root root 6532 Aug 24 2018 /app/etc/sysconfig/network-scripts/ifdown-eth
-rwxr-xr-x 1 root root 781 Aug 24 2018 /app/etc/sysconfig/network-scripts/ifdown-ippp
-rwxr-xr-x 1 root root 4540 Aug 24 2018 /app/etc/sysconfig/network-scripts/ifdown-ipv6
lrwxrwxrwx 1 root root 11 May 2 14:45 /app/etc/sysconfig/network-scripts/ifdown-isdn -> ifdown-ippp
-rwxr-xr-x 1 root root 2130 Aug 24 2018 /app/etc/sysconfig/network-scripts/ifdown-post
-rwxr-xr-x 1 root root 1068 Aug 24 2018 /app/etc/sysconfig/network-scripts/ifdown-ppp
-rwxr-xr-x 1 root root 870 Aug 24 2018 /app/etc/sysconfig/network-scripts/ifdown-routes
-rwxr-xr-x 1 root root 1456 Aug 24 2018 /app/etc/sysconfig/network-scripts/ifdown-sit
-rwxr-xr-x 1 root root 1462 Aug 24 2018 /app/etc/sysconfig/network-scripts/ifdown-tunnel
-rwxr-xr-x 1 root root 12415 Aug 24 2018 /app/etc/sysconfig/network-scripts/ifup-aliases
-rwxr-xr-x 1 root root 910 Aug 24 2018 /app/etc/sysconfig/network-scripts/ifup-bnep
-rwxr-xr-x 1 root root 13475 Aug 24 2018 /app/etc/sysconfig/network-scripts/ifup-eth
-rwxr-xr-x 1 root root 12075 Aug 24 2018 /app/etc/sysconfig/network-scripts/ifup-ippp
-rwxr-xr-x 1 root root 11893 Aug 24 2018 /app/etc/sysconfig/network-scripts/ifup-ipv6
lrwxrwxrwx 1 root root 9 May 2 14:45 /app/etc/sysconfig/network-scripts/ifup-isdn -> ifup-ippp
-rwxr-xr-x 1 root root 650 Aug 24 2018 /app/etc/sysconfig/network-scripts/ifup-plip
-rwxr-xr-x 1 root root 1064 Aug 24 2018 /app/etc/sysconfig/network-scripts/ifup-plusb
-rwxr-xr-x 1 root root 4997 Aug 24 2018 /app/etc/sysconfig/network-scripts/ifup-post
-rwxr-xr-x 1 root root 4154 Aug 24 2018 /app/etc/sysconfig/network-scripts/ifup-ppp
-rwxr-xr-x 1 root root 2001 Aug 24 2018 /app/etc/sysconfig/network-scripts/ifup-routes
-rwxr-xr-x 1 root root 3303 Aug 24 2018 /app/etc/sysconfig/network-scripts/ifup-sit
-rwxr-xr-x 1 root root 2711 Aug 24 2018 /app/etc/sysconfig/network-scripts/ifup-tunnel
-rwxr-xr-x 1 root root 1836 Aug 24 2018 /app/etc/sysconfig/network-scripts/ifup-wireless
-rwxr-xr-x 1 root root 5419 Aug 24 2018 /app/etc/sysconfig/network-scripts/init.ipv6-global
-rw-r--r-- 1 root root 20671 Aug 24 2018 /app/etc/sysconfig/network-scripts/network-functions
-rw-r--r-- 1 root root 31027 Aug 24 2018 /app/etc/sysconfig/network-scripts/network-functions-ipv6
-rwxr-xr-x 1 root root 1621 Mar 18 2017 /app/etc/sysconfig/network-scripts/ifdown-Team
-rwxr-xr-x 1 root root 1556 Mar 18 2017 /app/etc/sysconfig/network-scripts/ifdown-TeamPort
-rwxr-xr-x 1 root root 1755 Mar 18 2017 /app/etc/sysconfig/network-scripts/ifup-Team
-rwxr-xr-x 1 root root 1876 Mar 18 2017 /app/etc/sysconfig/network-scripts/ifup-TeamPort
-rw-r--r-- 1 root root 206 Apr 15 17:16 /app/etc/sysconfig/network-scripts/ifcfg-ens33
-rw-r--r-- 1 root root 210 Apr 15 17:18 /app/etc/sysconfig/network-scripts/ifcfg-ens37
lrwxrwxrwx 1 root root 22 May 2 14:45 /app/etc/sysconfig/network-scripts/ifup -> ../../../usr/sbin/ifup
lrwxrwxrwx 1 root root 24 May 2 14:45 /app/etc/sysconfig/network-scripts/ifdown -> ../../../usr/sbin/ifdown
-rw-r--r-- 1 root root 905 Oct 31 2018 /app/etc/sysconfig/readonly-root
-rw------- 1 root root 110 Apr 11 2018 /app/etc/sysconfig/crond
-rw-r--r-- 1 root root 0 Jun 10 2014 /app/etc/sysconfig/run-parts
-rw-r--r-- 1 root root 610 Oct 31 2018 /app/etc/sysconfig/wpa_supplicant
-rw------- 1 root root 1390 Apr 11 2018 /app/etc/sysconfig/ebtables-config
-rw-r--r-- 1 root root 903 Apr 11 2018 /app/etc/sysconfig/irqbalance
-rw-r--r-- 1 root root 200 Oct 30 2018 /app/etc/sysconfig/man-db
-rw-r--r-- 1 root root 196 Oct 30 2018 /app/etc/sysconfig/rsyslog
-rw-r--r-- 1 root root 73 Oct 31 2018 /app/etc/sysconfig/firewalld
-rw-r--r-- 1 root root 1722 Nov 5 01:10 /app/etc/sysconfig/kdump
-rw-r----- 1 root root 506 Apr 11 2018 /app/etc/sysconfig/sshd
-rw-r--r-- 1 root root 483 Jan 13 00:21 /app/etc/sysconfig/authconfig
-rw-r--r-- 1 root root 150 Nov 9 07:49 /app/etc/sysconfig/cpupower
-rw-r--r-- 1 root root 180 Jan 13 00:21 /app/etc/sysconfig/kernel
-rw-r--r-- 1 root root 22 May 2 14:45 /app/etc/sysconfig/network
-rw-r--r-- 1 root root 366 Jan 13 00:22 /app/etc/sysconfig/anaconda
-rw-r--r-- 1 root root 46 Apr 13 2018 /app/etc/sysconfig/chronyd
-rw-r--r-- 1 root root 111 Apr 11 2018 /app/etc/sysconfig/ntpdate
-rw-r--r-- 1 root root 45 Apr 11 2018 /app/etc/sysconfig/ntpd
-rw-r--r-- 1 root root 673 Apr 16 00:33 /app/etc/sysconfig/keepalived
-rw------- 1 root root 774 Mar 6 2015 /app/etc/sysconfig/ipvsadm-config
-rw-r--r-- 1 root root 98 Dec 4 23:01 /app/etc/sysconfig/nginx
-rw-r--r-- 1 root root 148 Dec 4 23:01 /app/etc/sysconfig/nginx-debug
-rw-r--r-- 1 root root 348 Oct 30 2018 /app/etc/sysconfig/htcacheclean
-rw-r--r-- 1 root root 802 Oct 30 2018 /app/etc/sysconfig/httpd
lrwxrwxrwx 1 root root 15 May 2 14:45 /app/etc/sysconfig/grub -> ../default/grub
lrwxrwxrwx 1 root root 17 Jan 13 00:16 /app/etc/sysconfig/selinux -> ../selinux/config
348 blocks

(三)解包文件

-v 显示打包过程中的文件名称。

-d 解包生成目录,在cpio还原时,自动的建立目录

cpio –idv < etc.cpio

[root@centos72 ~]# cpio -idv < /app/etc.cpio
/app/etc
/app/etc/sysconfig
cpio: /app/etc/sysconfig/ip6tables-config not created: newer or same age version exists
/app/etc/sysconfig/ip6tables-config
cpio: /app/etc/sysconfig/iptables-config not created: newer or same age version exists
/app/etc/sysconfig/iptables-config
/app/etc/sysconfig/cbq
cpio: /app/etc/sysconfig/cbq/avpkt not created: newer or same age version exists
/app/etc/sysconfig/cbq/avpkt
cpio: /app/etc/sysconfig/cbq/cbq-0000.example not created: newer or same age version exists
/app/etc/sysconfig/cbq/cbq-0000.example
cpio: /app/etc/sysconfig/rdisc not created: newer or same age version exists
/app/etc/sysconfig/rdisc
/app/etc/sysconfig/console
cpio: /app/etc/sysconfig/init not created: newer or same age version exists
/app/etc/sysconfig/init
/app/etc/sysconfig/modules
cpio: /app/etc/sysconfig/netconsole not created: newer or same age version exists
/app/etc/sysconfig/netconsole
/app/etc/sysconfig/network-scripts
cpio: /app/etc/sysconfig/network-scripts/ifcfg-lo not created: newer or same age version exists
/app/etc/sysconfig/network-scripts/ifcfg-lo
cpio: /app/etc/sysconfig/network-scripts/ifdown-bnep not created: newer or same age version exists
/app/etc/sysconfig/network-scripts/ifdown-bnep
cpio: /app/etc/sysconfig/network-scripts/ifdown-eth not created: newer or same age version exists
/app/etc/sysconfig/network-scripts/ifdown-eth
cpio: /app/etc/sysconfig/network-scripts/ifdown-ippp not created: newer or same age version exists
/app/etc/sysconfig/network-scripts/ifdown-ippp
cpio: /app/etc/sysconfig/network-scripts/ifdown-ipv6 not created: newer or same age version exists
/app/etc/sysconfig/network-scripts/ifdown-ipv6
cpio: /app/etc/sysconfig/network-scripts/ifdown-isdn not created: newer or same age version exists
/app/etc/sysconfig/network-scripts/ifdown-isdn
cpio: /app/etc/sysconfig/network-scripts/ifdown-post not created: newer or same age version exists
/app/etc/sysconfig/network-scripts/ifdown-post
cpio: /app/etc/sysconfig/network-scripts/ifdown-ppp not created: newer or same age version exists
/app/etc/sysconfig/network-scripts/ifdown-ppp
cpio: /app/etc/sysconfig/network-scripts/ifdown-routes not created: newer or same age version exists
/app/etc/sysconfig/network-scripts/ifdown-routes
cpio: /app/etc/sysconfig/network-scripts/ifdown-sit not created: newer or same age version exists
/app/etc/sysconfig/network-scripts/ifdown-sit
cpio: /app/etc/sysconfig/network-scripts/ifdown-tunnel not created: newer or same age version exists
/app/etc/sysconfig/network-scripts/ifdown-tunnel
cpio: /app/etc/sysconfig/network-scripts/ifup-aliases not created: newer or same age version exists
/app/etc/sysconfig/network-scripts/ifup-aliases
cpio: /app/etc/sysconfig/network-scripts/ifup-bnep not created: newer or same age version exists
/app/etc/sysconfig/network-scripts/ifup-bnep
cpio: /app/etc/sysconfig/network-scripts/ifup-eth not created: newer or same age version exists
/app/etc/sysconfig/network-scripts/ifup-eth
cpio: /app/etc/sysconfig/network-scripts/ifup-ippp not created: newer or same age version exists
/app/etc/sysconfig/network-scripts/ifup-ippp
cpio: /app/etc/sysconfig/network-scripts/ifup-ipv6 not created: newer or same age version exists
/app/etc/sysconfig/network-scripts/ifup-ipv6
cpio: /app/etc/sysconfig/network-scripts/ifup-isdn not created: newer or same age version exists
/app/etc/sysconfig/network-scripts/ifup-isdn
cpio: /app/etc/sysconfig/network-scripts/ifup-plip not created: newer or same age version exists
/app/etc/sysconfig/network-scripts/ifup-plip
cpio: /app/etc/sysconfig/network-scripts/ifup-plusb not created: newer or same age version exists
/app/etc/sysconfig/network-scripts/ifup-plusb
cpio: /app/etc/sysconfig/network-scripts/ifup-post not created: newer or same age version exists
/app/etc/sysconfig/network-scripts/ifup-post
cpio: /app/etc/sysconfig/network-scripts/ifup-ppp not created: newer or same age version exists
/app/etc/sysconfig/network-scripts/ifup-ppp
cpio: /app/etc/sysconfig/network-scripts/ifup-routes not created: newer or same age version exists
/app/etc/sysconfig/network-scripts/ifup-routes
cpio: /app/etc/sysconfig/network-scripts/ifup-sit not created: newer or same age version exists
/app/etc/sysconfig/network-scripts/ifup-sit
cpio: /app/etc/sysconfig/network-scripts/ifup-tunnel not created: newer or same age version exists
/app/etc/sysconfig/network-scripts/ifup-tunnel
cpio: /app/etc/sysconfig/network-scripts/ifup-wireless not created: newer or same age version exists
/app/etc/sysconfig/network-scripts/ifup-wireless
cpio: /app/etc/sysconfig/network-scripts/init.ipv6-global not created: newer or same age version exists
/app/etc/sysconfig/network-scripts/init.ipv6-global
cpio: /app/etc/sysconfig/network-scripts/network-functions not created: newer or same age version exists
/app/etc/sysconfig/network-scripts/network-functions
cpio: /app/etc/sysconfig/network-scripts/network-functions-ipv6 not created: newer or same age version exists
/app/etc/sysconfig/network-scripts/network-functions-ipv6
cpio: /app/etc/sysconfig/network-scripts/ifdown-Team not created: newer or same age version exists
/app/etc/sysconfig/network-scripts/ifdown-Team
cpio: /app/etc/sysconfig/network-scripts/ifdown-TeamPort not created: newer or same age version exists
/app/etc/sysconfig/network-scripts/ifdown-TeamPort
cpio: /app/etc/sysconfig/network-scripts/ifup-Team not created: newer or same age version exists
/app/etc/sysconfig/network-scripts/ifup-Team
cpio: /app/etc/sysconfig/network-scripts/ifup-TeamPort not created: newer or same age version exists
/app/etc/sysconfig/network-scripts/ifup-TeamPort
cpio: /app/etc/sysconfig/network-scripts/ifcfg-ens33 not created: newer or same age version exists
/app/etc/sysconfig/network-scripts/ifcfg-ens33
cpio: /app/etc/sysconfig/network-scripts/ifcfg-ens37 not created: newer or same age version exists
/app/etc/sysconfig/network-scripts/ifcfg-ens37
cpio: /app/etc/sysconfig/network-scripts/ifup not created: newer or same age version exists
/app/etc/sysconfig/network-scripts/ifup
cpio: /app/etc/sysconfig/network-scripts/ifdown not created: newer or same age version exists
/app/etc/sysconfig/network-scripts/ifdown
cpio: /app/etc/sysconfig/readonly-root not created: newer or same age version exists
/app/etc/sysconfig/readonly-root
cpio: /app/etc/sysconfig/crond not created: newer or same age version exists
/app/etc/sysconfig/crond
cpio: /app/etc/sysconfig/run-parts not created: newer or same age version exists
/app/etc/sysconfig/run-parts
cpio: /app/etc/sysconfig/wpa_supplicant not created: newer or same age version exists
/app/etc/sysconfig/wpa_supplicant
cpio: /app/etc/sysconfig/ebtables-config not created: newer or same age version exists
/app/etc/sysconfig/ebtables-config
cpio: /app/etc/sysconfig/irqbalance not created: newer or same age version exists
/app/etc/sysconfig/irqbalance
cpio: /app/etc/sysconfig/man-db not created: newer or same age version exists
/app/etc/sysconfig/man-db
cpio: /app/etc/sysconfig/rsyslog not created: newer or same age version exists
/app/etc/sysconfig/rsyslog
cpio: /app/etc/sysconfig/firewalld not created: newer or same age version exists
/app/etc/sysconfig/firewalld
cpio: /app/etc/sysconfig/kdump not created: newer or same age version exists
/app/etc/sysconfig/kdump
cpio: /app/etc/sysconfig/sshd not created: newer or same age version exists
/app/etc/sysconfig/sshd
cpio: /app/etc/sysconfig/authconfig not created: newer or same age version exists
/app/etc/sysconfig/authconfig
cpio: /app/etc/sysconfig/cpupower not created: newer or same age version exists
/app/etc/sysconfig/cpupower
cpio: /app/etc/sysconfig/kernel not created: newer or same age version exists
/app/etc/sysconfig/kernel
cpio: /app/etc/sysconfig/network not created: newer or same age version exists
/app/etc/sysconfig/network
cpio: /app/etc/sysconfig/anaconda not created: newer or same age version exists
/app/etc/sysconfig/anaconda
cpio: /app/etc/sysconfig/chronyd not created: newer or same age version exists
/app/etc/sysconfig/chronyd
cpio: /app/etc/sysconfig/ntpdate not created: newer or same age version exists
/app/etc/sysconfig/ntpdate
cpio: /app/etc/sysconfig/ntpd not created: newer or same age version exists
/app/etc/sysconfig/ntpd
cpio: /app/etc/sysconfig/keepalived not created: newer or same age version exists
/app/etc/sysconfig/keepalived
cpio: /app/etc/sysconfig/ipvsadm-config not created: newer or same age version exists
/app/etc/sysconfig/ipvsadm-config
cpio: /app/etc/sysconfig/nginx not created: newer or same age version exists
/app/etc/sysconfig/nginx
cpio: /app/etc/sysconfig/nginx-debug not created: newer or same age version exists
/app/etc/sysconfig/nginx-debug
cpio: /app/etc/sysconfig/htcacheclean not created: newer or same age version exists
/app/etc/sysconfig/htcacheclean
cpio: /app/etc/sysconfig/httpd not created: newer or same age version exists
/app/etc/sysconfig/httpd
cpio: /app/etc/sysconfig/grub not created: newer or same age version exists
/app/etc/sysconfig/grub
cpio: /app/etc/sysconfig/selinux not created: newer or same age version exists
/app/etc/sysconfig/selinux
348 blocks
[root@centos72 ~]# cpio -idv < /app/etc.cpio^C
[root@centos72 ~]# ll /app/etc.cpio
-rw-r--r-- 1 root root 178176 May 3 11:51 /app/etc.cpio
[root@centos72 ~]# cd /app
[root@centos72 app]# cpio -idv < /app/etc.cpio
/app/etc
/app/etc/sysconfig
cpio: /app/etc/sysconfig/ip6tables-config not created: newer or same age version exists
/app/etc/sysconfig/ip6tables-config
cpio: /app/etc/sysconfig/iptables-config not created: newer or same age version exists
/app/etc/sysconfig/iptables-config
/app/etc/sysconfig/cbq
cpio: /app/etc/sysconfig/cbq/avpkt not created: newer or same age version exists
/app/etc/sysconfig/cbq/avpkt
cpio: /app/etc/sysconfig/cbq/cbq-0000.example not created: newer or same age version exists
/app/etc/sysconfig/cbq/cbq-0000.example
cpio: /app/etc/sysconfig/rdisc not created: newer or same age version exists
/app/etc/sysconfig/rdisc
/app/etc/sysconfig/console
cpio: /app/etc/sysconfig/init not created: newer or same age version exists
/app/etc/sysconfig/init
/app/etc/sysconfig/modules
cpio: /app/etc/sysconfig/netconsole not created: newer or same age version exists
/app/etc/sysconfig/netconsole
/app/etc/sysconfig/network-scripts
cpio: /app/etc/sysconfig/network-scripts/ifcfg-lo not created: newer or same age version exists
/app/etc/sysconfig/network-scripts/ifcfg-lo
cpio: /app/etc/sysconfig/network-scripts/ifdown-bnep not created: newer or same age version exists
/app/etc/sysconfig/network-scripts/ifdown-bnep
cpio: /app/etc/sysconfig/network-scripts/ifdown-eth not created: newer or same age version exists
/app/etc/sysconfig/network-scripts/ifdown-eth
cpio: /app/etc/sysconfig/network-scripts/ifdown-ippp not created: newer or same age version exists
/app/etc/sysconfig/network-scripts/ifdown-ippp
cpio: /app/etc/sysconfig/network-scripts/ifdown-ipv6 not created: newer or same age version exists
/app/etc/sysconfig/network-scripts/ifdown-ipv6
cpio: /app/etc/sysconfig/network-scripts/ifdown-isdn not created: newer or same age version exists
/app/etc/sysconfig/network-scripts/ifdown-isdn
cpio: /app/etc/sysconfig/network-scripts/ifdown-post not created: newer or same age version exists
/app/etc/sysconfig/network-scripts/ifdown-post
cpio: /app/etc/sysconfig/network-scripts/ifdown-ppp not created: newer or same age version exists
/app/etc/sysconfig/network-scripts/ifdown-ppp
cpio: /app/etc/sysconfig/network-scripts/ifdown-routes not created: newer or same age version exists
/app/etc/sysconfig/network-scripts/ifdown-routes
cpio: /app/etc/sysconfig/network-scripts/ifdown-sit not created: newer or same age version exists
/app/etc/sysconfig/network-scripts/ifdown-sit
cpio: /app/etc/sysconfig/network-scripts/ifdown-tunnel not created: newer or same age version exists
/app/etc/sysconfig/network-scripts/ifdown-tunnel
cpio: /app/etc/sysconfig/network-scripts/ifup-aliases not created: newer or same age version exists
/app/etc/sysconfig/network-scripts/ifup-aliases
cpio: /app/etc/sysconfig/network-scripts/ifup-bnep not created: newer or same age version exists
/app/etc/sysconfig/network-scripts/ifup-bnep
cpio: /app/etc/sysconfig/network-scripts/ifup-eth not created: newer or same age version exists
/app/etc/sysconfig/network-scripts/ifup-eth
cpio: /app/etc/sysconfig/network-scripts/ifup-ippp not created: newer or same age version exists
/app/etc/sysconfig/network-scripts/ifup-ippp
cpio: /app/etc/sysconfig/network-scripts/ifup-ipv6 not created: newer or same age version exists
/app/etc/sysconfig/network-scripts/ifup-ipv6
cpio: /app/etc/sysconfig/network-scripts/ifup-isdn not created: newer or same age version exists
/app/etc/sysconfig/network-scripts/ifup-isdn
cpio: /app/etc/sysconfig/network-scripts/ifup-plip not created: newer or same age version exists
/app/etc/sysconfig/network-scripts/ifup-plip
cpio: /app/etc/sysconfig/network-scripts/ifup-plusb not created: newer or same age version exists
/app/etc/sysconfig/network-scripts/ifup-plusb
cpio: /app/etc/sysconfig/network-scripts/ifup-post not created: newer or same age version exists
/app/etc/sysconfig/network-scripts/ifup-post
cpio: /app/etc/sysconfig/network-scripts/ifup-ppp not created: newer or same age version exists
/app/etc/sysconfig/network-scripts/ifup-ppp
cpio: /app/etc/sysconfig/network-scripts/ifup-routes not created: newer or same age version exists
/app/etc/sysconfig/network-scripts/ifup-routes
cpio: /app/etc/sysconfig/network-scripts/ifup-sit not created: newer or same age version exists
/app/etc/sysconfig/network-scripts/ifup-sit
cpio: /app/etc/sysconfig/network-scripts/ifup-tunnel not created: newer or same age version exists
/app/etc/sysconfig/network-scripts/ifup-tunnel
cpio: /app/etc/sysconfig/network-scripts/ifup-wireless not created: newer or same age version exists
/app/etc/sysconfig/network-scripts/ifup-wireless
cpio: /app/etc/sysconfig/network-scripts/init.ipv6-global not created: newer or same age version exists
/app/etc/sysconfig/network-scripts/init.ipv6-global
cpio: /app/etc/sysconfig/network-scripts/network-functions not created: newer or same age version exists
/app/etc/sysconfig/network-scripts/network-functions
cpio: /app/etc/sysconfig/network-scripts/network-functions-ipv6 not created: newer or same age version exists
/app/etc/sysconfig/network-scripts/network-functions-ipv6
cpio: /app/etc/sysconfig/network-scripts/ifdown-Team not created: newer or same age version exists
/app/etc/sysconfig/network-scripts/ifdown-Team
cpio: /app/etc/sysconfig/network-scripts/ifdown-TeamPort not created: newer or same age version exists
/app/etc/sysconfig/network-scripts/ifdown-TeamPort
cpio: /app/etc/sysconfig/network-scripts/ifup-Team not created: newer or same age version exists
/app/etc/sysconfig/network-scripts/ifup-Team
cpio: /app/etc/sysconfig/network-scripts/ifup-TeamPort not created: newer or same age version exists
/app/etc/sysconfig/network-scripts/ifup-TeamPort
cpio: /app/etc/sysconfig/network-scripts/ifcfg-ens33 not created: newer or same age version exists
/app/etc/sysconfig/network-scripts/ifcfg-ens33
cpio: /app/etc/sysconfig/network-scripts/ifcfg-ens37 not created: newer or same age version exists
/app/etc/sysconfig/network-scripts/ifcfg-ens37
cpio: /app/etc/sysconfig/network-scripts/ifup not created: newer or same age version exists
/app/etc/sysconfig/network-scripts/ifup
cpio: /app/etc/sysconfig/network-scripts/ifdown not created: newer or same age version exists
/app/etc/sysconfig/network-scripts/ifdown
cpio: /app/etc/sysconfig/readonly-root not created: newer or same age version exists
/app/etc/sysconfig/readonly-root
cpio: /app/etc/sysconfig/crond not created: newer or same age version exists
/app/etc/sysconfig/crond
cpio: /app/etc/sysconfig/run-parts not created: newer or same age version exists
/app/etc/sysconfig/run-parts
cpio: /app/etc/sysconfig/wpa_supplicant not created: newer or same age version exists
/app/etc/sysconfig/wpa_supplicant
cpio: /app/etc/sysconfig/ebtables-config not created: newer or same age version exists
/app/etc/sysconfig/ebtables-config
cpio: /app/etc/sysconfig/irqbalance not created: newer or same age version exists
/app/etc/sysconfig/irqbalance
cpio: /app/etc/sysconfig/man-db not created: newer or same age version exists
/app/etc/sysconfig/man-db
cpio: /app/etc/sysconfig/rsyslog not created: newer or same age version exists
/app/etc/sysconfig/rsyslog
cpio: /app/etc/sysconfig/firewalld not created: newer or same age version exists
/app/etc/sysconfig/firewalld
cpio: /app/etc/sysconfig/kdump not created: newer or same age version exists
/app/etc/sysconfig/kdump
cpio: /app/etc/sysconfig/sshd not created: newer or same age version exists
/app/etc/sysconfig/sshd
cpio: /app/etc/sysconfig/authconfig not created: newer or same age version exists
/app/etc/sysconfig/authconfig
cpio: /app/etc/sysconfig/cpupower not created: newer or same age version exists
/app/etc/sysconfig/cpupower
cpio: /app/etc/sysconfig/kernel not created: newer or same age version exists
/app/etc/sysconfig/kernel
cpio: /app/etc/sysconfig/network not created: newer or same age version exists
/app/etc/sysconfig/network
cpio: /app/etc/sysconfig/anaconda not created: newer or same age version exists
/app/etc/sysconfig/anaconda
cpio: /app/etc/sysconfig/chronyd not created: newer or same age version exists
/app/etc/sysconfig/chronyd
cpio: /app/etc/sysconfig/ntpdate not created: newer or same age version exists
/app/etc/sysconfig/ntpdate
cpio: /app/etc/sysconfig/ntpd not created: newer or same age version exists
/app/etc/sysconfig/ntpd
cpio: /app/etc/sysconfig/keepalived not created: newer or same age version exists
/app/etc/sysconfig/keepalived
cpio: /app/etc/sysconfig/ipvsadm-config not created: newer or same age version exists
/app/etc/sysconfig/ipvsadm-config
cpio: /app/etc/sysconfig/nginx not created: newer or same age version exists
/app/etc/sysconfig/nginx
cpio: /app/etc/sysconfig/nginx-debug not created: newer or same age version exists
/app/etc/sysconfig/nginx-debug
cpio: /app/etc/sysconfig/htcacheclean not created: newer or same age version exists
/app/etc/sysconfig/htcacheclean
cpio: /app/etc/sysconfig/httpd not created: newer or same age version exists
/app/etc/sysconfig/httpd
cpio: /app/etc/sysconfig/grub not created: newer or same age version exists
/app/etc/sysconfig/grub
cpio: /app/etc/sysconfig/selinux not created: newer or same age version exists
/app/etc/sysconfig/selinux
348 blocks

上面于报错,重新将etc目录备份

进入到app目录里面

[root@centos72 ~]# cd  /app
[root@centos72 app]# ll -d /etc/
drwxr-xr-x. 79 root root 8192 May 2 14:56 /etc/
[root@centos72 app]# du -sh etc
368K etc
[root@centos72 app]# find ./etc
./etc
./etc/sysconfig
./etc/sysconfig/ip6tables-config
./etc/sysconfig/iptables-config
./etc/sysconfig/cbq
./etc/sysconfig/cbq/avpkt
./etc/sysconfig/cbq/cbq-0000.example
./etc/sysconfig/rdisc
./etc/sysconfig/console
./etc/sysconfig/init
./etc/sysconfig/modules
./etc/sysconfig/netconsole
./etc/sysconfig/network-scripts
./etc/sysconfig/network-scripts/ifcfg-lo
./etc/sysconfig/network-scripts/ifdown-bnep
./etc/sysconfig/network-scripts/ifdown-eth
./etc/sysconfig/network-scripts/ifdown-ippp
./etc/sysconfig/network-scripts/ifdown-ipv6
./etc/sysconfig/network-scripts/ifdown-isdn
./etc/sysconfig/network-scripts/ifdown-post
./etc/sysconfig/network-scripts/ifdown-ppp
./etc/sysconfig/network-scripts/ifdown-routes
./etc/sysconfig/network-scripts/ifdown-sit
./etc/sysconfig/network-scripts/ifdown-tunnel
./etc/sysconfig/network-scripts/ifup-aliases
./etc/sysconfig/network-scripts/ifup-bnep
./etc/sysconfig/network-scripts/ifup-eth
./etc/sysconfig/network-scripts/ifup-ippp
./etc/sysconfig/network-scripts/ifup-ipv6
./etc/sysconfig/network-scripts/ifup-isdn
./etc/sysconfig/network-scripts/ifup-plip
./etc/sysconfig/network-scripts/ifup-plusb
./etc/sysconfig/network-scripts/ifup-post
./etc/sysconfig/network-scripts/ifup-ppp
./etc/sysconfig/network-scripts/ifup-routes
./etc/sysconfig/network-scripts/ifup-sit
./etc/sysconfig/network-scripts/ifup-tunnel
./etc/sysconfig/network-scripts/ifup-wireless
./etc/sysconfig/network-scripts/init.ipv6-global
./etc/sysconfig/network-scripts/network-functions
./etc/sysconfig/network-scripts/network-functions-ipv6
./etc/sysconfig/network-scripts/ifdown-Team
./etc/sysconfig/network-scripts/ifdown-TeamPort
./etc/sysconfig/network-scripts/ifup-Team
./etc/sysconfig/network-scripts/ifup-TeamPort
./etc/sysconfig/network-scripts/ifcfg-ens33
./etc/sysconfig/network-scripts/ifcfg-ens37
./etc/sysconfig/network-scripts/ifup
./etc/sysconfig/network-scripts/ifdown
./etc/sysconfig/readonly-root
./etc/sysconfig/crond
./etc/sysconfig/run-parts
./etc/sysconfig/wpa_supplicant
./etc/sysconfig/ebtables-config
./etc/sysconfig/irqbalance
./etc/sysconfig/man-db
./etc/sysconfig/rsyslog
./etc/sysconfig/firewalld
./etc/sysconfig/kdump
./etc/sysconfig/sshd
./etc/sysconfig/authconfig
./etc/sysconfig/cpupower
./etc/sysconfig/kernel
./etc/sysconfig/network
./etc/sysconfig/anaconda
./etc/sysconfig/chronyd
./etc/sysconfig/ntpdate
./etc/sysconfig/ntpd
./etc/sysconfig/keepalived
./etc/sysconfig/ipvsadm-config
./etc/sysconfig/nginx
./etc/sysconfig/nginx-debug
./etc/sysconfig/htcacheclean
./etc/sysconfig/httpd
./etc/sysconfig/grub
./etc/sysconfig/selinux

把当前的文件重定向到其他目录里面

[root@centos72 app]# find   ./etc/   | cpio  -ov  >  /app1/etc.cpio
./etc/
./etc/sysconfig
./etc/sysconfig/ip6tables-config
./etc/sysconfig/iptables-config
./etc/sysconfig/cbq
./etc/sysconfig/cbq/avpkt
./etc/sysconfig/cbq/cbq-0000.example
./etc/sysconfig/rdisc
./etc/sysconfig/console
./etc/sysconfig/init
./etc/sysconfig/modules
./etc/sysconfig/netconsole
./etc/sysconfig/network-scripts
./etc/sysconfig/network-scripts/ifcfg-lo
./etc/sysconfig/network-scripts/ifdown-bnep
./etc/sysconfig/network-scripts/ifdown-eth
./etc/sysconfig/network-scripts/ifdown-ippp
./etc/sysconfig/network-scripts/ifdown-ipv6
./etc/sysconfig/network-scripts/ifdown-isdn
./etc/sysconfig/network-scripts/ifdown-post
./etc/sysconfig/network-scripts/ifdown-ppp
./etc/sysconfig/network-scripts/ifdown-routes
./etc/sysconfig/network-scripts/ifdown-sit
./etc/sysconfig/network-scripts/ifdown-tunnel
./etc/sysconfig/network-scripts/ifup-aliases
./etc/sysconfig/network-scripts/ifup-bnep
./etc/sysconfig/network-scripts/ifup-eth
./etc/sysconfig/network-scripts/ifup-ippp
./etc/sysconfig/network-scripts/ifup-ipv6
./etc/sysconfig/network-scripts/ifup-isdn
./etc/sysconfig/network-scripts/ifup-plip
./etc/sysconfig/network-scripts/ifup-plusb
./etc/sysconfig/network-scripts/ifup-post
./etc/sysconfig/network-scripts/ifup-ppp
./etc/sysconfig/network-scripts/ifup-routes
./etc/sysconfig/network-scripts/ifup-sit
./etc/sysconfig/network-scripts/ifup-tunnel
./etc/sysconfig/network-scripts/ifup-wireless
./etc/sysconfig/network-scripts/init.ipv6-global
./etc/sysconfig/network-scripts/network-functions
./etc/sysconfig/network-scripts/network-functions-ipv6
./etc/sysconfig/network-scripts/ifdown-Team
./etc/sysconfig/network-scripts/ifdown-TeamPort
./etc/sysconfig/network-scripts/ifup-Team
./etc/sysconfig/network-scripts/ifup-TeamPort
./etc/sysconfig/network-scripts/ifcfg-ens33
./etc/sysconfig/network-scripts/ifcfg-ens37
./etc/sysconfig/network-scripts/ifup
./etc/sysconfig/network-scripts/ifdown
./etc/sysconfig/readonly-root
./etc/sysconfig/crond
./etc/sysconfig/run-parts
./etc/sysconfig/wpa_supplicant
./etc/sysconfig/ebtables-config
./etc/sysconfig/irqbalance
./etc/sysconfig/man-db
./etc/sysconfig/rsyslog
./etc/sysconfig/firewalld
./etc/sysconfig/kdump
./etc/sysconfig/sshd
./etc/sysconfig/authconfig
./etc/sysconfig/cpupower
./etc/sysconfig/kernel
./etc/sysconfig/network
./etc/sysconfig/anaconda
./etc/sysconfig/chronyd
./etc/sysconfig/ntpdate
./etc/sysconfig/ntpd
./etc/sysconfig/keepalived
./etc/sysconfig/ipvsadm-config
./etc/sysconfig/nginx
./etc/sysconfig/nginx-debug
./etc/sysconfig/htcacheclean
./etc/sysconfig/httpd
./etc/sysconfig/grub
./etc/sysconfig/selinux
347 blocks

解压到当前目录里面

[root@centos72 app]# cd  /app1
[root@centos72 app1]# ls
etc.cpio
[root@centos72 app1]# ll
total 176
-rw-r--r-- 1 root root 177664 May 3 12:22 etc.cpio
[root@centos72 app1]# du -sh
176K .
[root@centos72 app1]# du -sh etc.cpio
176K etc.cpio
[root@centos72 app1]# cpio -idv < etc.cpio
etc
etc/sysconfig
etc/sysconfig/ip6tables-config
etc/sysconfig/iptables-config
etc/sysconfig/cbq
etc/sysconfig/cbq/avpkt
etc/sysconfig/cbq/cbq-0000.example
etc/sysconfig/rdisc
etc/sysconfig/console
etc/sysconfig/init
etc/sysconfig/modules
etc/sysconfig/netconsole
etc/sysconfig/network-scripts
etc/sysconfig/network-scripts/ifcfg-lo
etc/sysconfig/network-scripts/ifdown-bnep
etc/sysconfig/network-scripts/ifdown-eth
etc/sysconfig/network-scripts/ifdown-ippp
etc/sysconfig/network-scripts/ifdown-ipv6
etc/sysconfig/network-scripts/ifdown-isdn
etc/sysconfig/network-scripts/ifdown-post
etc/sysconfig/network-scripts/ifdown-ppp
etc/sysconfig/network-scripts/ifdown-routes
etc/sysconfig/network-scripts/ifdown-sit
etc/sysconfig/network-scripts/ifdown-tunnel
etc/sysconfig/network-scripts/ifup-aliases
etc/sysconfig/network-scripts/ifup-bnep
etc/sysconfig/network-scripts/ifup-eth
etc/sysconfig/network-scripts/ifup-ippp
etc/sysconfig/network-scripts/ifup-ipv6
etc/sysconfig/network-scripts/ifup-isdn
etc/sysconfig/network-scripts/ifup-plip
etc/sysconfig/network-scripts/ifup-plusb
etc/sysconfig/network-scripts/ifup-post
etc/sysconfig/network-scripts/ifup-ppp
etc/sysconfig/network-scripts/ifup-routes
etc/sysconfig/network-scripts/ifup-sit
etc/sysconfig/network-scripts/ifup-tunnel
etc/sysconfig/network-scripts/ifup-wireless
etc/sysconfig/network-scripts/init.ipv6-global
etc/sysconfig/network-scripts/network-functions
etc/sysconfig/network-scripts/network-functions-ipv6
etc/sysconfig/network-scripts/ifdown-Team
etc/sysconfig/network-scripts/ifdown-TeamPort
etc/sysconfig/network-scripts/ifup-Team
etc/sysconfig/network-scripts/ifup-TeamPort
etc/sysconfig/network-scripts/ifcfg-ens33
etc/sysconfig/network-scripts/ifcfg-ens37
etc/sysconfig/network-scripts/ifup
etc/sysconfig/network-scripts/ifdown
etc/sysconfig/readonly-root
etc/sysconfig/crond
etc/sysconfig/run-parts
etc/sysconfig/wpa_supplicant
etc/sysconfig/ebtables-config
etc/sysconfig/irqbalance
etc/sysconfig/man-db
etc/sysconfig/rsyslog
etc/sysconfig/firewalld
etc/sysconfig/kdump
etc/sysconfig/sshd
etc/sysconfig/authconfig
etc/sysconfig/cpupower
etc/sysconfig/kernel
etc/sysconfig/network
etc/sysconfig/anaconda
etc/sysconfig/chronyd
etc/sysconfig/ntpdate
etc/sysconfig/ntpd
etc/sysconfig/keepalived
etc/sysconfig/ipvsadm-config
etc/sysconfig/nginx
etc/sysconfig/nginx-debug
etc/sysconfig/htcacheclean
etc/sysconfig/httpd
etc/sysconfig/grub
etc/sysconfig/selinux
347 blocks
[root@centos72 app1]# ls
etc etc.cpio
[root@centos72 app1]# tree  etc
etc
└── sysconfig
├── anaconda
├── authconfig
├── cbq
│   ├── avpkt
│   └── cbq-0000.example
├── chronyd
├── console
├── cpupower
├── crond
├── ebtables-config
├── firewalld
├── grub -> ../default/grub
├── htcacheclean
├── httpd
├── init
├── ip6tables-config
├── iptables-config
├── ipvsadm-config
├── irqbalance
├── kdump
├── keepalived
├── kernel
├── man-db
├── modules
├── netconsole
├── network
├── network-scripts
│   ├── ifcfg-ens33
│   ├── ifcfg-ens37
│   ├── ifcfg-lo
│   ├── ifdown -> ../../../usr/sbin/ifdown
│   ├── ifdown-bnep
│   ├── ifdown-eth
│   ├── ifdown-ippp
│   ├── ifdown-ipv6
│   ├── ifdown-isdn -> ifdown-ippp
│   ├── ifdown-post
│   ├── ifdown-ppp
│   ├── ifdown-routes
│   ├── ifdown-sit
│   ├── ifdown-Team
│   ├── ifdown-TeamPort
│   ├── ifdown-tunnel
│   ├── ifup -> ../../../usr/sbin/ifup
│   ├── ifup-aliases
│   ├── ifup-bnep
│   ├── ifup-eth
│   ├── ifup-ippp
│   ├── ifup-ipv6
│   ├── ifup-isdn -> ifup-ippp
│   ├── ifup-plip
│   ├── ifup-plusb
│   ├── ifup-post
│   ├── ifup-ppp
│   ├── ifup-routes
│   ├── ifup-sit
│   ├── ifup-Team
│   ├── ifup-TeamPort
│   ├── ifup-tunnel
│   ├── ifup-wireless
│   ├── init.ipv6-global
│   ├── network-functions
│   └── network-functions-ipv6
├── nginx
├── nginx-debug
├── ntpd
├── ntpdate
├── rdisc
├── readonly-root
├── rsyslog
├── run-parts
├── selinux -> ../selinux/config
├── sshd
└── wpa_supplicant 5 directories, 70 files
[root@centos72 app1]# pwd
/app1

只解压一个文件到特定目录里面

注意文件是相对路径etc/sysconfig/network-scripts,也就是解压到当前目录

[root@centos72 ~]# cpio   -idv    etc/sysconfig/network-scripts   <   /app1/etc.cpio
etc/sysconfig/network-scripts
347 blocks
[root@centos72 ~]# ls
- 2.txt aa.txt etc messages.zip oCam.exe reset.sh
202.txt a anaconda-ks.cfg filelist.txt m.z reset1.sh tree-1.6.0-10.el7.x86_64.rpm
[root@centos72 ~]# tree etc/
etc/
└── sysconfig
└── network-scripts 2 directories, 0 files

在系统里面有些文件是cpio格式的

[root@centos72 ~]# file  /app1/etc.cpio
/app1/etc.cpio: cpio archive
[root@centos72 ~]# ls  /boot/
config-3.10.0-957.12.1.el7.x86_64
config-3.10.0-957.el7.x86_64
efi
grub
grub2
initramfs-0-rescue-cb26ac281315402a9928e9a4c3bedfcd.img
initramfs-3.10.0-957.12.1.el7.x86_64.img
initramfs-3.10.0-957.el7.x86_64.img
symvers-3.10.0-957.12.1.el7.x86_64.gz
symvers-3.10.0-957.el7.x86_64.gz
System.map-3.10.0-957.12.1.el7.x86_64
System.map-3.10.0-957.el7.x86_64
vmlinuz-0-rescue-cb26ac281315402a9928e9a4c3bedfcd
vmlinuz-3.10.0-957.12.1.el7.x86_64
vmlinuz-3.10.0-957.el7.x86_64
[root@centos72 ~]# file /boot/initramfs-3.10.0-957.el7.x86_64.img
/boot/initramfs-3.10.0-957.el7.x86_64.img: ASCII cpio archive (SVR4 with no CRC)

预览cpio的文件列表

[root@centos72 ~]# cpio   -tv   <  /boot/initramfs-3.10.0-957.el7.x86_64.img
drwxr-xr-x 3 root root 0 May 2 14:47 .
drwxr-xr-x 3 root root 0 May 2 14:47 kernel
drwxr-xr-x 3 root root 0 May 2 14:47 kernel/x86
drwxr-xr-x 2 root root 0 May 2 14:47 kernel/x86/microcode
-rw-r--r-- 1 root root 98304 May 2 14:47 kernel/x86/microcode/GenuineIntel.bin
-rw-r--r-- 1 root root 2 May 2 14:47 early_cpio
194 blocks

Linux文件归档工具——cpio的更多相关文章

  1. Linux文件归档工具——tar

    Linux打包压缩命令——tar 一tar工具的介绍 Tar(Tape ARchive,磁带归档的缩写) NAME tar - manual page for tar 1.26 SYNOPSIS ta ...

  2. 9款最佳的Linux文件比较工具

    程序员和撰稿人在编写程序文件或平常的文本文件时,有时想知道两个文件或同一文件的两个版本之间的差异.你在Linux上比较两个计算机文件时,文件内容之间的差异就叫diff.这一描述来源于提到diff的输出 ...

  3. window与linux文件传输工具

    window与linux文件传输工具 [一般用于SecureCRT ssh中使用] 法一:直接用yum安装lrzsz(推荐) yum install lrzsz -y 注意:rhel安装完系统后 直接 ...

  4. Linux文件编辑工具——VIM

    Linux文件编辑工具--VIM 1.VIM基本概述 1.1 什么是vim vi 和 vim 是 Linux 下的一个文本编辑工具.(可以理解为 windows 的记事本,或 Notepad++ 1. ...

  5. Linux文件查找工具之find “大宝剑”--转载

    原文地址:http://xinzong.blog.51cto.com/10018904/1749465 一.文件查找工具常用软件 locate: locate命令其实是find -name的另一种写法 ...

  6. Linux文件系统测试工具

    一.文件系统测试工具简介 1.LTP 参考网站:http://oss.sgi.com/projects/ltp/ LTP(Linux Test Project)是由SGI和IBM联合发起的项目,提供一 ...

  7. Linux文件归档和解压缩

    1.tar tar命令相当于归档,不做压缩,解压同样也是把归档文件释放出来(归档通俗上可以理解为把文件分类,把一些文件放到一个包中归类,方便用户管理) 解包:tar -zxvf file.tar #解 ...

  8. Linux文件排序工具 sort 命令详解

    sort是排序工具,它完美贯彻了Unix哲学:"只做一件事,并做到完美".它的排序功能极强.极完整,只要文件中的数据足够规则,它几乎可以排出所有想要的排序结果,是一个非常优质的工具 ...

  9. Linux文件同步工具之rsync

    学习背景 1.最近公司的项目在使用jenkins做自动化构建,因为jenkins在构建时是比较耗性能的,便单独使用了一台服务器做构建服务器.但是个人觉得这样成本过高,单独拿一台服务器来构建并且该服务器 ...

随机推荐

  1. CSS中的flex布局

    1.flex 布局的概念 Flex是Flexible Box的缩写,意为"弹性布局",用来为盒状模型提供最大的灵活性.任何一个容器都可以指定为 Flex 布局,行内元素也可以通过 ...

  2. javascript is ths best computer language

    alert('javascript is one of the best computer languages')

  3. 一、生成网络表--create Netlist

    Orcad Capture原理图篇 一.生成网络表--create Netlist 1.操作: .dsn文件--Tools--create Netlist 出现如下对话框--默认不进行更改--点击确定 ...

  4. (转)Java并发包:AtomicBoolean和AtomicReference

    转:https://blog.csdn.net/zxc123e/article/details/52057289 文章译自:http://tutorials.jenkov.com/java-util- ...

  5. JSP 获取访问者真正的IP地址

    request.getRemoteAddr(),这种方法在大部分情况下都是有效的,但是在通过了Apache,Squid等反向代理软件就不能获取到客户端的真实IP地址了, 如果使用了反向代理软件,用re ...

  6. flask 实现简易图书管理

    """ 1.配置数据库 a.导入 SQLalchemy库 b.创建db对象,并配置参数 c.创建数据库 2.添加书和作者的模型 a.模型集成db.Model b.__ta ...

  7. 浅谈 STM32 硬件I2C的使用 (中断方式 无DMA 无最高优先级)(转)

    引子 STM32的硬件I2C很多人都对它望而却步.因为很多电工都说,STM32 硬件 I2C有BUG.不稳定.死机等等……最后都使用GPIO模拟I2C. 的确,模拟I2C好用.但是在我看来在一个72M ...

  8. 测开之路二十九:Flask基础之jinja2模板

    中文文档:http://docs.jinkan.org/docs/jinja2/ 与静态资源一样,Flask默认的模板目录名为templates,如果有需要的话和static一样,要在初始化的时候声明 ...

  9. mac 上查看python3的各种安装路径

    1.mac chromedriver的安装目录:/usr/local/bin 2.mac htmltestrunner的存放目录:命令行下 import sys sys.path/Library/Fr ...

  10. Php 单元测试 phpunit && codecept

    Php 单元测试 phpunit && codecept phpunit: Windows版本 整体上说,在 Windows 下安装 PHAR 和手工在 Windows 下安装 Com ...