LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Server (https://www.linuxquestions.org/questions/linux-server-73/)
-   -   Using ssh command with watch (https://www.linuxquestions.org/questions/linux-server-73/using-ssh-command-with-watch-898520/)

sergani 08-20-2011 05:14 PM

Using ssh command with watch
 
Hi all,

I've been trying to use both ssh and watch commands in the same line, but getting this error:
Quote:

Error opening terminal: unknown.
I'm typing the following command:
Code:

mSergani:~ $ ssh user@192.168.1.100 "watch df -h"
Can anyone help shed some light if it's possible to use both commands?
It's highly important in my line of work.

Thanks.

//M

macemoneta 08-20-2011 08:49 PM

Add the '-t' option to ssh, to add a pseudo-terminal for any commands that use screen addressing (like watch, top, etc.):
Code:

$ ssh -t user@192.168.1.100 "watch df -h"
See 'man ssh' for additional details.

sergani 08-21-2011 06:27 AM

Thanks macemoneta, that worked fine.

Another solution I tried was
Code:

ssh user@IP "TERM=xterm ; watch "df -h""
It also worked fine.

One problem I found though was that watch isn't refreshing smoothly, like it skips time.
Any thoughts?

Thanks again.

//M

bkarthick 08-21-2011 07:41 AM

can you tell me how to connect the server graphically through ssh...

thanks

macemoneta 08-21-2011 08:26 AM

Quote:

Originally Posted by bkarthick (Post 4449240)
can you tell me how to connect the server graphically through ssh...

thanks

Please don't hijack threads. Start a new thread for your question.

macemoneta 08-21-2011 08:28 AM

Quote:

Originally Posted by sergani (Post 4449184)
Thanks macemoneta, that worked fine.

Another solution I tried was
Code:

ssh user@IP "TERM=xterm ; watch "df -h""
It also worked fine.

One problem I found though was that watch isn't refreshing smoothly, like it skips time.
Any thoughts?

Thanks again.

//M

There are many possible causes for this. A lossy connection, contention, high latency, even workload on the endpoints.


All times are GMT -5. The time now is 02:58 AM.