Skip to content

Instantly share code, notes, and snippets.

@penghou620
Created January 6, 2016 18:21
Show Gist options
  • Save penghou620/4b54552ceecc6050e396 to your computer and use it in GitHub Desktop.
Save penghou620/4b54552ceecc6050e396 to your computer and use it in GitHub Desktop.
Tmux kill un-attached sessions
tmux ls | grep --invert-match 'attached' | awk '{print $1}' | grep -oh '[0-9]\{1,\}' | xargs -n 1 -I {} tmux kill-session -t {}
@djvs
Copy link

djvs commented Apr 23, 2016

I had gotten this far before I googled "tmux xargs kill-session" and wound up here:

ϡ tmux ls|grep -v attached|awk '{ print $1 }'|sed 's/://'

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment