tar (gnutar)

Create, add files to, or extract files from an archive file in gnutar format, called a tarfile. Tape ARchiver; manipulate "tar" archive files.

Syntax
       tar [[-]function] [options] filenames...
       tar [[-]function] [options] -C directory-name...
   Command-line arguments that specify files to add to, extract from,
   or list from an archive may  be given as shell pattern matching strings.
FUNCTIONS
       Exactly one of the following functions must be specified.
       (append, create, difference, replace, table of contents, update, and extract)
     -A
     --catenate
     --concatenate  Append the contents of named file, which must itself be a
		    gnutar archive, to the end of the archive (erasing the old
		    end-of-archive block).  This has the effect of adding the
		    files contained in the named file to the first archive,
		    rather than adding the second archive as an element of the
		    first.  Note: This option requires a rewritable tarfile,
		    and therefore does not work on quarter-inch cartridge
		    tapes.  (see notes below)
     -c
     --create	    Create a new archive (or truncates an old one) and writes
		    the named files to it.
     -d
     --diff
     --compare	    Find differences between files in the archive and corre-
		    sponding files in the file system.
     --delete	    Delete named files from the archive.  (Does not work on
		    quarter-inch tapes).
     -r
     --append	    Append files to the end of an archive.  (Does not work on
		    quarter-inch tapes).
     -t
     --list	    List the contents of an archive; if filename arguments are
		    given, only those files are listed, otherwise the entire
		    table of contents is listed.
     -u
     --update	    Append the named files if the on-disk version has a modi-
		    fication date more recent than their copy in the archive
		    (if any).  Does not work on quarter-inch tapes.
     -x
     --extract
     --get	    Extract files from an archive.  The owner, modification
		    time, and file permissions are restored, if possible.  If
		    no file arguments are given, extract all the files in the
		    archive.  If a filename argument matches the name of a
		    directory on the tape, that directory and its contents are
		    extracted (as well as all directories under that direc-
		    tory).  If the archive contains multiple entries corre-
		    sponding to the same file (see the --append command
		    above), the last one extracted will overwrite all earlier
		    versions.

You can specify an argument for the `--file=ARCHIVE-NAME' (`-f ARCHIVE-NAME') option whenever you use `tar'; this option determines the name of the archive file that `tar' will work on.

If you don't specify this argument, then `tar' will use a default, usually some physical tape drive attached to your machine. If there is no tape drive attached, or the default is not meaningful, then `tar' will print an error message. The error message might look roughly like one of the following:

     tar: can't open /dev/rmt8 : No such device or address
     tar: can't open /dev/rsmt0 : I/O error

To avoid confusion, we recommend that you always specify an archive file name by using `--file=ARCHIVE-NAME' (`-f ARCHIVE-NAME') when writing your `tar' commands.

     --verbose' (`-v') shows details about the results of running `tar'.

This can be especially useful when the results might not be obvious. For example, if you want to see the progress of `tar' as it writes files into the archive, you can use the `--verbose' option. In the beginning, you may find it useful to use `--verbose' at all times; when you are more accustomed to `tar', you will likely want to use it at certain times but not at others.

