SlackwareThis Forum is for the discussion of Slackware Linux.
Notices
Welcome to LinuxQuestions.org, a friendly and active Linux Community.
You are currently viewing LQ as a guest. By joining our community you will have the ability to post topics, receive our newsletter, use the advanced search, subscribe to threads and access many other special features. Registration is quick, simple and absolutely free. Join our community today!
Note that registered members see fewer ads, and ContentLink is completely disabled once you log in.
If you have any problems with the registration process or your account login, please contact us. If you need to reset your password, click here.
Having a problem logging in? Please visit this page to clear all LQ-related cookies.
Get a virtual cloud desktop with the Linux distro that you want in less than five minutes with Shells! With over 10 pre-installed distros to choose from, the worry-free installation life is here! Whether you are a digital nomad or just looking for flexibility, Shells can put your Linux machine on the device that you want to use.
Exclusive for LQ members, get up to 45% off per month. Click here for more info.
How can you edit the PATH environment variable ?
I know you can add to it using the export command,
but this just adds stuff to the PATH. I want to chop some
stuff out of it, and then add stuff in.
This used to be so easy in the past. All you had to
do was access /etc/profile and use a text editor on
the profile file. But now I can't see any PATH in
/etc/profile and I can't find the PATH definition
in any other file either. I can see it all using
the env command, but I can't do anything to it.
I just love how they keep "improving" Linux and
making it more useless.
You mean in Slackware? Cause /etc/profile has this:
Code:
# Set the default system $PATH:
PATH="/usr/local/bin:/usr/bin:/bin:/usr/games"
# For root users, ensure that /usr/local/sbin, /usr/sbin, and /sbin are in
# the $PATH. Some means of connection don't add these by default (sshd comes
# to mind).
if [ "`id -u`" = "0" ]; then
echo $PATH | grep /usr/local/sbin 1> /dev/null 2> /dev/null
if [ ! $? = 0 ]; then
PATH=/usr/local/sbin:/usr/sbin:/sbin:$PATH
fi
fi
...
...
export PATH DISPLAY LESS TERM PS1 PS2
As already mentioned, in Slackware the $PATH variable is defined in /etc/profile. If you cannot see the variable with a text editor, then from a command line type grep PATH /etc/profile. If the variable is indeed not in that file, then the file has been edited. The /etc/profile file is from the a/etc-{version}-noarch-1.tgz package. The file in the package is named profile.new. If you want the original default file, then as root extract profile.new and rename the file.
You can create your own zlocal.sh script in /etc/profile.d rather than edit /etc/profile. That is one method I use to modify default values for environment variables.
Hint: Within a public forum where people provide help voluntarily, and in a forum specifically dedicated to a specific distro, you might notice a better response if you eliminate the rants and snide remarks. Many people get frustrated from time to time, especially with something as complex as computers. Been there done that many times. Yet before posting, a good approach is to calm down and edit the post before pressing that "Submit" button.
With a new install of 13, I have no /etc/profile and under /etc/profile.d there is no script that obviously sets things like PATH. Perhaps zeelog's frustration is justified.
Do you have a file named profile.new? Have you renamed the file to /etc/profile?
There also should be a sym link to /etc/profile named /etc/zprofile.
The /etc/profile file is in the "a" package tree. All "a" packages are considered required packages for any installation.
Regarding scripts in /etc/profile.d that might contain PATH modifications, the jre-6u11-i586-1 package (Java run-time) from the "l" tree is from the stock installation and installs the jre.sh and jre.csh scripts into /etc/profile.d. If you have the java development package (jdk-6u11-i586-1) from the "extras" tree, then there will be scripts from that package too that modify the PATH variable.
If none of the above apply then perhaps a full installation was not performed?
I must appologize ! I have the WRONG forum.
Slackware's /etc/profile has the PATH all there.
There's no problem editing the PATH with Slackware.
The distro with the problem starts with an F and ends with an ora
so I'll ask at that forum. And your right. No more ranting.
It's not a good idea at all.
So, in a way, the problem is solved. If I really want
to edit the PATH the with a text editor, I just have to
install Slackware.
Thank you everyone for your replies. It was appreciated.
With a new install of 13, I have no /etc/profile and under /etc/profile.d there is no script that obviously sets things like PATH. Perhaps zeelog's frustration is justified.
No, it's not. A new install of 13.0 WILL have those files. Either you got an incomplete mirror or you did it wrong.
LinuxQuestions.org is looking for people interested in writing
Editorials, Articles, Reviews, and more. If you'd like to contribute
content, let us know.