Sunday, April 21, 2013

Some Useful terminal commands for me


Building The Project


Build the project with all test cases
mvn install

Build the project by telling Maven to perform clean action in each module before running the install action. This will clear any compiled files you have and making sure that you're really compiling each module from scratch
mvn clean install

Build the project with all the test cases
mvn install -Dmaven.test.skip=true

When we use npu(no plugin update) flag maven won't check for updates on already downloaded packages and this will only download missing packages.
mvn install -npu -Dmaven.test.skip=true

This tee command can be used to export the terminal output for later referance.
mvn install -npu -Dmaven.test.skip=true | tee /home/manoj/Desktop/buildLog.txt


Running Carbon Server

Run the server
./wso2server.sh 

Run the server with OSGI console
./wso2server.sh -DosgiConsole

Run the server in remote debug mode (you need to configure remote debug in your configurations on your IDE)
./wso2server.sh --debug 5005


Creating and Applying Patch Files

To create a patch file execute from the directory location you required
svn diff > /home/manoj/Desktop/modify.txt

To apply a patch file execute from the directory location you required
patch -p0 < /home/manoj/Desktop/carbon-utils.patch

To display svn log history with specific limit (here 4 logs)
svn log -v --limit 4

To display current diff from the checkout copy
svn diff

String Find and Replace

Find a string recursively 
grep -r "text need to find" /etc/

Find a string on specific set of files
grep '4.3.0)' -R . --include pom.xml (ex: grep '4.3.0)' -R . --include pom.xml)

Find & replace a text StringOne from StringTwo
find . xargs sed -i 's/StringOne/StringTwo/g'

Find & replace a text StringOne from StringTwo from specific set of files(ex: from pom.xml files)
find . -name 'pom.xml'|xargs sed -i 's/StringOne/StringTwo/g'

Some other useful codes

Extract content of tar file
tar xvzf foo.tgz

Change user privilage of a file
chmod 777 wso2server.sh 

To edit bashrc file
gedit ~/.bashrc

To open 'Task Manager' on the terminal
top

No comments:

Post a Comment