Sometimes, a single instance of `--verbose' on the command line will show a full, `ls' style listing of an archive or files, giving sizes, owners, and similar information. Other times, `--verbose' will only show files or members that the particular operation is operating on at the time. In the latter case, you can use `--verbose' twice in a command to get a listing such as that in the former case.

Options

The other options to gnutar may be combined arbitrarily; single-letter options may be bundled in with the command word. Verbose options which take arguments will be followed by the argument; single-letter options will consume successive command line arguments (see the EXAMPLES below).
gnutar will properly handle option arguments passed either with or without a leading `=` (i.e. either --option=arg or --option arg).

     --help		     Prints a message listing and briefly describing
			     all the command options to gnutar.
     --atime-preserve	     Restore the access times on files which are writ-
			     ten to tape (note that this will change the
			     inode-change time!).
     -b
     --block-size number
     --blocking-factor number
     --record-size size	     Sets the block size for reading or writing to
			     number * 512-byte blocks.	Or sets block size for
			     reading or writing to size bytes which must be a
			     multiple of 512.
     -B
     --read-full-records     Re-assemble short reads into full records (for
			     reading 4.2BSD pipes).
     --backup control	     Backup files before removal.  Optionally, the
			     user can specify a control argument to control
			     how gnutar performs the backups.  Supported val-
			     ues are listed bellow in the ENVIRONMENT section.
     --suffix suffix	     Backup files before removal.  Override the normal
			     backup suffix (default: '~'), using suffix
			     instead.
     -C directory
     --directory directory   Change to directory before processing the remain-
			     ing arguments. (see notes below)
     --checkpoint	     Print number of buffer reads/writes while read-
			     ing/writing the archive.
     -f [hostname:]file
     --file [hostname:]file  Read or write the specified file (default is
			     /dev/sa0).	 If a hostname is specified, gnutar
			     will use rmt(8) to read or write the specified
			     file on a remote machine.	`-' may be used as a
			     filename, for reading or writing to/from
			     stdin/stdout.
     --force-local	     Archive file is local even if it has a colon.
     -F file
     --info-script file
     --new-volume-script file
			     Run a script at the end of each archive volume
			     (implies -M).
     -G
     --incremental	     Create/list/extract old GNU-format incremental
			     backup.
     -g file
     --listed-incremental file
			     Create/list/extract new GNU-format incremental
			     backup.
     --group name	     Force group as group for added files.
     -h
     --dereference	     Don't write symlinks as symlinks; write the data
			     of the files they name.
     -i
     --ignore-zeros	     Ignore blocks of zeroes in archive (usually means
			     End-Of-File).
     --ignore-failed-read    Don't exit with non-zero status on unreadable
			     files.
     -j
     --bzip2		     Filter the archive through bzip2(1).
     -k
     --keep-old-files	     Keep files which already exist on disk; don't
			     overwrite them from the archive.
     -K file
     --starting-file file    Begin at file in the archive.
     -l
     --one-file-system	     Stay in local file system when creating an
			     archive (do not cross mount points).
     -L number
     --tape-length number    Change tapes after writing number * 1024 bytes.
     --mode changes	     Force changes to file mode of added files.
     -m
     --modification-time     Don't extract file modified time.
     -M
     --multi-volume	     Create/list/extract multi-volume archive.
     --no-recursion	     Don't recurse into subdirectories when creating.
     --volno-file file	     File name with volume number to start with.
     -N date
     --after-date date
     --newer date	     only store files with creation time newer than
			     date.
     --newer-mtime date	     only store files with modification time newer
			     than date.
     --no-same-owner	     Do not preserve ownership when extracting files.
			     Extract them all as owned by the current user.
     --no-same-permissions   Do not extract permission information.  Extract
			     them using the default permissions for the cur-
			     rent user.
     --numeric-owner	     Use numbers instead of names for owner/group
			     names.
     -o
     --old-archive
     --portability	     Write a V7 format archive, rather than POSIX for-
			     mat.
     -O
     --to-stdout	     Extract files to standard output.
     --owner name	     Force name as owner for added files.
     --overwrite	     Overwrite existing files when extracting.
     --overwrite-dir	     Overwrite directory metadata when extracting.
     -p
     --same-permissions
     --preserve-permissions  Extract all permission information.
     --preserve		     Has the effect of -p -s.
     -P
     --absolute-names	     Don't strip leading `/' from file names.
     --posix		     Instructs gnutar to create a POSIX compliant
			     `tar' archive.
     -R
     --block-number	     Show record number within archive with each mes-
			     sage.
     --remove-files	     Remove files after adding them to the archive.
     --rsh-command command   Use command instead of rsh for remote
			     archives/files.
     -s
     --same-order
     --preserve-order	     List of names to extract is sorted to match
			     archive.
     --same-owner	     Try to preserve ownership when extracting files.
     --show-omitted-dirs     Show directories which were omitted while pro-
			     cessing the archive.
     -S
     --sparse		     Handle `sparse' files efficiently.
     -T file
     --files-from file	     Get names of files to extract or create from
			     file, one per line.
     --null		     Modifies behavior of -T to expect null-terminated
			     names; disables -C.
     --totals		     Prints total bytes written with --create.
     -U
     --unlink-first	     Unlink files before creating them.
     --recursive-unlink	     Empty hierarchies prior to extracting directory.
     -v
     --verbose		     Lists files written to archive with --create or
			     extracted with --extract; lists file protection
			     information along with file names with --list.
     -V volume-name
     --label volume-name     Create archive with the given volume-name.	 When
			     used with list or extract, volume-name is used as
			     a globing pattern.
     --version		     Print gnutar program version number.
     -w
     --interactive
     --confirmation	     Ask for confirmation for every action.
     -W
     --verify		     Attempt to verify the archive after writing it.
     --exclude pattern	     Exclude files matching the pattern (don't extract
			     them, don't add them, don't list them).
     -X file
     --exclude-from file     Exclude files listed in file.
     --anchored		     Exclude patterns match file name start (default).
     --no-anchored	     Exclude patterns match after any /.
     --ignore-case	     Exclude patterns ignore case.
     --no-ignore-case	     Exclude patterns are case sensitive (default).
     --wildcards	     Exclude patterns use wildcards (default).
     --no-wildcards	     Exclude patterns are plain strings.
     --wildcards-match-slash
			     Exclude pattern wildcards match '/' (default).
     --no-wildcards-match-slash
			     Exclude pattern wildcards do not match '/'.
     -Z
     --compress
     --uncompress	     Filter the archive through compress(1).
     -z
     --gzip
     --ungzip
     --gunzip		     Filter the archive through gzip(1).
     --use-compress-program program
			     Filter the archive through program (which must
			     accept -d to mean `decompress').
     -[0-7][lmh]	     Specify tape drive and density.

Examples

To tar and zip a file

  tar -czvf MyArchive.tgz Source_file 
or in full
  tar --create --gzip --verbose --file=MyArchive.tgz Source_file

To tar a folder (with all sub-folders and files)

  tar czf /volumes/myexternaldrive/backup01.tgz myfolder

The reverse process to extract the file

  tar -xzvf MyArchive.tgz Source_file 
or
  tar --extract --gunzip --verbose --file=MyArchive.tgz Source_file
  tar xzvf /volumes/myexternaldrive/backup01.tgz myfolder/subfolder/thefiletorestore
To extract all the C sources and headers from an archive named
backup.tar, type
  tar xf backup.tar '*.[ch]'
Note that the pattern must be quoted to prevent the shell from attempting
to expand it according the files in the current working directory (the
shell does not have access to the list of files in the archive, of
course).
To move file hierarchies, use a command line like this:
  tar -cf - -C srcdir . | tar xpf - -C destdir
To create a compressed archive on diskette, using gzip(1), use a command-
line like
  tar --block-compress -z -c -v -f /dev/fd1a -b 36 tar/
     Note that you cannot mix bundled flags and --style flags; you can use
     single-letter flags in the manner above, rather than having to type
	   tar --block-compress --gzip --verbose --file /dev/fd1a --block-size
	   20 tar/
     The above-created diskette can be listed with
	   tar tvfbz /dev/fd1a 36
To join two gnutar archives into a single archive, use
   tar Af archive1.tar archive2.tar
which will add the files contained in archive2.tar onto the end of
archive1.tar (note that this can't be done by simply typing
   cat archive2.tar >> archive1.tar
because of the end-of-file block at the end of a gnutar archive).
To archive all files from the directory srcdir, which were modified after
Feb. 9th 1997, 13:00 h, use
   tar -c -f backup.tar --newer-mtime 'Feb 9 13:15 1997' srcdir/
Other possible time specifications are `02/09/97 13:15', `1997-02-09
13:15', `13:15 9 Feb 1997', `9 Feb 1997 13:15', `Feb. 9, 1997 1:15pm',
`09-Feb', `3 weeks ago' or `May first Sunday'.  To specify the correct
time zone use either e.g. `13:15 CEST' or `13:15+200'.

Notes

Always tar -t before tar -x to check if the archive contents have been placed inside one subdirectory or will just spill all over the current directory.

The -C feature does not work like historical gnutar programs, and is probably untrustworthy.

The -A command should work to join an arbitrary number of gnutar archives together, but it does not; attempting to do so leaves the end-of-archive blocks in place for the second and subsequent archives.

The gnutar file format is a semi fixed width field format, and the field for device numbers were designed for 16 bit (8 major, 8 minor) and can not absorb our 32 bit (8 major, 16+8 minor) numbers.

Environment Variables

     POSIXLY_CORRECT  Normally, gnutar will process flag arguments that appear
		      in the file list.	 If set in the environment, this
		      causes gnutar to consider the first non-flag argument to
		      terminate flag processing, as per the POSIX specification.
     SHELL	      In interactive mode, a permissible response to the
		      prompt is to request to spawn a subshell, which will be
		      /bin/sh unless the SHELL variable is set.
     SIMPLE_BACKUP_SUFFIX
		      Sets the backup suffix used by gnutar.  Default is '~'.
     TAPE	      Changes gnutar's default tape drive /dev/sa0 (which is still
		      overridden by the -f flag).
     TAR_OPTIONS      The environment variable TAR_OPTIONS can hold a set of
		      default options for gnutar.  These options are inter-
		      preted first and can be overwritten by explicit command
		      line parameters.
     TAR_RSH	      The TAR_RSH environment variable allows you to override
		      the default shell used as the transport for gnutar.
     VERSION_CONTROL  Sets the backup method used by gnutar.  Possible values:
		      t, numbered      Make numbered backups
		      nil, existing    Numbered if numbered backups exist,
				       simple otherwise
		      never, simple    Always make simple backups
		      Default behaviour is 'existing'.

