ProgrammingThis forum is for all programming questions.
The question does not have to be directly related to Linux and any language is fair game.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
I would really like to capture the output of scp and my file's progress. Scp updates the transfer rate every 1 second, and I will like to save the transfer rate at every update. So for example, if the file transfer takes 30 seconds, I would like 30 reports of the transfer rate.
The output looks like:
Code:
file.dat 1% 3664KB 938.5KB/s 05:48
Whenever I try a simple redirect like:
Code:
scp file.dat 192.168.1.100:~/ &> output
... it does not save the rate at every update, it only shows the final rate.
If I try using typescript by starting "script" ... it's the same deal.
scp uses the "isatty()" function call to see if its output goes someplace sane, and doesn't print anything if it's not a tty (frankly I'm surprised you get the final update).
scp uses the "isatty()" function call to see if its output goes someplace sane, and doesn't print anything if it's not a tty (frankly I'm surprised you get the final update).
This requires public key authentication to be working on localhost.
thanks a bunch for the suggestion! I have public key authentication working on the localhost. I am simply do "ssh localhost" and without entering a password, I will connected.
However, whenever I try this command I keep getting:
How are you viewing the file "output"? If you're using "cat" then it will output every character as they appear in the file, and scp uses the "carriage return" character to overwrite the last update with the new update, so you'll only see the last output. The file probably does include every update line.
Try using a pager like less, or something like this:
hmmmm we are getting somewhere! the file size is continually growing, replace \r doesn't seem to get me very far though. still only shows the final (or current rate)
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.