Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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 need to create a script in Linux to get from server multiple files. After downloading files started need to close the session but without stopping the download.

How do I do this?

share|improve this question

migrated from Jan 5 '12 at 2:19

This question came from our site for professional and enthusiast programmers.

You can not download files without a session. You could do as aix suggests below but that just transfers the session to a different non-interface session it still needs an ftp connection (session). – Bueller Jan 4 '12 at 18:12

If what you mean is to continue downloading files in the background after you exit your login session what you need is nohup.

For example:

$ nohup download-script &
$ exit

counting on that you created download-script containing your commands.

share|improve this answer

You can use the screen command to create a "screen" session on your machine. Screen is a full-screen window manager that multiplexes a physical terminal between several processes (typically interactive shells). Screens can be detached while leaving the background processes running, and then later re-attached if you wish. This allows you to close a terminal window or close a session without losing your processes. This is especially useful if you need to leave something running for a long period of time or have a temperamental connection to your server.

Run man screen to see how to use it. (hint: It's painfully simple)

Alternatively, if you simply need to run a process or script in the background, but don't want to keep a "session" open, consider using:

progname [arguments] &

Any command terminated with & will execute in the background. Of course this implies that your program doesn't require user intervention.

share|improve this answer
You could also install and try tmux, another terminal multiplexer. It's very similar, but I prefer tmux to screen. – Rob Jan 5 '12 at 20:23

Your Answer


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