linux tar folder and subfolders

linux tar folder and subfolders

Hi,

I am new to Linux operating system. I have a directory which contains many files in several directories and sub-directories. There are many files in each directory and sub-directories. So, I want a simple way to compress these files preserving the directory structure so that when it is extracted I get the same structure.

What are the options for me for zipping it into a file possible Linux tar file. I just searched and found that the tar.gz file is best file format for compressing such directories.

Help me with the command in Linux for archiving folder and subfolders into tar or tar.gz file.

Thanks

View Answers

April 22, 2020 at 3:34 PM

Hi,

The tar utility of Linux is very powerful and you use it for working the with the archive files/directories in Linux.

If you want to tar folder and subfolders in Linux then you can use the following command:

tar cvzf mydata.tar.gz mydata

Above command creates mydata.tar.gz by including all the data inside mydata folder.

Inside mydata folder you can have any number directories/sub-directories and files.

So, above command will help in your case.

Thanks


April 22, 2020 at 3:36 PM

Hi,

Check the following tutorial for more examples:

Thanks









Related Tutorials/Questions & Answers:
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
Advertisements
How do I compress a tar file in Linux
How do I compress a tar file in Linux  Hi, I want to create the tar.gz file file of a directory in Linux. My directory contains many sub directories and many files are there inside it. I want to know the tar command
How do I compress a tar file in Linux
How do I compress a tar file in Linux  Hi, I want to create the tar.gz file file of a directory in Linux. My directory contains many sub directories and many files are there inside it. I want to know the tar command
How do I compress a tar file in Linux
How do I compress a tar file in Linux  Hi, I want to create the tar.gz file file of a directory in Linux. My directory contains many sub directories and many files are there inside it. I want to know the tar command
Java sdk/java poi hssf code to creat excel with folder structure,( i,e folders, subfolders and childrens )
Java sdk/java poi hssf code to creat excel with folder structure,( i,e folders, subfolders and childrens )   I need to create a folder structure... . i need some help in getting folder structure using this java . Folder
tar command
tar command  Hi, What is tar command in Linux and how it is used? Thanks
How to extract a zip file to a folder in Linux?
How to extract a zip file to a folder in Linux? Step by step command with example to extract a zip to specified folder In this tutorial we are going to explain you the usage of unzip tool in Linux and tell you the command to extract
how to create tar file in ubuntu
how to create tar file in ubuntu  Hi, I have a directory with many sub directories and files in it. I want to create tar file of the directory so... tar file in ubuntu? Thanks   Hi, Here is command to create tar file
how to create tar file in ubuntu
how to create tar file in ubuntu  Hi, I have a directory with many sub directories and files in it. I want to create tar file of the directory so... tar file in ubuntu? Thanks   Hi, Here is command to create tar file
tar directory and subdirectories
tar directory and subdirectories  Hi, I am developing program on Linux machine. I have to create the .tar file of a directory and subdirectories... easy in Linux or Unix. You can easily create tar archive of directory
Chmod 777 to a folder and all contents
, subfolders and all files inside the folder permission to 777. The chmod command is used to manage files and folder permissions in Linux. This command allows...Chmod 777 permission - Chmod 777 to a folder and all contents In this tutorial
ModuleNotFoundError: No module named 'tar-diff'
ModuleNotFoundError: No module named 'tar-diff'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'tar-diff' How to remove the ModuleNotFoundError: No module named 'tar-diff
ModuleNotFoundError: No module named 'batch-tar'
ModuleNotFoundError: No module named 'batch-tar'  Hi, My Python... 'batch-tar' How to remove the ModuleNotFoundError: No module named 'batch-tar' error? Thanks   Hi, In your python environment you
ModuleNotFoundError: No module named 'tar-diff'
ModuleNotFoundError: No module named 'tar-diff'  Hi, My Python program is throwing following error: ModuleNotFoundError: No module named 'tar-diff' How to remove the ModuleNotFoundError: No module named 'tar-diff
ModuleNotFoundError: No module named 'tar-progress'
ModuleNotFoundError: No module named 'tar-progress'  Hi, My Python... 'tar-progress' How to remove the ModuleNotFoundError: No module named 'tar-progress' error? Thanks   Hi, In your python
Folder in Java.
Folder in Java.  I have any problem how to make Folder in java program? Can Anybody help me in this part
create folder
create folder  what code we should write as a web application that it create an empty folder on client's desktop
Where is my.cnf in linux?
Where is my.cnf in linux?  Hi, Can anyone tell me where is my.cnf in linux? Thanks   Hi, Its is /etc folder. The complete path with file name is /etc/my.cnf. Thanks
Sitemap Linux Tutorial
| Site Map | Business Software Services India Linux Tutorial Section What is Linux? | Introducing Linux OS | Beginner Guide to Linux Server | Checking the Fedora Core 4 ISOs On Windows | Utility: tar for archieving files
ModuleNotFoundError: No module named 'devstack-plugin-tar-installer'
ModuleNotFoundError: No module named 'devstack-plugin-tar-installer'  ...: No module named 'devstack-plugin-tar-installer' How to remove the ModuleNotFoundError: No module named 'devstack-plugin-tar-installer' error
The Beginners Linux Guide
The Beginner's Guide to Linux Dedicated website to Linux containing Online Resource, Links to Linux Resources and Tutorials. Here you will find a lot of tutorials and information about the Linux. What is Linux
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... operating systems. What is tar utility in Linux/UNIX? Tar is utility in Linux
Linux installation
Linux installation  I want to install linux for generally purpose functions,which linux[fedora , ubunto,centos etc ]should i install.In my pc there is already windows,How much the linux will effect my windows & data in C
"The folder name is not valid" netbeans
"The folder name is not valid" netbeans  "The folder name is not valid" while crating a jsp,html or any page in netbeans
create a folder in jsp page
create a folder in jsp page  i want to create a folder in jsp page And it can be delete aslo
copy file from folder to folder - Java Beginners
copy file from folder to folder   my requirement is I need to copy xml files from one folder to another my source file contains the field filename.... Suppose in the source file, file name is goodfile1.xml source folder
struts2 folder struture - Struts
struts2 folder struture  Hi, I just want to know the exact folder structure required for the struts2 application? Its urgent
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
LINUX - Regex
LINUX  I am running Radhat LINUX in my system.. but in this gcc/cc/g++ command is not working .. so i think C,C++ is not installed my system... to the LINUX . I know for window.. but i want to connect LINUX
Zipping folder - Java Beginners
to zip a user selected folder . this folder may contain any number of folder and sub folders. i saw an example in this site showing , how to zip a folder, i executed... solve this.. zipping folder and all of its files and sub folders. thanking
Java lock file or folder.
Java lock file or folder.  Is it possible to create a desktop application to lock or encrypt file or folder in windows by using java code?? if possible can provide some reference?? because i can't find it... thanks
Last modified date of a folder
Last modified date of a folder  How to get the last modified date of a folder specified by a link in html
jdbc in linux
jdbc in linux  what will be database url if i'm using mysql database on linux platform ? what will be driver name & class name to be used in "Class.forName()" method ? plz give short source code
Linux Programming
Linux Programming  1.Write a program that reads an integer by the user and displays it in octal (base 8): Enter an integer number between 0 and 32767: 2012 In octal, your number is: 3734 (Use the same input and output format
URL folder download to local
URL folder download to local  I have a requirement to download all the folders and files inside from a SVN link to my local directory. Can you help how it could be done
java program to copy the contents of one folder to another folder
java program to copy the contents of one folder to another folder  java program to copy the contents of one folder to another folder   Have a look at the following link: Java Copy one folder to another
image save to folder in java
image save to folder in java  Hi, I am working with java. In my application i want to give facility to user to add and change image. I use open... folder and that path stored into database, for furhter retrivation. Please guide me
Zipping folder - Java Beginners
to zip a user selected folder . this folder may contain any number of folder and sub folders. i saw an example in this site showing , how to zip a folder, i executed... solve this.. zipping folder and all of its files and sub folders. thanking
org.apache.jackrabbit - oak-segment-tar version 1.8.10 Maven dependency. How to use oak-segment-tar version 1.8.10 in pom.xml?
org.apache.jackrabbit  - Version 1.8.10 of oak-segment-tar Maven...-segment-tar in pom.xml? How to use oak-segment-tar version 1.8.10 in pom.xml? Learn... org.apache.jackrabbit  - Version 1.8.10 of oak-segment-tar in project by the help
org.apache.jackrabbit - oak-segment-tar version 1.6.11 Maven dependency. How to use oak-segment-tar version 1.6.11 in pom.xml?
org.apache.jackrabbit  - Version 1.6.11 of oak-segment-tar Maven...-segment-tar in pom.xml? How to use oak-segment-tar version 1.6.11 in pom.xml? Learn... org.apache.jackrabbit  - Version 1.6.11 of oak-segment-tar in project by the help
org.apache.jackrabbit - oak-segment-tar version 1.9.11 Maven dependency. How to use oak-segment-tar version 1.9.11 in pom.xml?
org.apache.jackrabbit  - Version 1.9.11 of oak-segment-tar Maven...-segment-tar in pom.xml? How to use oak-segment-tar version 1.9.11 in pom.xml? Learn... org.apache.jackrabbit  - Version 1.9.11 of oak-segment-tar in project by the help
org.apache.jackrabbit - oak-segment-tar version 1.8.9 Maven dependency. How to use oak-segment-tar version 1.8.9 in pom.xml?
org.apache.jackrabbit  - Version 1.8.9 of oak-segment-tar Maven...-tar in pom.xml? How to use oak-segment-tar version 1.8.9 in pom.xml? Learn... org.apache.jackrabbit  - Version 1.8.9 of oak-segment-tar in project by the help of adding
org.apache.jackrabbit - oak-segment-tar version 1.9.7 Maven dependency. How to use oak-segment-tar version 1.9.7 in pom.xml?
org.apache.jackrabbit  - Version 1.9.7 of oak-segment-tar Maven...-tar in pom.xml? How to use oak-segment-tar version 1.9.7 in pom.xml? Learn... org.apache.jackrabbit  - Version 1.9.7 of oak-segment-tar in project by the help of adding
Linux
xcode group folder
in Xcode Project Folder. Neelam   Follow the steps.. View -> Smart Groups -> All Files it'll group all the files in Xcode Project Folder. Neelam
how to search a text in all files in a folder in unix
how to search a text in all files in a folder in unix  Hi, I am... Linux users are performing such task? What is the command that I can run from... a text in all files in a folder in unix? Thanks   Hi, I Ubuntu or any
how to search a text in all files in a folder in unix
how to search a text in all files in a folder in unix  Hi, I am... Linux users are performing such task? What is the command that I can run from... a text in all files in a folder in unix? Thanks   Hi, I Ubuntu or any
how to search a text in all files in a folder in unix
how to search a text in all files in a folder in unix  Hi, I am... Linux users are performing such task? What is the command that I can run from... a text in all files in a folder in unix? Thanks   Hi, I Ubuntu or any

Ads