You are not logged in.

#1 2009-11-06 05:30:04

yvonney
Member
Registered: 2008-06-11
Posts: 671

Anyone loving Tmux in place of Screen? Info/Tips etc. URLs I've found

NOTE: lotta cool improvements/changes in version 1.1 and now 1.2, and also HEAD (tmux-git in AUR i think)
Probably best to read the changelog and go to the IRC #tmux etc. if any key command weirdness.

I have switched to tmux from screen. It was a revelation. (for me that is)
Tips and interesting tmux pages are of interest though all's good enough lately. :-)

Consider that I was never expert at all with screen and had a few real issues with ncurses/cli programs. Screen's great of course. I was told about tmux from a cool dev.

Now wth tmux I have just learned a few commands for spliting (it splits by default), and moving around the panes in a window, and also set ctrl-b to be ctrl-a for now. tmux and zsh .... yeah!

down the page here [POST #14] is: a little "commands that are cool" - in a white box about 12 posts down.
They got me running without any doubt.

I'm so amazed and happy about tmux. New version came out today!

NOTE: these links are from some while ago and they may be less relevant or changed.
There's now TONS of great tutorials out there. best wishes! 12.2010

http://niallohiggins.com/2009/06/04/tmu … nu-screen/

http://tmux.cvs.sourceforge.net/viewvc/ … x/tmux/FAQ

http://www.wikivs.com/wiki/Screen_vs_tmux


http://www.toastdriven.com/fresh/scripting-tmux/

http://codefast.blogspot.com/2009/09/op … acker.html

http://todd.fries.net/pub/tmux.conf

[down the page]
http://www.openbsd.org/faq/faq7.html

http://wisconsinlinux.org/tmux-manpage- … tmux.1.txt

[really clear - yet probably missing 1.1 stuff]
http://www.linuxcertif.com/man/1/tmux/

[version 1.1]
http://tmux.cvs.sourceforge.net/viewvc/ … ux/CHANGES

http://chtekk.longitekk.com/index.php?/ … -tmux.html


[found and added after 20091212]
[potentially great power-starter post - config is great]
http://fedoratux.blogspot.com/2009/11/m … creen.html

Last edited by yvonney (2010-12-02 07:28:39)

Offline

#2 2009-11-06 07:17:36

xd-0
Member
From: Sweden
Registered: 2007-11-02
Posts: 327
Website

Re: Anyone loving Tmux in place of Screen? Info/Tips etc. URLs I've found

I've tried tmux only for one hour or less, but I liked the default status bar alot.

Offline

#3 2009-11-06 08:26:05

makimaki
Member
From: Ireland
Registered: 2009-04-02
Posts: 109

Re: Anyone loving Tmux in place of Screen? Info/Tips etc. URLs I've found

I have to say I'm liking it too.
Thanks yvonney.


====* -- Joke
    O
    \|/ --- Me
    / \             Whooooosh

Offline

#4 2009-11-06 13:04:20

Lich
Member
Registered: 2009-09-13
Posts: 437

Re: Anyone loving Tmux in place of Screen? Info/Tips etc. URLs I've found

I use tmux at work, screen at home. Will switch to tmux soon enough, I have the same bindings I have in screen anyway. It does handle "gfx" better, plus it already has nice splitting. AND it's in active development, which is a plus.


Archlinux | ratpoison + evilwm | urxvtc | tmux

Offline

#5 2009-11-07 11:01:20

jarav
Member
Registered: 2008-09-04
Posts: 63

Re: Anyone loving Tmux in place of Screen? Info/Tips etc. URLs I've found

Just got to know about tmux. While using tmux with vim, the background color comes only behind the text and not on the entire screen. How do I set this right?

Offline

#6 2009-11-07 11:18:17

yvonney
Member
Registered: 2008-06-11
Posts: 671

Re: Anyone loving Tmux in place of Screen? Info/Tips etc. URLs I've found

more detail needed I'd guess. your wm or de? how you start tmux, urxvt, xterm? running dotfiles in home folder or system version in /etc. stuff like that...

It will likely for sure be a guru here that can help, things are falling into place and working for me though I've had luck this time and not because I'm experienced. I am guessing that you have not set you term properly. Maybe someone can say if it's your .bashrc / .Xdefaults etc.

Very best wishes and tell us more about what you use if you wish. Someone will be brilliantly helpful I bet/hope.

Offline

#7 2009-11-07 13:21:27

jarav
Member
Registered: 2008-09-04
Posts: 63

Re: Anyone loving Tmux in place of Screen? Info/Tips etc. URLs I've found

Hi,
I have started it from the gnome terminal. I am using Gnome. It is not a 256 color problem because I get all the colors in the text. The problem is that the background color occurs just behind the text and not on the entire screen. i don't have this problem with either the gnome terminal or Terminator.

Offline

#8 2009-11-07 14:23:51

steve___
Member
Registered: 2008-02-24
Posts: 452

Re: Anyone loving Tmux in place of Screen? Info/Tips etc. URLs I've found

I don't use tmux, but I read the man page as it seems interesting.  Have you set the 'mode-bg' setting?  There are other background settings which you might want to specify as well.  Here is the man page I was reading: http://www.linuxcertif.com/man/1/tmux/

Last edited by steve___ (2009-11-07 14:24:30)

Offline

#9 2009-11-07 20:10:04

jarav
Member
Registered: 2008-09-04
Posts: 63

Re: Anyone loving Tmux in place of Screen? Info/Tips etc. URLs I've found

Ok.  I must admit that for someone like me who has not used Screen this thing is a bit weird.  May be I should get familiar with screen first.

Offline

#10 2009-11-07 21:26:11

steve___
Member
Registered: 2008-02-24
Posts: 452

Re: Anyone loving Tmux in place of Screen? Info/Tips etc. URLs I've found

Just curious, dId that work?

What aren't you understanding?

Last edited by steve___ (2009-11-07 21:26:36)

Offline

#11 2009-11-07 22:27:20

Nezmer
Member
Registered: 2008-10-24
Posts: 559
Website

Re: Anyone loving Tmux in place of Screen? Info/Tips etc. URLs I've found

Looks interesting ... Too lazy to make the switch .

The default keys are way different comparing to screen . It's not just C-a . Different concepts are present which means customizing keys is not enough to feel screen-home . Finally , there is the feel of maturity and dependability you get when you use screen that is lacking with tmux .

I might eventually make the switch If I had the time . I would probably bind the keys in a way that matches my custom Awesome keybinds .


English is not my native language .

Offline

#12 2009-11-07 23:45:34

yvonney
Member
Registered: 2008-06-11
Posts: 671

Re: Anyone loving Tmux in place of Screen? Info/Tips etc. URLs I've found

@Nezmer
I just switched the ctrl-b to ctrl-a and everything else was just cool. I mean very cool for what I had, or hadn't been doing with screen. A screen power-user would think other than I do perhaps/likely. Looks like tmux is catching on. The whole fresh code aspect.  I spend tons of time discovering what will work for me now and in the future. Like, it takes just as long to learn the wrong stuff.  hehehe
links up top got me running.
===
@jarav

http://tmux.sourceforge.net/
[the screenshots are cool]

noted in 1.1 release notes:
* The -d command line flag is now gone (can be replaced by terminal-overrides).
  Just use op/AX to detect default colours.


past day:
it's been bugging me that I can't quite recall, exactly what things I've excitedly discovered/tried/implimented when tweaking/fixing my own minimalist system. (ie. no desktop environment (DE) stuff at all as you'd likely know of course)

