1/10/2024 0 Comments Untar linux command example![]() To untar archive files in specified Directory It extracts the contents in the current working directory.Įxample Desktop]$ tar -xvf files.tarĭrwxrwxr-x. To untar or extract a tar file, just use following tar command with the option ‘ x’ (extract). To untar archive file in the same location Tar -cvjf Įxample Desktop]$ tar -cvjf 2 files To create highly compressed tar file we use option ‘ j’. The bz2 compression takes more time to compress and decompress files as compared to gzip which takes less time. The bz2 compress and create archive file less than the size of the gzip. Tar -cvzf Įxample Desktop]$ tar -cvzf files To create a compressed gzip archive file use the ‘ z’ option. Tar -cvf Įxample Desktop]$ tar -cvf files.tar filesįiles/Logical Volume Management on Linux.docxįiles/Raid Concept(Redundant Array of Independent).docxĭrwxrwxr-x. To create a new tar archive file, use the following tar command. The tar command is commonly called as tarball or tar, gzip and bzip. This means the top-level directory that is containing the archive files will not be created instead the files will be placed directly in the “ new_name” directory during the extracting process.Tar Command stands for Tape Archive which is used to merge a collection of files and directories into highly compressed archive file. “ –strip-components 1“: Another option we have used is to ask the Tar to remove the first directory component from the file names in the archive. All the extracted files will be placed in the “ new_name” directory, so, change it with whatever name you want to use for your extracted directory. “ –one-top-level= new_name“: This option is used to tell the Tar which directory it must be used to extract the files into, and if it doesn’t exist, it will create the one automatically. In simple words, it will rename the main archive folder name to what you have set and then extract all the files of the archive in it. It will extract the content in a new directory named “ new_name” while stripping the top-level directory from the extracted files. The above command follows the same regular process for extracting the files in the directory where your Archive is present, however with a slight alteration. tar -xzvf -one-top-level= new_name -strip-components 1 ![]() Those who want to extract the Tar file content in the same directory with some different folder name can use the given command. Extract Tar in the same directory but with renamed folder: ![]() In the given screenshot you can see we didn’t have any folder named “ testfolder” under “/ opt” so the extraction command gave the error for the same. Which can also be replaced with the –directory option.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |