There are three commonly used operations `—create’, `—list’, and `—extract’ or ‘-c’, ‘-t’ and ‘-x’
And there are six commonly used options ‘-C’, ‘-f’, ‘-j’, ‘-p’, ‘-v’ and ‘-z’.
- ‘-C’, change to directory
- ‘-f’, use archive file or device F (default “-“, meaning stdin/stdout)
- ‘-j’, filter archive through bzip2, use to decompress *.bz2 files
- ‘-p’, extract all protection information
- ‘-v’, verbosely list files processed
- ‘-z’, filter the archive through gzip
- Verbosely create a tar archive name.tar from sourceFiles or sourceDirectory
tar -cvf name.tar sourceFiles
tar -cvf sourceDirectory/ - Verbosely create a tar file name.tar.gz from souceFiles and compress it use gzip
tar -czf name.tar.gz sourceFiles - Extract name.tar.gz from name.tar.gz
tar -xzf name.tar.gz - Extract one file test.txt from name.tar.gz
tar -xzf name.tar.gz test.txt - List archive members from name.tar
tar -tvf name.tar
No comments:
Post a Comment