Skip to content

Instantly share code, notes, and snippets.

@pjz
Created October 2, 2012 18:08
Show Gist options
  • Save pjz/3821862 to your computer and use it in GitHub Desktop.
Save pjz/3821862 to your computer and use it in GitHub Desktop.
Set prompt to fqdn - domain.toplevel
# This will change your prompt and screen/tmux tab title based on how many
# fields there are in the FQDN. For a normal 3 field FQDN, it will use $HOSTNAME
# like normal. For 4+ fields it will set it to field1.field2.
# Rename screen window
function rename_screen_tab () { echo -ne "\x1bk$@\x1b\\"; return 0; }
MYHOST=`echo $HOSTNAME | sed 's/[.][^.]*[.][^.]*$//'`
[[ $TERM == "screen" ]] && PROMPT_COMMAND='rename_screen_tab ${MYHOST}'
PS1="\d \A \w\n\u@$MYHOST > "
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment