LinuxQuestions.org
Latest LQ Deal: Linux Power User Bundle
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
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!

Notices


Reply
  Search this Thread
Old 11-19-2014, 01:28 PM   #1
casperdaghost
Member
 
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'.

[CODE]
(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"
[CODE]
 
Old 11-19-2014, 04:23 PM   #2
corp769
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:
Code:
function preexec() {
    local a=${${1## *}[(w)1]}
    local b=${a##*\/}
    a="${b}${1#$a}"
    a=${a//\%/\%\%}
    a=$(print -Pn "$a" | tr -d "\t\n\v\f\r")
    a=${(V)a//\%/\%\%}
    a=${a:0:14}
    case "$TERM" in
        screen-256color ) print -Pn "\ek%n@%m:%-3~[$a]\e\\" ;;
    esac
}
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 - http://superuser.com/questions/24929...e-ssh-hostname
 
  


Reply


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 03:03 PM
CRTL-ALT-DEl bboy-mass Linux - Security 3 09-26-2006 04: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 09:09 AM
mail server the naming naming convention problem kashan Linux - Newbie 0 07-16-2004 03:08 PM
CRTL D in bash script pazvant Programming 2 05-12-2004 11:02 AM


All times are GMT -5. The time now is 04:26 PM.

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