Today (Saturday) We will make some minor tuning adjustments to MySQL.

You may experience 2 up to 10 seconds "glitch time" when we restart MySQL. We expect to make these adjustments around 1AM Eastern Daylight Saving Time (EDT) US.


Add directory to path permanently


Login or Register to Reply

 
Thread Tools Search this Thread
# 1  
Add directory to path permanently

I ssh in and am trying to add a directory permanently to $PATH in centos 7 and having issues. My current $PATH is

Code:
echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin

but when I do a sudo nano ~/.bashrc
Code:
# .bashrc

# User specific aliases and functions

alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'

# Source global definitions
if [ -f /etc/bashrc ]; then
        . /etc/bashrc
fi
export PATH=/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin

In ubuntu 14.04 I would do the below and that worked great, but it doesn't seem to in centos 7. Thank you Smilie.

Code:
export PATH="$PATH":/usr/bin/gatk-4.0.10.1
source ~/.bashrc

# 2  
I don't see where you added /usr/bin/gatk-4.0.10.1 to your PATH in the .bashrc. I won't ask why it's in /usr/ and not /usr/local/, though Smilie
This User Gave Thanks to Scott For This Post:
# 3  
Code:
export PATH=$PATH:/usr/bin/gatk-4.0.10.1
source ~/.bashrc

echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin

is this not correct? II don't see where the /root/bin is coming from either. Thank you Smilie

I use/usr/bin to make it easier for others on the server to find. Thank you.

update

Code:
export PATH="$PATH":/usr/bin/gatk-4.0.10.1

echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin:/usr/bin/gatk-4.0.10.1

but then after exiting and re-logging in
Code:
echo $PATH
/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/root/bin


Last edited by cmccabe; 10-16-2018 at 03:50 PM.. Reason: added update
# 4  
Perhaps I misread your first post. Did you actually edit your .bashrc to add the path to gatk-4.0.10.1, or just change it on the command line?

(second, probably silly question - are you using bash?).

/root/bin was most likely added to PATH from some default bashrc in /etc, or in .bash_profile in root's home directory.
This User Gave Thanks to Scott For This Post:
# 5  
I just ran the below on the command line. Is there a better more optimal way? Thank you Smilie.

Code:
export PATH="$PATH":/usr/bin/gatk-4.0.10.1

I am using bash although that is a bash command to add to path I think. Thank you very much for the clarification and helpSmilie.
# 6  
Well, if you modify PATH from the command line it will be lost when you end your current session. To make it stick, you need to modify the path in one of your login scripts (e.g. .bashrc or .bash_profile).

This statement confused me, because I don't know why that would be...
Quote:
In ubuntu 14.04 I would do the below and that worked great, but it doesn't seem to in centos 7
This User Gave Thanks to Scott For This Post:
# 7  
added update

I apologize, I would do the below in ubuntu 14.04

Code:
echo export PATH=$PATH:"/usr/bin/gatk-4.0.10.1" >> ~/.bashrc

to update .bashrc, although that doesn't work either. Thank you Smilie.

though if I log out then login, it's fine.

so maybe, source ~/.bashrc after the command?

------ Post updated 10-17-18 at 07:15 AM ------

Thank you very much for your help Smilie.

Last edited by cmccabe; 10-16-2018 at 04:58 PM..
Login or Register to Reply

|
Thread Tools Search this Thread
Search this Thread:
Advanced Search

More UNIX and Linux Forum Topics You Might Find Helpful
NFS with a NAS: permanently inconsistent directory state across clients
cosmojetz
Hi, I am having some NFS directory consistency problems with the below setup on a local (192.) network: 1. Different permissions (chmod) for the same NFS dir are reflected on different clients. 2. (more serious) an NFS dir created on client1 cannot be accessed on client2; this applies to some...... Solaris
10
Solaris
Can't add directory to path correctly
tastybrownies
Hello everyone I am a newcomer to UNIX and I have hit a snag in something that would probably take experienced people about 30 seconds. Long story short I am trying to add a directory to my PATH and it is getting added but not working. I mean, the object of adding it to the path is so I can access...... Shell Programming and Scripting
2
Shell Programming and Scripting
Setting the path permanently using shell script
pjeedu2247
I'm trying to set the path permanently through a shell script. (/opt/quest/bin:/usr/bin/lab to /.profile.) I tired using echo option like below but it doesn't work. Please suggest me the right way to do so. echo "PATH=$PATH:/opt/quest/bin:/usr/bin/lab" >> /.profile... Shell Programming and Scripting
6
Shell Programming and Scripting
Add directory to a global PATH
miltonrods
Guys, I did a search on this but couldn't find any thing. I need to add /home/scadm/scripts to the PATH. If I do the below it works for the session I'm in. If I close it and reopen it doesnt work. PATH=$PATH\:/home/scadm/scripts ; export PATH I also want this path added to all the...... UNIX for Dummies Questions & Answers
3
UNIX for Dummies Questions & Answers
add path variable permanently
burton
Hi, I have added the path variable as below export...... Shell Programming and Scripting
4
Shell Programming and Scripting

Featured Tech Videos