LinuxQuestions.org
Help answer threads with 0 replies.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Other *NIX Forums > Solaris / OpenSolaris
User Name
Password
Solaris / OpenSolaris This forum is for the discussion of Solaris, OpenSolaris, OpenIndiana, and illumos.
General Sun, SunOS and Sparc related questions also go here. Any Solaris fork or distribution is welcome.

Notices


Reply
  Search this Thread
Old 07-10-2009, 09:46 AM   #1
Xris718
Member
 
Registered: May 2003
Location: NYC
Distribution: CentOS
Posts: 261

Rep: Reputation: 30
.screenrc to create window titles


Hi


I am having a bit of a problem with .screenrc and trying to find how to make window title to display server hostnames. What I want to do is when I login to server 'A' and I launch screens from there, I will get a tabbed window on the bottom. From there if I login to server 'B' I want to have that window title display servername from server 'B' instead of server 'A'. Is there a way to do such a task in screens? And lastly I wanted to know if its possible to make that window title line which is always shows up on the bottom to show up on the top?

I am using Solaris 8 with screen version 4.
 
Old 07-12-2009, 02:32 AM   #2
gapan
Member
 
Registered: Feb 2007
Posts: 378

Rep: Reputation: 163Reputation: 163
You can use hardstatus. My .screenrc looks like this for example:
Code:
hardstatus alwayslastline
hardstatus string '%{= kg}[ %{G}%H %{g}][%= %{=kw}%?%-Lw%?%{r}(%{W}%n*%f%t%?(%u)%?%{r})%{w}%?%+Lw%?%?%= %{g}][%{B}%Y-%m-%d %{W}%c%{g}]'
Not really sure if this is exactly what you need, because you will need to have a similar .screenrc in every PC and you will have to launch screen in every PC you login, resulting to nested screens.
 
Old 07-13-2009, 09:32 AM   #3
Xris718
Member
 
Registered: May 2003
Location: NYC
Distribution: CentOS
Posts: 261

Original Poster
Rep: Reputation: 30
What I am looking for is this, when you ssh into server_A and launch screens from server_A I will get a tabbed window on the bottom. I want that tab to say server_A. Then if from server_A inside screens i will ssh into server_B. I now want the tabbed window to show server_B instead of server_A. Afterwards when i exit out of server_B and back to server_A. I now want tabbed window to show server_A all this to be done dynamically without manual intervention. Can that be done? I am using bash shell.
 
Old 07-13-2009, 11:22 AM   #4
gapan
Member
 
Registered: Feb 2007
Posts: 378

Rep: Reputation: 163Reputation: 163
If you open a screen session on each PC you're logging in, it will work as I described. But if you want to launch screen only once, I don't think it can be done in screen. But I guess you can change the bash prompt to something like this:
Code:
export PS1='\u@\h[\W]\$ '
to show the hostname. You'll need to change that on every PC you're logging in, you can put that line in your ~/.bashrc
 
Old 07-13-2009, 12:36 PM   #5
Xris718
Member
 
Registered: May 2003
Location: NYC
Distribution: CentOS
Posts: 261

Original Poster
Rep: Reputation: 30
Thanks for the reply but I was really looking to launch screens on server_A only and then from there log into many other servers and wanted to see their hostnames in the window titles.
 
Old 07-13-2009, 02:56 PM   #6
gapan
Member
 
Registered: Feb 2007
Posts: 378

Rep: Reputation: 163Reputation: 163
Sorry, but I don't think that's possible.
 
Old 07-14-2009, 11:28 AM   #7
Xris718
Member
 
Registered: May 2003
Location: NYC
Distribution: CentOS
Posts: 261

Original Poster
Rep: Reputation: 30
Actually I think I found a way to do it. This is what I did and it worked. Inside your .bashrc file where you have your settings for PS1 you simply place below string at the very end of your PS1 variable:

'\[\033k\033\\\]'

example:
PS1="\u@\h\$"'\[\033k\033\\\]'
export PS1

Then in your .screenrc file you place this entry:

shelltitle "$ |bash"

Lastly, go back into your .bashrc file and create an alias for the server you are going to ssh into like this:

alias server_B='ssh -q server_B'

When you run screens from server_A and you type at your prompt "server_B" to ssh into that server you will see how your tab changes to server_B. When you exit out it will change back to "bash" title. This is by far the best easiest way i found how to tweak my .screenrc and .bashrc to allow myself to see tabs with hostname of the machine I'm in.

I got this hint from this website.

http://www.gentoo-wiki.info/Screen

I hope this helps.
 
  


Reply



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
How to remove "(on localhost.localdomain)" from window titles? stuntbairn Linux - Newbie 6 03-23-2009 03:20 AM
dvdstyler - How to create custom button to play a range of titles dv502 Linux - Software 2 12-09-2008 10:40 PM
LXer: How to create video titles and graphics with Kino LXer Syndicated Linux News 0 03-21-2007 04:01 AM
Create sub titles to movies tshrinivasan Linux - Software 2 12-27-2006 11:33 AM
Fluxter Nweb: I want window titles displayed in the fluxter worskapce. muscap Linux - Software 0 09-05-2004 11:55 PM

LinuxQuestions.org > Forums > Other *NIX Forums > Solaris / OpenSolaris

All times are GMT -5. The time now is 12:53 AM.

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
Open Source Consulting | Domain Registration