It could be also the wrong terminal line for TERM=linux ... or what kind of terminal line the device /dev/ttyAMA0 is? This looks like a serial line and this might be something like TERM=vt100