Issue
Examples:
Create an ISO image and burn it directly to a CD.
mkisofs -V Photos -r /home/vivek/photos | cdrecord -v dev=/dev/dvdrw -
Change to the previous directory.
cd -
Listen on port 12345 and untar data sent to it.
nc -l -p 12345 | tar xvzf -
What is the purpose of the dash and how do I use it?
Solution
If you mean the naked -
at the end of the tar
command, that's common on many commands that want to use a file.
It allows you to specify standard input or output rather than an actual file name.
That's the case for your first and third example. For example, the cdrecord
command is taking standard input (the ISO image stream produced by mkisofs
) and writing it directly to /dev/dvdrw
.
With the cd
command, every time you change directory, it stores the directory you came from. If you do cd
with the special -
"directory name", it uses that remembered directory instead of a real one. You can easily switch between two directories quite quickly by using that.
Other commands may treat -
as a different special value.
Answered By - paxdiablo Answer Checked By - Mildred Charles (WPSolving Admin)