tar -czf *.jpg # This command is to make a tarball of all.The -z argument is used in tar to invoke gzip. The opposite of gzip is the decompression program gunzip. Gzip is a compression program developed by the GNU organization. In addition to the most basic packing function, tar can also call other compression software, such as gzip, bzip2, etc., while packing or unpacking. tar -xvf file2.tar -C /home/user2/file2 # Decompress the file to the specified directory path.Note: -C dir is used to change the working directory and is valid until the next -C dir in that command. tar -cvf file2.tar -C /home/user2/file2 # Use the -C command to change the working directory of tar from the current directory to /home/user2 to compress the file2 file (without absolute path) into tar.tar -cvf file2.tar /home/user2/file2 #pack the /home/user2/file2 file into a tar in the current directory, it should be noted that: the source file identified with an absolute path, after compressed with the tar command, the file name along with the absolute path (home/user2/, the root directory “/” is automatically removed) is compressed in together with the home file, two is not file2 after decompression using tar.tar -ztvf file or directory name – check for those files in the compressed file.tar -jcvf file or directory name - packed, compressed with bzip2Ĭheck: (Note: choose whether to add z depending on whether it is gzip compressed or not). tar -zcvf file or directory name - packed, compressed with gzip.tar -cvf file or directory name Packed object - pack only, not compress.-exclude FILE: don’t pack the FILE during the compression process.-p: use the original attributes of the original file.-f: Specify the compressed file, note that the file name should be immediately after f (your own), no other parameters should be added.does it need to be compressed or decompressed with bzip2? Usually the format is bz2 -j: Does it also have the properties of bzip2? i.e.-z: Does it also have the properties of gzip? That is, does it need to be compressed or decompressed with gzip? The usual format is gz or xx.tgz.-x: release files from zip file, equivalent to unpacking.-c: create a new zip file, equivalent to packing. Primary options: they cannot be present at the same time, telling tar what to do is mandatory tar command has a lot of options (you can check them with man tar).įormat: tar file or directory After generating a tarball, you can use other programs to compress it. The most common packaging program under Linux is tar (note that tar is packaging, not compression!) We often refer to the package that is created using the tar program as a tarball, and the commands for tarball files usually end with. Under Windows, you only need to install a tool like Winrar to decompress most files, while under Linux command line there are different compression and decompression methods for each kind of file.Ĭommon Linux compression and decompression commands Using tar to package files Compressing and decompressing files under Linux is quite different from the Windows environment.
0 Comments
Leave a Reply. |
Details
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |