Excuse me if this sounds pretty noobie. I was just checking the man page for throttle about how does the pipeline work hand in hand for throttle. So while checking the manual page example, I stuck over '-' in the below command. In there manual page in the EXAMPLE section, the first example was as follows:

   To limit the bandwidth of a tar back-up to a remote server to 1 Mbit/s, type:

   $ tar czf - . | throttle -m 1 | ssh host 'tar xzf - -C /bak'

Now in here, I wanted to understand the '-' just after czf and '-' after xzf. If this doubt is clear, I would be comfortable to understand the whole command.

Thank you in Advance.


2 Answers 2


I'll break down the command into pieces and explain it piece by piece:

tar czf - .

This command tells tar to create an archive from current directory, and save the output to file indicated by -f argument. Here the file is -, which means standard output.

The | character takes standard output from left side command and passes it as standard input to the right side command.

In this case, the output of tar is passed as input to throttle -m 1, which then provides the output to last command:

ssh host 'tar xzf - -C /bak'

Output is piped via SSH to tar command running on host, using SSH as pipe transport. The xzf - argument means that tar reads from standard input and extracts the archive. Before extraction, tar changes to /bak directory.

As a summary, when creating archive, the -f - means that tar outputs the result to standard output (stdout).

When extracting archive, the -f - means that tar reads the input archive from standard input (stdin).


The relevant part to look at is really -f - (the - in your question is the parameter to the -f option, specifying the filename)

What this says is to read from/write to the file -, which is a common special case for filenames. - in this context commonly means stdin (when reading) or stdout when writing.

Ie, the first tar process writes an archive to stdout, which is then piped through throttle, and then piped to the second tar process which reads an archive from stdin.

Not the answer you're looking for? Browse other questions tagged .