um, I know I had to create a   (dot)     .bash_profile         in my home directory.
And for some reason I put this in there.

if [ -f ~/.bashrc ]; then . ~/.bashrc; fi

[though maybe that was so i could get zsh happier as i use zsh inside tmux)

if you do a google search of the exact line code above you'll see tmux mentioned a fair bit in the initial google lines for each link, I believe.

For myself as well I'm enjoying puzzling again the flow of files that work together.
.xinitrc  .Xdefaults .bashrc  .bash_profile .vimrc . zshrc
And the window managers I enjoy and their conf or rc files which I think point to what run in them somewhat.

I can't think of where I'd still be if I hadn't become way better because of having and solving so many problems. Better than taking course I'd say. :-)

um, the thing I find most time goes to, is finding out what's best to use as there often many different overlapping programs and then the methods.

I came to enjoying as much command-line as possible, ncurses stuff. yep, the above is not anything other than my recollections on my path to now.

best wishes to all.

version 1.1 - just out
http://tmux.cvs.sourceforge.net/viewvc/ … ux/CHANGES

* The -d command line flag is now gone (can be replaced by terminal-overrides).
  Just use op/AX to detect default colours.

Last edited by yvonney (2009-11-08 20:20:46)

Offline

#13 2009-11-08 06:52:45