"Of all forms of caution, caution in love is perhaps the most fatal to true happiness" - Bertrand Russell

Related:

tar man page - Apple.com
bzip2(1)
compress - compress and expand data
gzip - Compress or decompress files
pax(1)
rmt - remote magtape protocol module
info tar



© Copyright SS64.com 1999-2012
Some rights reserved

 

[root@gouni mail]# tar --help
GNU `tar' saves many files together into a single tape or disk archive, and
can restore individual files from the archive.

Usage: tar [OPTION]... [FILE]...

Examples:
  tar -cf archive.tar foo bar  # Create archive.tar from files foo and bar.
  tar -tvf archive.tar         # List all files in archive.tar verbosely.
  tar -xf archive.tar          # Extract all files from archive.tar.

If a long option shows an argument as mandatory, then it is mandatory
for the equivalent short option also.  Similarly for optional arguments.

주요 동작 모드:
  -t, --list              아카이브의 내용물을 출력합니다
  -x, --extract, --get    아카이브에서 파일을 추출합니다
  -c, --create            새로운 아카이브를 만듭니다
  -d, --diff, --compare   아카이브와 파일 시스템간의 차이점을 비교합니다
  -r, --append            아카이브 끝에 파일을 추가합니다
  -u, --update            아카이브 안의 것보다 새로운 파일만 추가합니다
  -A, --catenate          아카이브에 tar 파일을 추가합니다
      --concatenate       -A와 같음
      --delete            아카이브로부터 제거합니다 (자기 테이프에선 안됨!)

Operation modifiers:
  -W, --verify               attempt to verify the archive after writing it
      --remove-files         remove files after adding them to the archive
  -k, --keep-old-files       don't replace existing files when extracting
      --overwrite            overwrite existing files when extracting
      --overwrite-dir        overwrite directory metadata when extracting
  -U, --unlink-first         remove each file prior to extracting over it
      --recursive-unlink     empty hierarchies prior to extracting directory
  -S, --sparse               handle sparse files efficiently
  -O, --to-stdout            extract files to standard output
  -G, --incremental          handle old GNU-format incremental backup
  -g, --listed-incremental=FILE
                             handle new GNU-format incremental backup
      --ignore-failed-read   do not exit with nonzero on unreadable files

Handling of file attributes:
      --owner=NAME             force NAME as owner for added files
      --group=NAME             force NAME as group for added files
      --mode=CHANGES           force (symbolic) mode CHANGES for added files
      --atime-preserve         don't change access times on dumped files
  -m, --modification-time      don't extract file modified time
      --same-owner             try extracting files with the same ownership
      --no-same-owner          extract files as yourself
      --numeric-owner          always use numbers for user/group names
  -p, --same-permissions       extract permissions information
      --no-same-permissions    do not extract permissions information
      --preserve-permissions   same as -p
  -s, --same-order             sort names to extract to match archive
      --preserve-order         same as -s
      --preserve               same as both -p and -s

장치 선택과 전환:
  -f, --file=ARCHIVE             아카이브 파일 또는 ARCHIVE 장치를 사용합니다
      --force-local              이름에 콜론이 있는 아카이브 파일도 지역 파일로
                                 인식합니다
      --rsh-command=COMMAND      rsh 대신 원격 COMMAND를 사용합니다
  -[0-7][lmh]                    드라이브와 기록 밀도를 지정합니다
  -M, --multi-volume             다중 볼륨 아카이브를 생성/출력/추출합니다
  -L, --tape-length=NUM          NUM x 1024 바이트를 쓴 뒤에 테이프를 바꿉니다
  -F, --info-script=FILE         각 테이프의 끝에서 스크립트를 실행합니다
                                 (-M을 포함함)
      --new-volume-script=FILE   -F FILE과 같음
      --volno-file=FILE          FILE 안에 있는 볼륨 번호를 사용/갱신합니다

장치 블럭 설정:
  -b, --blocking-factor=BLOCK    레코드당 BLOCK x 512 바이트
      --record-size=SIZE         레코드당 SIZE 바이트, 512의 배수
  -i, --ignore-zeros             아카이브에서 영으로 된 블럭을 무시합니다
                                 (EOF를 의미함)
  -B, --read-full-records        읽은 것을 재블럭화합니다 (4.2BSD 파이프용으로)

Archive format selection:
  -V, --label=NAME                   create archive with volume name NAME
              PATTERN                at list/extract time, a globbing PATTERN
  -o, --old-archive, --portability   write a V7 format archive
      --posix                        write a POSIX format archive
  -j, --bzip2                        filter the archive through bzip2
  -z, --gzip, --ungzip               filter the archive through gzip
  -Z, --compress, --uncompress       filter the archive through compress
      --use-compress-program=PROG    filter through PROG (must accept -d)

Local file selection:
  -C, --directory=DIR          change to directory DIR
  -T, --files-from=NAME        get names to extract or create from file NAME
      --null                   -T reads null-terminated names, disable -C
      --exclude=PATTERN        exclude files, given as a PATTERN
  -X, --exclude-from=FILE      exclude patterns listed in FILE
      --anchored               exclude patterns match file name start (default)
      --no-anchored            exclude patterns match after any /
      --ignore-case            exclusion ignores case
      --no-ignore-case         exclusion is case sensitive (default)
      --wildcards              exclude patterns use wildcards (default)
      --no-wildcards           exclude patterns are plain strings
      --wildcards-match-slash  exclude pattern wildcards match '/' (default)

      --no-wildcards-match-slash exclude pattern wildcards do not match '/'
  -P, --absolute-names         don't strip leading `/'s from file names
  -h, --dereference            dump instead the files symlinks point to
      --no-recursion           avoid descending automatically in directories
  -l, --one-file-system        stay in local file system when creating archive
  -K, --starting-file=NAME     begin at file NAME in the archive
  -N, --newer=DATE             only store files newer than DATE
      --newer-mtime=DATE       compare date and time when data changed only
      --after-date=DATE        same as -N
      --backup[=CONTROL]       backup before removal, choose version control
      --suffix=SUFFIX          backup before removal, override usual suffix

