So you're in the middle of working on something and you decide you need to do something else. You could just drop what you're doing and switch tasks, but this is a multi-user system, right? And you can log in as many times simultaneously as you want, right? So why should you have to do one thing at a time?
You don't. We can't all have multiple keyboards, mice, and monitors for one machine; chances are most of us don't want them. Clearly, hardware isn't the solution. That leaves software, and Linux steps up on this one, providing “virtual terminals”, or “VTs”.
By pressing Alt and a function key, you can switch between virtual terminals; each function key corresponds to one. Slackware has logins on 6 VTs by default. Alt+F2 will take you to the second one, Alt+F3 to the third, etc.
The rest of the function keys are reserved for X sessions. Each X session uses its own VT, beginning with the seventh (Alt+F7) and going up. When in X, the Alt+Function key combination is replaced with Ctrl+Alt+Function; so if you are in X and want to get back to a text login (without exiting your X session), Ctrl+Alt+F3 will take you to the third. (Alt+F7 will take you back, assuming you're using the first X session.)
But what about situations where there are no virtual terminals? What then? Fortunately, slackware includes a beautiful screen manager aptly named screen. screen is a terminal emulator that has virtual terminal like capabilities. Executing screen flashes a brief introduction, then dumps to a terminal. Unlike the standard virtual terminals, screen has its own commands. All screen commands are prefixed with a Crtl+A keystroke. For example, Ctrl+A+C will create a new terminal session. Ctrl+A+N will switch to the next terminal. Ctrl+A+P switches to the previous terminal.
screen also supports detaching and re-attaching to screen sessions which is particularly useful for remote sessions via ssh and telnet, (more on those later). Ctrl+A+D will detach from the currently running screen. Executing screen -r will list all currently running screen sessions you may reattach to.
% screen -r There are several suitable screens on: 1212.pts-1.redtail (Detached) 1195.pts-1.redtail (Detached) 1225.pts-1.redtail (Detached) 17146.pts-1.sanctuary (Dead ???) Remove dead screens with 'screen -wipe'. Type "screen [-d] -r [pid.]tty.host" to resume one of them. |
Running screen -r 1212 would reattach to the first screen listed. I mentioned earlier how useful this was for remote sessions. If I were to login to a remote slackware server via ssh, and my connection was severed by some chance occurrence such as a local power failure, whatever I was doing at that moment would instantly perish, which can be a horrible thing for your server. Using screen prevents this by detaching my session if my connection is dropped. Once my connection is restored, I can reattach to my screen session and resume right where I left off.