[리눅스] 압축하기 tar, 압축풀기 gz 23.03.28
압축을한게 tar
gz가 압축풀기
압축하기
[root@centos7 temp]# touch a b c d e ==>디렉터리 만들기
[root@centos7 temp]# tar -cvf test.tar ./a ./b ./c ./d ./e ==> test에다 디렉터리 묶기
./a
./b
./c
./d
./e
[root@centos7 temp]# ls
test.tar
[root@centos7 temp]# mv test.tar /
[root@centos7 temp]# rm -rf ./*
[root@centos7 temp]# gzip /test.tar
[root@centos7 temp]# ls /test.tar*
/test.tar.gz
[root@centos7 temp]# gzip -d /test.tar.gz
[root@centos7 temp]# ls /test.tar*
/test.tar
[root@centos7 temp]# ls
tar 압축 풀기
[root@centos7 temp]# mv /test.tar ./ ==>옮기고
[root@centos7 temp]# ls
test.tar
[root@centos7 temp]# tar -xvf test.tar ==>압축풀기
./a
./b
./c
./d
./e
[root@centos7 temp]# cd /
[root@centos7 /]# rm -rf /temp/*
[root@centos7 heejae]# tar -cvzf ./test_etc.tar.gz /etc/* ==>만들어라 보여라 gzip까지 같이 파일명 지정해라
[root@centos7 heejae]# mv test_etc.tar.gz /temp ==>temp로 옮기고
[root@centos7 heejae]# cd /temp
[root@centos7 temp]# tar -xvzf test_etc.tar.gz ==>압축 다시 풀기
과제>>
/temp를 비우고 /bin 디렉터리 안에 모든 내용을 한꺼번에 묶어서 /temp 디렌터리 안에 binlist.tar.gz 파일로 생성하세요.
[root@centos7 /]# rm -rf /temp/*
[root@centos7 /]# tar -cvzf binlist.tar.gz /bin/*
과제2>>
/temp 안 binlist.tar.gz 파일만 제외하고 모두 지운다음 그 안에 다시 binlist.tar.gz을 압출 해제 및 푸는 과정을 한꺼번에 수행하세요
알아서 binlist.tar.gz지우기
tar -xvzf binlist.tar.gz