Command Line Apps screen
Screen is a program that creates a "session" in which several "windows" exist. There is a shell prompt in each window, from which commands can be executed and programs can be run. With screen, a user can "detach" from his or her screen session, log out in order to do something useful, let someone else log in and do their work then log out, log back in, and reattach to the screen session and find it in the same condition as it was left. antiX comes with screen installed and a basic ~/.screenrc file.
Open a terminal to start screen:
You should be immediately returned to a shell prompt. You're now inside of your screen. You can see this by typing screen -list
antiX@9[~]$ screen -ls There is a screen on: 3203.pts-0.antiX1 (Attached) 1 Socket in /var/run/screen/S-antiX.
Type raggle in that terminal, you will see it is running inside screen.
There are certain keystrokes that you can make inside of a screen session to control it. The commands are usually in the format of Ctrl-a,letter. This is executed by pressing the control key and the 'a' key at the same time, releasing both, and then pressing a letter. Press ctrl-a,d to detach from screen (Press ctrl-a, release, press d). When this is done, you should see something like "[detached]" in your terminal. If you see this, you're no longer in screen, but raggle is still running in the background. You can exit the terminal and raggle is still operating.
Since you have already created a screen session, you do not want to make a new one, you want to reattach to the one you already created. To do this, type:
Like magic, raggle should have reappeared. You can leave raggle running all the time under screen, detach from screen and disconnect from your shell, come back later, login and reattach and raggle will be there.
How to create new windows inside screen.
This is done by typing C-a c (this is how it is written in the screen manpage. It means Ctrl-a,c). As new windows are created, you will be automatically switched to them. You can navigate through screen windows using C-a #, starting at zero, so Ctrl-a,0 should take you back to raggle. Here's a cheat sheet (from the screen manpage):
The following table shows the default key bindings:
C-a 0 (select 0) ... ... C-a 9 (select 9) C-a C-a (other) Toggle to the window displayed previously. C-a a (meta) Send the command character (C-a) to window. See escape command. C-a A (title) Allow the user to enter a name for the current window. C-a c (screen) Create a new window with a shell. C-a C (clear) Clear the screen. C-a d (detach) Detach screen from this terminal. C-a D D (pow_detach) Detach and logout. C-a k (kill) Destroy current window. C-a n (next) Switch to the next window. C-a p (previous) Switch to the previous window. C-a w (windows) Show a list of window. C-a ? (help) Show key bindings.
These commands basically operate screen, especially the last one. There are plenty more, use Ctrl-a,c and then type man screen for the full list.
Before you disconnect from your shell, make sure you detach from your screen using the appropriate detach sequence.
Troubleshooting: If you mess up and screen doesn't seem to work correctly, remember to use screen -list (or screen -ls) to see where you are. You should pay attention to whether or not you are attached, detached, or if screen is running at all.
If you end up with multiple screen sessions, you have to specify which session when you want to attach. If this is not desired, kill one of the sessions by first using screen -list to find the id of the session. The id will look something like 8037.tty1.antiX. With the id in hand, run:
screen -X -S ID kill
to kill the screen session with id ID.
Setting up several cli apps to run in screen
Copy the screenrc file from /usr/share/doc/screen to your /home/ directory and make it hidden by right clicking on it and renaming to '.screenrc' (Without the quotation marks.)
Add these lines to the end of your ~/.screenrc file:
screen -t irc irssi screen -t bash screen -t rss raggle screen -t browser links2 screen -t top top screen -t music ncmpc screen -t torrent rtorrent screen -t email mutt
The first entry after -t is the title you choose and the final one is the apps command name.
Open a terminal to start screen:
and all the apps will open. C-a n to toggle through.
NB: antiX comes with a basic screen set up that will open irssi (chat), newsbeuter (RSS), moc (audio), htop and a terminal.