Place servername in TAB iTerm

Matthew Seaman m.seaman at infracaninophile.co.uk
Tue Dec 22 17:19:17 UTC 2015


On 12/22/15 12:51, Johan Hendriks wrote:
> Thanks that works, can this be automated when I log in
> 
> regards
> Johan
> 
> Op 22/12/15 om 13:39 schreef Matthias Apitz:
>> El día Tuesday, December 22, 2015 a las 01:34:01PM +0100, Johan Hendriks escribió:
>>
>>> Hello all.
>>>
>>> I use iTerm on my mac.
>>> When I connect to a Linux (Ubuntu) machine, in the TAB the name off the
>>> server appears.
>>> If I connect to a FreeBSD machine it just shows me ssh.
>>> How can I change the name off the TAB in iTerm (and other terminal
>>> programs) to show the servername.
>>> I use the standard csh. BTW if i use portmaster then it renames the tab
>>> also to what portmaster is doing.
>>>
>>> I do not know what I need to change to get the same behauviour as Linux
>>>
>>> Thank you for your time.
>> I can only speak for xterm and urxvt terminals (and maybe for iTerm on
>> Mac you should consult its documentation or mac user forums); I have a
>> script 'ti.sh' which says:
>>
>>
>> #!/bin/sh
>> printf "\033]0;$1\007"
>>
>> and when I run this as '~/ti.sh blabla' it puts 'blabla' in the titel
>> bar of the terminal.

Given you're using tcsh, try something like this in your .tcshrc:

        set prompt = "%B%m%b:%c03:%# "
        if ( $?TERM ) then
            switch ($TERM)
            case xterm:
            case xterm-color:
                set prompt = '%{\033]0;%n@%m:%/\007%}%B%m%b:%c03:%# '
                breaksw
            case screen:
                set prompt = '[%B%m%b]:%c03:%# '
                breaksw
            default:
                set prompt = '%B%m%b:%c03:%# '
                breaksw
            endsw
        endif

That sets your prompt to look like eg.

lucid-nonsense:~:%

(except the hostname bit is in bold)

and for any terminal that behaves like an xterm -- which includes both
Terminal.app and iTerm.app -- it sets the title bar to eg

matthew at lucid-nonsense:/home/matthew

The other cases in that switch statement are used for different terminal
types.

	Cheers,

	Matthew



-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 801 bytes
Desc: OpenPGP digital signature
URL: <http://lists.freebsd.org/pipermail/freebsd-questions/attachments/20151222/d5c1d6fd/attachment.sig>


More information about the freebsd-questions mailing list