"리눅스 cpio"의 두 판 사이의 차이

잔글 (봇: 자동으로 텍스트 교체 (-==참고 자료== +==참고==))
 
(사용자 2명의 중간 판 2개는 보이지 않습니다)
9번째 줄: 9번째 줄:


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


==실습 2: find .==
==실습 2: find .==
<source lang='cli'>
<source lang='console'>
[root@zetawiki ~]# cd /etc/sysconfig/networking/
[root@zetawiki ~]# cd /etc/sysconfig/networking/
[root@zetawiki networking]# du -b .
4538 ./profiles/default
8634 ./profiles
4096 ./devices
16826 .
</source>
<source lang='cli'>
[root@zetawiki networking]# find .
[root@zetawiki networking]# find .
.
.
66번째 줄: 59번째 줄:
./devices
./devices
./devices/ifcfg-eth0
./devices/ifcfg-eth0
[root@zetawiki networking]# find . | cpio -o > test2.cpio
</source>
3 blocks
<source lang='console'>
[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
</source>
</source>


79번째 줄: 85번째 줄:
<references/>
<references/>


==참고 자료==
==참고==
*http://en.wikipedia.org/wiki/Cpio
*http://en.wikipedia.org/wiki/Cpio


[[분류: 파일]]
[[분류: 파일]]
[[분류: /bin]]
[[분류: /bin]]

2017년 7월 11일 (화) 03:40 기준 최신판

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 }}