tar
를 사용할 때 항상 매개 변수에 -f
를 포함하지만 이유를 모르겠습니다.
나는 그 남자를 올려다 보았고 그것은 말했다.
-f, --file [HOSTNAME:]F
use archive file or device F (default
"-", meaning stdin/stdout)
하지만 솔직히 그게 무슨 뜻인지 모르겠습니다. 누구든지 그것에 대해 밝힐 수 있습니까?
-f
옵션은 다음 인수가 아카이브의 파일 이름이거나 -
인 경우 표준 출력임을 tar
에 알려줍니다.
아주 간단합니다. -f
매개 변수를 생략하면 출력이 stdout에 전달됩니다.
gammy@denice:/tmp/demo$ tar -c a b c
a0000644000175000017500000000000011435437117010223 0ustar gammygammyb0000644000175000017500000000000011435437117010224 0ustar gammygammyc0000644000175000017500000000000011435437117010225 0ustar gammygammygammy@denice:/tmp/demo$ ls
a b c
gammy@denice:/tmp/demo$
... 정말 엉망이야!
-f
-매개 변수 (인용 된대로)는 파일 이름 (및 선택적으로 호스트 이름)을 예상하므로 다음 첫 번째 인수가 출력 파일 이름입니다.
gammy@denice:/tmp/demo$ tar -cf output.tar a b c
gammy@denice:/tmp/demo$ ls
a b c output.tar
gammy@denice:/tmp/demo$
작업 할 파일 또는 장치를 지정할 수 있습니다. 다른 제공된 플래그에 따라 생성, 업데이트 또는 추출합니다. 예를 들면 :
# Create a tar file with the contents of somepath/
tar -cvf filename.tar somepath/
# Extract the tar file.
tar -xvf filename.tar