Ssh – using watch with ssh

sshwatchxterm

I have a script:

export TERM=xterm
watch -t -d -n 1 'netstat -veeantpo | grep 43597

when we run this script though ssh, it does not determine the monitor resolution. so lines are wrapped although there is space to show results. You can see the result in the picture.(I have removed the trailing space after ESTABLISHED).

enter image description here

Best Answer

Add -t to your ssh. By default when you pass a command to ssh, it doesn't allocate a TTY on the remote host, so the application only has a basic STDOUT pipe to work with.

ssh -t foobar 'watch -t -d -n 1 "netstat -veeantpo | grep 43597"'
Related Question