Skip to content

Instantly share code, notes, and snippets.

@bmoore
Last active December 21, 2015 20:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bmoore/6358811 to your computer and use it in GitHub Desktop.
Save bmoore/6358811 to your computer and use it in GitHub Desktop.
tmux split and tail all your files in the logs directory.
#!/bin/bash
if [ !-d 'logs' ]
then
echo "No logs!"
exit 1
fi
i=0
count=$(ls logs | grep log | wc -l)
perc=$((100/$count))
echo $perc
tmux start
for file in $(ls logs | grep log); do
if [ $i -eq '0' ]
then
tmux new-session -d "tail -f logs/$file"
else
tmux splitw -d "tail -f logs/$file"
fi
let i+=1
done
tmux select-layout even-horizontal
tmux attach
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment