웹사이트 검색

Dtrx - Linux용 지능형 아카이브 추출(tar, zip, cpio, rpm, deb, rar) 도구


우리 모두는 Linux tar.gz, tar.bz2, tbz 명령을 사용하는 동안 어느 시점에서 상황에 직면했을 수 있습니다. . 너무 많은 아카이브 유형, 기억해야 할 명령이 너무 많습니다. dtrx 도구 덕분에 더 이상은 아닙니다.

  1. Linux에서 아카이브를 생성하고 추출하는 18가지 Tar 명령
  2. Linux에서 RAR 파일을 열고 추출하고 생성하는 방법

Dtrx 란 무엇입니까?

Dtrx는 "올바른 추출 수행"의 약자로, 아카이브 추출 작업을 더 쉽게 단순화하는 *nix 시스템용 오픈 소스이자 매우 효과적인 명령줄 애플리케이션입니다.

dtrx 명령은 "tar -zxvf" 또는 "tar -xjf" 명령을 대체하며 아카이브를 추출하는 단일 명령을 제공합니다. tar, zip, rpm, deb, gem 을 포함한 다양한 형식 , 7z, cpio, rar 등이 있습니다. bzip2, gzip 등으로 압축된 파일의 압축을 푸는 데에도 사용할 수 있습니다.

기본적으로 dtrx는 콘텐츠를 전용 디렉터리로 추출하고 콘텐츠를 추출하는 동안 사용자가 겪는 권한 문제(예: 권한 거부)를 수정하여 소유자가 모든 내용을 읽고 쓸 수 있도록 합니다. 그 파일들.

Dtrx 기능

  1. 다양한 아카이브 유형 처리: tar, zip, rar, gz, bz2, xz, rpm, deb, gem, 자동 추출 zip 파일 및 기타 여러 형식의 exe 파일을 추출하는 간단한 명령 하나만 제공합니다. .
  2. 모든 것을 정리된 상태로 유지: 아카이브를 전용 디렉토리에 추출합니다.
  3. 정상적인 권한: 또한 사용자가 추출 후 권한을 그대로 유지하면서 모든 파일을 읽고 쓸 수 있는지 확인합니다.
  4. 재귀적 추출: 아카이브 내부의 아카이브를 찾아서 추출할 수 있습니다.

Linux에 Dtrx를 설치하는 방법

dtrx 도구는 기본적으로 Ubuntu 저장소에 포함되어 있으며, apt-get을 수행하여 시스템에 설치하기만 하면 됩니다.

데비안/우분투/리눅스 민트에서

sudo apt-get install dtrx

RHEL/CentOS/Fedora에서

Red Hat 기반 시스템에서는 dtrx를 기본 저장소를 통해 사용할 수 없습니다. dtrx 스크립트를 다운로드하고 루트 사용자로 아래 명령을 사용하여 시스템 전체에 프로그램을 설치해야 합니다.

wget http://brettcsmith.org/2007/dtrx/dtrx-7.1.tar.gz
tar -xvf dtrx-7.1.tar.gz 
cd dtrx-7.1
python setup.py install --prefix=/usr/local
샘플 출력
running install
running build
running build_scripts
creating build
creating build/scripts-2.6
copying and adjusting scripts/dtrx -> build/scripts-2.6
changing mode of build/scripts-2.6/dtrx from 644 to 755
running install_scripts
copying build/scripts-2.6/dtrx -> /usr/local/bin
changing mode of /usr/local/bin/dtrx to 755
running install_egg_info
Creating /usr/local/lib/python2.6/site-packages/
Writing /usr/local/lib/python2.6/site-packages/dtrx-7.1-py2.6.egg-info

dtrx 명령을 사용하는 방법

dtrx 명령은 반지의 제왕에서 모든 것을 지배하는 하나의 반지와 같습니다. 각 아카이브의 구문을 기억할 필요 없이 dtrx 명령만 기억하면 됩니다.

1. 단일 아카이브 추출

예를 들어, "tecmint27-12-2013.gz"라는 아카이브 파일을 추출하려고 하는데 플래그를 사용하지 않고 dtrx 명령만 실행합니다.

[root@tecmint]# dtrx tecmint27-12-2013.gz

추출을 단순화하는 것 외에도 파일을 폴더로 추출하고 지정된 아카이브 내의 다른 모든 아카이브를 반복적으로 추출하는 것과 같은 다양한 옵션이 있습니다.

2. 여러 아카이브 추출

dtr1.zip, dtr2.zipdtr3.zip<으로 구성된 "dtrAll.zip" 파일이 있다고 가정해 보겠습니다. 각각은 dtr1, dtr2dtr3으로 구성됩니다. 먼저 dtrAll zip을 수동으로 추출한 다음 dtr1, dtr2dtr3을 각각 추출할 필요가 없습니다. dtrx를 사용하여 각 폴더에 직접 압축을 풀 수 있으며 "a" 옵션을 선택하면 모든 zip 파일이 반복적으로 추출됩니다.

[root@tecmint]# dtrx dtrAll.zip
샘플 출력
dtrx: WARNING: extracting /root/dtrAll.zip to dtrAll.1
dtrAll.zip contains 3 other archive file(s), out of 3 file(s) total.
You can:
 * _A_lways extract included archives during this session
 * extract included archives this _O_nce
 * choose _N_ot to extract included archives this once
 * ne_V_er extract included archives during this session
 * _L_ist included archives