jarav
Member
Registered: 2008-09-04
Posts: 63

Re: Anyone loving Tmux in place of Screen? Info/Tips etc. URLs I've found

@steve:
Well. I put a
set-window-option -g mode-bg 0

in .tmux.conf. That didn't resolve the issue. I don't understand how to invoke the tmux commands in an open tmux session. Are they invoked with a Ctrl-b followed by a '.' ?

Offline

#14 2009-11-08 17:43:05

yvonney
Member
Registered: 2008-06-11
Posts: 671

Re: Anyone loving Tmux in place of Screen? Info/Tips etc. URLs I've found

This is currently my (dot)   .tmux.conf      in home directory.
commands that are cool

set -g prefix C-a
unbind C-b
bind C-a send-prefix

I love tmux cause what I do is this: (with the above .tmux.conf running C-a is the modifier key, so it's ctrl-a.)

C-a  then on the right kybd side   shift-"     splits screen
C-a  then on the left kybd side     shift-%    splits other way

C-a  (let go) then letter o (for ostrich)    goes/cycles around the 'panes'
C-a  (hold them)  then hit letter o swaps the other panes INTO the pane you're now in

C-a (let go) then hit the arrow repeatedly during ALT-right arrow (times out quickly by default)    
                 and the pane will resize in that direction.  All the arrow directions work.

C-a then x  will then prompt you if you want to kill the pane. (y/n)

Most things get info/updated in bottom left corner of tmux window. It tells me where I am etc.

There a bunch of others, like start tmux with a session name, and detach and attach.
All the above is just done in one window. 
You can of course create more windows and have panes in them as well.
And switch between them.

I think someone who knows how to use a man page way better than me,
and understands what they want and need to do can really fly.
I put up a couple more links up top that I enjoyed.

Last edited by yvonney (2009-11-17 23:42:09)

Offline

#15 2009-11-09 04:22:25

moljac024
Member
From: Serbia
Registered: 2008-01-29
Posts: 2,676

Re: Anyone loving Tmux in place of Screen? Info/Tips etc. URLs I've found

I like it smile


The day Microsoft makes a product that doesn't suck, is the day they make a vacuum cleaner.
--------------------------------------------------------------------------------------------------------------
But if they tell you that I've lost my mind, maybe it's not gone just a little hard to find...

Offline

#16 2009-11-09 04:42:18

yvonney
Member
Registered: 2008-06-11
Posts: 671

Re: Anyone loving Tmux in place of Screen? Info/Tips etc. URLs I've found

[edit]
So yes, tmux just feels right for many it appears. I figure linux/bsd really benefit from tmux and it's so so fresh! Late night Sunday ramble. One thing I just started using is when I kill/shut/detach tmux any way I type 'tmux a' and it's all there attached again. Standard proceedure though there's more to it that I'm still figuring out, obviously.

There's ways to start tmux as a named session and then it's even more important to be aware of any detached session as it lets you know if you just try to run simply 'tmux' again. Can't explain it much just yet.

Last edited by yvonney (2009-11-09 07:45:18)

Offline

#17 2009-11-12 07:57:14

Barrucadu
Member
From: York, England
Registered: 2008-03-30
Posts: 1,158
Website

Re: Anyone loving Tmux in place of Screen? Info/Tips etc. URLs I've found

tmux looks nice, I'm still working on getting it configured to my liking, and I wish I new how to reload the configuration without restarting the server, but it's nice smile

Offline

#18 2009-11-17 18:09:40

tzervo
Member
From: Athens
Registered: 2009-04-03
Posts: 86

Re: Anyone loving Tmux in place of Screen? Info/Tips etc. URLs I've found

I also use screen, I tried tmux and so far I like it. I couldn't find something that handles nested tmux'es (for example ssh aaaa@bbbb tmux from within tmux), all keybindings break for the nested session, in screen you did C-a C-a d for example to detach only the inside screen. Did I miss something or is this impossible?

Offline

#19 2009-11-17 19:09:10

thayer
Fellow
From: Vancouver, BC
Registered: 2007-05-20
Posts: 1,560
Website

Re: Anyone loving Tmux in place of Screen? Info/Tips etc. URLs I've found

tzervo wrote:

I also use screen, I tried tmux and so far I like it. I couldn't find something that handles nested tmux'es (for example ssh aaaa@bbbb tmux from within tmux), all keybindings break for the nested session, in screen you did C-a C-a d for example to detach only the inside screen. Did I miss something or is this impossible?

# set prefix key to ctrl+a until I have time to adapt
unbind C-b
set -g prefix C-a
# send the prefix to client inside window (ala nested sessions)
bind-key a send-prefix

thayer williams ~ cinderwick.ca

Offline

#20 2009-11-17 19:57:46

yvonney
Member
Registered: 2008-06-11
Posts: 671

Re: Anyone loving Tmux in place of Screen? Info/Tips etc. URLs I've found

if you go on

irc.freenode.net #tmux

you'll get the definitive right away I believe. The author and gurus are mostly always there if I'm not mistaken.  1.1 released a week or so ago. I enjoyed trying to understand some of the cool changelog. Glad I'm slowly enjoyably gaining skill with programs I know I can really get into.

Last edited by yvonney (2009-12-06 07:17:06)

Offline

#21 2009-11-17 20:42:58

piffey
Member
From: Sioux Falls, SD
Registered: 2009-10-07
Posts: 54

Re: Anyone loving Tmux in place of Screen? Info/Tips etc. URLs I've found

Just swapped to tmux. I'm glad you made this thread. I've never heard of it and am really glad I now know of its existence. Bye bye gnuscreen.

Offline

#22 2009-11-17 21:40:38

tzervo
Member
From: Athens
Registered: 2009-04-03
Posts: 86

Re: Anyone loving Tmux in place of Screen? Info/Tips etc. URLs I've found

Thayer, it worked. Thanks a lot!! This will help me switch!! :-)

