<?xml version="1.0" encoding="ISO-8859-1"?>
<!DOCTYPE artikkel PUBLIC "-//infoweb.ntnu.no//DTD Infoweb 1.0 //NO" "http://infoweb.ntnu.no/infoweb.dtd">
<artikkel spraak="en">
<tittel>Running programs even if you're logged off</tittel>
<forfatter>livermor</forfatter>
<sammendrag>You can let programs run on *nix-terminals even though you're logged out.</sammendrag>
<hoveddel>
<avsnitt>
When logging off, programs will normally be closed. There are several ways to avoid this, you can use <kursiv>nohup</kursiv> or <kursiv>screen</kursiv> on NTNU's servers.
</avsnitt>
<os2>nohup</os2>
<avsnitt>
nohup is simple and easy to understand. With the command <kommando>nohup use_command</kommando> <tegn symbol="#38"/>, where use_command indicates which command you want to leave running even when you're logged out, you can start working. It's the <tegn symbol="#38"/>-sign which denotes 'working in background' that allows you to log off. For more information, type <kommando>man nohup</kommando> in any terminal.
</avsnitt>
<os2>screen</os2>
<avsnitt>
screen is more advanced and has a world of possibilities. It opens virtual windows (screens) where you can do whatever you want. You can have different things running on different screens and switch between them easily.
</avsnitt>
<avsnitt>
If you decide to use screen, you might want to give your screens different names so it is easier to navigate between them. To start a screen named 'irc' use the command <kommando>screen -R irc</kommando>. You will now be in the new screen and you can start everything normally there. To 'detach' the screen, press <trykk>Ctrl+a+d</trykk>. For more information on which commands you can give to the screen, press <trykk>Ctrl+a+?</trykk>. The Ctrl-part will be denoted with <tegn symbol="#94"/>.
</avsnitt>
<avsnitt>
To open your screen again, write <kommando>screen -r irc </kommando>. If you want to, you can list all screens with <kommando>screen -ls</kommando>.

<kode>
There are screens on:
        1175.pts-75.james       (Detached)
        5217.pts-75.james       (Detached)
Type "screen [-d] -r [pid.]tty.host" to resume one of them.
</kode>

For more information on how to use screen, type <kommando>man screen</kommando>.
</avsnitt>
</hoveddel>
</artikkel>
