Shell tricks


Reset cursor

Sometimes, especially when using ANSI escape code heavy applications, your terminal state might get mangled. If that’s the case, it’s just a matter of performing a VT320 escape sequence to reset the state. For instance, in zsh, using the unhide command:

echo -en "\e[?25h"


Get screen resolution


On linux you can get the x and y resolutions, respectively:

$ xrandr --current | grep '*' | uniq | awk '{print $1}' | cut -d 'x' -f1
$ xrandr --current | grep '*' | uniq | awk '{print $1}' | cut -d 'x' -f2