리눅스 cpio

1 개요[ | ]

cpio[1], .cpio
/bin/cpio
  • 파일 아카이빙 도구, 그 파일 포맷
  • UNIX 계열에서 많이 사용됨
  • tar처럼, 파일들을 압축하지 않고 그냥 묶는다.
  • 라이선스: GPL

2 실습 1: *.txt[ | ]

[root@zetawiki ~]# echo hello > 1.txt
[root@zetawiki ~]# echo world > 2.txt
[root@zetawiki ~]# ll *.txt
-rw-r--r--. 1 root root 6 Apr 13 00:16 1.txt
-rw-r--r--. 1 root root 6 Apr 13 00:16 2.txt
[root@zetawiki ~]# ls *.txt
1.txt  2.txt
[root@zetawiki ~]# ls *.txt | cpio -o > test.cpio
1 block
→ 2개의 txt 파일이 cpio 파일로 포장되었다.
[root@zetawiki ~]# cpio -t < test.cpio
1.txt
2.txt
1 block
→ 2개의 파일이 들어있음을 확인할 수 있다.
[root@zetawiki ~]# mkdir test
[root@zetawiki ~]# cd test
[root@zetawiki test]# cpio -i < ../test.cpio
1 block
→ test 폴더를 만들고 거기서 cpio을 풀었다.
[root@zetawiki test]# ll
total 8
-rw-r--r--. 1 root root 6 Apr 13 00:23 1.txt
-rw-r--r--. 1 root root 6 Apr 13 00:23 2.txt

3 실습 2: find .[ | ]

[root@zetawiki ~]# cd /etc/sysconfig/networking/
[root@zetawiki networking]# find .
.
./profiles
./profiles/default
./profiles/default/ifcfg-eth0
./profiles/default/hosts
./profiles/default/network
./profiles/default/resolv.conf
./devices
./devices/ifcfg-eth0
[root@zetawiki networking]# find . | cpio -o > ../test2.cpio
2 blocks
[root@zetawiki networking]# cpio -t < ../test2.cpio
.
profiles
profiles/default
profiles/default/ifcfg-eth0
profiles/default/hosts
profiles/default/network
profiles/default/resolv.conf
devices
devices/ifcfg-eth0
2 blocks

4 같이 보기[ | ]

5 주석[ | ]

  1. ← copy in and out.

6 참고[ | ]

문서 댓글 ({{ doc_comments.length }})
{{ comment.name }} {{ comment.created | snstime }}