Reputation: 1801
I have a task that is continuously echoing info.
For example, if you do a git clone and you want to send that task to the background (by using ampersand)
git clone https://github.com/mrdoob/three.js.git &
then the git clone operation is constantly refreshing the screen with the new percentage of the git clone process, ie:
Receiving objects: 47% (22332/47018), 92.53 MiB | 480 KiB/s 1410/47018), 7.18 MiB | 185 KiB/s
Receiving objects: 53% (24937/47018), 99.40 MiB | 425 KiB/s 1410/47018), 7.18 MiB | 185 KiB/s
So I cannot continue doing other operations in the foreground, as these updates are preventing me to see what I am trying to write.
Can you tell me guys how to effectively send one verbose task like this to the background?
Thanks a lot!
Upvotes: 9
Views: 5655
Reputation: 1547
If you are specifically looking to put it in the background you can append an ampersand (&
) to the end of the command, or while it is running use ctrl+z
then the command 'bg'
to run it in the background.
To bring it back, use jobs
to list your jobs and then fg %{job #}
to bring it back.
Hope this helps and works in this unique situation
Upvotes: -1
Reputation: 4137
you could have the process write its output to a file (if you need to view it later) like this:
git clone https://github.com/mrdoob/three.js.git >output.txt &
or discard the output altogether like this:
git clone https://github.com/mrdoob/three.js.git >/dev/null &
edit:
you could also include any error messages sent to stderror in either of the above options by replacing the &
with 2>&1 &
Upvotes: 6
Reputation: 10172
redirect its standard output:
git clone https://github.com/mrdoob/three.js.git > /dev/null &
or use appropriate verbose options of the command (in this case git)
Upvotes: 1