Skip to content

Instantly share code, notes, and snippets.

@trbhoang
Created November 21, 2014 07:13
Show Gist options
  • Select an option

  • Save trbhoang/f1033a3285af00d9db25 to your computer and use it in GitHub Desktop.

Select an option

Save trbhoang/f1033a3285af00d9db25 to your computer and use it in GitHub Desktop.
name terminal's tab title as hostname on Mac OS
# refs:
# https://coderwall.com/p/hox_hq/keep-terminal-app-tab-name-follow-working-host
# http://wiki.bash-hackers.org/scripting/posparams
#
# customize Terminal tab title
#
function tabname () {
# Change Terminal.app tab name (by josjbuhler)
echo -en "\033];$1\007"
}
function sshname () {
SSHHOST="${@: -1}"
tabname "`echo $SSHHOST`"
unalias ssh
ssh $1
alias ssh=sshname
tabname $USER'@localhost'
}
alias ssh=sshname
tabname $USER'@localhost'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment