tar command

tar command

Hi,

What is tar command in Linux and how it is used?

Thanks

View Answers

April 22, 2020 at 2:41 PM

Hi,

The tar is very popular utility in Linux/UNIX which was first introduced to Linux back in January 1979 for taking the tape backup of the data/software.

Since then it became of the most popular tool in Linux for archiving files and directories. The tar tool is very powerful and comes with many options to work with the archiving and un-archiving of the files/directories.

The tar tool can be used from the command line, so you can even login to your Linux/UNIX system from an ssh terminal and use this powerful tool on your server.

If you have a directory named "mydata" and you want to archive this directory into a tar.gz file you can do it by following tar command:

tar cvzf mydata.tar.gz mydata

The above command will create an archive file called mydata.tar.gz which will have all the data stored in the mydata directory. It will include all the files, directories and files under all sub directories into the tar.gz file. The tar command preserves the directory structure in the tar.gz file and you will get same directory structure as original when extracted.

So, this tool is very powerful for the Linux user and administrators.

Check the following tutorial for detailed instruction on the use of tar utility in Linux:

Thanks









Related Tutorials/Questions & Answers:
tar command
tar command  Hi, What is tar command in Linux and how it is used? Thanks
tar directory and subdirectories
and subdirectories. Use the following command: tar -cvf myArchieve.tar myfolder/ Thanks...tar directory and subdirectories  Hi, I am developing program on Linux machine. I have to create the .tar file of a directory and subdirectories
Advertisements
ModuleNotFoundError: No module named 'tar-diff'
command: pip install tar-diff After the installation of tar-diff python...ModuleNotFoundError: No module named 'tar-diff'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'tar
ModuleNotFoundError: No module named 'tar-diff'
command: pip install tar-diff After the installation of tar-diff python...ModuleNotFoundError: No module named 'tar-diff'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'tar
ModuleNotFoundError: No module named 'tar-progress'
with following command: pip install tar-progress After the installation...ModuleNotFoundError: No module named 'tar-progress'  Hi, My Python... 'tar-progress' How to remove the ModuleNotFoundError: No module named '
ModuleNotFoundError: No module named 'batch-tar'
command: pip install batch-tar After the installation of batch-tar...ModuleNotFoundError: No module named 'batch-tar'  Hi, My Python... 'batch-tar' How to remove the ModuleNotFoundError: No module named 'batch
linux tar folder and subfolders
. Help me with the command in Linux for archiving folder and subfolders into tar...linux tar folder and subfolders  Hi, I am new to Linux operating... for me for zipping it into a file possible Linux tar file. I just searched and found
how to check the size of a tar file in linux
how to check the size of a tar file in linux  Hi, I want to check the size of tar file in Linux. How to check the size of a tar file in linux? What Linux command I should use to check the size of a tar file? Thanks
how to create tar file in ubuntu
tar file in ubuntu? Thanks   Hi, Here is command to create tar file... of the tar.gz file: tar -zxvf dir_archieve.tar.gz Above command will extract... while creating tar.gz file use following command: tar -pcvzf dir
how to create tar file in ubuntu
tar file in ubuntu? Thanks   Hi, Here is command to create tar file... of the tar.gz file: tar -zxvf dir_archieve.tar.gz Above command will extract... while creating tar.gz file use following command: tar -pcvzf dir
ModuleNotFoundError: No module named 'devstack-plugin-tar-installer'
command: pip install devstack-plugin-tar-installer After...ModuleNotFoundError: No module named 'devstack-plugin-tar-installer'  ...: No module named 'devstack-plugin-tar-installer' How to remove
How do I compress a tar file in Linux
and many files are there inside it. I want to know the tar command... the command for this. Thanks   Hi, The tar command was first introduced... to work with files and directories. The tar command can be used to work
How do I compress a tar file in Linux
and many files are there inside it. I want to know the tar command... the command for this. Thanks   Hi, The tar command was first introduced... to work with files and directories. The tar command can be used to work
How do I compress a tar file in Linux
and many files are there inside it. I want to know the tar command... the command for this. Thanks   Hi, The tar command was first introduced... to work with files and directories. The tar command can be used to work
How do I tar a directory without retaining the directory structure?
How do I tar a directory without retaining the directory structure?  Hi, I want to create tar file without retaining the directory permission. How to do this? Thanks   Use tar czf ~/backup.tgz Thanks
How do I tar a directory without retaining the directory structure?
How do I tar a directory without retaining the directory structure?  Hi, I want to create tar file without retaining the directory permission. How to do this? Thanks   Use tar czf ~/backup.tgz Thanks
Maven dependency for org.apache.jackrabbit - oak-segment-tar version 1.46.0 is released. Learn to use oak-segment-tar version 1.46.0 in Maven based Java projects
-segment-tar released The developers of   org.apache.jackrabbit - oak-segment-tar project have released the latest version of this library on 16 Dec 2022, the released version of  org.apache.jackrabbit - oak-segment-tar
Maven dependency for org.apache.jackrabbit - oak-segment-tar version 1.22.13 is released. Learn to use oak-segment-tar version 1.22.13 in Maven based Java projects
of oak-segment-tar released The developers of   org.apache.jackrabbit - oak-segment-tar project have released the latest version of this library on 13 Oct 2022, the released version of  org.apache.jackrabbit - oak-segment-tar
Maven dependency for org.apache.jackrabbit - oak-segment-tar version 1.44.0 is released. Learn to use oak-segment-tar version 1.44.0 in Maven based Java projects
-segment-tar released The developers of   org.apache.jackrabbit - oak-segment-tar project have released the latest version of this library on 12 Jul 2022, the released version of  org.apache.jackrabbit - oak-segment-tar
Maven dependency for org.apache.jackrabbit - oak-segment-tar version 1.22.12 is released. Learn to use oak-segment-tar version 1.22.12 in Maven based Java projects
of oak-segment-tar released The developers of   org.apache.jackrabbit - oak-segment-tar project have released the latest version of this library on 15 Jul 2022, the released version of  org.apache.jackrabbit - oak-segment-tar
Maven dependency for org.apache.jackrabbit - oak-segment-tar version 1.42.0 is released. Learn to use oak-segment-tar version 1.42.0 in Maven based Java projects
-segment-tar released The developers of   org.apache.jackrabbit - oak-segment-tar project have released the latest version of this library on 07 Jan 2022, the released version of  org.apache.jackrabbit - oak-segment-tar
Maven dependency for org.apache.jackrabbit - oak-segment-tar version 1.22.11 is released. Learn to use oak-segment-tar version 1.22.11 in Maven based Java projects
of oak-segment-tar released The developers of   org.apache.jackrabbit - oak-segment-tar project have released the latest version of this library on 22 Feb 2022, the released version of  org.apache.jackrabbit - oak-segment-tar
Maven dependency for org.apache.jackrabbit - oak-segment-tar version 1.22.10 is released. Learn to use oak-segment-tar version 1.22.10 in Maven based Java projects
of oak-segment-tar released The developers of   org.apache.jackrabbit - oak-segment-tar project have released the latest version of this library on 20 Jan 2022, the released version of  org.apache.jackrabbit - oak-segment-tar
Maven dependency for org.apache.jackrabbit - oak-segment-tar version 1.8.26 is released. Learn to use oak-segment-tar version 1.8.26 in Maven based Java projects
-segment-tar released The developers of   org.apache.jackrabbit - oak-segment-tar project have released the latest version of this library on 01 Feb 2022, the released version of  org.apache.jackrabbit - oak-segment-tar
Maven dependency for org.apache.jackrabbit - oak-segment-tar version 1.6.23 is released. Learn to use oak-segment-tar version 1.6.23 in Maven based Java projects
-segment-tar released The developers of   org.apache.jackrabbit - oak-segment-tar project have released the latest version of this library on 11 Mar 2022, the released version of  org.apache.jackrabbit - oak-segment-tar
Maven dependency for org.apache.jackrabbit - oak-segment-tar version 1.40.0 is released. Learn to use oak-segment-tar version 1.40.0 in Maven based Java projects
-segment-tar released The developers of   org.apache.jackrabbit - oak-segment-tar project have released the latest version of this library on 28 May 2021, the released version of  org.apache.jackrabbit - oak-segment-tar
Maven dependency for org.apache.jackrabbit - oak-segment-tar version 1.38.0 is released. Learn to use oak-segment-tar version 1.38.0 in Maven based Java projects
-segment-tar released The developers of   org.apache.jackrabbit - oak-segment-tar project have released the latest version of this library on 22 Jan 2021, the released version of  org.apache.jackrabbit - oak-segment-tar
Maven dependency for org.apache.jackrabbit - oak-segment-tar version 1.22.9 is released. Learn to use oak-segment-tar version 1.22.9 in Maven based Java projects
-segment-tar released The developers of   org.apache.jackrabbit - oak-segment-tar project have released the latest version of this library on 06 Oct 2021, the released version of  org.apache.jackrabbit - oak-segment-tar
Maven dependency for org.apache.jackrabbit - oak-segment-tar version 1.22.8 is released. Learn to use oak-segment-tar version 1.22.8 in Maven based Java projects
-segment-tar released The developers of   org.apache.jackrabbit - oak-segment-tar project have released the latest version of this library on 14 Jul 2021, the released version of  org.apache.jackrabbit - oak-segment-tar
Maven dependency for org.apache.jackrabbit - oak-segment-tar version 1.22.7 is released. Learn to use oak-segment-tar version 1.22.7 in Maven based Java projects
-segment-tar released The developers of   org.apache.jackrabbit - oak-segment-tar project have released the latest version of this library on 09 Apr 2021, the released version of  org.apache.jackrabbit - oak-segment-tar
Maven dependency for org.apache.jackrabbit - oak-segment-tar version 1.22.6 is released. Learn to use oak-segment-tar version 1.22.6 in Maven based Java projects
-segment-tar released The developers of   org.apache.jackrabbit - oak-segment-tar project have released the latest version of this library on 15 Jan 2021, the released version of  org.apache.jackrabbit - oak-segment-tar
Maven dependency for org.apache.jackrabbit - oak-segment-tar version 1.8.25 is released. Learn to use oak-segment-tar version 1.8.25 in Maven based Java projects
-segment-tar released The developers of   org.apache.jackrabbit - oak-segment-tar project have released the latest version of this library on 01 Nov 2021, the released version of  org.apache.jackrabbit - oak-segment-tar
Maven dependency for org.apache.jackrabbit - oak-segment-tar version 1.6.22 is released. Learn to use oak-segment-tar version 1.6.22 in Maven based Java projects
-segment-tar released The developers of   org.apache.jackrabbit - oak-segment-tar project have released the latest version of this library on 15 Nov 2021, the released version of  org.apache.jackrabbit - oak-segment-tar
Maven dependency for org.apache.jackrabbit - oak-segment-tar version 1.6.21 is released. Learn to use oak-segment-tar version 1.6.21 in Maven based Java projects
-segment-tar released The developers of   org.apache.jackrabbit - oak-segment-tar project have released the latest version of this library on 28 May 2021, the released version of  org.apache.jackrabbit - oak-segment-tar
Compute command
Compute command  hello, What is compute command?   hii, samarADS_TO_REPLACE_1 Compute command control computations on subsets created by the BREAK command
Print command
Print command  Can I use System.out.println command in Struts form bean or Struts action class. I am using Struts 1.3.8 but when I write this command...;You can use System.out.println command in Strut Action Class. The message written
Create tar.gz file in Linux command line
directory name or file name for adding into the tar.gz file. Linux tar command... backup. This command is used by the administrator of Linux/Unix system. The tar... in command line mode in Linux terminal. Open the terminal in Linux and type 'tar
iperf command in java
iperf command in java  How to write a code for iperf command in java
c++ system command
c++ system command   c++ system command variables and an example in real time of using the system command
Command line arguments
Command line arguments  Please explain me what is the use of "command line arguments" and why we need to use
ModuleNotFoundError: No module named 'Command'
ModuleNotFoundError: No module named 'Command'  Hi, My Python... 'Command' How to remove the ModuleNotFoundError: No module named 'Command... to install padas library. You can install Command python with following command
What is command prompt in Java?
What is command prompt in Java?  Hi, What is command prompt in Java? Thanks   Hi, On the Windows Command Prompt is a program to run... system them you can use the command prompt to compile the Java program. Command
create .tar.gz in one command
for backup. I want the command to that i can create .tar.gz in one command. Give me the command. Thanks
ping command in servlet
ping command in servlet  hi can we execute ping command in servlet like as we do in normal java. if we can please give an example how. thanks & regards
unrar command not found in linux
unrar command not found in linux  Hi, I am trying to unrar a file in Linux with following command: unrar myfile.rar Here is complete log of the error: [email protected]:~/examples$ unrar myfile.rar Command 'unrar
Compiling package in command line
Compiling package in command line  Hi friends, i am totally new... package using command line. For Eg: When i compile following command, c:>set... as an internal or external command, operable program or batch file. please help me
Command Prompt in UI
Command Prompt in UI  Hi, Is there any API or JAR file for running all the windows command prompt commands like dir,echo,ping commands? If any please tell me what is it? Thanks & Regards---Vanchinathan.R
command prompt is compilation is not working
command prompt is compilation is not working   Dear java users can anyone help me to run the program in command line prompt i tried by selecting... is compiling and generation the class file using javac c:\helloworld.java command
Java Command Line Input
Java Command Line Input  How to get input from command line in java ?   Hi please Find the code for inputting data from the command line System.out.println("Please Input A Number"); BufferedReader br
Hadoop command not found
Hadoop command not found  Hi, I am trying to put file with the command: hadoop fs -put test.txt /test/ But its saying hadoop command not found. How to resolve this? Thanks   Hi, This error means that you have

Ads