정보 출력에 관한 옵션:
      --help            이 도움말을 인쇄하고 끝냅니다
      --version         tar 프로그램의 버전 번호를 인쇄하고 끝냅니다
  -v, --verbose         처리되는 파일을 순서대로 출력합니다
      --checkpoint      아카이브를 읽을 동안 디렉토리 이름을 인쇄합니다
      --totals          아카이브를 만들 동안 쓰여진 총 바이트 수를 인쇄합니다
  -R, --block-number    각 메시지마다 아카이브내의 블럭 번호를 표시합니다
  -w, --interactive     모든 행동에 대해 확인을 요구합니다
      --confirmation    -w와 같음

The backup suffix is `~', unless set with --suffix or SIMPLE_BACKUP_SUFFIX.
The version control may be set with --backup or VERSION_CONTROL, values are:

  t, numbered     make numbered backups
  nil, existing   numbered if numbered backups exist, simple otherwise
  never, simple   always make simple backups

GNU tar cannot read nor produce `--posix' archives.  If POSIXLY_CORRECT
is set in the environment, GNU extensions are disallowed with `--posix'.
Support for POSIX is only partially implemented, don't count on it yet.
ARCHIVE may be FILE, HOST:FILE or USER@HOST:FILE; DATE may be a textual date
or a file name starting with `/' or `.', in which case the file's date is used.
*This* `tar' defaults to `-f- -b20'.

