Site-wide Tags:  Linux(17) | CommandLine(12) | Ubuntu(10) | RemoteAccess(7) | Tools(7) | Vim(7) | LiftWeb(5) | SBT(5) | SoftwareDev(5) | Mac(5) | Scripts(4) | WebDev(4) | Diagrams(4) | Lifty(3) | NetworkDrives(3) | Processwire(3) | Security(3) | Fog(3) | VCS(3) | BestPractices(3) | RaspberryPi(2) | WebDesign(2) | Encryption(2) | Windows(2) | SSH(2) | WinCommandPrompt(2) | GitHubRepos(2) | Emacs(2) | PHP(2) | IDE(2) | ErrorMsgs(2) | JVM(2) | Hardware(2) | Bash(2) | Networks(2) | Graphviz(2) | Cloning | Cygwin | Graphics | Java | SystemRecovery | lessc | Maven | Python | PXE | Samba | LXDE | PackageManagement | LifeHacks | LESS |

This site has been archived and will no longer be updated.
You can find my new homepage at neilpahl.com.

Screen: Use It To Begin A Command Remotely And Then Logout

Tags:  Linux   RemoteAccess   CommandLine   
Created on Tue, 17 Jan 2012.
Last Modified on Thu, 05 Apr 2012.

Motivation Behind This Cheatsheet

Sometimes you want to start a download, update, or what have you. Instead of keeping your terminal (remote connection) open, you can start the process using screen, detach, and then exit/logout.

The Cheatsheet

This cheatsheet is for running a command under screen so that you won't have to stay logged in, or worry about your dodgey connection with your remote host.

just run

screen command_you_want

then, when the screen ui opens, you can press C-a d. (Again, thats hold down cntrl and press a, then d while still holding control). You will then recieve a message saying that your process/job is detached.

run

screen -r

to re-attach. or

screen -r process_id_number

to list all the screen pid's:

screen -list

Further Discussion

This is just a quick and dirty on how to use screen to start and detach a process. Screen is normally used in a situation where the connection is unstable. It will create a process which looks much like the normal bash shell (with a few control differences) and keep that screen process running even when the user session ends.

ie, if you ssh into your *nix box, begin your updates with screen, and then logout. The updates will continue until they are finished, even if you are no longer logged in.

for more details, use:

man screen

or better yet, check out the source for a more in depth screen tutorial.



PLEASE let me know if I'm doing something wrong, or if you have any suggestions or requests~

blog comments powered by Disqus