![]() Once again, we make sure that the destination folder exists using: # mkdir / tmp / tar-specific # tar -xvf etc.tar etc / issues / etc / content. In this case the file is called etc tar and the destination folder / tar-specific Something that we can also do with tar, is to extract a specific part of the file that we are decompressing, without having to extract all the content. Once again, we make sure that the destination folder exists using: # mkdir / tmp / tar-bzĪnd we unzip the file called documents.tbz2 in the folder created before # tar -jvxf docs.tbz2 -C / tmp / tar-bzĮxample 4: Extract one or more specific folders within the. It can also be used this way (it does exactly the same thing) # tar -zvxf docs.tgz -directory / tmp / tgz /Įxample 3: Extract tar.bz2, tar.bz. Now we are going to extract documents.tgz to the folder we created earlier # tar -zvxf docs.tgz -C / tmp / tgz / tgz filesĪs in the previous example, we must make sure that the destination folder exists using: # mkdir / tmp / tgz It can also be used –Directory instead of -C, they have exactly the same functionĮxample 2: Extract. Now, to extract the files from article.tar to / tmp / my_article we execute the following: # tar -xvf article.tar -C / tmp / my_article / We are going to create the destination folder with the following command: say # mkdir / tmp / my_article Something that is very important is that you make sure that the destination directory or folder exists before extracting the. We are going to extract the files from article.tar to a / tmp / my_article directory. This option must be followed by the name of the tar file. f: File, the name of the tar file we want tar to work with. ![]() z: Gzip, use gzip to decompress the tar file. v: Verbose, list the files as they are being extracted. Here are some examples where this can be better explained: The command line options we used are: -x: Extract, retrieve the files from the tar file. NOTE: In the first syntax, the -C is to specify that you are working in a different directory than the current one, that is, when we are going to change the directory or folder. # tar -xf filename.tar -C / file_path / folder # tar -xf -directory / file_path / folder If you're running tar (1) as root, then you can give -no-same-permissions command line option to ask tar (1) to respect the umask. Here in the following example, we have the syntax to extract a file The general syntax of tar utility for extracting files: tar -xf filename.tar -C /target/directory tar -xf -directory /target/directory Note: In the above first syntax, the -C option is used to specify a different directory other than the current working directory. If you're running tar (1) as a regular user, it will apply your umask by default. ![]() tar to any directory, as long as we specify that directory, not necessarily in our current directory. Something to know is that you can extract a file with the extension. However, there are many other options and flags available for the unzip and tar commands that you can explore by reading their respective manuals.Utility tar is a utility that helps us to create backups on any Linux system, it includes many options which we must specify depending on what we want to do. The methods discussed in this article should be enough to get you started. Unzipping files into a specific folder in Linux is a simple task once you know the right command syntax or have a GUI tool that supports this functionality. ![]() To extract a file using the file roller, you can simply right-click on the zip or tar archive and select “Extract Here” or “Extract to” to specify the target folder. One popular tool is the file roller, which is the default archive manager for many Linux distributions. If you prefer to use a graphical user interface (GUI), there are many file archiving and extraction tools available in Linux. You can select files to extract and exclude files you do not need now. bash-3.2 uname -a SunOS mymac 5. You dont have to extract all the files included in a. For example, if you want to extract a file called sample.tar into a folder called “unzipped” in your home directory, you can use the following command: tar -xvf ~/sample.tar -C ~/unzipped Method 3: Using GUI tools Untar to a particular directory is Failing. ![]()
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |