LinuxQuestions.org
Download your favorite Linux distribution at LQ ISO.
Home Forums Tutorials Articles Register
Go Back   LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie
User Name
Password
Linux - Newbie This Linux forum is for members that are new to Linux.
Just starting out and have a question? If it is not in the man pages or the how-to's this is the place!

Notices


Reply
  Search this Thread
Old 05-02-2008, 12:00 PM   #1
HarryBoy
Member
 
Registered: Apr 2008
Distribution: MontaVista Linux Version 4.0.1, Professional Edition
Posts: 215

Rep: Reputation: 16
add a directory to PATH


I am using Fedora, how do I add a directory to my PATH. Do I do it in bashrc or bash_profile?

What syntax to I use when adding this?

Thanks

harry
 
Old 05-02-2008, 12:14 PM   #2
sirclif
Member
 
Registered: Sep 2004
Location: south texas
Distribution: fedora core 3,4; gentoo
Posts: 192

Rep: Reputation: 30
you put it in your .bashrc file. to add the directory /home/usr/bin to your path, you would just add

PATH="$PATH:/home/usr/bin"
export PATH

the $PATH part makes sure you keep all the other directories in your path. the PATH variable is a string containing directories seperated by colons (, so it will look like

echo $PATH
/usr/bin:/home/usr/bin:/other/directories/bin

etc.
 
Old 05-02-2008, 12:19 PM   #3
HarryBoy
Member
 
Registered: Apr 2008
Distribution: MontaVista Linux Version 4.0.1, Professional Edition
Posts: 215

Original Poster
Rep: Reputation: 16
Thanks

Thanks for your reply,

at the minute my file looks like this:

# .bashrc

# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi

# User specific aliases and functions


where would this new path be inserted??

Thanks again for your help

Harry
 
Old 05-02-2008, 12:22 PM   #4
dv502
Member
 
Registered: Sep 2006
Location: USA - NYC
Distribution: Whatever icon you see!
Posts: 642

Rep: Reputation: 57
Also, to take effect you must logout and login again or
run source /etc/.bashrc

The source command can reread the .bashrc file without you exiting.

Note: Sometimes the PATH variable is in /etc/profile

Last edited by dv502; 05-02-2008 at 12:23 PM.
 
Old 05-02-2008, 12:30 PM   #5
sirclif
Member
 
Registered: Sep 2004
Location: south texas
Distribution: fedora core 3,4; gentoo
Posts: 192

Rep: Reputation: 30
put it after

# User specific aliases and functions

Quote:
Note: Sometimes the PATH variable is in /etc/profile
if you want to change the PATH variable system-wide (for all users), you would want to change it there. if you only want to change if for you account, or you don't have root access, but it in your .bashrc file.
 
Old 05-02-2008, 12:39 PM   #6
HarryBoy
Member
 
Registered: Apr 2008
Distribution: MontaVista Linux Version 4.0.1, Professional Edition
Posts: 215

Original Poster
Rep: Reputation: 16
thanks

thanks a million guys
 
  


Reply



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
Do you add to the path line or make a new path in /etc/profile? M$ISBS Linux - Newbie 2 12-13-2006 02:14 PM
Can't add directory to the PATH hpladd Linux - Newbie 5 07-25-2006 05:17 PM
How to rsynce the actual directory path instead of just the directory at the end of Niceman2005 Linux - General 5 04-08-2005 07:58 PM
I need to add a directory to the search path johnjafa Linux - Software 1 01-06-2005 01:43 PM
How to add a directory to PATH permantely paulmedic555 SUSE / openSUSE 1 11-12-2004 03:58 PM

LinuxQuestions.org > Forums > Linux Forums > Linux - Newbie

All times are GMT -5. The time now is 06:42 AM.

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