I want to run some command in the background, but at the same time I want to see the output to make sure it is working well.

I'm using this to do some action using wp-cli and save the output.

  • Do you mean redirecting / piping the output to a file?
    – NoExpert
    Jan 28 at 0:08
  • 2
    To just see the output of the command while it runs in the background on your current terminal run end it with '&' on the shell. Generally all the shell output still goes to the console that invoked it. and usually you have to redirect stdout and stderr for that NOT to happen.
    – davolfman
    Jan 28 at 0:24
  • Is this specific to wp-cli or is this only about stdout/stderr? Jan 28 at 14:21
  • @NoExpert yes i habe a command with no problem just i want to save the output in the text file
    – Eman Dev
    Jan 28 at 18:16
  • @JannPoppinga no it's not just about wp-cli.
    – Eman Dev
    Jan 29 at 12:27

1 Answer 1


If I understand you correctly, "i want to save the output in the text file" and "I want to see the output" then the answer here will help.

"The tee command copies standard input to standard output and also to any files given as arguments. This is useful when you want not only to send some data down a pipe, but also to save a copy."

You can also read more here:

To use gustafbstrom's simple example:
program [arguments...] 2>&1 | tee outfile

So, you can see the output of your command on screen and at the same time save it in a file.

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.