1

This question already has an answer here:

I'm using tmux and cueing up a very large copy:

/bin/cp -aRv /mnt/src/folder/. /mnt/dest/folder/ 2>&1 | tee /log/big_copy_log

When I run without tee, I see output on the terminal just fine. With tee, nothing shows in the logfile or screen. What am I missing?

  • I don't mind stderr and stdout both going to the same log.
  • I want to do this logging so I can audit later if necessary (multiple TB sized copy)
  • The -a is because I'd like timestamps preserved, -R because there are multiple levels of folders to move, -v to log everything.
  • I wasn't planning to use rsync, since this is designed to be a one-way copy.
  • Using /bin/cp because cp is aliased.
  • Tailing . on the src because I need all subfolders copied to dest folder

marked as duplicate by Gilles, Anthon, Satō Katsura, Anthony Geoghegan, Archemar Apr 10 '17 at 11:14

This question has been asked before and already has an answer. If those answers do not fully address your question, please ask a new question.

  • 1
    Try 2>&1 instead of 2&>1. – pfnuesel Apr 7 '17 at 15:38
  • 3
    Oh wow, hang on, if you're copying multiple TB use rsync! – terdon Apr 7 '17 at 15:54
  • 1
    Nothing when? Right away, or after the command has run (enough to fill up a flush a buffer or to completion)? – thrig Apr 7 '17 at 16:03
  • 4
    "I wasn't planning to use rsync, since this is designed to be a one-way copy" -- This doesn't make sense. rsync is one way. And rsync has the ability to write to a log file natively, meaning no need to use tee. – Patrick Apr 7 '17 at 16:06
  • 4
    It is also faster, can compress while copying and is much, much better than cp at resuming unfinished transfers. The latter is particularly important when dealing with huge amounts of data. Basically, it is designed to solve all the issues you are asking about. Use it! – terdon Apr 7 '17 at 16:13

Browse other questions tagged or ask your own question.