10

I'm using the command:

mv -v -f sourceDir destDir

How can I output the verbose console out to a file?

2
  • Please make clear if the use case is 'shell scripting' or 'interactive shell usage'. For shell scripting the answer gt6989b applies. For interactive shell usage my answer applies.
    – user86064
    Oct 31, 2012 at 15:47
  • I used it for interactive mode, i wanted to move a large set of files from one disk that was falling to another which is new, and search after for failed copy attemps in order to know which files where not copied. in windows i know "xcopy source dest >>C:\files.txt " could do the job but windows could not read the file system correctly (NTFS !) and Linux Mint did ! Thanks for your answers will try them soon
    – firephil
    Nov 1, 2012 at 17:13

2 Answers 2

19

Try mv -v -f sourceDir destDir > out.file 2> err.file

1
  • 1
    Just tried this. It works.
    – VenkatH
    Oct 31, 2012 at 15:40
9

Invoke:

 exec > >(tee /tmp/logfile) 

All the output (to stdout) of your next commands will be duplicated to the logfile.
This will continue till you leave the shell.

If you want this only for some commands create a subshell with:

bash | tee /tmp/logfile
3
  • And how would he revert that?
    – VenkatH
    Oct 31, 2012 at 15:37
  • Should be clear now :-)
    – user86064
    Oct 31, 2012 at 15:42
  • That's nice for logging the output of many commands. Upvoted! =)
    – VenkatH
    Oct 31, 2012 at 15:47

You must log in to answer this question.

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