Offline

#23 2009-12-04 03:14:49

Bolts
Member
From: Moorhead, MN
Registered: 2009-05-09
Posts: 39
Website

Re: Anyone loving Tmux in place of Screen? Info/Tips etc. URLs I've found

Here's a script I found that will auto away irrsi:

use Irssi;
use strict;
use FileHandle;

use vars qw($VERSION %IRSSI);

$VERSION = "0.9.7.1+tmux";
%IRSSI = (
    authors     => 'Nick Moffitt <nick@zork.net>',
    name        => 'tmux_away',
    description => 'set (un)away, if tmux is attached/detached (based on screen_away by Andreas \'ads\' Scherbaum <ads@ufp.de>)',
    license     => 'GPL v2',
    url         => 'none',
);

# usage:
#
# put this script into your autorun directory and/or load it with
#  /SCRIPT LOAD <name>
#
# there are 5 settings available:
#
# /set tmux_away_active ON/OFF/TOGGLE
# /set tmux_away_repeat <integer>
# /set tmux_away_message <string>
# /set tmux_away_window <string>
# /set tmux_away_nick <string>
#
# active means, that you will be only set away/unaway, if this
#   flag is set, default is ON
# repeat is the number of seconds, after the script will check the
#   tmux status again, default is 5 seconds
# message is the away message sent to the server, default: not here ...
# window is a window number or name, if set, the script will switch
#   to this window, if it sets you away, default is '1'
# nick is the new nick, if the script goes away
#   will only be used it not empty
#
# normal you should be able to rename the script to something other
# than 'tmux_away' (as example, if you dont like the name) by simple
# changing the 'name' parameter in the %IRSSI hash at the top of this script


