Ask Ubuntu is a question and answer site for Ubuntu users and developers. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I'm a long time Windows user and how I usually do this in Windows is to edit the environment path and add the file path to the command that I want to use. Like when I want to use PHPUnit I just add this path to the environment variables:


And then I can just use phpunit file_test.php to run my tests. How do I do that in Ubuntu?

share|improve this question
up vote 5 down vote accepted

Add the complete path of phpunit to ~/.bash_profile like this

export PATH=$PATH:tools/phpunit/vendor/bin/phpunit

Thats it :)

Make sure that you are adding the complete path of phpunit. This is same as setting the environment variable PATH in Windows. $PATH will retain the values of PATH variable and we are just appending the location of phpunit to it.

**If the ~/.bash_profile is not present you can add the line at the end of ~/.bashrc.

share|improve this answer
thanks! but where do I find this bash_profile? – Ieyasu Sawada May 19 '13 at 5:04
Open a terminal by Ctrl+Alt+T. Type gedit ~/.bash_profile. In the editor which opens up, add that line, with the complete path to phpunit and save it. – thefourtheye May 19 '13 at 5:26
For me it had to be path to directory not a file. – Esamo Aug 16 '14 at 18:11
@heemayl your edit is badly formatted (** at the beginning of the last line), can you please fix it? – A.L Apr 7 '15 at 9:47
@A.L: I have added that line as a caveat..the ** are not for bold-ing, those are there for indicating a note. – heemayl Apr 7 '15 at 9:50

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.