Firefox 16, a treat for developers http://t.co/cnd27CzT
Saving session terminal states with screen command
Have you ever been using a terminal in Linux and mistakenly closed the terminal or found yourself disconnected from SSH right when you were working on something
important? You reopen the terminal and suddenly all your work has been lost or the script you were running stopped working half way through.
Screen is a Linux application which solves this problem by allowing you to save terminal session states each time you load a terminal using screen. Screen is a versatile application in that it allows you to run a virtually unlimited amount of terminal windows from a single terminal session. Each individual terminal screen you create using screen will store information in a buffer, so that you can scroll up and down the terminal history or copy and paste text between terminals.
At first it might be a bit difficult for you to wrap your head around this concept, but it’s actually quite simple. Let’s take a more detailed look below.
To find out if you have screen installed open up a terminal and type in any of the following commands:
rpm –q screen
screen –help
By default screen comes installed on most Linux distributions including Fedora, CentOS and Ubuntu.
To start a new screen session, the first thing you will need to do is just type in “screen”, once you hit enter, you probably wont notice much of a difference, but you have just created your first screen session. Below are a few commands which you can use to manage your screen sessions.
To check what sessions screen has running type in the following command:
Screen –ls
You will notice that the screen session that your currently using will display as (attached) and the sessions you have stored which you arnt used will be displayed as (detached).
To enter into screens management controls you will need to press ctrl+a followed by the correct key for the action you want to take. Below are a few of the main keys you will need to memorize in order to use screen.
c = New window
k = Destroy window. If there are no other windows open it will destroy the session.
n = Switch between windows.
[ = Scroll up terminal history using the arrow keys or page up, page down.
C = Clear window
d = Detach screen session and go back to the regular terminal
If at any point you get stuck or you’ve forgotten a key which you wanted to use, simply pressing ctrl + a and then pressing h will bring up a list of keys which are displayed below.
break ^B b
license ,
removebuf =
clear C
lockscreen ^X x
reset Z
colon :
log H
screen ^C c
copy ^[ [
login L
select ‘
detach ^D d
meta a
silence _
digraph ^V
monitor M
split S
displays *
next ^@ ^N sp n
suspend ^Z z
dumptermcap .
number N
time ^T t
fit F
only Q
title A
flow ^F f
other ^A
vbell ^G
focus ^I
pow_break B
version v
hardcopy h
pow_detach D
width W
help ?
prev ^H ^P p ^?
windows ^W w
history { }
quit
wrap ^R r
info i
readbuf <
writebuf >
kill K k
redisplay ^L l
xoff ^S s
lastmsg ^M m
remove X
xon ^Q q
Once you have a basic understanding of how screen works, try typing in a few commands or running a basic script and then close the terminal. To reopen it you simply type “screen –ls” to find your previous session name and “screen –r sessionname” to reattach the session. The script will still be running and none of the work has been lost.
{module user9-footer}
Like us on Facebook
This week Top Posts 
Top Things to do After Installing Ubuntu 13.04 ‘Raring Ringtail’ : Ubuntu 13.04 Raring Ringtail final is almost out. The final release it scheduled for release on Apri...0 comment(s) |
Howto: Upgrade to Ubuntu 13.04 Raring Ringtail from 12.04, 12,10 | Desktop & Server : Updated 05-04-2013: Ubuntu 13.04 Raring Ringtail will be released Soon, If you have ubuntu 12,10, 12...0 comment(s) |
Install lamp with 1 command in Ubuntu 12.10, 13.04 Raring Ringtail & LinuxMint13 : Updated: 10/09/2012 :LAMP (Linux, Apache, MySQL and PHP) is an open source Web development platform ...0 comment(s) |
Configure conky-Lua in Ubuntu (12.10 & 13.04 Raring Ringtail), Fedora, debian and LinuxMint | Howto Conky : Updated 05-04-2013: Conky is a free, light-weight system monitor for X, that displays any informatio...0 comment(s) |
Scan Your Home Network With Nmap : Who should read this article? Everyone who is interested in computer security and computer networkin...0 comment(s) |
Howto- Resolve nosound problem on Ubuntu 13.04 Raring Ringtail,12.10 and Older : Updated 05/04/2013 : One of the common issues facing Ubuntu users after installing or upgrading Ubun...0 comment(s) |
Recent Posts
- Secure File from Removal in Linux and Unix
- How to Install Nginx on FreeBSD 9.x
- Create a Launcher in Ubuntu Using Bash
- Scan Your Home Network With Nmap
- Steganography- Hide Your Files Inside An Image in Linux
- Unix/Linux File Recognition. Did You Know?
- Migrate from MySQL to MariaDB in FreeBSD
- Connect Your Android Galaxy Tablet to Ubuntu via USB
- ElementaryOS Beta 1 and 2 Comparison and Review
- Introduction to the Linux Command Line
Recent Comments



















Snake
| #
Wow, great. That’s what i’m waiting for too. I want to make DC with LDAP ( Active Directory alternative) and SAMBA on Ubuntu. :-)
Blawer
| #
Thanks!!!!!!!!!!!!!!!!!! you rules!!! all the other “help” in google are useless… yours was very helpful. Thanks again
piCool
| #
Great ! we have another another master trick :-)
Yilmaz Ulugtekin
| #
Just delete the space after the slash (/) it will work.
Pat L
| #
I tried it and it works with a regular zip file, but if you password-protect the .zip file it does NOT work.