# variables
my $timer_name = undef;
my $away_status = 0;
my %old_nicks = ();
my %away = ();

# Register formats
Irssi::theme_register(
[
 'tmux_away_crap', 
 '{line_start}{hilight ' . $IRSSI{'name'} . ':} $0'
]);

# if we are running
my $tmux_away_used = 0;

# try to find out, if we are running in a tmux
# (see, if $ENV{STY} is set
if (!defined($ENV{TMUX})) {
  # just return, we will never be called again
  Irssi::printformat(MSGLEVEL_CLIENTCRAP, 'tmux_away_crap',
    "could not open status file for parent process (pid: " . getppid() . "): $!");
  return;
}

my $socket = $ENV{TMUX};
$socket =~ s/,.*$//;

# register config variables
Irssi::settings_add_bool('misc', $IRSSI{'name'} . '_active', 1);
Irssi::settings_add_int('misc', $IRSSI{'name'} . '_repeat', 5);
Irssi::settings_add_str('misc', $IRSSI{'name'} . '_message', "not here ...");
Irssi::settings_add_str('misc', $IRSSI{'name'} . '_window', "1");
Irssi::settings_add_str('misc', $IRSSI{'name'} . '_nick', "");

# init process
tmux_away();

# tmux_away()
#
# check, set or reset the away status
#
# parameter:
#   none
# return:
#   0 (OK)
sub tmux_away {
  my ($away, @tmux, $tmux);

  # only run, if activated
  if (Irssi::settings_get_bool($IRSSI{'name'} . '_active') == 1) {
    if ($away_status == 0) {
      # display init message at first time
      Irssi::printformat(MSGLEVEL_CLIENTCRAP, 'tmux_away_crap',
        "activating $IRSSI{'name'} (interval: " . Irssi::settings_get_int($IRSSI{'name'} . '_repeat') . " seconds)");
    }
    # get actual tmux status
    my @tmux = stat($socket);
    # 00100 is the mode for "user has execute permissions", see stat.h
    if (($tmux[2] & 00100) == 0) {
      # no execute permissions, Detached
      $away = 1;
    } else {
      # execute permissions, Attached
      $away = 2;
    }

    # check if status has changed
    if ($away == 1 and $away_status != 1) {
      # set away
      if (length(Irssi::settings_get_str($IRSSI{'name'} . '_window')) > 0) {
        # if length of window is greater then 0, make this window active
        Irssi::command('window goto ' . Irssi::settings_get_str($IRSSI{'name'} . '_window'));
      }
      Irssi::printformat(MSGLEVEL_CLIENTCRAP, 'tmux_away_crap',
        "Set away");
      my $message = Irssi::settings_get_str($IRSSI{'name'} . '_message');
      if (length($message) == 0) {
        # we have to set a message or we wouldnt go away
        $message = "not here ...";
      }
      my ($server);
      foreach $server (Irssi::servers()) {
        if (!$server->{usermode_away}) {
          # user isnt yet away
          $away{$server->{'tag'}} = 0;
          $server->command("AWAY " . (($server->{chat_type} ne 'SILC') ? "-one " : "") . "$message") if (!$server->{usermode_away});
          if (length(Irssi::settings_get_str($IRSSI{'name'} . '_nick')) > 0) {
            # only change, if actual nick isnt already the away nick
            if (Irssi::settings_get_str($IRSSI{'name'} . '_nick') ne $server->{nick}) {
              # keep old nick
              $old_nicks{$server->{'tag'}} = $server->{nick};
              # set new nick
              $server->command("NICK " . Irssi::settings_get_str($IRSSI{'name'} . '_nick'));
            }
          }
        } else {
          # user is already away, remember this
          $away{$server->{'tag'}} = 1;
        }
      }
      $away_status = $away;
    } elsif ($away == 2 and $away_status != 2) {
      # unset away
      Irssi::printformat(MSGLEVEL_CLIENTCRAP, 'tmux_away_crap',
        "Reset away");
      my ($server);
      foreach $server (Irssi::servers()) {
        if ($away{$server->{'tag'}} == 1) {
          # user was already away, dont reset away
          $away{$server->{'tag'}} = 0;
          next;
        }
        $server->command("AWAY" . (($server->{chat_type} ne 'SILC') ? " -one" : "")) if ($server->{usermode_away});
        if (defined($old_nicks{$server->{'tag'}}) and length($old_nicks{$server->{'tag'}}) > 0) {
          # set old nick
          $server->command("NICK " . $old_nicks{$server->{'tag'}});
          $old_nicks{$server->{'tag'}} = "";
        }
      }
      $away_status = $away;
    }
  }
  # but everytimes install a new timer
  register_tmux_away_timer();
  return 0;
}

