In Linux, you can assign short keys to commands you are required to run more often. These are called ‘alias’ and could be added in your .bashrc file. This really helps in quickly doing things and also avoid unnecessary mistakes while writing the commands. Below are some example:
To list all the files in current directory, including hidden files, you can assign a short key for it, say "ls" like mentioned below:
To get the running process:
To have these effective, run "source .bashrc" command.
NOTE: $JBOSS_HOME is an environment variable set as follows:
export JBOSS_HOME=/home/systest/web/jboss/jboss-5.1.0.GA
To list all the files in current directory, including hidden files, you can assign a short key for it, say "ls" like mentioned below:
alias
ls="ls -a"
View some properties file at particular location:
alias
vdp="vi $JBOSS_HOME/server/default/conf/props/some.properties"
alias
jbp="ps -ef | grep jboss"
To view logs:
alias
tlog="tail -f $JBOSS_HOME/bin/nohup.out"
Remove some files inside a directory:
alias
clrjb="rm -rf $JBOSS_HOME/server/default/work/jboss.web"
Changing directory:
alias
jb="cd $JBOSS_HOME/bin"
Beside this, the most useful is
one here under. You can use this as “update <relative_directory_path>” to
perform some steps in a sequence, one after another. This is called 'function' in linux, and are slightly different from alias, as they expect argument to be passed to them.
function
update () {
cd $SRC_HOME/"$1";
mvn
clean install -DskipTests -o -e;
cd
$SRC_HOME/someOtherFolder;
mvn
clean generate-resources -o -e;
cd
$JBOSS_HOME/bin/;
sh
runit.sh;
tail
-f $JBOSS_HOME/bin/nohup.out;
}
To have these effective, run "source .bashrc" command.
NOTE: $JBOSS_HOME is an environment variable set as follows:
export JBOSS_HOME=/home/systest/web/jboss/jboss-5.1.0.GA
Enjoy!