Report bugs to <bug-tar@gnu.org>.

 

 

tar 압축시 특정 디렉토리 제외 리눅스*윈도우*개발

2010/11/27 18:20

 

복사 http://blog.naver.com/cjsong/60119077091

 

tar 압축시 특정 디렉토리 제외(tar Manpage)

압축시 특정 파일이나 디렉토리를 제외 시킬 경우가 종종 있다.
이때 써먹으면 좋을것 같다.

아래는 백업 스크립트의 일부이다. 


#!/bin/sh

cd /backup/home/weekly

tar cvfzp home.tar.gz --exclude=/home/no_backup /home


/home 디렉토리를 1주일 마다 백업한다. 이때 /home/no_backup 디렉토리를 제외 하고 백업하는 스크립트 이다.

또는 아래와 같은 방법을 쓸 수 잇다.

vi exclude.files

#내용

/home/user1/.bashrc

/home/user2/Text*


tar -cvfzp home.tar.gz  -X exclude.files /home

 
특정 파일(exclude.files)을 만들어 제외 시키고 싶은 파일이나 디렉토리를 입력후 위와 같이 tar 명령어를 실행 시키면 된다.


* tar Manpage
tar - GNU 버전 tar 저장 도우미

사용법
tar [ - ] A --catenate --concatenate | c --create | d --diff --compare | r --append | t --list | u --update | x -extract --get [ --atime-preserve ] [ -b, --block-size N ] [ -B, --read-full-blocks ] [ -C, --directory DIR ] [ --checkpoint ] [ -f, --file [HOSTNAME:]F ] [ --force-local ] [ -F, --info-script F --new-volume-script F ] [ -G, --incremental ] [ -g, --listed-incremental F ] [ -h, --dereference ] [ -i, --ignore-zeros ] [ -j, --bzip2 ] [ --ignore-failed-read ] [ -k, --keep-old-files ] [ -K, --starting-file F ] [ -l, --one-file-system ] [ -L, --tape-length N ] [ -m, --modification-time ] [ -M, --multi-volume ] [ -N, --after-date DATE, --newer DATE ] [ -o, --old-archive, --portability ] [ -O, --to-stdout ] [ -p, --same-permissions, --preserve-permissions ] [ -P, --absolute-names ] [ --preserve ] [ -R, --record-number ] [ --remove-files ] [ -s, --same-order, --preserve-order ] [ --same-owner ] [ --numeric-owner ] [ -S, --sparse ] [ -T, --files-from F ] [ --null ] [ --totals ] [ -v, --verbose ] [ -V, --label NAME ] [ --version ] [ -w, --interactive, --confirmation ] [ -W, --verify ] [ --exclude=FILE ] [ -X, --exclude-from FILE ] [ -Z, --compress, --uncompress ] [ -z, --gzip, --ungzip ] [ --use-compress-program PROG ] [ --block-compress ] [ --rsh-command=CMD ] [ -[0-7][lmh] ]
filename1 [ filename2, ... filenameN ]
directory1 [ directory2, ...directoryN ]

