Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Im using

tar zcf - stuff | ssh user@server 'cat > data.tar.gz'

Is there a way to split the file on transfer?

Something like this:

tar zcf - stuff | split -b 5G | ssh user@server 'cat > data-${part}.tar.gz'
share|improve this question
up vote 1 down vote accepted

Yes, the command is called split.

tar czf - stuff | split -b 5G -d -f 'ssh server "cat >$FILE"'

This option is new in Ubuntu 12.04. With previous versions, split can only split to files, not to commands. The files can be named pipes, but organizing the commands to read from the pipes is cumbersome.

Without split -f, an easier approach is to forget about using a command. Mount the remote filesystem with sshfs instead, so that you can write to it as if it was a local file.

mkdir ~/net/server
sshfs user@server ~/net/server
tar czf - stuff | (cd ~/net/server && split -b 5G -d)
fusermount -u ~/net/server

You might be interested in a proper backup software such as duplicity instead.

share|improve this answer
Thanks! This seems to work. And: sshfs is not installed on the server and I'm not the administrator... – Andreas Oct 29 '12 at 17:54
@Andreas If FUSE is available (specifically, the fuse package, which contains privileged components), you can install SSHFS manually. It's a lot more hassle than a simple package installation, of course, so if you aren't the admin it's only worth doing it if you do nontrivial manipulations of remote files often. – Gilles Oct 29 '12 at 18:10

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.