LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - Newbie (https://www.linuxquestions.org/questions/linux-newbie-8/)
-   -   Where is PATH line located in ubuntu 12.04? (https://www.linuxquestions.org/questions/linux-newbie-8/where-is-path-line-located-in-ubuntu-12-04-a-4175470792/)

jpmcbooks 07-24-2013 02:26 PM

Where is PATH line located in ubuntu 12.04?
 
Where can I modify PATH line in ubuntu 12.04? I typed PATH=$PATH:$HOME
then typed export PATH. Home dir was in path when I looked at it with echo $PATH but went away after I relogged in. How can I make it permanent? and where exactly is it in a file in Ubuntu 12.04?

szboardstretcher 07-24-2013 02:42 PM

you are looking for the bash_profile

its at /home/username/.bash_profile

Firerat 07-24-2013 02:44 PM

The magic is in ~/.profile

do you really want $HOME in path?
it is usual to have $HOME/bin in PATH

this is handled in ~/.profile
Code:

# ~/.profile: executed by the command interpreter for login shells.
# This file is not read by bash(1), if ~/.bash_profile or ~/.bash_login
# exists.
# see /usr/share/doc/bash/examples/startup-files for examples.
# the files are located in the bash-doc package.

# the default umask is set in /etc/profile; for setting the umask
# for ssh logins, install and configure the libpam-umask package.
#umask 022

# if running bash
if [ -n "$BASH_VERSION" ]; then
    # include .bashrc if it exists
    if [ -f "$HOME/.bashrc" ]; then
        . "$HOME/.bashrc"
    fi
fi

# set PATH so it includes user's private bin if it exists
if [ -d "$HOME/bin" ] ; then
    PATH="$HOME/bin:$PATH"
fi

simply creating bin in your home dir will trigger it
Code:

mkdir ~/bin
source ~/.profile

~/ is short for $HOME
an alternative to source ~/.profile is
. ~/.profile
note the "."<space>~/.

If you feel you must have $HOME in $PATH, you can add it ( along with any others you would like ) to the end of ~/.profile

jpmcbooks 07-24-2013 09:44 PM

Quote:

Originally Posted by szboardstretcher (Post 4996091)
you are looking for the bash_profile

its at /home/username/.bash_profile

xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
I type ls -la|less
and .bash_profile does not exist.

jpmcbooks 07-24-2013 09:47 PM

where is PATH
 
FIRERAT:
I did as you said and it works. I also found full Path in /etc/environment.

Thank you

jpmcbooks 07-24-2013 09:50 PM

Solved!
 
I tried to mark this as solved but I got a 502 Bad Gateway error message....?

Just now tried it again and it went ok.


All times are GMT -5. The time now is 03:08 PM.