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.
teecommand 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:46catdoes read from standard input, andsshdoes 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 512asks 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:48catreads 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 suspectmbufferis failing (or not even installed), so ssh has nothing to pass tocat. Maybe trymbufferon a smaller local file without using the remote system yet. – Paul_Pedant Dec 14 '21 at 22:49teethere if the data is going to just one place (it's calledteesince it acts like a T-shape connection). Doing something liketee filename > /dev/nullwould work, but the writes to stdout would be useless... – ilkkachu Dec 14 '21 at 22:50mbuffer...? – ilkkachu Dec 14 '21 at 22:52foo | bar | blahworks so that the output offoogoes to the input ofbar, and the output ofbargoes to the input ofblah, it seems rather reasonable that ifbarfails 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 answerread the comments, and you'll see that the answer you copied verbatim causes errors :p – Bravo Dec 15 '21 at 07:01