GNU Screen - A Hacker's Ideal Terminal
ibm.com
ibm.com
Either way, if you use Unix, learn to use screen or tmux. They're tremendouslyuseful. (Also: Noisy wireless connections are the new flaky dialup, when it comes to resuming shell sessions.)
OpenBSD man page: http://www.openbsd.org/cgi-bin/man.cgi?query=tmux
Sorry, I felt a little old there for a second.
Basically short for 'radical' and a replacement for 'awesome' or 'cool.'
Grab a process that you forgot to start inside neercs
Great screensaver
Real time thumbnails of your shells
Special effects when closing a window
Various window layouts...screen device baud
ex:
screen /dev/tty.usbserial-FTDPZOEJ 115200
Very useful for embedded system hackers and others who still need to speak RS-232.
source /home/mcantor/.screenrc
chdir $SANDBOX/src
screen 0:svn
screen 1:lib
screen 2:nosetests
stuff "activate_environment\015"
screen 3:ipython
stuff "activate_environment\015ipython\015"
screen 4:
select 0
I use stuff because it's the most straightforward way to send commands with carriage returns (015 in octal) to a window.I make this even more effortless by using a special alias in my .bashrc:
alias scd='screen -c /home/mcantor/.screenrc-dev'
I also use a few other aliases to support common uses: alias scr='screen -rd'
alias scx='screen -x'
alias lsc='screen -list'
Also, don't forget the very useful -S switch: screen -S someproject
Or, you can use Ctrl-a :sessionname, if you're already within a session, to rename it. That way, screen -list and screen -r can use your sessionnames, and you don't have to parse or remember the process ID's.There is no reason why you shouldn't use screen when ssh'ing in and working on remote machines, it will save you tons of time in case the connection goes down, plus allows your to keep a persistent working environment on remote boxes.
ssh -t user@host screen -rx
That will drop you immediately to a running screen on connect screen -d -R
logout
On the rare occasions that I don't want to run under screen, I run `ssh -t user@host bash`.Perhaps the terminal support issue could be worked out with better termcap etc. settings, but I haven't found the answers. I asked questions here:
http://superuser.com/questions/23144/how-to-make-screen-term...
... but no luck.
Try entering Copy Mode ('C-a ['). Once in Copy Mode you can page up and down without any modifiers. Just hit ']' to exit Copy Mode. You can also use the up and down arrows in Copy Mode. It's mostly meant for selecting regions of text to yank, but I find it's the easiest way to access the scrollback buffer.
To be clear, C-a ESC puts me in a mode where I can then freely page through the scrollback buffer with PgUp and PgDn, but the problem is that's 4 key presses required for something that only needs 2 in a normal terminal, and Ctrl (with A), Esc, and PgUp are about as far apart as you can get on a keyboard, which doesn't make for efficiency.
I personally don't find that to be an annoyance, though. Especially not when stacked up against all of the other benefits you get from using screen.
The other advantage of "rich" support is mousewheel combined with selection: with Cygwin rxvt, I can scroll up, begin a selection with the mouse, and scroll down with the mouse wheel and thereby copy multiple pages of scrollback buffer into the Windows clipboard, ready for e.g. paste in to blog article.
The advantage of keyboard-free casual scrollback when I'm writing such articles, checking what I did earlier, is something you learn to take for granted, and is quite obviously missing with screen.
I have once again found minor enlightenment and am already more productive because of it. Its nice when procrastinating on HN turns into a net win!
It's also great if you want to run something big - say a job that would take 5 hours. I'm free to do whatever I want without fear that killing my ssh session will also kill the job.
The monitor function can also notify you when there's activity or 30 sec. silence in a window, too. :)
In screen I use ^a, " to get a list of screens, then j/k to pick a screen. That may not seem like a win, but it keeps my fingers on the home keys, and feels smoother.
That and the fact that I split windows in screen fairly often means I won't go back to terminal tabs...
1) It's obvious why you'd want this for remote sessions, and I want a consistent feel whether I'm sshing into remote machines or just on my local machine.
2) I like to allocate a different screen session for each project. I can use the Terminal.app tabs to differentiate between these and between remote sessions on other machines. I could technically use multiple Terminal.app windows instead, but meh.
One thing I've found to be annoying: I can't get gnuplot to work from within a screen window (using the default AquaTerm output).
In your .screenrc file:
escape ^Ww
This will default C-w as the command character.edit: You could maybe try C-9 or use a symbol. I was only thinking in letters.
escape ^^^
Ctrl+Shift 6
But no, seriously, screen is one of the more useful programs I've ever used. I have a screen session running on a server somewhere, and just log into it from whatever terminal I happen to be using at the time. It's pretty much the best.
whereas you'd have thought it would be just escape `
escape `~
and reserve `` for switching to the most recently used window. (It looks like I didn't need to specify that explicitly.)A screen within a screen gets ctrl-v, just because it seems mostly unused and is next to z on a dvorak keyboard :)
(And no, I don't ever nest them any deeper).
Ctrl+T is the menu access character in aptitude, is there any convention around that?
% screen -e^]]
Then Ctrl-] is my escape.
If you want something that isn't GNU or GPL'd, take a look at `tmux`.
Some people would rather support the BSD license instead.
Other people just don't care at all.
You can send ^a to a window in screen by typing "^a a" - I do this everyday using emacs inside of screen. It becomes second nature.
See http://renesd.blogspot.com/2009/09/screen-for-ghetto-servers... for more pointers.
[Edited for clarity]
# Set up my status line at the bottom of every frame
caption always "%{gb} %{ck}%m-%d %C %{gb} %{gb}%?%-Lw%?%{ck}%n*%f %t%?(%u)%?%{gb}%?%+Lw%?"
I use tmux now, though. (it has a statusbar similar to the above by default)