Unable to hide a running process in terminal

Unable to hide a running process in terminal

裸钻 发布于 2021-11-24 字数 760 浏览 726 回复 3 原文

I yesterday upgraded by MacPorts' apps which took apparently about 4 hours.
It was irritating to see the installation process going on in one tab in terminal.

Problem: to hide a running process in terminalsuch that it does not take space in my working area

I found today that there a new command coproc in Bash 4:

coprocess is executed asynchronously
in a subshell, as if the command
established between the executing shell and the coprocess

I am not sure whether you can use it to solve the problem or not. I did not manage to use it.

How can you hide the running process such that it is not visible in terminal but it continues to run?

如果你对这篇文章有疑问,欢迎到本站 社区 发帖提问或使用手Q扫描下方二维码加群参与讨论,获取更多帮助。



需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。


这样的小城市 2022-06-07 3 楼

There is at least one thing the other repliers have not covered: how to manage hiding processes.

Suppose you have 100 background processes created with "nohup find / &". You want to quit them to really see how the background processes work. Please, use the command:

ps -ej | awk '! /grep/ && /find/ {print $2}' | xargs kill -9

Then, you may want to know how to control the keys to hide processes. You can change it to p, where susp stands for CTRL+z (^Z):

stty susp p

You can see the keys here:

stty -a

Please, compare the stdouts before and after the change. The command is particularly useful because it helps to remember other commands, such as ^W (to remove a word).

Jerome had an excellent tip about screen. I highly recommend to pursue the direction:


时间你老了 2022-06-07 2 楼

I suspect you are looking for nohup

nohup LongRunningNoisyProgram &

will run the program, log the output to a file so you don't see it, push the program into the background, and won't cancel the program if you exit your terminal later while it is still running.

厌味 2022-06-07 1 楼

Did you consider Ctrl + Z to put the process in pause, then bg to run this one in background?

To detach your process from the terminal, you can then type disown. You can now close the terminal, and even your session.

The problem here is that the outputs will appear anyway in the bash.

You can also start your program in screen. This command provide an easy way to start a program, close the console and retrieve it later.