# register_tmux_away_timer()
#
# remove old timer and install a new one
#
# parameter:
#   none
# return:
#   none
sub register_tmux_away_timer {
  if (defined($timer_name)) {
    # remove old timer, if defined
    Irssi::timeout_remove($timer_name);
  }
  # add new timer with new timeout (maybe the timeout has been changed)
  $timer_name = Irssi::timeout_add(Irssi::settings_get_int($IRSSI{'name'} . '_repeat') * 1000, 'tmux_away', '');
}

Source: http://zork.net/pub/tmux_away.pl

Just put it in ~/.irssi/scripts/autorun

Offline

#24 2009-12-04 06:59:55

nblock
Member
From: Austria
Registered: 2008-08-06
Posts: 123
Website

Re: Anyone loving Tmux in place of Screen? Info/Tips etc. URLs I've found

thanks for this script!

Offline

#25 2009-12-05 15:10:06

Cirk
Member
From: Cologne / Germany
Registered: 2007-07-02
Posts: 15

Re: Anyone loving Tmux in place of Screen? Info/Tips etc. URLs I've found

I just switched from screen to tmux ---- and i love it!!!

Here is my current .tmux.conf:

# vi mode
set-window-option -g mode-keys vi
set-option -g status-keys vi

# misc settings
set-window-option -g utf8 on
set-window-option -g automatic-rename off
set-window-option -g mode-mouse on
set bell-action none

# statusbar
set-option -g status-bg black
set-option -g status-fg yellow
set-option -g status-right '#H %d.%m.%Y %H:%M'
set-window-option -g window-status-current-attr bold

and heres a example project file that i start, when i login to xmonad, that creates all my current
project windows and panes:

#!/bin/sh
# creates the environment for the project a

tmux start-server

if ! $(tmux has-session -t ProjectA) 
then

    cd /srv/www/ProjectA
    tmux new-session -d -s ProjectA -n terminal

    tmux new-window -t ProjectA:1 -n editor
    tmux set-window-option -t ProjectA:1 aggressive-resize on

    cd /srv/www/ProjectA/system/usr/share/doc/database
    tmux new-window -t ProjectA:2 -n database
    tmux split-window -t ProjectA:2
    tmux resize-pane -D -t ProjectA:2.0 20 
    tmux select-pane -t ProjectA:2.0

    tmux new-window -t ProjectA:3 -n log 
    tmux split-window -t ProjectA:3

    cd /srv/www/ProjectA/system/usr/share/doc/test
    tmux new-window -t ProjectA:4 -n test

    tmux send-keys -t ProjectA:1 'vim' C-m
    tmux send-keys -t ProjectA:2.0 'mysql -u root -pmypass ProjectA' C-m
    tmux send-keys -t ProjectA:3.0 'tail -f /srv/www/ProjectA/system/var/log/messages.log' C-m
    tmux send-keys -t ProjectA:3.1 'tail -f /var/log/httpd/error_log' C-m

    tmux select-window -t ProjectA:0

fi

tmux -2 attach-session -t ProjectA

Each project gets its own project starter file - very comfortable.

This wonderful multiplexer gives such an performance boost - i really, really love it :-)

Before tmux i used screen, but tmux is really a hit! A big THANK YOU to the original poster, i didnt knew tmux at all - but within 2 days i really fell in love with it.

Best wishes,
Dirk

Last edited by Cirk (2009-12-05 15:21:31)

Offline

Board footer

Powered by FluxBB