Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

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

Every time I need to start or stop Tomcat, I am navigating to:


and once I am in the folder I enter:


And to stop the server, I navigate to the same directory and enter:


I was wondering if there was a way in Linux to alias the above described process, so that from any location in the filesystem, I can simply type in something like

StartTomcat or StopTomcat to perform the Startup and Shutdown of the web-server?

share|improve this question
up vote 2 down vote accepted

You don't even need to navigate to these directories. Just use the full paths instead:


With those, you can create an alias, as you said:

alias StartTomcat='/Tomcat_Dir/bin/'
alias StopTomcat='/Tomcat_Dir/bin/'

Add these lines to your ~/.bash_profile, ~/.profile, or ~/.bashrc (whichever you're using – what is the difference?), restart the shell, and you're done.

share|improve this answer
This is great. I had to use sudo alias StartTomcat='sudo /Tomcat_Dir/bin/' – Andrew Johnston May 25 at 16:14

I know of three easy options -

1) You can add the /Tomcat_Dir/bin to your PATH.

open your .bashrc and edit/add the following


2) Add links to the startup and shutdown scripts in you bin directory.

ln -s /Tomcat_Dir/bin/ /bin/

ln -s /Tomcat_Dir/bin/ /bin/

3) Alias the startup and shutdown scripts.

alias Tomstart='/Tomcat_Dir/bin/'

alias Tomstop='/Tomcat_Dir/bin/'

share|improve this answer

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.