![]() ![]() $ tar -xvf /path/to/foo.tar -C /path/to/destination/ 13) Extract file from tar archive To extract a tar archive to a specific directory, use -C option to provide destination directory. Tar will auto-detect the format and uncompress it. tgz file as long as it was compressed with a -j option. bz2 archive is $ tar -xjvf /path/to/foo.bz2 ![]() Where '/path/to/foo.tgz' is the absolute or relative path to the compressed file. gz archive, we use the command syntax: $ tar -xzvf /path/to/foo.tgz Where /path/to/foo.tar is the absolute/relative path to the location of a tar file. tar, the command syntax is: $ tar -xvf /path/to/foo.tar To extract an uncompressed archive which often has an extension. The above command adds the content of the fullbackup.tar to backup.tar archive. ![]() The above command will append an anaconda-ks.cfg file in the backup.tar archive 8) Adding two archive files with concatenate option # tar -concatenate -file=backup.tar fullbackup.tar ![]() # tar -append -file=backup.tar anaconda-ks.cfg 7) Append new file to existing tar archiveĪppend a file or add a new file to existing tar archive. 6) Tar all files starting specific letterĬreate a tar archive of everything in the current directory starting with an 'i'. $ tar -zcvf /path/to/foo.tgz -C/path/to/foo. When using tar to compress files and you provide an absolute path, a compressed file will have a full path in its metadata, So when you extract the content, it will be in directories similar to the absolute path that was passed. 5) Use tar with no absolute path on compress The syntax is similar to below: $ tar -czvf /path/to/foo.tgz -exclude=\*. We use -exclude tar option to exclude a specific extension or list of file extensions. $ tar -cjvf /path/to/foo.tgz /path/to/foo/ 4) Create a. Where '/path/to/foo.tgz' is the destination compressed file, and ' /path/to/foo/' is source directory or file to be compressed. gz archive with tar is: $ tar -czvf /path/to/foo.tgz /path/to/foo/ ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. Archives
January 2023
Categories |