Since I use the *nix command screen
all day, and I couldn't find anyone starting this question, I figured it should be started. You know the drill: community wiki, one answer per features so we all can vote.
Since I use the *nix command screen
all day, and I couldn't find anyone starting this question, I figured it should be started. You know the drill: community wiki, one answer per features so we all can vote.
I love using it for connecting to serial consoles, i.e.
This command simply opens up a connection to serial port 0 (ttyS0) with a baud speed of 19200
The best feature of
screen
is Byobu (formerly screen-profiles) which comes with Ubuntu by default since Jaunty: https://launchpad.net/byobuIt's a configuration manager with very nice defaults, tons of status notifications and useful keyboard shortcuts (i.e. f2 for new screen, f3-f4 for prev/next etc.)
I really don't go anywhere without it anymore :)
From KTamas's amswer: More than one person can use the same screen, i.e. if a friend of yours
ssh
into your computer, then he can connect to your screen. It's great when two or three people are working on the same projects.Not exactly a "hidden feature"; but a properly setup .screenrc file can make a world of difference. One of the better examples out there can be found by googling screenrc and 'brad sims' - he has an excellent file to tinker with.
that said, my favourite setting would be bindkey:
I can't remember who I stole this from (someone on dotfile.org). I've modified it slightly for ssh:
Then I set the following bash aliases:
It opens a new screen for the above aliases and iff using ssh, it renames the screen title with the ssh hostname.
Cheers z0mbix
One thing I find useful is that screen can emulate a larger width than your terminal. I find this useful if I'm using
less
to real log files, and I don't want the lines to wrap. Using:Ctrl-A:
width -w 999
I can set
screen
's with to be wider than my terminal, and log lines inless
won't wrap.The ability to change the control key with -ethat when starting screen. I use it so I can nest screen sessions inside each other. Example: "screen -e ^w^x" makes the control key ctr-w.
One nice feature: you can use
backtick
to pull in extra info for display in a caption. For example, I have a script that output a one-line summary of new mail counts in various folders, and I have that appear in the bottom line if my screen session along with the hostname with a config that looks like this:The key is the %1` bit, which refers to the output of backtick job 1.
(I use
hardstatus
as the xterm title string and have it set differently, thus the use ofcaption
instead ofhardstatus alwayslastline
.)Not a "hidden" feature, but the ability to share a screen session with another active user is very useful.
There are complicated ways to set up screen sharing, including access control permissions and user name management. What I most often do with coworkers is much more quick & dirty:
chmod 777 $(tty)
sudo su <username>
screen -x <session>
This doesn't require any advance configuration or password sharing.
A little cheat sheet I have printed out for myself;
(Note: Everything is preceeded by Ctrl-A)
And
screen -D -R
to deattach and reattach a running session (in case you somehow lose access to your session).None of these are really hidden features, but these are the features I find to be the most useful.