Live Chat & Podcast at 1:00PM Eastern on Sunday!
There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
Search
Linux and Unix
Tag Cloud
access acer asus bios bsod computer crash desktop driver drivers error ethernet excel freeze gaming hard drive hardware hdmi internet laptop malware memory modem monitor motherboard network printer problem ram registry router security slow software sound toshiba trojan ubuntu 11.10 uninstall usb video virus vista wifi windows windows 7 windows 7 32 bit windows 7 64 bit windows xp wireless
Search
Search for:
Tech Support Guy Forums > Operating Systems > Linux and Unix >
Adding a permanent directory to my path.

Reply  
Thread Tools
l0f33t's Avatar
Junior Member with 26 posts.
 
Join Date: Aug 2003
08-Aug-2003, 08:10 PM #1
Adding a permanent directory to my path.
Hello,

How do I (specifically)(I'm still a noobian) add a permanent directory to my $PATH.

I'm running Mandrake 9.0 and when I change the path in the shell:


Example:
From the command line:
export PATH="$PATH:/usr/local/apache/bin

If anyone has a link pointing to some doc's on howto do this I would be greatful.

I can't seem to find any specifics though. I believe that this can be done through the set command but I don't know how to make it permanent. I.E. after makeing the changes needed and then I reboot the changes stay/static.

Thanks in advance
__________________
JBanks
twill's Avatar
Member with 44 posts.
 
Join Date: Jul 2003
Location: IA-US
09-Aug-2003, 12:22 AM #2
l0f33t's Avatar
Junior Member with 26 posts.
 
Join Date: Aug 2003
09-Aug-2003, 01:42 AM #3
Thanks Twill,

I study up on this.

Thanks,
l0f33t's Avatar
Junior Member with 26 posts.
 
Join Date: Aug 2003
09-Aug-2003, 01:55 AM #4
Quick question about paths.

I just compiled Apache.

To start Apache or (httpd) (apachectl start)the command is found in/at:
[root@localhost jbanks]# cd /usr/local/apache
[root@localhost apache]# dir
bin cgi-bin conf htdocs icons include libexec logs man proxy
[root@localhost apache]# cd bin
[root@localhost bin]# dir
ab apxs dbmmanage htpasswd logresolve
apachectl checkgid htdigest httpd rotatelogs
[root@localhost bin]# apachectl start
bash: apachectl: command not found

When I'm root my path reads:
echo $PATH
/sbin:/usr/sbin:/bin:/usr/bin:/usr/X11R6/bin:/usr/local/bin:/usr/local/sbin

Correct me if I'm wrong. The reason shell isn't able to execute the command is because I don't have /usr/local/apache/bin in my path. Correct or Not?
I know how to put it in my path via what I intially posted or just by ./apachectl start in the bin directory from the command line.

I keep getting conflicting info's on how to set the PATH environment variable permanently so I will research this thoroghly first before hacking everything up.

Thanks,
__________________
JBanks
ed209's Avatar
Junior Member with 15 posts.
 
Join Date: Aug 2003
Location: Ottawa, Canada
09-Aug-2003, 03:04 AM #5
Depending on your shell (bash, csh, ksh, etc) you have to edit your users startup files in your home directory. These are hidden files, meaning their names are preceeded with a dot. The command to list files in linux is 'ls', I had not previously known that someone had made a dir command, but trust me ls is easier, at least its easier to type right?

Ok so in your home directory do an ls -la to list all hidden files in long form so that you can see everything.

I am going to go out on a limb and guess that you are using bash as your shell ( the format of your export command kind of gives it away but hey I might be wrong), this may not be correct so if you are using a different shell your edits will be in a different file than the ones I suggest.

For bash these are your two startup files to worry about:

~/.bashrc
~/.bash_profile

The tilde preceeding the slash is short form for /home/$username/ this is a variable that you can use for convenience. These files are in essence shell scripts. You can run commands inside of these and everything else but their primary purpose is to setup your users enviroment variables, PATH, LD_LIBRARY_PATH, PS1 etc.

The reason for the two files is one is used for interactive logins and the other is used for non-interactive logins. For more info on this read the bash man page with the command, man bash, the section explaining interactive and non-interactive logins was pretty good. I would recommend reading the whole thing start to finish but no one ever seems to so just do the what I do, search for the topic you need. Depending on your $PAGER of choice ( more or less, or something else ) the way to search is by typing / and then the word you want to find in the file.

If you encounter a line in your .bashrc that reads something like this:

. /etc/profile

What that means is that you source note the space after the dot ( the short hand for source is simply a dot by itself ) a global bashrc in etc. Changes to this file will be global for all users that source it. Sourcing a file basically execs it so that it will be run similarly to your .bashrc.


I hope that helps

ed
Reply

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.

Search Tech Support Guy

Find the solution to your
computer problem!




Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who want to help you solve your computer problems. See our Welcome Guide to get started.
Thread Tools



Facebook Facebook Twitter Twitter TechGuy.tv TechGuy.tv Mobile TSG Mobile
You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -4. The time now is 11:01 PM.
Copyright © 1996 - 2011 TechGuy, Inc. All rights reserved.

Powered by Cermak Technologies, Inc.