Visit Jeremy's Blog.
Go Back > Forums > Linux Forums > Linux - Newbie
User Name
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!


  Search this Thread
Old 11-19-2014, 12:28 PM   #1
Registered: Aug 2009
Posts: 349

Rep: Reputation: 16
crtl-w on tmux naming shells

This is tmux - when i hit 'ctrl -w' which shows me all the
different shells that I have up. This shell casper1005foo
is where i initially log in to the system. Each of these
shells have ssh'd to another host. It would be cool if when
I hit 'ctrl-w' is listed the host the that the shell was
ssh'd into.
Is there a setting in tmux.config or is there a way to rename the
shells. It would be better if I could identify where the shells were
logged into with 'crtl-w'.

(0) 0: bash "casper1005foo"
(1) 1: ssh- "casper1005foo"
(2) 2: ssh* "casper1005foo"
(3) 3: ssh "casper1005foo"
(4) 4: ssh "casper1005foo"
(5) 5: ssh "casper1005foo"
(6) 6: ssh "casper1005foo"
(7) 7: ssh "casper1005foo"
(8) 8: bash "casper1005foo"
Old 11-19-2014, 03:23 PM   #2
LQ Guru
Registered: Apr 2005
Posts: 5,817

Rep: Reputation: 1002Reputation: 1002Reputation: 1002Reputation: 1002Reputation: 1002Reputation: 1002Reputation: 1002Reputation: 1002
I use the preexec function in zsh to do this before hand, see the following:
function preexec() {
    local a=${${1## *}[(w)1]}
    local b=${a##*\/}
    a=$(print -Pn "$a" | tr -d "\t\n\v\f\r")
    case "$TERM" in
        screen-256color ) print -Pn "\ek%n@%m:%-3~[$a]\e\\" ;;
I use pretty much the same function/config across all of my machines, but you can use a function in your shell's config (zsh, bash, etc) to do this as well. Found the following doing a quick search, it may suffice for what you are looking for -


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
[SOLVED] Can all shells read all environmental variables set by other shells? carlodelmundo Linux - Newbie 2 07-23-2010 02:03 PM
CRTL-ALT-DEl bboy-mass Linux - Security 3 09-26-2006 03:55 AM
Is there a way to have grub translate its own naming to naming scheme under Linux zhjim Linux - Software 6 05-28-2006 08:09 AM
mail server the naming naming convention problem kashan Linux - Newbie 0 07-16-2004 02:08 PM
CRTL D in bash script pazvant Programming 2 05-12-2004 10:02 AM > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 11:37 PM.

Main Menu
Write for LQ is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration