I installed Ubuntu 16.04 with Xrdp and Xfce4 for remote access. Installed ruby using RVM. When I try to access Ruby Interactive (irb), it works perfectly from the SSH shell (I type irb and I can use the interactive ruby environment). However when I do remote logon and use Xterm, it cannot find a lot of commands (like irb, reboot, shutdown)
I query using RVM again and see ruby is installed. This is not only about ruby, I see many other commands are not accessible.
When I type
echo $SHELLI see
/bin/bash 1 2 Answers
It looks like your PATH variable is differently constructed depending on how to enter the shell.
You could double check with
echo $PATHfor the differences.
I've no experience with Ruby's environment but I could imagine there's a script being sourced which sets up everything (e.g. like with node/npm).
Bash is potentially sourcing multiple scripts like /etc/profile, ~/.profile ~/.bash_rc, /etc/bash.bashrc.
Perhaps your xterm configuration makes use of --noprofile or --norc or it's not invoked as login shell and therefore is not sourcing a relevant part for setting up your Ruby environment.
From man bash:
When bash is invoked as an interactive login shell, or as a non-
inter-active shell with the --login option, it first reads and
executes com-mands from the file /etc/profile, if that file exists.
After reading that file, it looks for ~/.bash_profile, ~/.bash_login,
and ~/.profile, in that order, and reads and executes commands from
the first one that exists and is readable. The --noprofile option
may be used when the shell is started to inhibit this behavior.and
When an interactive shell that is not a login shell is started, bash
reads and executes commands from /etc/bash.bashrc and ~/.bashrc, if
these files exist. This may be inhibited by using the --norc option.Edit: here's a screenshot showing what needs to be configured for xterm
Original source here:
bash searches for the command you type (assuming the command is NOT an alias or a builtin and doesn't start with "/") in the directories listed in the colon-separated list contained in the PATH variable. echo $PATH to show it. I don't have irb installed, but reboot and shutdown are in the /sbin/ directory.
export PATH=$PATH:/sbinwill make reboot and shutdown visible.
You can find where irb is located by logging in with ssh, then
type -p irbAdd this directory to your PATH.
Check your terminal type (echo $TERM) in each environment, and see if $TERM affects your ~/.bashrc.