Skip to content

Instantly share code, notes, and snippets.

View javipolo's full-sized avatar

Javi Polo javipolo

  • Red Hat
  • Barcelona, Catalunya
View GitHub Profile
@javipolo
javipolo / set-tmux-title
Last active November 29, 2023 09:31 — forked from florianbeer/set-tmux-title
Set tmux pane title to short hostname on ssh connections
# Make short hostname only if its not an IP address
__tm_get_hostname(){
local HOST="$(echo $* | rev | cut -d ' ' -f 1 | rev)"
if echo $HOST | grep -P "^([0-9]+\.){3}[0-9]+" -q; then
echo $HOST
else
echo $HOST| cut -d . -f 1
fi
}