Issue
It's strange that neither
ssh [email protected] bash -c "top"
nor
ssh [email protected] "top"
works as expected, whereas both
ssh [email protected] "ls"
and
ssh [email protected] bash -c "ls"
work well.
Here is the error message\output for the former command.
TERM environment variable not set.
I searched and found this post.
As per the said post, there is an answer
shed some light on this matter.
You can see if it's really not set. Run the command set | grep TERM. If not, you can set it like that: export TERM=xterm
I tried
ssh [email protected] bash -c "set | grep TERM;top"
, and the output is
TERM=dumb
TERM environment variable not set.
, which is in my expectation.
Then I try to set XTERM
as what the post told me, but it does not work. I am stuck again.
Here is my command to set XTERM
and run top
:
ssh [email protected] bash -c "export TERM=xterm-256color; top"
Here is the output for the above command:
declare -x DISPLAY="localhost:13.0"
declare -x LANG="en_US.UTF-8"
declare -x LC_ALL="C"
#...
TERM environment variable not set.
Could somebody shed some light on this matter?
Solution
Try using the -t
option to allocate a pseudo-terminal for the ssh session.
For example
ssh -t [email protected] top
Answered By - Dmitri Chubarov Answer Checked By - Mary Flores (WPSolving Volunteer)