commandlinefu.com is the place to record those command-line gems that you return to again and again.
You can sign-in using OpenID credentials, or register a traditional username and password.
Subscribe to the feed for:
Create an image of "device" and send it to another machine through the network ("target" and "port" sets the ip and port the stream will be sent to), outputting a progress bar
On the machine that will receive, compress and store the file, use:
nc -l -p <port> | 7z a <filename> -si -m0=lzma2 -mx=9 -ms=on
Optionally, add the -v4g switch at the end of the line in order to split the file every 4 gigabytes (or set another size: accepted suffixes are k, m and g).
The file will be compressed using 7z format, lzma2 algorithm, with maximum compression level and solid file activated.
The compression stage will be executed on the machine which will store the image. It was planned this way because the processor on that machine was faster, and being on a gigabit network, transfering the uncompressed image wasn't much of a problem.
There are 3 alternatives - vote for the best!
If you can do better, submit your command here.
You must be signed in to comment.