LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Problem setting PATH with X11 (https://www.linuxquestions.org/questions/linux-newbie-8/problem-setting-path-with-x11-667833/)

tarahmarie 09-05-2008 02:21 PM

Problem setting PATH with X11
 
Hi, all:

Here's my problem: X11 is not set in the PATH. I believe that this is the reason I am getting "no protocol specified, cannot open display" error messages in my terminal when using bash. As a result, I cannot open the /.bashrc or /.bash_profile (not that I have figured out yet what I'm supposed to put in there) in either root or username (trying to use gedit with "&" to open in a separate window). When I try to set the PATH, here's what I do:

PATH=$PATH:/usr/bin/X11
export PATH

I've tried this as root and as username, and what happens is that as soon as I exit the terminal or exit root status is this:

root@tarahmarie-desktop:/home/tarahmarie# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/bin/X11
root@tarahmarie-desktop:/home/tarahmarie# exit
exit
tarahmarie@tarahmarie-desktop:~$ su
Password:
root@tarahmarie-desktop:/home/tarahmarie# echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games

The same thing happens when I try to add /usr/lib/kde4/bin to my path in either root or username. What do I do?

tarahmarie 09-05-2008 03:27 PM

I have found two solutions, could someone please explain to me the difference between editing /.bash_profile and /.bashrc? What's the diff?

makuyl 09-05-2008 03:50 PM

IIRC ~/.bash_profile gets read at login and ~/.bashrc every time you open a shell. Of the two you should set the path in ~/.bash_profile. That said, I would use ~/.profile for that, or edit /etc/profile and include /usr/X11R6/bin in its PATH line.

weibullguy 09-05-2008 03:54 PM

man bash, read the section entitle Invocation.

tarahmarie 09-05-2008 04:40 PM

Quote:

Originally Posted by makuyl (Post 3270931)
IIRC ~/.bash_profile gets read at login and ~/.bashrc every time you open a shell. Of the two you should set the path in ~/.bash_profile. That said, I would use ~/.profile for that, or edit /etc/profile and include /usr/X11R6/bin in its PATH line.

Thanks; editing the /etc/profile worked perfectly.

Hewson 09-05-2008 06:48 PM

Quote:

Originally Posted by makuyl (Post 3270931)
IIRC ~/.bash_profile gets read at login and ~/.bashrc every time you open a shell. Of the two you should set the path in ~/.bash_profile. That said, I would use ~/.profile for that, or edit /etc/profile and include /usr/X11R6/bin in its PATH line.

It should also be be noted that /etc/profile is system wide (I.E. all users use it, while your ~/.profile is user specific)

tarahmarie 09-06-2008 12:55 PM

Quote:

Originally Posted by Hewson (Post 3271054)
It should also be be noted that /etc/profile is system wide (I.E. all users use it, while your ~/.profile is user specific)

By editing the /etc/profile's PATH, I have no problem now using all the bash commands as username. I still seem to have problems using the bash commands as root. When you say that the /etc/profile's PATH is system-wide, why doesn't root get access to the PATH in it?


All times are GMT -5. The time now is 06:26 PM.