Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have scp transfer (from one remote server to another), that is quite big.

So maybe I want close the computer from which I executed this command, will this end the transfer? I have ssh access to the shell using the program Bitwise.

share|improve this question

If you did not have the foresight to launch the process with nohup, you can also background the process and disown the bash session while it is running.

  1. Open ssh terminal to remote server
  2. Begin scp transfer as usual
  3. Background the scp process (Ctrl+Z, then bg)
  4. Disown the backgrounded process (disown)
  5. Terminate the session (exit) and the process will continue to run on the remote machine.

One disadvantage to this approach is that the file descriptors for stdout and stderr will still contain references to your ssh session's tty. The terminal may hang when you try to exit because of this. You can work around this by typing ~. to force close your ssh client (that escape sequence must follow a new line...see also ~?). If the process you are abandoning writes to stdout or stderr, the process may exit prematurely if the tty buffer overfills.

screen, cron, at, and nohup can also be used. There is more than one way to skin a cat!~~ The advantage of using disown is that you do not have to plan in advance. You can be halfway through the file transfer and decide, "oh bugger, I need to log out now", and you can just background it and disown.

The advantage of using Screen is that if the network drops out at any time, your session will remain active, but you must get into the habit of using Screen. Using a scheduler such as cron is the best solution if this is a periodic sort of task that you want to automate.

share|improve this answer
I didn’t know disown. Thank you. – erik Feb 21 '13 at 14:28

You could use nohup(1), i.e., do something like:

nohup scp alice@source:/the/answer/of/all bob@target.example.com:/var/tmp/42 &

This will create an output of nohup.out. Then you can safely logout.

share|improve this answer

Yes, it will be terminated. The solution to maintain terminal session alive without connectivity is the screen program:

SCREEN(1)                                                            SCREEN(1)

       screen - screen manager with VT100/ANSI terminal emulation

       screen [ -options ] [ cmd [ args ] ]
       screen -r [[pid.]tty[.host]]
       screen -r sessionowner/[[pid.]tty[.host]]

       Screen is a full-screen window manager that multiplexes a physical ter‐
       minal between several processes (typically interactive  shells).   Each
       virtual terminal provides the functions of a DEC VT100 terminal and, in
       addition, several control functions from the ISO 6429  (ECMA  48,  ANSI
       X3.64)  and ISO 2022 standards (e.g. insert/delete line and support for
       multiple character sets).  There is a  scrollback  history  buffer  for
       each virtual terminal and a copy-and-paste mechanism that allows moving
       text regions between windows.
share|improve this answer

As said above, you can use the screen command, for example:

  • Create screen

user@server:~$ screen -S bigscptransfer

  • You're now in the screen

ser@server:~$ scp bigfile.dat server2:.

  • Detach from the screen using CTRL+A then push D

[detached from 5899.bigscptransfer]

  • Resume session when you need it with:

user@server:~$ screen -r bigscptransfer

share|improve this answer

nohup scp shinto@source:/home/data roose@target.example.com:/var/tmp/file

stop temporarily the command with


put on background the command, type:


yo can check the process with:


share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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