How can i add shortcuts like 'rst' for restarting the tomcat in the terminal?
Depends on your desktop environment or how you want to access it.
Do you want a nice icon on your desktop?
Create an application icon (which is the closest equivalent to a MS Windows Shortcut): KDE: Perform a right click in a Folder View and select 'Create new -> Link to Application...'
Do you want it to be available from the bash only?
Create an alias in your ~/.bashrc or ~/.profile:
alias rst='service tomcat restart' # Ubuntu with upstart alias rst='/etc/init.d/tomcat restart' # Other distributions w/o upstart
However note that it will not be available from shell scripts in this case.
Do you want to make it available just like an executable file to bash and shell scripts?
Create a symbolic link in a folder in the PATH. I recommend to create a ~/bin folder, where you can add your personal scripts and links and add this folder to your path in the .bashrc:
Note that some applications might fail to start as the working directory is not set properly. In this case create a shell script in your ~/bin folder that changes to the respective folder first:
#!/bin/sh cd /opt/myAppHomeDirectory ./myapp "$@"
Oh, and don't forget to make this script executable of course using chmod.