1

I'm scp'ing several large files to a few servers in succession. I'd like to see the progress (so I don't want to use scp --quiet), but I don't need to see the stats when the copy is complete.

Is there a tool that can receive input on stdin, echo it to stdout, and then remove it when the input stream closes? This reminds me of stuff ncurses can do, but I can't seem to find anything online that does this.

For instance, if such a utility were called echo-then-discard, I could call it as:

scp lots-*-of-files "$server:$dest" | echo-then-discard

It's possible such a tool, even if it existed, might not work with the kind of updating scp does -- since piping scp output seems to just discard the progress (likely because ncurses needs direct access to the terminal to do the fancy updating).

7
  • 1
    I would just run your big scp in a new terminal window so you can come back to check on it whenever you want and can also leave it whenever you want.
    – Yetti99
    Dec 4, 2021 at 16:22
  • 2
    Have you considered using rsync instead, with it's --progress and --stats options?
    – Kusalananda
    Dec 4, 2021 at 17:06
  • @they rsync is pretty sweet and has definitely made the overall process faster, so thanks for the tip :-) (leaving the question open because I'm still interested to know if a generic tool exists.) Dec 4, 2021 at 18:31
  • @SeanAllred, Are you using a text mode screen or a graphical desktop environment? And do you want to keep previous terminal dialogue, or would it be OK to simply clear the screen (or terminal window)?
    – sudodus
    Dec 4, 2021 at 21:40
  • 1
    @sudodus I'd like to keep previous dialogue (otherwise I would use something like clear). I'm usually using a terminal emulator from a graphical environment. Dec 4, 2021 at 21:55

1 Answer 1

0

Graphical desktop environment

A simple method is to use less in a terminal emulator window, simply redirect the output from the program,

program-name | less

for exmaple if you want to preserve colours,

ls -l --color ~/* | less -r

and and when you exit from less (with 'q'), the previous dialogue is there.

Text mode screen

Many newer text mode screens do not preserve the previous dialogue, but you can install and use screen.

screen
# run some programs here

screen
# run the program from which you want temporary output saved here
exit

and you are back in the 'first screen' and its dialogue.

screen is an advanced program, and I know only some rudimentary features of it, but I tested that it works like this.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .