Shell tricks
TTY
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"
Resolution
Get screen resolution
Linux
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