Question: I have started a few processes in the past initiated via the `screen` command. Most of those scripts have already finished running, but looks like the screens are still sitting there idle. I can see them when I do a `ps aux | less` to see all processes. 

How can I see all the `screen`s and whether there is an active script running in them. 

Thanks

Answer: 
To see the current list of running screens:

```
screen -list

```

The first part of the screen's name is its PID. To see the tree of currently running processes spawned from that parent process, run:

```
pstree <PID>

```

or, for a more detailed output,

```
pstree -a <PID> | less

```

To reattach to a screen (and detach it if it's already attached elsewhere), run:

```
screen -rd <PID>

```

To kill a screen once you've established you no longer need it, you have a couple options. If you're currently attached to the screen, you can simply use `Ctrl` + `a`, `k`, which will kill the screen and all its windows.

Alternatively, if you're not attached to the session, you can use:

```
kill <PID>
screen -wipe <PID>

```

to kill it and remove it from the list of screens.
You can prevent `screen` from sitting idle after a script finishes by terminating the shell when the script completes:

```
script.sh; exit

```

Or, if you want to have a chance to look at error messages, you could run

```
script.sh && exit

```

That way, `screen` will only close if `script.sh` completed successfully.