InfoHeap
Tech
Navigation
  • Home
  • Tutorials
    • CSS tutorials & examples
    • CSS properties
    • Javascript cookbook
    • Linux/Unix Command Line
    • Mac
    • PHP
      • PHP functions online
      • PHP regex
    • WordPress
  • Online Tools
    • Text utilities
    • Online Lint Tools
search

Mac Command Line tutorials

  • Bulk convert jpeg files to png using sips on mac
  • Custom terminal tab title and ssh on mac
  • How to convert text to speech on Mac using command line utility say
  • How to join multiple pdf files on Mac
  • How to use qpdf to add/remove password from pdf on mac
  • Install redis on Mac
  • Mac - find which process is listening on a port
  • Mac - hide and unhide a file or directory
  • Mac - open a terminal from a folder
  • Mac - print java home on command line
  • Mac - search files on command line using mdfind
  • Mac command line convert svg to png
  • Mac command line utility open - some handy tips for better productivity
  • Mac terminal - how to close shell on exit
  • mac pkgutil - quick start guide
 
  • Home
  • > Tutorials
  • > Mac
  • > Mac Command Line

Custom terminal tab title and ssh on mac

By admin | Last updated on Mar 20, 2016

In case you are using ssh private keys to connect to remote Linux servers on cloud, it is better to automation connection to various machines using bash script. I often connect to EC2 machines from my local macbook. Here is a sample script (you can save it as myssh.sh) you can use to connect to a remote linux machine:

ssh -i /somepath/private_key.pem $1

Now to connect to prod1.infoheap.com, you can use the following command:

$ myssh.sh prod1.infoheap.com

When you open multiple tabs and connect to various machine, the following bash code can be used in myssh.sh script:

#!/bin/bash
printf "\e]1;`echo $* | sed -Ee 's/^.+\@//'`\a"
TERM=vt100 ssh -i /somepath/private_key.pem $*
printf "\e]1;bash\a"

You can customize it as per your need. Note that the code to set the tab title uses escape and bell char as shown below:

$ printf "\e]1;SOME_VALUE\a"

Suggested posts:

  1. How to display auto fade out message using jQuery
  2. migrate multiple mysql databases using mysqldump on Linux
  3. How to Preload cache in wordpress on Linux
  4. How to log page latency and url host in apache log
  5. AngularJS format date using date filter
  6. Linux/Unix – find inode number of a file
  7. WordPress – how to create custom tag cloud
  8. How to fix a broken sudoers file on AWS/EC2 Linux
Share this article: share on facebook share on linkedin tweet this submit to reddit
Posted in Tutorials | Tagged Linux, Mac Command Line, Tutorials
  • Browse content
  • Article Topics
  • Article archives
  • Contact Us
Popular Topics: Android Development | AngularJS | Apache | AWS and EC2 | Bash shell scripting | Chrome developer tools | Company results | CSS | CSS cookbook | CSS properties | CSS Pseudo Classes | CSS selectors | CSS3 | CSS3 flexbox | Devops | Git | HTML | HTML5 | Java | Javascript | Javascript cookbook | Javascript DOM | jQuery | Kubernetes | Linux | Linux/Unix Command Line | Mac | Mac Command Line | Mysql | Networking | Node.js | Online Tools | PHP | PHP cookbook | PHP Regex | Python | Python array | Python cookbook | SEO | Site Performance | SSH | Ubuntu Linux | Web Development | Webmaster | Wordpress | Wordpress customization | Wordpress How To | Wordpress Mysql Queries | InfoHeap Money

Copyright © 2025 InfoHeap.

Powered by WordPress