Recursive tar compression?
I'd like to create a tar file to compress a folder that contains sub folders. I'm trying with the following command int in the terminal:
tar -czf folder directorios.tar.gz
directorios.tar.gz would be the result
command-line tar
add a comment |
I'd like to create a tar file to compress a folder that contains sub folders. I'm trying with the following command int in the terminal:
tar -czf folder directorios.tar.gz
directorios.tar.gz would be the result
command-line tar
add a comment |
I'd like to create a tar file to compress a folder that contains sub folders. I'm trying with the following command int in the terminal:
tar -czf folder directorios.tar.gz
directorios.tar.gz would be the result
command-line tar
I'd like to create a tar file to compress a folder that contains sub folders. I'm trying with the following command int in the terminal:
tar -czf folder directorios.tar.gz
directorios.tar.gz would be the result
command-line tar
command-line tar
edited Oct 9 '16 at 4:18
andrew.46
21.5k1469148
21.5k1469148
asked Oct 9 '16 at 3:05
SamSam
140119
140119
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
Try:
tar -czvf directorios.tar.gz folder
A few notes:
Recursion is the default, from the
tar
man pages:
-c, --create
Create a new archive. Arguments supply the names of the files to be archived.
Directories are archived recursively, unless the --no-recursion option is
given.
Although this can be turned off by using the
--no-recursion
option...
You need the archive name immediately after the
-f
option, the correct sequence being:
tar -c [-f ARCHIVE] [OPTIONS] [FILE...]
^^^^^^^^^^
For a more flexible command line (particularly if you wanted to use other compression utilities apart from gzip with tar) you could omit the
-z
option and use-a
or--auto-compress
option to allow tar to automatically decide which compressor to use based on the archive suffix:
-a, --auto-compress
Use archive suffix to determine the compression program.
Recognised suffixes (and their attendant compressing applications) are:
- .gz : gzip
- .tgz : gzip
- .taz : gzip
- .Z : compress
- .taZ : compress
- .bz2 : bzip2
- .tz2 : bzip2
- .tbz2 : bzip2
- .tbz : bzip2
- .lz : lzip
- .lzma : lzma
- .tlz : lzma
- .lzo : lzop
- .xz : xz
tar is pretty cool :)
References:
8.1.1 Creating and Reading Compressed Archives Sound information on using the auto-compress options with tar as well as the possibilities for accomplishing the same goal with a more manual and flexible option...
Is directorios.tar.gz a gzip tarfile? I have red that -cz creates a gzip and -v(verbose) shows the process.
– Sam
Oct 9 '16 at 3:28
@sam Indeed, my apologies, I have added this in. You could omit the-z
option and use-a
to allow tar to guess from the archive suffix....
– andrew.46
Oct 9 '16 at 3:50
@sam OK I have bulked up the answer considerably, hopefully some useful additions in there for you :)
– andrew.46
Oct 9 '16 at 3:59
I used both-z
and-a
and didn't notice any difference(i'm working on a remote server). Both tars weight the same. In the exercise I'm asked to create a gzip, then decompress it using gunzip. Thanks for all the help!
– Sam
Oct 9 '16 at 4:04
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "89"
};
initTagRenderer("".split(" "), "".split(" "), channelOptions);
StackExchange.using("externalEditor", function() {
// Have to fire editor after snippets, if snippets enabled
if (StackExchange.settings.snippets.snippetsEnabled) {
StackExchange.using("snippets", function() {
createEditor();
});
}
else {
createEditor();
}
});
function createEditor() {
StackExchange.prepareEditor({
heartbeatType: 'answer',
autoActivateHeartbeat: false,
convertImagesToLinks: true,
noModals: true,
showLowRepImageUploadWarning: true,
reputationToPostImages: 10,
bindNavPrevention: true,
postfix: "",
imageUploader: {
brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
allowUrls: true
},
onDemand: true,
discardSelector: ".discard-answer"
,immediatelyShowMarkdownHelp:true
});
}
});
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f834717%2frecursive-tar-compression%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
Try:
tar -czvf directorios.tar.gz folder
A few notes:
Recursion is the default, from the
tar
man pages:
-c, --create
Create a new archive. Arguments supply the names of the files to be archived.
Directories are archived recursively, unless the --no-recursion option is
given.
Although this can be turned off by using the
--no-recursion
option...
You need the archive name immediately after the
-f
option, the correct sequence being:
tar -c [-f ARCHIVE] [OPTIONS] [FILE...]
^^^^^^^^^^
For a more flexible command line (particularly if you wanted to use other compression utilities apart from gzip with tar) you could omit the
-z
option and use-a
or--auto-compress
option to allow tar to automatically decide which compressor to use based on the archive suffix:
-a, --auto-compress
Use archive suffix to determine the compression program.
Recognised suffixes (and their attendant compressing applications) are:
- .gz : gzip
- .tgz : gzip
- .taz : gzip
- .Z : compress
- .taZ : compress
- .bz2 : bzip2
- .tz2 : bzip2
- .tbz2 : bzip2
- .tbz : bzip2
- .lz : lzip
- .lzma : lzma
- .tlz : lzma
- .lzo : lzop
- .xz : xz
tar is pretty cool :)
References:
8.1.1 Creating and Reading Compressed Archives Sound information on using the auto-compress options with tar as well as the possibilities for accomplishing the same goal with a more manual and flexible option...
Is directorios.tar.gz a gzip tarfile? I have red that -cz creates a gzip and -v(verbose) shows the process.
– Sam
Oct 9 '16 at 3:28
@sam Indeed, my apologies, I have added this in. You could omit the-z
option and use-a
to allow tar to guess from the archive suffix....
– andrew.46
Oct 9 '16 at 3:50
@sam OK I have bulked up the answer considerably, hopefully some useful additions in there for you :)
– andrew.46
Oct 9 '16 at 3:59
I used both-z
and-a
and didn't notice any difference(i'm working on a remote server). Both tars weight the same. In the exercise I'm asked to create a gzip, then decompress it using gunzip. Thanks for all the help!
– Sam
Oct 9 '16 at 4:04
add a comment |
Try:
tar -czvf directorios.tar.gz folder
A few notes:
Recursion is the default, from the
tar
man pages:
-c, --create
Create a new archive. Arguments supply the names of the files to be archived.
Directories are archived recursively, unless the --no-recursion option is
given.
Although this can be turned off by using the
--no-recursion
option...
You need the archive name immediately after the
-f
option, the correct sequence being:
tar -c [-f ARCHIVE] [OPTIONS] [FILE...]
^^^^^^^^^^
For a more flexible command line (particularly if you wanted to use other compression utilities apart from gzip with tar) you could omit the
-z
option and use-a
or--auto-compress
option to allow tar to automatically decide which compressor to use based on the archive suffix:
-a, --auto-compress
Use archive suffix to determine the compression program.
Recognised suffixes (and their attendant compressing applications) are:
- .gz : gzip
- .tgz : gzip
- .taz : gzip
- .Z : compress
- .taZ : compress
- .bz2 : bzip2
- .tz2 : bzip2
- .tbz2 : bzip2
- .tbz : bzip2
- .lz : lzip
- .lzma : lzma
- .tlz : lzma
- .lzo : lzop
- .xz : xz
tar is pretty cool :)
References:
8.1.1 Creating and Reading Compressed Archives Sound information on using the auto-compress options with tar as well as the possibilities for accomplishing the same goal with a more manual and flexible option...
Is directorios.tar.gz a gzip tarfile? I have red that -cz creates a gzip and -v(verbose) shows the process.
– Sam
Oct 9 '16 at 3:28
@sam Indeed, my apologies, I have added this in. You could omit the-z
option and use-a
to allow tar to guess from the archive suffix....
– andrew.46
Oct 9 '16 at 3:50
@sam OK I have bulked up the answer considerably, hopefully some useful additions in there for you :)
– andrew.46
Oct 9 '16 at 3:59
I used both-z
and-a
and didn't notice any difference(i'm working on a remote server). Both tars weight the same. In the exercise I'm asked to create a gzip, then decompress it using gunzip. Thanks for all the help!
– Sam
Oct 9 '16 at 4:04
add a comment |
Try:
tar -czvf directorios.tar.gz folder
A few notes:
Recursion is the default, from the
tar
man pages:
-c, --create
Create a new archive. Arguments supply the names of the files to be archived.
Directories are archived recursively, unless the --no-recursion option is
given.
Although this can be turned off by using the
--no-recursion
option...
You need the archive name immediately after the
-f
option, the correct sequence being:
tar -c [-f ARCHIVE] [OPTIONS] [FILE...]
^^^^^^^^^^
For a more flexible command line (particularly if you wanted to use other compression utilities apart from gzip with tar) you could omit the
-z
option and use-a
or--auto-compress
option to allow tar to automatically decide which compressor to use based on the archive suffix:
-a, --auto-compress
Use archive suffix to determine the compression program.
Recognised suffixes (and their attendant compressing applications) are:
- .gz : gzip
- .tgz : gzip
- .taz : gzip
- .Z : compress
- .taZ : compress
- .bz2 : bzip2
- .tz2 : bzip2
- .tbz2 : bzip2
- .tbz : bzip2
- .lz : lzip
- .lzma : lzma
- .tlz : lzma
- .lzo : lzop
- .xz : xz
tar is pretty cool :)
References:
8.1.1 Creating and Reading Compressed Archives Sound information on using the auto-compress options with tar as well as the possibilities for accomplishing the same goal with a more manual and flexible option...
Try:
tar -czvf directorios.tar.gz folder
A few notes:
Recursion is the default, from the
tar
man pages:
-c, --create
Create a new archive. Arguments supply the names of the files to be archived.
Directories are archived recursively, unless the --no-recursion option is
given.
Although this can be turned off by using the
--no-recursion
option...
You need the archive name immediately after the
-f
option, the correct sequence being:
tar -c [-f ARCHIVE] [OPTIONS] [FILE...]
^^^^^^^^^^
For a more flexible command line (particularly if you wanted to use other compression utilities apart from gzip with tar) you could omit the
-z
option and use-a
or--auto-compress
option to allow tar to automatically decide which compressor to use based on the archive suffix:
-a, --auto-compress
Use archive suffix to determine the compression program.
Recognised suffixes (and their attendant compressing applications) are:
- .gz : gzip
- .tgz : gzip
- .taz : gzip
- .Z : compress
- .taZ : compress
- .bz2 : bzip2
- .tz2 : bzip2
- .tbz2 : bzip2
- .tbz : bzip2
- .lz : lzip
- .lzma : lzma
- .tlz : lzma
- .lzo : lzop
- .xz : xz
tar is pretty cool :)
References:
8.1.1 Creating and Reading Compressed Archives Sound information on using the auto-compress options with tar as well as the possibilities for accomplishing the same goal with a more manual and flexible option...
edited Dec 28 '18 at 22:57
answered Oct 9 '16 at 3:09
andrew.46andrew.46
21.5k1469148
21.5k1469148
Is directorios.tar.gz a gzip tarfile? I have red that -cz creates a gzip and -v(verbose) shows the process.
– Sam
Oct 9 '16 at 3:28
@sam Indeed, my apologies, I have added this in. You could omit the-z
option and use-a
to allow tar to guess from the archive suffix....
– andrew.46
Oct 9 '16 at 3:50
@sam OK I have bulked up the answer considerably, hopefully some useful additions in there for you :)
– andrew.46
Oct 9 '16 at 3:59
I used both-z
and-a
and didn't notice any difference(i'm working on a remote server). Both tars weight the same. In the exercise I'm asked to create a gzip, then decompress it using gunzip. Thanks for all the help!
– Sam
Oct 9 '16 at 4:04
add a comment |
Is directorios.tar.gz a gzip tarfile? I have red that -cz creates a gzip and -v(verbose) shows the process.
– Sam
Oct 9 '16 at 3:28
@sam Indeed, my apologies, I have added this in. You could omit the-z
option and use-a
to allow tar to guess from the archive suffix....
– andrew.46
Oct 9 '16 at 3:50
@sam OK I have bulked up the answer considerably, hopefully some useful additions in there for you :)
– andrew.46
Oct 9 '16 at 3:59
I used both-z
and-a
and didn't notice any difference(i'm working on a remote server). Both tars weight the same. In the exercise I'm asked to create a gzip, then decompress it using gunzip. Thanks for all the help!
– Sam
Oct 9 '16 at 4:04
Is directorios.tar.gz a gzip tarfile? I have red that -cz creates a gzip and -v(verbose) shows the process.
– Sam
Oct 9 '16 at 3:28
Is directorios.tar.gz a gzip tarfile? I have red that -cz creates a gzip and -v(verbose) shows the process.
– Sam
Oct 9 '16 at 3:28
@sam Indeed, my apologies, I have added this in. You could omit the
-z
option and use -a
to allow tar to guess from the archive suffix....– andrew.46
Oct 9 '16 at 3:50
@sam Indeed, my apologies, I have added this in. You could omit the
-z
option and use -a
to allow tar to guess from the archive suffix....– andrew.46
Oct 9 '16 at 3:50
@sam OK I have bulked up the answer considerably, hopefully some useful additions in there for you :)
– andrew.46
Oct 9 '16 at 3:59
@sam OK I have bulked up the answer considerably, hopefully some useful additions in there for you :)
– andrew.46
Oct 9 '16 at 3:59
I used both
-z
and -a
and didn't notice any difference(i'm working on a remote server). Both tars weight the same. In the exercise I'm asked to create a gzip, then decompress it using gunzip. Thanks for all the help!– Sam
Oct 9 '16 at 4:04
I used both
-z
and -a
and didn't notice any difference(i'm working on a remote server). Both tars weight the same. In the exercise I'm asked to create a gzip, then decompress it using gunzip. Thanks for all the help!– Sam
Oct 9 '16 at 4:04
add a comment |
Thanks for contributing an answer to Ask Ubuntu!
- Please be sure to answer the question. Provide details and share your research!
But avoid …
- Asking for help, clarification, or responding to other answers.
- Making statements based on opinion; back them up with references or personal experience.
To learn more, see our tips on writing great answers.
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2faskubuntu.com%2fquestions%2f834717%2frecursive-tar-compression%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown