cashaw
Posts: 71
Joined: Tue Mar 06, 2012 8:32 pm

"Screen" is very useful on the Pi !

Mon Jun 11, 2012 12:10 pm

I am not sure if this has been mentioned before on this forum, but I always find 'Screen' is extremely useful for Linux boxes such as the Raspberry PI.

'Screen' is downloaded from the repositories with the command line -

sudo apt-get install screen

It allows you to create many terminal tty instances which can be connected to or disconnected from whenever or where-ever you want. So for example, you may want to download some large files or torrents which will take hours but don't want to leave your laptop connected to an SSH session whilst the download completes, you can use the 'screen' command to start a new terminal session then disconnect from it, close down your laptop and re-connect to the same session at a later time or from any other computer.

It's as simple as typing -

[email protected]:~$ screen bash
- to start a new screen session

To detach from a screen session press ctrl+a release and then d
To close and shutdown completely a screen session press ctrl+d

You can have multiple screen sessions running and see them all with 'screen -list' and then just re-attach to them with screen -r

I find it useful as I often kick something off first thing in the morning on my laptop at home, I can then come into work and monitor the session on my work laptop.

Hope someone finds this useful, I find it indispensable !

JeremyF
Posts: 515
Joined: Wed Jan 25, 2012 9:06 pm
Contact: Website

Re: "Screen" is very useful on the Pi !

Mon Jun 11, 2012 1:08 pm

