neurotrigger

Tag: terminal

Auto-reattaching terminal multiplexor with tabs

by mmnicolas on Oct.21, 2009, under gnu/linux

Typically, from a single ssh connection comes a single shell, let’s improve this situation.

We will use a terminal multiplexor GNU Screen, which provide multiple terminals. We will also implement a neat tab bar to allow naming/showing tabs and automatic session re-attachment capability.

Follow these steps to significantly enhance your distant shell experience, you will need to install screen and ssh, mutt and irssi are optional.

The first step involves using environment variables in order to detect if the login is locally originating or not. If the user is logging from a distant machine, we will reattach an existing detached screen session or create a new one.

When logging in remotely, the most evident distinction i’ve found between a local and remote shell is the environment variable SSH_CONNECTION=, with this var we have a way of detecting remote logins easily and launch something else accordingly.

(continue reading…)

2 Comments :, , , , more...

Useful and nice looking shell with GNU Screen

by mmnicolas on Jul.28, 2009, under gnu/linux

This is how i got my linux shell looking so wonderful, using GNU Screen of course and its famous ~/.screenrc configuration file.

Let’s create it and paste this into it:

#hardstatus string ” %wb%-w%wr%n %t%-%+w %=%D %d %M %y %c”
#hardstatus string “%r%c%k | %w% ? (%h)% ?”
#hardstatus string “%{gk}[ %{G}%H %{g}][%= %{wk}%?%-Lw%?%{r}(%{W}%n*%f %t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B} %m/%d %{W}%c %{g}]“
hardstatus string ‘%{= c}[ %{W}%H %{c}][%= %{= w}%?%-Lw%?%{c}(%{W}%n*%f%t%?(%u)%?%{c})%{w}%?%+Lw%?%?%= %{c}][%{W} %d/%m %{W}%c %{c}]‘

bindkey -k F1 prev
bindkey -k F2 next

screen -t irssi 1 irssi -c irc.freenode.net
screen -t mutt 2 mutt
screen -t monitor 0 lwatch -i /dev/xconsole

hardstatus alwaysignore hardstatus alwayslastline

The whole aesthetic thing reside in the first uncommented line, this is where it sets what is displayed in the hardstatus line which is always the last line. You can find documentation about the variables that can be used to display different types of information in the screen man page. ($ man screen).

As for the bindkey, you’ve guessed they bind keys to go forward and backward in your terminal tabs, and yes F1 means F11, don’t ask me why. I use F11 and F12 because i intend to use F9 and F10 in irssi to move between windows.

1 Comment :, , , , more...

Looking for something?

Use the form below to search the site:

Visit my idols!

Those who gave us tools to play with...

    Archives

    All entries, chronologically...