Skip to content

Instantly share code, notes, and snippets.

@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
}