-1

I was wondering if there is a way to execute a command to start a client in the background, with no output on the screen.

I want to run multiple clients in the background of my screen.

Thank you

2

1 Answer 1

3

Yes. Just add an ampersand (&) at the end of command.

You'll also be able to redirect standard output using > and standard error with 2>.

ex:

ls &                                 # will background the LS command (you'll have a ready prompt) but will show standard output and standard error
ls > /dev/null &                     # will do LS in background showing only standard error
ls > /dev/null 2>&1 &                # will execute the LS command discarding any output        
ls > ls_output.txt &                 # will background LS and store the output in ls_output.txt while error still on video
ls > ls_output.txt 2>ls_error.log &  # will put LS output in ls_output.txt and errors in ls_error.log
ls > ls_output_all.txt 2>&1 &        # will put both LS standard error and standard output to same output_all.txt
5
  • Thank you, that was where I was looking for :) works like a charm May 24, 2018 at 9:01
  • fixed (showing only standard error)
    – DDS
    May 24, 2018 at 9:02
  • edited again (I was missing redirection to /dev/null)
    – DDS
    May 24, 2018 at 9:15
  • @WesleySchravendijk Don't hesitate to mark this answer as "accepted" if it helps to solve your problem please! May 24, 2018 at 9:28
  • @DDS When answering a question that seems like it might have been answered before, please check that there are no duplicate questions on this site.
    – slhck
    May 24, 2018 at 9:56

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