Kill All tmux Sessions

I realized today that I have ~20 old tmux sessions floating around. Tmux doesn’t seem to have a killall option, here’s a one liner to do it with bash/zsh:

for i in $(tmux ls | grep : | cut -d: -f1); do tmux kill-session -t $i; done

Formatted nicely:

  for i in $(tmux ls | grep : | cut -d: -f1) do
    tmux kill-session -t $i
  done