Posts

Showing posts from April, 2011

Showing CPU/Memory usage on tmux status bar(tmuxのステータスバーにCPUとMemoryの使用状況を表示する)

Image
On OSX, to show CPU usage, script is like this. #!/bin/bash top -l 1 | head -n 4 | tail -n 1|awk '{printf "%3d%%\n", $3}' to get Memory Usage, script is like this. #!/bin/bash vm_stat | awk 'BEGIN{FS="[:]+"}{if(NR<7&&NR>1)sum+=$2; if(NR==2||NR==4||NR==5)free+=$2} END{printf "%3d%%\n",100*((sum - free)/sum)}' Name thsese scripts like getCpuUsage.sh/getMemUsage.sh and put them in folder where the $PATH is set. Change their mode to u+x. To show them on tmux status line, .tmux.conf is like set -g status-right '#[fg=blue,bold]#H#[default] #[fg=blue,bold][CPU=#(getCpuUsage.sh) MEM=#(getMemUsage.sh)]#[default]'

Broken border of tmux on iTerm can be caused by some setting.(tmux+iTerm2での表示の乱れについて)

Image
I've been annoyed by broken border lines of tmux on iTerm2, but finally I figured out what causes this. To fix it, turn off the chechk box of "Treat ambiguous-width characters as double width" in Terminal tab of "Edit profile".