Make programming a bit easier in Linux

Restarting services or killing them are the must repeated activities that I have to do during current project. Running maven commands and deleting ‘.svn‘ folders are so easy but those take time too. By the other hand all of them should accomplish in the operating system shell. Sometimes more than ten times per a day I have ran this commands. Moreover, everyone knew that it could be much easier to develop simple Linux bash scripts or define Aliases which contains more usage commands. Then, I developed below scripts and define some aliases to make it easier. is a bash script which kills my Java processes that consists ‘javaagent‘ keyword. The application needs javaagent‘ as VM parameter; so, I am looking for it to kill the right process.

for i in `psef | grep javaagent | cut -c10-14`
/bin/kill $i
echo ” $i has killed.”
if [ $(ps ax | grep -c javaagent) -gt 1 ] ; then
echo “NOTE: There are more alive java process yet!!!”
echo “DONE”
fi removes .svn folders recursively.

echo “Warning!!!”
echo “CHECK BELOW PATH. This will remove all .svn folders recursively!!!”
read -p “Are you sure (yes/no)? “
[ “$REPLY” == “yes” ] && rm –rf `find . -type d -name .svn` && echo “all .svn folders have been removed!!!”

Also I added below lines at the end of .bashrc file:

alias lt=’ls -alt | head -20′
alias ld=”ls –al -d * | egrep ‘^d'”
alias c=”mvn clean”
alias ci=”mvnPdevDskipTests clean install”
alias i=”mvnPdevDskipTests install”
alias jkill=”/bin/”
alias rmsvn=”/bin/”
alias go=”cd /home/amir/projects/company/jcb2″
alias dpiproxy=”sudo cp -f /etc/tor/torrc.dpi /etc/tor/torrc
alias noproxy=”sudo cp -f /etc/tor/torrc.noproxy /etc/tor/torrc
alias tor=”sudo /etc/init.d/tor restart”
Now, compiling, cleaning and killing processes are much easier…

This entry was posted in Linux. Bookmark the permalink.

Leave a Reply