Using bash aliases to shorten lengthy commands

Table of contents

No heading

No headings in the article.

I remember my times using Lumen. I did not know composer scripts back then so I had to type vendor/bin/phpunit painstakingly when running my tests.

I used bash aliases to shorten commands. I have the alias created on my Dockerfile on build-time. Like so:

# Add bash alias for PHPUnit
RUN echo 'alias phpunit="vendor/bin/phpunit"' >> ~/.bashrc
RUN source ~/.bashrc

After building the image, there is no need to type the lengthy command anymore. Just run the new alias and my tests would run as usual!

$ phpunit

Moreover, you can make use of the same technique and create bash aliases for other lengthy commands in your Docker container.