What does the hyphen “-” mean in “tar xzf -”?What is the difference between cat and tee?What does “%U” mean when calling a command?Can someone spell out what this wget command to install Heroku toolbelt does?Trying to figure out what the command meanWhat does 'ls -la' do?What does the “apt-get dselect-upgrade” command do?Adding the tar '-z' (gzip) parameter at the end of 'tar -cvpfz …' doesn't work as expectedWhy am I not being able to tar /opt and move it to my USB location in LinuxWhat does this command mean: awk -F'/BaseCalls/' 'print $2'?curl, sh, what do those commands mean?Metadata in the tar file
Should I share with a new service provider a bill from its competitor?
Can 'leave' mean 'forget'?
Mean Value Theorem: Continuous or Defined?
Golf the smallest circle!
Are there any features that help with the roll to avoid the destruction of a Wand of Fireballs when using the last charge?
How did researchers use to find articles before the Internet and the computer era?
Why don't all electrons contribute to total orbital angular momentum of an atom?
Can a single server be associated with multiple domains?
Different budgets within roommate group
What's the safest way to inform a new user of their password on my web site?
Symbol for "not absolutely continuous" in Latex
Why do I need two parameters in an HTTP parameter pollution attack?
cannot execute script while its permission is 'x'
How was film developed in the late 1920s?
How is this practical and ancient scene shot?
Was it really unprofessional of me to leave without asking for a raise first?
Details of video memory access arbitration in Space Invaders
Is it bad to describe a character long after their introduction?
Meaning of もてり and use of が
What are good ways to spray paint a QR code on a footpath?
When are digital copies of Switch games made available to play?
In native German words, is Q always followed by U, as in English?
Why was Mal so quick to drop Bester in favour of Kaylee?
Understanding Lasso Regression's sparsity geometrically
What does the hyphen “-” mean in “tar xzf -”?
What is the difference between cat and tee?What does “%U” mean when calling a command?Can someone spell out what this wget command to install Heroku toolbelt does?Trying to figure out what the command meanWhat does 'ls -la' do?What does the “apt-get dselect-upgrade” command do?Adding the tar '-z' (gzip) parameter at the end of 'tar -cvpfz …' doesn't work as expectedWhy am I not being able to tar /opt and move it to my USB location in LinuxWhat does this command mean: awk -F'/BaseCalls/' 'print $2'?curl, sh, what do those commands mean?Metadata in the tar file
.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;
When try to install dropbox from command line, I read the commands
cd ~ && wget -O - "https://www.dropbox.com/download?plat=lnx.x86_64" | tar xzf -
what does -
mean here? is it previous directory?
command-line tar
add a comment |
When try to install dropbox from command line, I read the commands
cd ~ && wget -O - "https://www.dropbox.com/download?plat=lnx.x86_64" | tar xzf -
what does -
mean here? is it previous directory?
command-line tar
9
A bit of pedantry: the option you're asking about isf -
. This might make finding the answer in the man pages a little easier.
– studog
Jun 18 at 19:01
4
It would be really helpful if you could explain what, precisely is unclear to you about the documentation ofwget
andtar
. That way, the respective developers can improve their documentation so that future users don't stumble over the same problems again. In other words: be a hero and make the world a better place!
– Jörg W Mittag
Jun 18 at 20:07
2
It would be a nice default for tar to use stdin, but since it’s heritage is to work with tapes it did not do that. Instead it learned how to work with files (with the f option) and then follows the convention to have a - in place of the filename for stdin (In case of eXtract or stdout in case of Create)
– eckes
Jun 19 at 1:44
1
@eckes In the case of GNU tar, stdin is the default unless$TAPE
is set.
– chrylis
Jun 20 at 6:17
add a comment |
When try to install dropbox from command line, I read the commands
cd ~ && wget -O - "https://www.dropbox.com/download?plat=lnx.x86_64" | tar xzf -
what does -
mean here? is it previous directory?
command-line tar
When try to install dropbox from command line, I read the commands
cd ~ && wget -O - "https://www.dropbox.com/download?plat=lnx.x86_64" | tar xzf -
what does -
mean here? is it previous directory?
command-line tar
command-line tar
edited Jun 19 at 19:25
Eliah Kagan
85.4k22 gold badges239 silver badges380 bronze badges
85.4k22 gold badges239 silver badges380 bronze badges
asked Jun 18 at 6:55
DummyHeadDummyHead
7034 silver badges20 bronze badges
7034 silver badges20 bronze badges
9
A bit of pedantry: the option you're asking about isf -
. This might make finding the answer in the man pages a little easier.
– studog
Jun 18 at 19:01
4
It would be really helpful if you could explain what, precisely is unclear to you about the documentation ofwget
andtar
. That way, the respective developers can improve their documentation so that future users don't stumble over the same problems again. In other words: be a hero and make the world a better place!
– Jörg W Mittag
Jun 18 at 20:07
2
It would be a nice default for tar to use stdin, but since it’s heritage is to work with tapes it did not do that. Instead it learned how to work with files (with the f option) and then follows the convention to have a - in place of the filename for stdin (In case of eXtract or stdout in case of Create)
– eckes
Jun 19 at 1:44
1
@eckes In the case of GNU tar, stdin is the default unless$TAPE
is set.
– chrylis
Jun 20 at 6:17
add a comment |
9
A bit of pedantry: the option you're asking about isf -
. This might make finding the answer in the man pages a little easier.
– studog
Jun 18 at 19:01
4
It would be really helpful if you could explain what, precisely is unclear to you about the documentation ofwget
andtar
. That way, the respective developers can improve their documentation so that future users don't stumble over the same problems again. In other words: be a hero and make the world a better place!
– Jörg W Mittag
Jun 18 at 20:07
2
It would be a nice default for tar to use stdin, but since it’s heritage is to work with tapes it did not do that. Instead it learned how to work with files (with the f option) and then follows the convention to have a - in place of the filename for stdin (In case of eXtract or stdout in case of Create)
– eckes
Jun 19 at 1:44
1
@eckes In the case of GNU tar, stdin is the default unless$TAPE
is set.
– chrylis
Jun 20 at 6:17
9
9
A bit of pedantry: the option you're asking about is
f -
. This might make finding the answer in the man pages a little easier.– studog
Jun 18 at 19:01
A bit of pedantry: the option you're asking about is
f -
. This might make finding the answer in the man pages a little easier.– studog
Jun 18 at 19:01
4
4
It would be really helpful if you could explain what, precisely is unclear to you about the documentation of
wget
and tar
. That way, the respective developers can improve their documentation so that future users don't stumble over the same problems again. In other words: be a hero and make the world a better place!– Jörg W Mittag
Jun 18 at 20:07
It would be really helpful if you could explain what, precisely is unclear to you about the documentation of
wget
and tar
. That way, the respective developers can improve their documentation so that future users don't stumble over the same problems again. In other words: be a hero and make the world a better place!– Jörg W Mittag
Jun 18 at 20:07
2
2
It would be a nice default for tar to use stdin, but since it’s heritage is to work with tapes it did not do that. Instead it learned how to work with files (with the f option) and then follows the convention to have a - in place of the filename for stdin (In case of eXtract or stdout in case of Create)
– eckes
Jun 19 at 1:44
It would be a nice default for tar to use stdin, but since it’s heritage is to work with tapes it did not do that. Instead it learned how to work with files (with the f option) and then follows the convention to have a - in place of the filename for stdin (In case of eXtract or stdout in case of Create)
– eckes
Jun 19 at 1:44
1
1
@eckes In the case of GNU tar, stdin is the default unless
$TAPE
is set.– chrylis
Jun 20 at 6:17
@eckes In the case of GNU tar, stdin is the default unless
$TAPE
is set.– chrylis
Jun 20 at 6:17
add a comment |
3 Answers
3
active
oldest
votes
Some commands accept -
in place of a filename, either:
- To write to standard output instead of to a named file. This is what the
-
argument passed towget
after-O
is doing. - To read from standard input instead of from a named file. This is what the
-
argument passed totar
afterxzf
.
The command you showed downloads an archive file with wget
and unpacks it with tar
. To achieve this, the output of wget
is piped (|
) to the input of tar
. This is why wget
writes to standard output instead of a file and tar
reads from standard input instead of a file.
I'd say "most commands" rather than just "some commands". I believe it's part of the POSIX option syntax specification.
– Barmar
Jun 18 at 15:55
2
@Barmar Yes and no: Guideline 13: For utilities that use operands to represent files to be opened for either reading or writing, the '-' operand should be used to mean only standard input (or standard output when it is clear from context that an output file is being specified) or a file named-
.. So if-
is an operand for a "file option" and it has a special meaning, then it must be that of stdin/stdout. The program is free to not treat as a special case and simply look for file-
– Bakuriu
Jun 19 at 19:23
(and typically in those cases omitting the option will be the same as using-
)
– Bakuriu
Jun 19 at 19:24
@Bakuriu I don't see how that refutes what I said. I suspect most commands take filename arguments, so they're supposed to follow that guideline. But maybe I should have qualified it as "most commands that operate on files".
– Barmar
Jun 19 at 19:31
1
@Barmar One way to follow the guideline is to decline to treat-
specially at all, treating it as a literal filename. The only way to go against the guideline is to treat-
specially but with some other meaning than the ones the guideline suggests.
– Eliah Kagan
Jun 19 at 19:39
|
show 3 more comments
That's just a filename that a lot of Unix programs interpret as "instead of actually opening a file, read from stdin
(or write to stdout
)."
That means reading from the input that gets streamed into the program; in your case, that's the output of wget.
New contributor
6
Is it really a filename, though?
– Eric Duminil
Jun 18 at 17:01
7
@EricDuminil It's a filename in the sense that programs accept it in some places where they would otherwise only accept filenames, but you're right that it's not really about an actual name of a file in some directory.
– JoL
Jun 18 at 17:55
5
@EricDuminil: In particular, for programs that follow this convention, you have to use./-
if you actually want to open a file named-
.
– Jörg W Mittag
Jun 18 at 20:05
4
@EricDuminil In fact: yes! It names a file; in the unix sense,stdin
is a file descriptor, and-
is the name you supply to use that. It's not a file name from the OS's perspective, though. Only from the user perspective.
– Marcus Müller
Jun 19 at 6:15
3
@rexkogitans no./dev/stdin
is just a convenience file name offered by some kernel facility. There's usually nofopen("/dev/stdin", "r")
happening anywhere when you write a program that chooses to use stdin; you just go ahead and use theextern FILE* stdin
that your libc header provided you with; by the way, that is the integer file descriptor0
.
– Marcus Müller
Jun 19 at 6:46
|
show 5 more comments
The -
argument to tar
specifies that the archive should be read from stdin
instead of a file. From the GNU tar manual:
If you use
-
as an archive-name,tar
reads the archive from standard input (when listing or extracting files)
Other commands have the same behavior, and it is specified by the POSIX.1-2017 standard:
Guideline 13:
For utilities that use operands to represent files to be opened for either reading or writing, the '
-
' operand should be used to mean
only standard input (or standard output when it is clear from context
that an output file is being specified) or a file named-
.
New contributor
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%2f1151909%2fwhat-does-the-hyphen-mean-in-tar-xzf%23new-answer', 'question_page');
);
Post as a guest
Required, but never shown
3 Answers
3
active
oldest
votes
3 Answers
3
active
oldest
votes
active
oldest
votes
active
oldest
votes
Some commands accept -
in place of a filename, either:
- To write to standard output instead of to a named file. This is what the
-
argument passed towget
after-O
is doing. - To read from standard input instead of from a named file. This is what the
-
argument passed totar
afterxzf
.
The command you showed downloads an archive file with wget
and unpacks it with tar
. To achieve this, the output of wget
is piped (|
) to the input of tar
. This is why wget
writes to standard output instead of a file and tar
reads from standard input instead of a file.
I'd say "most commands" rather than just "some commands". I believe it's part of the POSIX option syntax specification.
– Barmar
Jun 18 at 15:55
2
@Barmar Yes and no: Guideline 13: For utilities that use operands to represent files to be opened for either reading or writing, the '-' operand should be used to mean only standard input (or standard output when it is clear from context that an output file is being specified) or a file named-
.. So if-
is an operand for a "file option" and it has a special meaning, then it must be that of stdin/stdout. The program is free to not treat as a special case and simply look for file-
– Bakuriu
Jun 19 at 19:23
(and typically in those cases omitting the option will be the same as using-
)
– Bakuriu
Jun 19 at 19:24
@Bakuriu I don't see how that refutes what I said. I suspect most commands take filename arguments, so they're supposed to follow that guideline. But maybe I should have qualified it as "most commands that operate on files".
– Barmar
Jun 19 at 19:31
1
@Barmar One way to follow the guideline is to decline to treat-
specially at all, treating it as a literal filename. The only way to go against the guideline is to treat-
specially but with some other meaning than the ones the guideline suggests.
– Eliah Kagan
Jun 19 at 19:39
|
show 3 more comments
Some commands accept -
in place of a filename, either:
- To write to standard output instead of to a named file. This is what the
-
argument passed towget
after-O
is doing. - To read from standard input instead of from a named file. This is what the
-
argument passed totar
afterxzf
.
The command you showed downloads an archive file with wget
and unpacks it with tar
. To achieve this, the output of wget
is piped (|
) to the input of tar
. This is why wget
writes to standard output instead of a file and tar
reads from standard input instead of a file.
I'd say "most commands" rather than just "some commands". I believe it's part of the POSIX option syntax specification.
– Barmar
Jun 18 at 15:55
2
@Barmar Yes and no: Guideline 13: For utilities that use operands to represent files to be opened for either reading or writing, the '-' operand should be used to mean only standard input (or standard output when it is clear from context that an output file is being specified) or a file named-
.. So if-
is an operand for a "file option" and it has a special meaning, then it must be that of stdin/stdout. The program is free to not treat as a special case and simply look for file-
– Bakuriu
Jun 19 at 19:23
(and typically in those cases omitting the option will be the same as using-
)
– Bakuriu
Jun 19 at 19:24
@Bakuriu I don't see how that refutes what I said. I suspect most commands take filename arguments, so they're supposed to follow that guideline. But maybe I should have qualified it as "most commands that operate on files".
– Barmar
Jun 19 at 19:31
1
@Barmar One way to follow the guideline is to decline to treat-
specially at all, treating it as a literal filename. The only way to go against the guideline is to treat-
specially but with some other meaning than the ones the guideline suggests.
– Eliah Kagan
Jun 19 at 19:39
|
show 3 more comments
Some commands accept -
in place of a filename, either:
- To write to standard output instead of to a named file. This is what the
-
argument passed towget
after-O
is doing. - To read from standard input instead of from a named file. This is what the
-
argument passed totar
afterxzf
.
The command you showed downloads an archive file with wget
and unpacks it with tar
. To achieve this, the output of wget
is piped (|
) to the input of tar
. This is why wget
writes to standard output instead of a file and tar
reads from standard input instead of a file.
Some commands accept -
in place of a filename, either:
- To write to standard output instead of to a named file. This is what the
-
argument passed towget
after-O
is doing. - To read from standard input instead of from a named file. This is what the
-
argument passed totar
afterxzf
.
The command you showed downloads an archive file with wget
and unpacks it with tar
. To achieve this, the output of wget
is piped (|
) to the input of tar
. This is why wget
writes to standard output instead of a file and tar
reads from standard input instead of a file.
edited Jun 18 at 17:29
answered Jun 18 at 7:07
Eliah KaganEliah Kagan
85.4k22 gold badges239 silver badges380 bronze badges
85.4k22 gold badges239 silver badges380 bronze badges
I'd say "most commands" rather than just "some commands". I believe it's part of the POSIX option syntax specification.
– Barmar
Jun 18 at 15:55
2
@Barmar Yes and no: Guideline 13: For utilities that use operands to represent files to be opened for either reading or writing, the '-' operand should be used to mean only standard input (or standard output when it is clear from context that an output file is being specified) or a file named-
.. So if-
is an operand for a "file option" and it has a special meaning, then it must be that of stdin/stdout. The program is free to not treat as a special case and simply look for file-
– Bakuriu
Jun 19 at 19:23
(and typically in those cases omitting the option will be the same as using-
)
– Bakuriu
Jun 19 at 19:24
@Bakuriu I don't see how that refutes what I said. I suspect most commands take filename arguments, so they're supposed to follow that guideline. But maybe I should have qualified it as "most commands that operate on files".
– Barmar
Jun 19 at 19:31
1
@Barmar One way to follow the guideline is to decline to treat-
specially at all, treating it as a literal filename. The only way to go against the guideline is to treat-
specially but with some other meaning than the ones the guideline suggests.
– Eliah Kagan
Jun 19 at 19:39
|
show 3 more comments
I'd say "most commands" rather than just "some commands". I believe it's part of the POSIX option syntax specification.
– Barmar
Jun 18 at 15:55
2
@Barmar Yes and no: Guideline 13: For utilities that use operands to represent files to be opened for either reading or writing, the '-' operand should be used to mean only standard input (or standard output when it is clear from context that an output file is being specified) or a file named-
.. So if-
is an operand for a "file option" and it has a special meaning, then it must be that of stdin/stdout. The program is free to not treat as a special case and simply look for file-
– Bakuriu
Jun 19 at 19:23
(and typically in those cases omitting the option will be the same as using-
)
– Bakuriu
Jun 19 at 19:24
@Bakuriu I don't see how that refutes what I said. I suspect most commands take filename arguments, so they're supposed to follow that guideline. But maybe I should have qualified it as "most commands that operate on files".
– Barmar
Jun 19 at 19:31
1
@Barmar One way to follow the guideline is to decline to treat-
specially at all, treating it as a literal filename. The only way to go against the guideline is to treat-
specially but with some other meaning than the ones the guideline suggests.
– Eliah Kagan
Jun 19 at 19:39
I'd say "most commands" rather than just "some commands". I believe it's part of the POSIX option syntax specification.
– Barmar
Jun 18 at 15:55
I'd say "most commands" rather than just "some commands". I believe it's part of the POSIX option syntax specification.
– Barmar
Jun 18 at 15:55
2
2
@Barmar Yes and no: Guideline 13: For utilities that use operands to represent files to be opened for either reading or writing, the '-' operand should be used to mean only standard input (or standard output when it is clear from context that an output file is being specified) or a file named
-
.. So if -
is an operand for a "file option" and it has a special meaning, then it must be that of stdin/stdout. The program is free to not treat as a special case and simply look for file -
– Bakuriu
Jun 19 at 19:23
@Barmar Yes and no: Guideline 13: For utilities that use operands to represent files to be opened for either reading or writing, the '-' operand should be used to mean only standard input (or standard output when it is clear from context that an output file is being specified) or a file named
-
.. So if -
is an operand for a "file option" and it has a special meaning, then it must be that of stdin/stdout. The program is free to not treat as a special case and simply look for file -
– Bakuriu
Jun 19 at 19:23
(and typically in those cases omitting the option will be the same as using
-
)– Bakuriu
Jun 19 at 19:24
(and typically in those cases omitting the option will be the same as using
-
)– Bakuriu
Jun 19 at 19:24
@Bakuriu I don't see how that refutes what I said. I suspect most commands take filename arguments, so they're supposed to follow that guideline. But maybe I should have qualified it as "most commands that operate on files".
– Barmar
Jun 19 at 19:31
@Bakuriu I don't see how that refutes what I said. I suspect most commands take filename arguments, so they're supposed to follow that guideline. But maybe I should have qualified it as "most commands that operate on files".
– Barmar
Jun 19 at 19:31
1
1
@Barmar One way to follow the guideline is to decline to treat
-
specially at all, treating it as a literal filename. The only way to go against the guideline is to treat -
specially but with some other meaning than the ones the guideline suggests.– Eliah Kagan
Jun 19 at 19:39
@Barmar One way to follow the guideline is to decline to treat
-
specially at all, treating it as a literal filename. The only way to go against the guideline is to treat -
specially but with some other meaning than the ones the guideline suggests.– Eliah Kagan
Jun 19 at 19:39
|
show 3 more comments
That's just a filename that a lot of Unix programs interpret as "instead of actually opening a file, read from stdin
(or write to stdout
)."
That means reading from the input that gets streamed into the program; in your case, that's the output of wget.
New contributor
6
Is it really a filename, though?
– Eric Duminil
Jun 18 at 17:01
7
@EricDuminil It's a filename in the sense that programs accept it in some places where they would otherwise only accept filenames, but you're right that it's not really about an actual name of a file in some directory.
– JoL
Jun 18 at 17:55
5
@EricDuminil: In particular, for programs that follow this convention, you have to use./-
if you actually want to open a file named-
.
– Jörg W Mittag
Jun 18 at 20:05
4
@EricDuminil In fact: yes! It names a file; in the unix sense,stdin
is a file descriptor, and-
is the name you supply to use that. It's not a file name from the OS's perspective, though. Only from the user perspective.
– Marcus Müller
Jun 19 at 6:15
3
@rexkogitans no./dev/stdin
is just a convenience file name offered by some kernel facility. There's usually nofopen("/dev/stdin", "r")
happening anywhere when you write a program that chooses to use stdin; you just go ahead and use theextern FILE* stdin
that your libc header provided you with; by the way, that is the integer file descriptor0
.
– Marcus Müller
Jun 19 at 6:46
|
show 5 more comments
That's just a filename that a lot of Unix programs interpret as "instead of actually opening a file, read from stdin
(or write to stdout
)."
That means reading from the input that gets streamed into the program; in your case, that's the output of wget.
New contributor
6
Is it really a filename, though?
– Eric Duminil
Jun 18 at 17:01
7
@EricDuminil It's a filename in the sense that programs accept it in some places where they would otherwise only accept filenames, but you're right that it's not really about an actual name of a file in some directory.
– JoL
Jun 18 at 17:55
5
@EricDuminil: In particular, for programs that follow this convention, you have to use./-
if you actually want to open a file named-
.
– Jörg W Mittag
Jun 18 at 20:05
4
@EricDuminil In fact: yes! It names a file; in the unix sense,stdin
is a file descriptor, and-
is the name you supply to use that. It's not a file name from the OS's perspective, though. Only from the user perspective.
– Marcus Müller
Jun 19 at 6:15
3
@rexkogitans no./dev/stdin
is just a convenience file name offered by some kernel facility. There's usually nofopen("/dev/stdin", "r")
happening anywhere when you write a program that chooses to use stdin; you just go ahead and use theextern FILE* stdin
that your libc header provided you with; by the way, that is the integer file descriptor0
.
– Marcus Müller
Jun 19 at 6:46
|
show 5 more comments
That's just a filename that a lot of Unix programs interpret as "instead of actually opening a file, read from stdin
(or write to stdout
)."
That means reading from the input that gets streamed into the program; in your case, that's the output of wget.
New contributor
That's just a filename that a lot of Unix programs interpret as "instead of actually opening a file, read from stdin
(or write to stdout
)."
That means reading from the input that gets streamed into the program; in your case, that's the output of wget.
New contributor
edited Jun 18 at 19:58
Eliah Kagan
85.4k22 gold badges239 silver badges380 bronze badges
85.4k22 gold badges239 silver badges380 bronze badges
New contributor
answered Jun 18 at 7:07
Marcus MüllerMarcus Müller
2211 silver badge5 bronze badges
2211 silver badge5 bronze badges
New contributor
New contributor
6
Is it really a filename, though?
– Eric Duminil
Jun 18 at 17:01
7
@EricDuminil It's a filename in the sense that programs accept it in some places where they would otherwise only accept filenames, but you're right that it's not really about an actual name of a file in some directory.
– JoL
Jun 18 at 17:55
5
@EricDuminil: In particular, for programs that follow this convention, you have to use./-
if you actually want to open a file named-
.
– Jörg W Mittag
Jun 18 at 20:05
4
@EricDuminil In fact: yes! It names a file; in the unix sense,stdin
is a file descriptor, and-
is the name you supply to use that. It's not a file name from the OS's perspective, though. Only from the user perspective.
– Marcus Müller
Jun 19 at 6:15
3
@rexkogitans no./dev/stdin
is just a convenience file name offered by some kernel facility. There's usually nofopen("/dev/stdin", "r")
happening anywhere when you write a program that chooses to use stdin; you just go ahead and use theextern FILE* stdin
that your libc header provided you with; by the way, that is the integer file descriptor0
.
– Marcus Müller
Jun 19 at 6:46
|
show 5 more comments
6
Is it really a filename, though?
– Eric Duminil
Jun 18 at 17:01
7
@EricDuminil It's a filename in the sense that programs accept it in some places where they would otherwise only accept filenames, but you're right that it's not really about an actual name of a file in some directory.
– JoL
Jun 18 at 17:55
5
@EricDuminil: In particular, for programs that follow this convention, you have to use./-
if you actually want to open a file named-
.
– Jörg W Mittag
Jun 18 at 20:05
4
@EricDuminil In fact: yes! It names a file; in the unix sense,stdin
is a file descriptor, and-
is the name you supply to use that. It's not a file name from the OS's perspective, though. Only from the user perspective.
– Marcus Müller
Jun 19 at 6:15
3
@rexkogitans no./dev/stdin
is just a convenience file name offered by some kernel facility. There's usually nofopen("/dev/stdin", "r")
happening anywhere when you write a program that chooses to use stdin; you just go ahead and use theextern FILE* stdin
that your libc header provided you with; by the way, that is the integer file descriptor0
.
– Marcus Müller
Jun 19 at 6:46
6
6
Is it really a filename, though?
– Eric Duminil
Jun 18 at 17:01
Is it really a filename, though?
– Eric Duminil
Jun 18 at 17:01
7
7
@EricDuminil It's a filename in the sense that programs accept it in some places where they would otherwise only accept filenames, but you're right that it's not really about an actual name of a file in some directory.
– JoL
Jun 18 at 17:55
@EricDuminil It's a filename in the sense that programs accept it in some places where they would otherwise only accept filenames, but you're right that it's not really about an actual name of a file in some directory.
– JoL
Jun 18 at 17:55
5
5
@EricDuminil: In particular, for programs that follow this convention, you have to use
./-
if you actually want to open a file named -
.– Jörg W Mittag
Jun 18 at 20:05
@EricDuminil: In particular, for programs that follow this convention, you have to use
./-
if you actually want to open a file named -
.– Jörg W Mittag
Jun 18 at 20:05
4
4
@EricDuminil In fact: yes! It names a file; in the unix sense,
stdin
is a file descriptor, and -
is the name you supply to use that. It's not a file name from the OS's perspective, though. Only from the user perspective.– Marcus Müller
Jun 19 at 6:15
@EricDuminil In fact: yes! It names a file; in the unix sense,
stdin
is a file descriptor, and -
is the name you supply to use that. It's not a file name from the OS's perspective, though. Only from the user perspective.– Marcus Müller
Jun 19 at 6:15
3
3
@rexkogitans no.
/dev/stdin
is just a convenience file name offered by some kernel facility. There's usually no fopen("/dev/stdin", "r")
happening anywhere when you write a program that chooses to use stdin; you just go ahead and use the extern FILE* stdin
that your libc header provided you with; by the way, that is the integer file descriptor 0
.– Marcus Müller
Jun 19 at 6:46
@rexkogitans no.
/dev/stdin
is just a convenience file name offered by some kernel facility. There's usually no fopen("/dev/stdin", "r")
happening anywhere when you write a program that chooses to use stdin; you just go ahead and use the extern FILE* stdin
that your libc header provided you with; by the way, that is the integer file descriptor 0
.– Marcus Müller
Jun 19 at 6:46
|
show 5 more comments
The -
argument to tar
specifies that the archive should be read from stdin
instead of a file. From the GNU tar manual:
If you use
-
as an archive-name,tar
reads the archive from standard input (when listing or extracting files)
Other commands have the same behavior, and it is specified by the POSIX.1-2017 standard:
Guideline 13:
For utilities that use operands to represent files to be opened for either reading or writing, the '
-
' operand should be used to mean
only standard input (or standard output when it is clear from context
that an output file is being specified) or a file named-
.
New contributor
add a comment |
The -
argument to tar
specifies that the archive should be read from stdin
instead of a file. From the GNU tar manual:
If you use
-
as an archive-name,tar
reads the archive from standard input (when listing or extracting files)
Other commands have the same behavior, and it is specified by the POSIX.1-2017 standard:
Guideline 13:
For utilities that use operands to represent files to be opened for either reading or writing, the '
-
' operand should be used to mean
only standard input (or standard output when it is clear from context
that an output file is being specified) or a file named-
.
New contributor
add a comment |
The -
argument to tar
specifies that the archive should be read from stdin
instead of a file. From the GNU tar manual:
If you use
-
as an archive-name,tar
reads the archive from standard input (when listing or extracting files)
Other commands have the same behavior, and it is specified by the POSIX.1-2017 standard:
Guideline 13:
For utilities that use operands to represent files to be opened for either reading or writing, the '
-
' operand should be used to mean
only standard input (or standard output when it is clear from context
that an output file is being specified) or a file named-
.
New contributor
The -
argument to tar
specifies that the archive should be read from stdin
instead of a file. From the GNU tar manual:
If you use
-
as an archive-name,tar
reads the archive from standard input (when listing or extracting files)
Other commands have the same behavior, and it is specified by the POSIX.1-2017 standard:
Guideline 13:
For utilities that use operands to represent files to be opened for either reading or writing, the '
-
' operand should be used to mean
only standard input (or standard output when it is clear from context
that an output file is being specified) or a file named-
.
New contributor
New contributor
answered Jun 18 at 22:01
TimTim
1512 bronze badges
1512 bronze badges
New contributor
New contributor
add a comment |
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%2f1151909%2fwhat-does-the-hyphen-mean-in-tar-xzf%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
9
A bit of pedantry: the option you're asking about is
f -
. This might make finding the answer in the man pages a little easier.– studog
Jun 18 at 19:01
4
It would be really helpful if you could explain what, precisely is unclear to you about the documentation of
wget
andtar
. That way, the respective developers can improve their documentation so that future users don't stumble over the same problems again. In other words: be a hero and make the world a better place!– Jörg W Mittag
Jun 18 at 20:07
2
It would be a nice default for tar to use stdin, but since it’s heritage is to work with tapes it did not do that. Instead it learned how to work with files (with the f option) and then follows the convention to have a - in place of the filename for stdin (In case of eXtract or stdout in case of Create)
– eckes
Jun 19 at 1:44
1
@eckes In the case of GNU tar, stdin is the default unless
$TAPE
is set.– chrylis
Jun 20 at 6:17