tar
Configuration
Create, extract, and manage tape archives
Safety Advisory
`--delete` modifies the archive in place and cannot be undone. `--overwrite` silently replaces files during extraction.
Add flags from the picker below...
Tests
-cCreate a new archive (-c)
-xExtract files from an archive (-x)
-tList the contents of an archive (-t)
-rAppend files to the end of an archive (-r)
-uAppend files newer than the copy in the archive (-u)
-AAppend tar files to an archive (-A / --catenate)
-zFilter the archive through gzip (-z / --gzip)
-jFilter the archive through bzip2 (-j / --bzip2)
-JFilter the archive through xz (-J / --xz)
--zstdFilter the archive through zstd
-aUse archive suffix to determine the compression program (-a / --auto-compress)
--levelCompression level (1 = fastest, 9 = best)
-fUse specified archive file or device. Use - for stdin/stdout (-f / --file)
-CChange to the specified directory before performing operations (-C / --directory)
--excludeExclude files matching the given pattern
-XExclude patterns listed in the specified file (-X / --exclude-from)
--includeInclude only files matching the given pattern
-TRead names to extract or create from the specified file (-T / --files-from)
--newerOnly store files newer than the specified date (--newer / -N)
--strip-componentsStrip the specified number of leading path components from file names on extraction
--overwriteOverwrite existing files when extracting
-kDo not overwrite existing files when extracting (-k / --keep-old-files)
--keep-newer-filesDo not replace existing files that are newer than their archive copies
--no-same-ownerExtract files as the current user (do not preserve ownership)
-pPreserve file permissions (-p / --preserve-permissions)
--numeric-ownerUse numeric user/group IDs instead of names
-vVerbosely list files processed (-v / --verbose)
--totalsPrint total bytes written after creating the archive
--progressShow extraction progress (GNU tar)
-WAttempt to verify the archive after writing (-W / --verify)
-MCreate/list/extract multi-volume archive (-M / --multi-volume)
-LChange tape after writing the specified number of KiB (-L / --tape-length)
--one-file-systemStay in the local file system when creating an archive; do not cross mount points
--ignore-failed-readDo not exit with non-zero status on unreadable files
--dereferenceFollow symlinks; archive the files they point to rather than the links (-h / --dereference)
--hard-dereferenceFollow hard links and store the referenced file independently
-bSet record size to the specified number of 512-byte records (-b / --blocking-factor)
--checkpointDisplay a progress message every Nth record
Actions
--deleteDelete named members from the archive (not on tape drives)
Live Output
PRO TIP:Combine -c -z -f in one flag group: tar -czf archive.tar.gz ./dir