Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

how do I teach a new command to the terminal? 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:

tools/phpunit/vendor/bin/phpunit

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

share|improve this question

1 Answer 1

up vote 2 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.

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 at 18:11

Your Answer

 
discard

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.