설명
이 설명서는 tarfile 이라고 알려진 저장 파일을 묶거나 풀 수 있도록 만들어 진 GNU 버전 tar 저장 프로그램에 대한 설명이다. tarfile 은 테이프 드라이브에 저장할 수도 있고, tarfile 을 일반적인 보통 파일로 쓸 수도 있다. tar 의 첫번째 인수로는 반드시 Acdrtux 중 하나의 옵션이 들어가야 하고, 다른 선택적인 기능이 덧붙여진다. tar 의 마지막 인수로는 압축될 파일이나 디렉토리의 이름이 오게 된다. 디렉토리 이름이 사용될 경우 언제나 하위 디렉토리가 함께 저장된다.

예제
tar -xvvf foo.tar
foo.tar 파일을 푼다.
tar -xvvzf foo.tar.gz
gzip으로 압축된 foo.tar.gz 파일을 푼다.
tar -cvvf foo.tar foo/
foo 디렉토리에 있는 내용물을 foo.tar 파일로 묶는다.

기능 옵션
반드시 아래 옵션들 중 하나가 들어가야 한다.
-A, --catenate, --concatenate
저장 파일에 tar 파일을 추가한다.
-c, --create
새 저장 파일을 만든다.
-d, --diff, --compare
저장 파일 혹은 파일 시스템 간의 다른 점을 찾는다.
--delete
저장 파일에서 지운다. (자기 테이프에는 쓰면 안됨!)
-r, --append
저장 파일의 끝에 파일을 덧붙인다.
-t, --list
저장 파일의 내용 목록을 보여준다.
-u, --update
저장 파일에 저장된 사본보다 새로운 파일만을 덧붙인다.
-x, --extract, --get
저장된 것에서 풀어낸다.

