stty intr specifies the interactive attention character. When a TTY finds this character in the input stream, it immediately sends a SIGINT signal to the corresponding process.
stty intr ^F
stty raw
On linux, a terminal will by default buffer input until Enter is pressed. This can be changed with
stty raw
stty size
stty returns the screen dimensions.
#!/bin/bash
stty_size=$(stty size) # Returns two numbers: rows and columns
nofCols=${stty_size##* } # delete up to last space from the left
nofRows=${stty_size%% *} # delete from first space to the right
echo "Number of columns: $nofCols"
echo "Number of rows: $nofRows"