Results 1 to 5 of 5
So I started copying a large amount of data from the command line via a ssh terminal. Since the command is tied to the controlling terminal, I assume that if ...
Enjoy an ad free experience by logging in. Not a member yet? Register.
- 02-15-2007 #1Just Joined!
- Join Date
- Feb 2007
- Posts
- 4
Launching process with no controlling terminal
So I started copying a large amount of data from the command line via a ssh terminal. Since the command is tied to the controlling terminal, I assume that if the connection is lost that the command will die with the connection. So, I was wondering if there's a way with jobs like these - that are bound to take a while - to launch the process with my user as the process owner but with no controlling terminal. Also, if that is possible, is there a way to change the controlling terminal of a process to no controlling terminal while the process is running? Thanks in advance for your help.
- 02-15-2007 #2
You'd be best off looking at something called screen. Screen is a program that you run and allows you to "detatch" the terminal from the current shell, do whatever you want, then reconnect to it. For something like what you want, what you would do is this:
ssh into the remote computer
run screen with the command: "screen"
this will appear to open a new terminal on the remote computer.
Set the copy running
press "Ctrl+a" then "d". This will "detatch the session and take you back to the plain ssh terminal
You can then log out of the remote computer freeing up the network from this connection. Then at any point you want to check the copy ssh back in then run "screen -r" and it'll reconnect to the screen session you setup. Once you dont need the session any more, just exit the screen session with the "exit" command like any other shell.
The advantage to screen over detatching the process from a terminal (if this is possible) is that you can see all the output from the command, meaning that if the cp failed for some reason, you're not left assuming it's worked then find it hasn't, you can see the exact reason it failed.
HTH"I am not an alcoholic, alcoholics go to meetings"
Registered Linux user = #372327
- 02-15-2007 #3Just Joined!
- Join Date
- Feb 2007
- Posts
- 4
That's a handy little command, thanks for the help!
- 02-15-2007 #4
also you can use such construction:
$ nohup <command> &
all output will be written to nohup.out in current directory and executing of <command> is not interrupting when you log out or your ssh connection is timed out. To controling of output in real time useful construction is:
tail -n 30 nohup.out
it means that will be printed last 30 strings of nohup.out
or even u can use following:
watch -n 1 tail -n 30 nohup.out
it means same, but it will be printed out automaticaly every 1 sec.
and do not forget to delete a lot of different outs in different dirs=)
UPD: but it seems that screen utility is better solution
- 02-16-2007 #5Just Joined!
- Join Date
- Feb 2007
- Posts
- 4
Both suggestions have been quite helpful, thanks!


Reply With Quote