The Raspberry Pi already has 6 virtual consoles accessible by Ctrl-Alt-(Console#)
{sig} Setup: Original version Raspberry Pi (B, rev1, 256MB), Dell 2001FP monitor (1600x1200), 8GB Class 4 SD Card with Raspbian and XBMC, DD-WRT wireless bridge

Joe Schmoe
Posts: 4277
Joined: Sun Jan 15, 2012 1:11 pm

Re: "Screen" is very useful on the Pi !

Mon Jun 11, 2012 1:14 pm

JeremyF wrote:The Raspberry Pi already has 6 virtual consoles accessible by Ctrl-Alt-(Console#)
Could I have "Totally Missing the Point" for $600, Alex?
And some folks need to stop being fanboys and see the forest behind the trees.

(One of the best lines I've seen on this board lately)

cashaw
Posts: 71
Joined: Tue Mar 06, 2012 8:32 pm

Re: "Screen" is very useful on the Pi !

Mon Jun 11, 2012 1:16 pm

Of course, but they are not accessible via SSH as I understand, I run my Pi headless.

User avatar
SN
Posts: 1012
Joined: Mon Feb 13, 2012 8:06 pm
Location: Romiley, UK
Contact: Website

Re: "Screen" is very useful on the Pi !

Mon Jun 11, 2012 1:29 pm

screen is one of those little Unix gems that I've known about for 20 years or more
although the ability to run multiple sessions on one terminal/screen/xterm whatever is not so useful in these GUI days (once upon a time i green screen land it was a godsend) what is really cool is that you can detach/attache screen sessions

What this means is you start a session on the GUI - start up screen, do what you need to do, then detach
Then you can log in remotely from anywhere on an ssh session and pick up the previous screen session from where you left it
And the screen session will survive an ssh or network drop out too - just log back in and reattach

Indeed I THINK you can share sessions too
Steve N – binatone mk4->intellivision->zx81->spectrum->cbm64->cpc6128->520stfm->pc->raspi ?

cashaw
Posts: 71
Joined: Tue Mar 06, 2012 8:32 pm

Re: "Screen" is very useful on the Pi !

Mon Jun 11, 2012 1:44 pm

I've used it for many years, but was surprised when speaking to an "experienced" Linux developer* this morning that he had never heard of it. So I thought I would mention it here.

* - It's always good that even though I may be getting long in the tooth, I can still surprise even the brightest young developer with gems of wisdom !

User avatar
alexeames
Forum Moderator
Forum Moderator
Posts: 2810
Joined: Sat Mar 03, 2012 11:57 am
Location: UK
Contact: Website

Re: "Screen" is very useful on the Pi !

Mon Jun 11, 2012 3:54 pm

cashaw wrote: It allows you to create many terminal tty instances which can be connected to or disconnected from whenever or where-ever you want. So for example, you may want to download some large files or torrents which will take hours but don't want to leave your laptop connected to an SSH session whilst the download completes, you can use the 'screen' command to start a new terminal session then disconnect from it, close down your laptop and re-connect to the same session at a later time or from any other computer.
This looks really useful thank you. I got stuck the other day when I ran a compile by ssh that took 3.5 hours (twice as long as I expected) and I had to leave my laptop on. I'm going to give this a go. :D

Update: awesome - took me nearly 2 whole minutes to get this working and tested. Superb tip thanks :ugeek:
Alex Eames RasPi.TV, RasP.iO

User avatar
damaru
Posts: 39
Joined: Fri May 11, 2012 2:11 am
Location: Canada
Contact: Website

Re: "Screen" is very useful on the Pi !

Mon Jun 11, 2012 4:17 pm

the best thing is to have a bashrc that connects you automatically. I don't have it here but I crafted a small script that re-attach your screen automatically. But I use my pi headless with keyboard (to make it even more complexe) so I use the multiuser function of screen ;) anyhow will post the whole experiment in a bit since it's even more complex and fun !

JeremyF
Posts: 515
Joined: Wed Jan 25, 2012 9:06 pm
Contact: Website

Re: "Screen" is very useful on the Pi !

Mon Jun 11, 2012 4:54 pm

cashaw wrote:Of course, but they are not accessible via SSH as I understand, I run my Pi headless.
Ah yes, sorry about that. In which case, yes. Screen is useful.
{sig} Setup: Original version Raspberry Pi (B, rev1, 256MB), Dell 2001FP monitor (1600x1200), 8GB Class 4 SD Card with Raspbian and XBMC, DD-WRT wireless bridge

Joe Schmoe
Posts: 4277
Joined: Sun Jan 15, 2012 1:11 pm

Re: "Screen" is very useful on the Pi !

Mon Jun 11, 2012 5:15 pm

JeremyF wrote:
cashaw wrote:Of course, but they are not accessible via SSH as I understand, I run my Pi headless.
Ah yes, sorry about that. In which case, yes. Screen is useful.
I still say you've totally missed the point.

There are lots of advantages to screen, even in a GUI (headed, xterm, whatever terminology you favor) environment.
And some folks need to stop being fanboys and see the forest behind the trees.

(One of the best lines I've seen on this board lately)

kasperl
Posts: 90
Joined: Fri Jan 06, 2012 6:20 pm

Re: "Screen" is very useful on the Pi !

Tue Jun 12, 2012 9:59 am

In addition to screen, when running with multiple SSH sessions, molly-guard can be a real livesaver. (aptitude install molly-guard). It asks you the name of the box you're trying to shutdown/reboot over SSH before shutting down the box at home instead of the local computer because you picked the wrong terminal.

obarthelemy
Posts: 1399
Joined: Tue Aug 09, 2011 10:53 pm

Re: "Screen" is very useful on the Pi !

Tue Jun 12, 2012 9:22 pm

After spending quite some time on screen, I've been told tmux is where it's at now ?

jamesh
Raspberry Pi Engineer & Forum Moderator
Raspberry Pi Engineer & Forum Moderator
Posts: 20512
Joined: Sat Jul 30, 2011 7:41 pm

Re: "Screen" is very useful on the Pi !

Tue Jun 12, 2012 9:40 pm

I use a thing called terminator in Ubuntu - handy for multi pane command line stuff - think it might be a bit like tmux - not sure it works on the Pi though. Just tried screen - like it.
Principal Software Engineer at Raspberry Pi (Trading) Ltd.
Please direct all questions to the forum, I do not do support via PM.

User avatar
damaru
Posts: 39
Joined: Fri May 11, 2012 2:11 am
Location: Canada
Contact: Website

Re: "Screen" is very useful on the Pi !

Tue Jun 12, 2012 10:12 pm

obarthelemy wrote:After spending quite some time on screen, I've been told tmux is where it's at now ?
Both are quite different, if you want multiwindow with mouse support with tab and more of a 'graphical' feel to it, tmux would be the choice. Screen seems stronger at multiuser and sessions attach detach, and a little less 'visually' oriented.. Two different beast, I found tmux easier to learn at first then switched to screen later on...

User avatar
alexeames
Forum Moderator
Forum Moderator
Posts: 2810
Joined: Sat Mar 03, 2012 11:57 am
Location: UK
Contact: Website

Re: "Screen" is very useful on the Pi !

Fri Jun 15, 2012 6:43 pm

I'm so pleased with SCREEN that I've made a blog post about it, mainly for beginners, complete with video installation and usage instructions. With a link back to this thread of course, as this is where i heard about it. :D Thanks cashaw.

http://raspi.tv/2012/using-screen-with- ... sions-open

Let me know if I've messed anything up in the explanations. :?
Alex Eames RasPi.TV, RasP.iO

pcouture
Posts: 4
Joined: Sat Jun 07, 2014 3:29 am

Re: "Screen" is very useful on the Pi !

Sun Jun 08, 2014 12:24 am

Have you ever been caught with a screen inside a screen inside a screen? It's like inception :-)

component
Posts: 53
Joined: Thu Aug 29, 2013 3:49 pm

Re: "Screen" is very useful on the Pi !

Sat Oct 31, 2015 11:41 am

I have been using Screen for ages and cant live without it and ssh to see what is going on...

I have a python pi project that I would like to run headless when the Pi starts (its a camera...). Within the program is a load of useful information that I display on the terminal which I would like to keep a track of.

What I would like to do is have an autostart sequence for the pi which starts an instance of "screen", then starts my python program so that later if I need to I can ssh in and see what is going on. Any ideas?

SonOfAMotherlessGoat
Posts: 690
Joined: Tue Jun 16, 2015 6:01 am

Re: "Screen" is very useful on the Pi !

Sat Oct 31, 2015 2:08 pm

Screen and Tmux are both good. Try BYOBU though, it's a front end to screen and tmux. http://byobu.co/
Account Inactive

component
Posts: 53
Joined: Thu Aug 29, 2013 3:49 pm

Re: "Screen" is very useful on the Pi !

Sat Oct 31, 2015 6:44 pm

Thanks, Ill do that.

Also found

https://coderwall.com/p/quflrg/run-a-sc ... spberry-pi

Which does what I want

Return to “Beginners”

Who is online

Users browsing this forum: ImagineZA and 32 guests