How to permanently add current directory to PATH in Linux?

14

2

Possible Duplicate:
Add folder to PATH

I want to a add a directory to my bash to search in, and I am using the $PATH=.... it works however when I open a new command window it is not there.

How can I permanently add this to the path on Linux?

Syntax_Error

Posted 2011-10-26T16:14:09.480

Reputation:

Question was closed 2011-10-28T11:56:59.873

Related topic. – Daniel Beck – 2011-10-26T16:25:24.250

3A remark: adding the current working directory to your path is considered very dangerous. You cannot move around safely in any filesystem anymore. Just imagine, someone places a script called "ls" in his home or any directory which calls "rm -f" on your home or any other sensitive files. – barbaz – 2011-10-26T19:57:22.577

Answers

14

Add a PATH=$PATH:. line to your ~/.bashrc. See this question for details.

jpalecek

Posted 2011-10-26T16:14:09.480

Reputation: 453

1should you mount a filesystem peppered with malicious executable files or share a box with a bunch of clowns, then prepend your path and cd to such a silly directory, suggest you aws ec2 terminate-instances or docker rmi with prejudice – nik.shornikov – 2017-01-08T20:30:54.597

13Bear in my that adding current folder to the path is security risk, it exposes user of never knowing if its running command from some unsecured folder or a normal system command ( 'ls' for example) – bbaja42 – 2011-10-26T16:48:53.707

5And before someone claims that adding the current directory at the end of PATH is safe, an attacker can still run code as you by creating a program or script named after misspelled commands, such as mroe, tial, vmi, emasc, etc. Those won't be found earlier in the path, and then you end up running the attacker's code as you. – Fran – 2012-06-08T20:42:34.103