2

I need to set path /usr/local/gnupg-2.1/bin to the command line.

I tried to enter "export PATH=/usr/local/gnupg-2.1/bin:$PATH" in the command line, but it works until the terminal session ends.

I tried to create .bash_profile, but I don't know how to create hidden file, where to put it, and what it should contain?

2 Answers 2

3

Open your terminal an paste de following command:

echo "export PATH=/usr/local/gnupg-2.1/bin:$PATH" >> ~/.bash_profile

This will create the file .bash_profile if does not exists and append your command at the end if the file exists.

To create a hidden file you just need to prepend a dot (.) in the file name when you save it (profile -> .profile). That's all you need.

1

.bash_profile resides in your user folder. To create a file (hidden or visible) simply enter touch:

touch ~/.bash_profile

A dot prepending the file name makes the file invisible.

Then open the file with nano and add the line:

nano ~/.bash_profile

Save the content with ctrlO to disk and exit nano with ctrlX

Afterwards you have to source the modified or new .bash_profile file to immediately reflect the changes:

source ~/.bash_profile

A different method (and a one-liner) is:

echo "export PATH=/usr/local/gnupg-2.1/bin:$PATH" > ~/.bash_profile && source ~/.bash_profile

This will overwrite any content in .bash_profile

To append a line in an already existing .bash_profile file use

echo "export PATH=/usr/local/gnupg-2.1/bin:$PATH" >> ~/.bash.profile && source ~/.bash_profile

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .