screen
Remembering and using the forgotten screen for remote administration
A co-worker was overlooking my shoulder today while I was working (blasted.. I hate that) and he saw me going through several screens in one shell window and was wondering how I was doing it.
I told him I was just using screen. *silence* … yeah screen..
After another moment of awkward silence, I realize that most people have forgotten about screen. Why use screen when you can just have tons of shells? Why run screen if I can just use that cool 3D compiz thing and put them on different desktops.
Well kids.. (my birthday was on the 4th.. I turned an ancient 27 years old.. so I can address others as kids now), screen has many other functions then just letting me run something in a different window. Have you ever had to ssh to a server, do some functions.. then realized it’s time to hit the bar with your buddies? Well then, screen would have been your friend there. Instead of telling your friends “Hey, I gotta sit here at work and finish something up, because I can’t log off and break this”, you could say “Hey, wait up a minute, let me start this and packup and leave.” How you may wonder. Easy, with screen, here’s how:
ssh to the server needing something done (lets just say a zypper update for the simplicity of this).
Now type:
screen -S zypper
This will bring you to a new prompt.
Now type:
sudo zypper up -y
This will update all our packages saying yes to them
Now just press:
ctrl+a then d
You’ll see something that says [detached] and you’ll be thrown to your original prompt.
Now you could log off (log off you say.. you’re nuts.. I’m updating).. Well your screen session is detached and still running, you can log off and it will still be running.
So now you’re done with your binge drinking, sobered up (I do not recommend working on production servers drunk as a skunk) enough the next morning to log back onto the server and check it out. So you ssh back to the server, and you’re at your prompt… but now what?
Now you can list your sessions with:
screen -ls
(Note: or screen -list)
Now you’ll see something like so:
There is a screen on:
11679.zypper (Detached)
1 Socket in /var/run/uscreens/S-bkevan.
Awesome.. so it is still there (did you think I was lying to you?). But how do I get it back?
Simple, you just have to reattach. You can reattach by doing a:
screen -r zypper
(Note: I used zypper since that’s what I named it when I ran screen -S (-S allows you to name the session)).
(Note: You can also recover the screen using the PID at the beginning of the line from the screen -list output.. in this case 11679).
Once you reattach to the screen session you’ll see that it’s done and that you were still able to have a fun night with your friends.
Also note there are many more other functions of screen and I highly recommend checking them out with:
man screen
If you want to know more about it.. leave a comment, throw me an email.. do what ever.. just let me know.
Search
Powered by
Tags
10.3 11.0 11.1 apache bash beta bootchart codeweavers compiz drivers emerald emulation esx fat ass tomato man filesystems flash fonts gnome grub ibm kde kde4 kernel knoppix linux lotus notes lvm Microsoft nomad nvidia openoffice opensuse performance repositories review scripting security tech tutorial ubuntu user management VMWare windows wine workstationArchives
- December 2008
- November 2008
- October 2008
- September 2008
- August 2008
- July 2008
- June 2008
- May 2008
- April 2008
- February 2008
- January 2008
- November 2007
- October 2007
- September 2007
- August 2007
- July 2007
- June 2007
- May 2007
- April 2007
- February 2007
- January 2007
- December 2006
- November 2006
- October 2006
- September 2006
Ben Kevan's Blog
- Connecting to Linux via RDP using NOMAD on openSUSE 11.1
- Red Hat (RHT) Profits Soar, is Novell (NOVL) Next?
- Dropping KDE 3.5 for openSUSE 11.2 isn’t really a bad thing
- 5 Days on openSUSE 11.1 was an early X-Mas present
- Unexpected Downtime
- Amarok 2.0 Final Released - Shipping with openSUSE 11.1
- PCLinuxOS 2009 Beta 2 - Review, Thoughts and Screenshots
- Opera 10.0 Alpha 1 on openSUSE 11.1 - Review
- Ding Dong the Emeralds Back Compiz
- 11.1 Build Service Repositories being Built