InfoHeap
Tech tutorials, tips, tools and more
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. Bash – how to run custom commands at script exit
  2. How to use rsync for production release automation
  3. Find memcache request hit rate on linux command line
  4. Run Internet Explorer (IE) on Mac using VirtualBox and ievms script
  5. Bash – pass all arguments from one script to another
  6. CSS – !important examples
  7. Rsync – show progress and transfer rate
  8. Docker quick start guide on Mac
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 | 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

Copyright © 2023 InfoHeap.

Powered by WordPress