I was reading an answer regarding sending large files from one Linux system to another by quick methods, and I was trying this solution
The answer is saying that if you don't want to use the tar
command, you can use the cat
command instead [Like if you for example already have a tar file and you don't want to create another one, you can use the cat
command instead directly]
So I have this command that I want to execute:
sam@sam:~/Documents$ cat test.mp4 | mbuffer -s 1K -m 512 | ssh 192.168.1.33 "cat > ~/Documents/here/test.mp4"
What I am trying to do using the above command is to send a large file (test.mp4
) from the Linux machine (A) to the Linux machine (B). The file (test.mp4
) is available on the Linux machine (A) at ~/Documents
, what I want to do is to send this file from the Linux machine (A) to the Linux machine (B) on ~/Documents/here
However, running the above command does not send the file, but instead, the Linux machine (B) is creating a plain-text file called test.mp4.
So the problem is that the cat command needs a way to read the input from the previous command, Got it :D?
[Edit]: After running the command above, I always get the following warning message
mbuffer: fatal: Number of blocks must be at least 5.
tee
command instead of cat. But cat reads standard input by default if you have not given it anything, so your command should work – tbrugere Dec 14 '21 at 22:46cat
does read from standard input, andssh
does connect its stdin to that of the remote command, so yeah, the pipeline does work. What's wrong there is with the options tombuffer
,-s 1K -m 512
asks for 1 kB blocks for a total buffer of 512 bytes, which obviously doesn't work. You probably want-m 512k
, or-m 512M
, depending on what size buffer you'd like, though a block size of 1 kB also seems quite small. Of course you could also do withoutmbuffer
. – ilkkachu Dec 14 '21 at 22:48sam@sam:~/Documents$ cat test.mp4 | mbuffer -s 1K -m 512 | ssh 192.168.1.33 "tee > ~/Documents/here/test.mp4"
but it didn't make any change – Normal Dec 14 '21 at 22:48cat
reads stdin by default. You can give it the filename arg-
to represent stdin, but it makes no difference. How big is the outputtest.mp4
, and what does the start of the plain-text look like? I suspectmbuffer
is failing (or not even installed), so ssh has nothing to pass tocat
. Maybe trymbuffer
on a smaller local file without using the remote system yet. – Paul_Pedant Dec 14 '21 at 22:49tee
there if the data is going to just one place (it's calledtee
since it acts like a T-shape connection). Doing something liketee filename > /dev/null
would work, but the writes to stdout would be useless... – ilkkachu Dec 14 '21 at 22:50mbuffer
...? – ilkkachu Dec 14 '21 at 22:52foo | bar | blah
works so that the output offoo
goes to the input ofbar
, and the output ofbar
goes to the input ofblah
, it seems rather reasonable that ifbar
fails due do invalid options, the whole thing breaks down. – ilkkachu Dec 14 '21 at 22:54scp
? – glenn jackman Dec 15 '21 at 00:05provided in the answer
read the comments, and you'll see that the answer you copied verbatim causes errors :p – Bravo Dec 15 '21 at 07:01