부가적인 옵션
--atime-preserve
덤프된 파일의 접근 시간을 바꾸지 않는다.
-b, --block-size N
블럭 크기를 N x 512 바이트로 정한다. (기본값 N = 20)
-B, --read-full-blocks
읽은 만큼 블럭을 재지정한다. (4.2BSD 파이프를 읽기 위함)
-C, --directory DIR
DIR 디렉토리로 바꾸고 작업을 한다.
--checkpoint
저장 파일을 읽는 동안 디렉토리 이름을 출력한다.
-f, --file [HOSTNAME:]F
저장 파일 혹은 장치 파일 F에 저장한다. (기본 -, 표준입/출력을 나타낸다.)
--force-local
colon 문자가 있더라도 저장 파일을 지역 파일로 처리한다.
-F, --info-script F --new-volume-script F
run script at end of each tape (implies -M) 테이프의 끝에 도달하면 스크립트를 실행한다. (-M 이 포함된다.)
-G, --incremental
이전 GNU 형식으로 incremental 백업을 만들거나 목록을 보거나 풀어낸다.
-g, --listed-incremental F
새로운 GNU 형식으로 incremental 백업을 만들거나 목록을 보거나 풀어낸다.
-h, --dereference
심볼릭 링크를 묶지 않는다. 그것이 가리키는 파일을 묶는다.
-i, --ignore-zeros
크기가 0인 것은 무시한다. (보통 EOF를 의미한다.)
-j, --bzip2
bzip2 필터를 사용하여 .bz2 파일을 푼다.
--ignore-failed-read
읽을 수 없는 파일이 있더라도 종료 코드 0을 출력하지 않는다.
-k, --keep-old-files
기존에 있는 파일을 유지한다. 파일이 있으면 덮어쓰지 않는다.
-K, --starting-file F
저장 파일에 있는 파일 F에서부터 시작한다.
-l, --one-file-system
저장 파일을 만들 때 로컬 파일 시스템 안의 놓는다.
-L, --tape-length N
N * 1024 바이트를 쓴 다음 테이프를 바꾼다.
-m, --modification-time
파일의 변경 시간 정보를 유지하지 않는다.
-M, --multi-volume
여러 개로 나눠진 저장 파일로 만들거나 목록을 보거나 풀어낸다.
-N, --after-date DATE, --newer DATE
주어진 DATE 보다 새로운 파일만 저장한다.
-o, --old-archive, --portability
ANSI 형식 대신 V7 형식으로 저장한다.
-O, --to-stdout
표준 출력으로 파일들을 풀어낸다.
-p, --same-permissions, --preserve-permissions
모든 퍼미션 정보를 유지한다.
-P, --absolute-paths
파일 이름의 맨 앞 `/' 문자를 버리지 않는다.
--preserve
-p 옵션과 -s 옵션을 함께 사용한 것과 같다.
-R, --record-number
저장 파일의 레코드 번호를 각각의 메시지로 보여준다.
--remove-files
파일을 저장 파일에 덧붙인 다음 파일을 지운다.
-s, --same-order, --preserve-order
저장 파일 목록과 똑같은 순서로 풀어낸다.
--same-owner
같은 사용자 소유권으로 파일들을 풀어낸다.
--numeric-owner
user/group 이름으로 항상 숫자를 사용한다.
-S, --sparse
듬성한 파일을 효율적으로 다룬다.
-T, --files-from F
파일 F에서 목록을 읽어 추출하거나 만든다.
--null
-T reads null-terminated names, disable -C -C를 비활성화하고, -T로 읽을 때 null로 끝나는 이름을 읽는다.
--totals
--create로 만들어진 바이트 총합을 출력한다.
-v, --verbose
처리중인 파일을 자세하게 보여준다.
-V, --label NAME
저장 파일의 볼륨 이름을 NAME으로 한다.
--version
tar 프로그램의 버전 정보를 출력한다.
-w, --interactive, --confirmation
각각을 처리할 때 마다 물어본다.
-W, --verify
attempt to verify the archive after writing it 저장 파일을 쓴 후에 저장 파일을 점검한다.
--exclude=FILE
FILE을 제외한다.
-X, --exclude-from FILE
FILE 목록에 있는 것을 제외한다.
-Z, --compress, --uncompress
compress로 압축하거나 푼다.
-z, --gzip, --ungzip
gzip으로 압축하거나 푼다.
--use-compress-program PROG
PROG로 저장 파일을 다시 처리한다. (PROG은 반드시 -d를 처리해야 한다.)
--block-compress
테이프에 저장할 때 압축 프로그램의 출력을 막는다.
--rsh-command=CMD
`rsh' 대신 원격 COMMAND를 사용한다. 이 옵션은 표준 `rsh' 대신 원격 장치에 접근할 수 있는 다른 것(예를 들어, Kerberized `rsh')을 사용하는 사람들을 위해 필요하다.
-[0-7][lmh]
드라이브와 밀도를 지정한다.

+ Recent posts