What do you want to do?  (a/o/N/v/l) a

추출 후 ls 명령어를 사용하여 추출된 디렉터리의 내용을 확인할 수 있습니다.

[root@tecmint]# cd dtrAll
[root@tecmint]# ls 

dtr1  dtr1.zip  dtr2  dtr2.zip  dtr3  dtr3.zip

3. 특정 아카이브 추출

첫 번째 아카이브를 추출하고 그 안에 있는 아카이브는 추출하지 않으려고 한다고 가정해 보겠습니다. N을 선택하면 지정된 아카이브만 추출되고 그 안에 있는 다른 아카이브는 추출되지 않습니다.

[root@tecmint]# dtrx dtrAll.zip
샘플 출력
dtrx: WARNING: extracting /root/dtrAll.zip to dtrAll.1
dtrAll.zip contains 3 other archive file(s), out of 3 file(s) total.
You can:
 * _A_lways extract included archives during this session
 * extract included archives this _O_nce
 * choose _N_ot to extract included archives this once
 * ne_V_er extract included archives during this session
 * _L_ist included archives
What do you want to do?  (a/o/N/v/l) N

추출된 디렉터리의 내용은 그림과 같이 ls 명령을 사용하여 확인할 수 있습니다.

[root@tecmint]# cd dtrAll
[root@tecmint]# ls

dtr1.zip dtr2.zip dtr3.zip

4. 아카이브의 각 레이어 추출

사례별로 아카이브 내부 아카이브의 각 레이어를 추출하려면 즉, 아카이브의 두 번째 레이어를 추출하고 세 번째 레이어는 추출하지 않으려는 경우 "o" 옵션을 사용할 수 있습니다.

내용이 "dtrAll.zip" 및 "dtrNew"인 zip 파일 "dtrNewAll.zip"이 있다고 가정해 보겠습니다. 이제 "dtrNewAll" 및 "dtrAll"의 콘텐츠를 추출하고 dtr1.zip은 추출하지 않으려면 dtr2 .zipdtr3.zip의 경우 아래와 같이 "o" 및 "n" 옵션을 사용할 수 있습니다.

dtrx dtrNewAll.zip
샘플 출력
dtrNewAll.zip contains 1 other archive file(s), out of 2 file(s) total.
You can:
 * _A_lways extract included archives during this session
 * extract included archives this _O_nce
 * choose _N_ot to extract included archives this once
 * ne_V_er extract included archives during this session
 * _L_ist included archives
What do you want to do?  (a/o/N/v/l) o
dtrAll.zip contains 3 other archive file(s), out of 3 file(s) total.
You can:
 * _A_lways extract included archives during this session
 * extract included archives this _O_nce
 * choose _N_ot to extract included archives this once
 * ne_V_er extract included archives during this session
 * _L_ist included archives
What do you want to do?  (a/o/N/v/l) n

추출된 디렉터리의 내용은 그림과 같이 ls 명령을 사용하여 확인할 수 있습니다.

[root@tecmint]# cd dtrNewAll
[root@tecmint]# ls

dtrAll  dtrAll.zip  dtrNew
[root@tecmint]# cd dtrAll
[root@tecmint]# ls

dtr1.zip dtr2.zip dtr3.zip

먼저 dtrNewAll 내부의 모든 아카이브가 추출된다는 의미인 "o" 옵션을 선택합니다. 나중에 dtrAll.zip에 대해 "n" 옵션을 선택합니다. 이는 그 안에 있는 아카이브가 dtr1.zip , dtr2.zip임을 의미합니다. dtr3.zip은 추출되지 않습니다.

5. .deb, .rpm 및 .gem 파일에서 메타데이터 추출

"-m" 옵션은 .deb, .rpm.gem 아카이브에서 메타데이터를 추출합니다. 정상적인 내용 대신. 다음은 명령의 예입니다.

[root@tecmint]# dtrx -m openfire_3.8.2_all.deb 
[root@tecmint]# dtrx -m openfire-3.8.2-1.i386.rpm
[root@tecmint]# ls

conffiles  control  md5sums  postinst  postrm  prerm

탐색할 수 있는 더 많은 dtrx 옵션이 있습니다. "dtrx –help"를 실행하여 사용 가능한 옵션을 나열하세요.

[root@tecmint]# dtrx  --help

Usage: dtrx [options] archive [archive2 ...]

Intelligent archive extractor

Options:
  --version             	show program's version number and exit
  -h, --help            	show this help message and exit
  -l, -t, --list, --table      	list contents of archives on standard output
  -m, --metadata        	extract metadata from a .deb/.gem
  -r, --recursive       	extract archives contained in the ones listed
  -n, --noninteractive  	don't ask how to handle special cases
  -o, --overwrite       	overwrite any existing target output
  -f, --flat, --no-directory    extract everything to the current directory
  -v, --verbose         	be verbose/print debugging information
  -q, --quiet           	suppress warning/error messages

참조 링크

dtrx 홈페이지

dtrx는 모든 형식의 아카이브 파일의 압축을 풀 수 있는 단일 명령을 제공하는 유일한 강력한 명령줄 도구이기 때문에 꼭 사용해 보아야 한다고 생각합니다. 지금은 여기까지입니다. 댓글 섹션에 메모를 남기는 것을 잊지 마세요.