Follow Techotopia on Twitter

On-line Guides
All Guides
eBook Store
iOS / Android
Linux for Beginners
Office Productivity
Linux Installation
Linux Security
Linux Utilities
Linux Virtualization
Linux Kernel
System/Network Admin
Programming
Scripting Languages
Development Tools
Web Development
GUI Toolkits/Desktop
Databases
Mail Systems
openSolaris
Eclipse Documentation
Techotopia.com
Virtuatopia.com
Answertopia.com

How To Guides
Virtualization
General System Admin
Linux Security
Linux Filesystems
Web Servers
Graphics & Desktop
PC Hardware
Windows
Problem Solutions
Privacy Policy

  




 

 

Writing to Standard Output

To write the extracted files to the standard output, instead of creating the files on the file system, use --to-stdout (-O) in conjunction with --extract (--get, -x). This option is useful if you are extracting files to send them through a pipe, and do not need to preserve them in the file system. If you extract multiple members, they appear on standard output concatenated, in the order they are found in the archive.

--to-stdout
-O
Writes files to the standard output. Use only in conjunction with --extract (--get, -x). When this option is used, instead of creating the files specified, tar writes the contents of the files extracted to its standard output. This may be useful if you are only extracting the files in order to send them through a pipe. This option is meaningless with --list (-t).

This can be useful, for example, if you have a tar archive containing a big file and don't want to store the file on disk before processing it. You can use a command like this:

     tar -xOzf foo.tgz bigfile | process

or even like this if you want to process the concatenation of the files:

     tar -xOzf foo.tgz bigfile1 bigfile2 | process

Hovewer, --to-command may be more convenient for use with multiple files. See the next section.

 
 
  Published under the terms of the GNU General Public License Design by Interspire