LinuxQuestions.org
Review your favorite Linux distribution.
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Server
User Name
Password
Linux - Server This forum is for the discussion of Linux Software used in a server related context.

Notices


Reply
  Search this Thread
Old 08-20-2011, 06:14 PM   #1
sergani
LQ Newbie
 
Registered: Jan 2010
Distribution: Fedora, CentOS, OpenSuse, Oracle Enterprise Linux, MacOSX
Posts: 27

Rep: Reputation: 0
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
 
Old 08-20-2011, 09:49 PM   #2
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 335Reputation: 335Reputation: 335Reputation: 335
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.
 
1 members found this post helpful.
Old 08-21-2011, 07:27 AM   #3
sergani
LQ Newbie
 
Registered: Jan 2010
Distribution: Fedora, CentOS, OpenSuse, Oracle Enterprise Linux, MacOSX
Posts: 27

Original Poster
Rep: Reputation: 0
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
 
Old 08-21-2011, 08:41 AM   #4
bkarthick
Member
 
Registered: Apr 2009
Posts: 56

Rep: Reputation: 0
can you tell me how to connect the server graphically through ssh...

thanks
 
Old 08-21-2011, 09:26 AM   #5
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 335Reputation: 335Reputation: 335Reputation: 335
Quote:
Originally Posted by bkarthick View Post
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.
 
Old 08-21-2011, 09:28 AM   #6
macemoneta
Senior Member
 
Registered: Jan 2005
Location: Manalapan, NJ
Distribution: Fedora x86 and x86_64, Debian PPC and ARM, Android
Posts: 4,593
Blog Entries: 2

Rep: Reputation: 335Reputation: 335Reputation: 335Reputation: 335
Quote:
Originally Posted by sergani View Post
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.
 
  


Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off



Similar Threads
Thread Thread Starter Forum Replies Last Post
Watch Command jessy1983 Linux - Newbie 2 11-04-2010 12:25 AM
Watch command in a shell script hawk__0 Programming 5 03-03-2010 01:42 PM
Something Command watch with scroll ability sebelk Linux - Server 1 05-07-2009 06:36 PM
Linux watch command batofd Linux - General 3 12-14-2007 02:33 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Server

All times are GMT -5. The time now is 03:23 AM.

Main Menu
Advertisement
My LQ
Write for LQ
LinuxQuestions.org is looking for people interested in writing Editorials, Articles, Reviews, and more. If you'd like to contribute content, let us know.
Main Menu
Syndicate
RSS1  Latest Threads
RSS1  LQ News
Twitter: @linuxquestions
Facebook: linuxquestions Google+: linuxquestions
Open Source Consulting | Domain Registration