![]() ![]() If you need to extract the content of the generated tar to a custom directory instead of the current directory, you can specify the new directory where the content should be extracted using the -C or -directory option in your extraction command: tar -xvzf sandbox_compressed.tar. That will extract the content of the file (sandbox folder) in the current directory. If any files are named on the command line, only those files will be extracted from the archive.įor example, to extract our previously created file you should use the command: tar -xvzf sandbox_ -x: Stand for extract file (input tar.gz file).If you want now to extract as well with the command line the generated file, you should use now the following command syntax: tar -xvzf This should start the compression of the directory into a new tar file, as we have our -v argument to display the progress in the console, you would see a list of every filename that is being added to the file. This works, but I'm wondering if there is a better way: cd /another/directory bunzip2 -k /original/directory/foo. It seems like bunzip2 will only extract the archive to the same directory as the archive. I want to extract the tar file from the archive, but to a different directory. -f: Finally the path of the desire file/directory to compressįor example, let's suppose that you are located in the command line in the /sandbox 12 Say I have a file foo.tbz2 in a directory.-v: To display the progress while creating the file.-c: Stand for create file (output tar.gz file).-z: Compress the desired file/directory using gzip.If your system uses GNU tar, you can easily use gzip (the GNU file compression program) in conjunction with tar to create compressed files with the command line following the next command syntax: tar -zcvf The most common use for tar is to simply combine a few files into a single file, for easy storage and distribution. Similar to gzip you can compress multiple files in one go. TAR stands for tape archiving, the storing of entire file systems onto magnetic tape, which is one use for the command. A file by name file1.bz2 will be created in current directory replacing file1. Many modern Unix systems, such as Linux, use GNU tar, a version of tar produced by the Free Software Foundation. How to Archive and Compress Files with the tar and gizp Commands in Linux -czvf -czvf egg.![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |