I'm using the command:

mv -v -f sourceDir destDir

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

  • 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 '12 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 '12 at 17:13

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

| improve this answer | |
  • 1
    Just tried this. It works. – VenkatH Oct 31 '12 at 15:40


 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
| improve this answer | |
  • And how would he revert that? – VenkatH Oct 31 '12 at 15:37
  • Should be clear now :-) – user86064 Oct 31 '12 at 15:42
  • That's nice for logging the output of many commands. Upvoted! =) – VenkatH Oct 31 '12 at 15:47

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.