![]() ![]() zip file in that it can hold multiple files, but. A tar file is a special format that groups files into one. The resultant archive files are commonly known as tarballs, gzip, bzip, or tar files. sudo tar xvf my_docs_new.tgz -C home/sguzman/backupShellsĪnd that’s how you create archives, compressed files, and unpack them. What is the Linux tar Command The tar command lets you create compressed archives which contain a particular file or set of files. To mirror our test commands exactly, the correct syntax would look like this: sudo time nice -n -20 tar -czvf game-directory. Here 9 specifies maximum possible compression level. tar cvf - /path/to/directory gzip -9 - >. Next, let's unpack and move our my_docs_new.tgz file to that directory. We also used the time and nice Linux commands to help us measure time elapsed and increase CPU priority for the compression process, respectively. However instead, as noted in this answer, you can pipe the two commands: tar & gzip such that you can explicitly specify compression level for the gzip command to achieve the smallest output size. First, let's make a directory sudo mkdir /home/user/backupShells tgz file and move it to a new directory we will use the -C option. The x options are also used to unpack gzip files. In these examples, we will extract a file contained in the. To extract or unpack a file you can use the x option. Tar and zip commands are often used to compress a websites content to a single smaller file to use less disk space and to expedite the download process of. tar backup using the z option sudo tar cvzf my_docs.tgz home/user/DocumentsĪbove you can see the my_doc.tgz file that was created and the verbose output that has been compressed successfully. We will need to use gzip to compress our. In this example, I will back up my /Documents folder sudo tar cvf backup_docs.tar home/user/DocumentsĬompressing files and folders using tar along with gzip To verify that the files were archived, we will use the t option to list folders in the. f – short for filename (name of the archived file).v – short for verbose (show verbose output).sudo tar cvf my_backup.tar file1 file2 file3 ![]() In the example below, we will be using sudo to bypass permission issues. To archive more than one file you just need to add a space tar Then up top in the search bar, type terminal, and click on the terminal icon to open.īasic Syntax for TAR is shown below. In this tutorial, we will go over some basic TAR commands that will come in handy.įirst, let's open up a terminal by clicking on the bottom left. Also, software that is downloaded from the internet can come compressed and you can use the tar command on the terminal to unpack these compressed files. TAR is short for Tape Archive and is a good tool for archiving and compressing files for backup use.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |