Friday, September 5, 2008

Gnome Terminal Tips

I often use the profiles feature in gnome terminal to organize all my remote shell accounts. Inside of gnome terminal, you can go to Edit->Profiles to manage your profiles. From there, you can either edit an existing profile or create a new one. Either action will take you to the "Editing Profile" window. Once inside, click on "Title and Command" tab and check the box that says "Run a custom command instead of my shell". You can put your ssh login info inside of the "Custom command" box. An example would be:

ssh -i /home/username/.ssh/id_rsa.1 -p 7822

That would invoke an ssh session using port 7822 and the identity file stored in your .ssh directory. It's particularly useful to setup sessions with shared keys so you can just go File->Open Terminal and point to the desired session. If you have certain ssh session you use a lot, it might be worth adding a launcher to your panel and specifying the desired profile like so:

gnome-terminal --window-with-profile SomeProfile

It's also worth noting that gnome terminal allows you to color code your saved profiles. I find that this helps prevent stupid mistakes caused by thinking your logged into a different session than you actually are.

Since I use gnome terminal to store many remote login sessions, I sometimes need to retrieve this information whilst remotely logged into my workstation. An example would be when I ssh to my work PC from home over a VPN connection. Gnome terminal stores all of it's saved profile information in the following location.


In this case, $username and $profilename would represent your username and desired gnome profile name respectively. Inside of the %gconf.xml file, there's a section for custom command that looks like this.

<entry name="custom_command" mtime="1193759925" type="string">
    <stringvalue>ssh -p 7822</stringvalue>

From there, you should be able to extract whatever info is desired.

Bonus tip: you can open a new terminal window whilst inside an active gnome terminal session by doing ctrl-shift-N.


Torgny said...

"Gnome terminal stores all of it's saved profile information in the following location.


Not anymore it seems. Im my Ubuntu jaunty the location is rather:
Profile0/, Profile1/, Profile2/, etc.

rhp997 said...

To copy a profile you'll need to copy both the global and profiles directory; ~/.gconf/apps/gnome-terminal/global/%gconf.xml contains pointers to the enumerated profiles in ~/.gconf/apps/gnome-terminal/profiles