unzip partial folder of tar file from url
I have a url which leads to a high size tar file, around 200gb , I need to extract one folder of that file in my linux system. Because of the large file size I don't want to download the entire file to my linux system. Also I don't have shh access to the source system.
Is there any way to extract only a small part of the tar.gz file?
linux tar unzip
add a comment |
I have a url which leads to a high size tar file, around 200gb , I need to extract one folder of that file in my linux system. Because of the large file size I don't want to download the entire file to my linux system. Also I don't have shh access to the source system.
Is there any way to extract only a small part of the tar.gz file?
linux tar unzip
add a comment |
I have a url which leads to a high size tar file, around 200gb , I need to extract one folder of that file in my linux system. Because of the large file size I don't want to download the entire file to my linux system. Also I don't have shh access to the source system.
Is there any way to extract only a small part of the tar.gz file?
linux tar unzip
I have a url which leads to a high size tar file, around 200gb , I need to extract one folder of that file in my linux system. Because of the large file size I don't want to download the entire file to my linux system. Also I don't have shh access to the source system.
Is there any way to extract only a small part of the tar.gz file?
linux tar unzip
linux tar unzip
asked Dec 10 '18 at 8:33
Ebin Manuval
1093
1093
add a comment |
add a comment |
2 Answers
2
active
oldest
votes
To extract only particular directory you need to know the exact filenames. Wildcards do not work with tar. and the command will look like
curl -s -o - <URL>|tar xz /path/file1 /path/file2 ...
add a comment |
The tar
format does not allow adressing a file (or a directory) directly - this is due to the fact, that tape archives were ment to be sequentially read from a backup medium.
What you can of course do, is stop the process after the relevant parts have been extracted. You would do something along the lines of
curl -o - 'http://your/url' | tar -xvz your_filter
This will download the file starting from the beginning and extract the relevant parts, once you have everything you need, you can stop the process to avoid downloading the rest.
Depending on what sort of access you have to the source server, you might even do better: Do you have PHP without save mode? If yes you can extract what you need via shell_exec
and friends.
IMO you need to removef
fromtar
or usef -
to use STDIN as input file
– Romeo Ninov
Dec 10 '18 at 8:59
1
@RomeoNinov Thanks, good catch - edited my answer.
– Eugen Rieck
Dec 10 '18 at 9:15
add a comment |
Your Answer
StackExchange.ready(function() {
var channelOptions = {
tags: "".split(" "),
id: "3"
};
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%2fsuperuser.com%2fquestions%2f1382258%2funzip-partial-folder-of-tar-file-from-url%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
2 Answers
2
active
oldest
votes
2 Answers
2
active
oldest
votes
active
oldest
votes
active
oldest
votes
To extract only particular directory you need to know the exact filenames. Wildcards do not work with tar. and the command will look like
curl -s -o - <URL>|tar xz /path/file1 /path/file2 ...
add a comment |
To extract only particular directory you need to know the exact filenames. Wildcards do not work with tar. and the command will look like
curl -s -o - <URL>|tar xz /path/file1 /path/file2 ...
add a comment |
To extract only particular directory you need to know the exact filenames. Wildcards do not work with tar. and the command will look like
curl -s -o - <URL>|tar xz /path/file1 /path/file2 ...
To extract only particular directory you need to know the exact filenames. Wildcards do not work with tar. and the command will look like
curl -s -o - <URL>|tar xz /path/file1 /path/file2 ...
answered Dec 10 '18 at 9:02
Romeo Ninov
1,6642914
1,6642914
add a comment |
add a comment |
The tar
format does not allow adressing a file (or a directory) directly - this is due to the fact, that tape archives were ment to be sequentially read from a backup medium.
What you can of course do, is stop the process after the relevant parts have been extracted. You would do something along the lines of
curl -o - 'http://your/url' | tar -xvz your_filter
This will download the file starting from the beginning and extract the relevant parts, once you have everything you need, you can stop the process to avoid downloading the rest.
Depending on what sort of access you have to the source server, you might even do better: Do you have PHP without save mode? If yes you can extract what you need via shell_exec
and friends.
IMO you need to removef
fromtar
or usef -
to use STDIN as input file
– Romeo Ninov
Dec 10 '18 at 8:59
1
@RomeoNinov Thanks, good catch - edited my answer.
– Eugen Rieck
Dec 10 '18 at 9:15
add a comment |
The tar
format does not allow adressing a file (or a directory) directly - this is due to the fact, that tape archives were ment to be sequentially read from a backup medium.
What you can of course do, is stop the process after the relevant parts have been extracted. You would do something along the lines of
curl -o - 'http://your/url' | tar -xvz your_filter
This will download the file starting from the beginning and extract the relevant parts, once you have everything you need, you can stop the process to avoid downloading the rest.
Depending on what sort of access you have to the source server, you might even do better: Do you have PHP without save mode? If yes you can extract what you need via shell_exec
and friends.
IMO you need to removef
fromtar
or usef -
to use STDIN as input file
– Romeo Ninov
Dec 10 '18 at 8:59
1
@RomeoNinov Thanks, good catch - edited my answer.
– Eugen Rieck
Dec 10 '18 at 9:15
add a comment |
The tar
format does not allow adressing a file (or a directory) directly - this is due to the fact, that tape archives were ment to be sequentially read from a backup medium.
What you can of course do, is stop the process after the relevant parts have been extracted. You would do something along the lines of
curl -o - 'http://your/url' | tar -xvz your_filter
This will download the file starting from the beginning and extract the relevant parts, once you have everything you need, you can stop the process to avoid downloading the rest.
Depending on what sort of access you have to the source server, you might even do better: Do you have PHP without save mode? If yes you can extract what you need via shell_exec
and friends.
The tar
format does not allow adressing a file (or a directory) directly - this is due to the fact, that tape archives were ment to be sequentially read from a backup medium.
What you can of course do, is stop the process after the relevant parts have been extracted. You would do something along the lines of
curl -o - 'http://your/url' | tar -xvz your_filter
This will download the file starting from the beginning and extract the relevant parts, once you have everything you need, you can stop the process to avoid downloading the rest.
Depending on what sort of access you have to the source server, you might even do better: Do you have PHP without save mode? If yes you can extract what you need via shell_exec
and friends.
edited Dec 10 '18 at 9:14
answered Dec 10 '18 at 8:54
Eugen Rieck
9,74122127
9,74122127
IMO you need to removef
fromtar
or usef -
to use STDIN as input file
– Romeo Ninov
Dec 10 '18 at 8:59
1
@RomeoNinov Thanks, good catch - edited my answer.
– Eugen Rieck
Dec 10 '18 at 9:15
add a comment |
IMO you need to removef
fromtar
or usef -
to use STDIN as input file
– Romeo Ninov
Dec 10 '18 at 8:59
1
@RomeoNinov Thanks, good catch - edited my answer.
– Eugen Rieck
Dec 10 '18 at 9:15
IMO you need to remove
f
from tar
or use f -
to use STDIN as input file– Romeo Ninov
Dec 10 '18 at 8:59
IMO you need to remove
f
from tar
or use f -
to use STDIN as input file– Romeo Ninov
Dec 10 '18 at 8:59
1
1
@RomeoNinov Thanks, good catch - edited my answer.
– Eugen Rieck
Dec 10 '18 at 9:15
@RomeoNinov Thanks, good catch - edited my answer.
– Eugen Rieck
Dec 10 '18 at 9:15
add a comment |
Thanks for contributing an answer to Super User!
- 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.
Some of your past answers have not been well-received, and you're in danger of being blocked from answering.
Please pay close attention to the following guidance:
- 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%2fsuperuser.com%2fquestions%2f1382258%2funzip-partial-folder-of-tar-file-from-url%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