LinuxQuestions.org
Share your knowledge at the LQ Wiki.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware
User Name
Password
Slackware This Forum is for the discussion of Slackware Linux.

Notices


Reply
  Search this Thread
Old 12-09-2009, 10:22 AM   #1
zeelog
Member
 
Registered: Jan 2008
Posts: 139

Rep: Reputation: 1
Editing the PATH environment


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.
 
Old 12-09-2009, 10:26 AM   #2
sahko
Senior Member
 
Registered: Sep 2008
Distribution: Slackware
Posts: 1,041

Rep: Reputation: Disabled
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

Last edited by sahko; 12-09-2009 at 10:28 AM.
 
Old 12-09-2009, 10:27 AM   #3
zordrak
Member
 
Registered: Feb 2008
Distribution: Slackware
Posts: 595

Rep: Reputation: 116Reputation: 116
Are you in the right forum? Slackware does still have PATH set in /etc/profile. Your post tag suggests you're coming from Ubuntu..

Also look at /etc/profile.d
 
Old 12-09-2009, 10:28 AM   #4
brianL
LQ 5k Club
 
Registered: Jan 2006
Location: Oldham, Lancs, England
Distribution: Slackware64 15; SlackwareARM-current (aarch64); Debian 12
Posts: 8,299
Blog Entries: 61

Rep: Reputation: Disabled
There's a PATH in my /etc/profile:
Code:
# Set the default system $PATH:
PATH="/usr/local/bin:/usr/bin:/bin:/usr/games:/usr/share/texmf/bin"
 
Old 12-09-2009, 10:35 AM   #5
tux_dude
Member
 
Registered: Dec 2008
Distribution: Slackware64 Current
Posts: 277

Rep: Reputation: 41
Maybe you should look more closely. Then the improvement would not be "useless". For slackware PATH is set in /etc/profile and /etc/profile.d
 
Old 12-09-2009, 12:24 PM   #6
Woodsman
Senior Member
 
Registered: Oct 2005
Distribution: Slackware 14.1
Posts: 3,482

Rep: Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546
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.

Another method is to use the bash startup scripts.

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.
 
Old 12-09-2009, 06:19 PM   #7
patostevens
Member
 
Registered: Dec 2007
Location: Kennewick,WA
Distribution: Slackware 14
Posts: 172

Rep: Reputation: 21
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.
 
Old 12-09-2009, 07:10 PM   #8
Woodsman
Senior Member
 
Registered: Oct 2005
Distribution: Slackware 14.1
Posts: 3,482

Rep: Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546Reputation: 546
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?
 
Old 12-10-2009, 09:30 PM   #9
zeelog
Member
 
Registered: Jan 2008
Posts: 139

Original Poster
Rep: Reputation: 1
Editing the PATH environment

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.
 
Old 12-11-2009, 12:02 AM   #10
rworkman
Slackware Contributor
 
Registered: Oct 2004
Location: Tuscaloosa, Alabama (USA)
Distribution: Slackware
Posts: 2,559

Rep: Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351Reputation: 1351
Quote:
Originally Posted by patostevens View Post
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.
 
Old 12-11-2009, 02:55 AM   #11
zordrak
Member
 
Registered: Feb 2008
Distribution: Slackware
Posts: 595

Rep: Reputation: 116Reputation: 116
Quote:
Originally Posted by zordrak View Post
Are you in the right forum?
Quote:
Originally Posted by zeelog View Post
I must appologize ! I have the WRONG forum.
* Zordrak eats a green 1up mushroom
 
  


Reply

Tags
editing, environment, path, variable



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
editing library environment variable -- shojaru Linux - Newbie 3 06-13-2009 07:55 AM
Editing the PATH Environment Varialbe spangler Linux - General 6 11-21-2008 10:02 AM
editing $PATH resist_r Linux - Newbie 3 07-09-2005 09:33 PM
PATH editing... Jester888 Linux - Newbie 2 01-23-2002 08:13 PM
Editing the PATH Cichlid Linux - General 3 01-06-2002 07:47 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Distributions > Slackware

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

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
Open Source Consulting | Domain Registration