# Bringing back the output of a process back to screen



## 123sam (Oct 30, 2018)

After a few days of searching I found this easy way to bring back the output of a process back to screen even if the source terminal is closed.
The advantage is that you do not need extra software to manage this.

1. Start the process, write it to a new pipe and send it to the background

f.e.: ping 8.8.8.8 > pipe1 &

In this example the pipe is written to "pipe1" in the actual directory.

2. Bring the output back to screen:

tail -f pipe1

The "&" flag at the end of the command ensures that the the process keeps running, even if the source terminal is closed.

I feel lucky about replies.

123sam


----------



## SirDice (Oct 30, 2018)

I suggest you look into script(1), screen(1) and tmux(1).


----------



## 123sam (Oct 30, 2018)

SirDice said:


> I suggest you look into script(1), screen(1) and tmux(1).



Thanks for the suggestion. As I am new to freebsd I didn't t see that so far.


----------



## SirDice (Oct 30, 2018)

I've used screen(1) for years (before tmux(1) existed),  it has saved my bacon more than once. Especially if you do "dangerous" things remotely, nothing will be worse than having everything cut off because of a dodgy SSH connection. With tools like screen(1) or tmux(1) you can simply pick up your session again when you reconnect. Also useful for starting long running scripts, start them from work, disconnected. Go home, dial in and pick up the session again.


----------



## 123sam (Oct 30, 2018)

SirDice said:


> I've used screen(1) for years (before tmux(1) existed),  it has saved my bacon more than once. Especially if you do "dangerous" things remotely, nothing will be worse than having everything cut off because of a dodgy SSH connection. With tools like screen(1) or tmux(1) you can simply pick up your session again when you reconnect. Also useful for starting long running scripts, start them from work, disconnected. Go home, dial in and pick up the session again.



You are right but as Installation of tmux and screen failed in an iocage jail, I looked for a "build-in" solution. 
And for my needs, which are absolutely amateur-like and innocent, this solution  is sufficient...and works on linux with the same comands.
Thanks for your reply.

123sam


----------



## SirDice (Oct 30, 2018)

The traditional way of keeping processes running after you get disconnected is nohup(1): `nohup some_long_running_script.sh`


----------



## 123sam (Oct 30, 2018)

SirDice said:


> The traditional way of keeping processes running after you get disconnected is nohup(1): `nohup some_long_running_script.sh`



For some strange reason the nohup command didn' t work either in the jail. There where no jobs bringing to the foreground.

But, maybe alongside others, there's the big disadvantage of the solution I named: As far as I figured out, you can't interact with the process :-(


----------

