Friday, February 27, 2015

Linux and Maven Commands

mvn -Dmaven.test.skip=true -e clean install
mvn clean install

mvn clean install -Dmaven.test.skip=true

telnet  9012
telnet <machine_IP> <port>

Sudo su
Su -
sudo -u dev2adm  -i
ps -ef|grep jboss

Find a folder
Just find directories and skip file names pass the -type d option as follows:
find  / -type d -name "apt" -ls

locate httpdocs

Delete latest 3 files:
rm -f $(ls -1t ./ | head -3)   working fine

ls -d -1tr /path/to/folder/* | head -n -10 | xargs -d '\n' rm -f

rm -f $(ls -1t ./ | tail -n +4)

netstat -ln | grep '80 ' | grep 'LISTEN'
netstat -atnp|grep LISTEN 

netstat -ln | grep '99 ' | grep 'LISTEN'
 netstat -ln | grep '16'

 scp -pr Services-0.0.2-SNAPSHOT.war sbiswas@

tail -f /tmp/Liferay-JBoss.out |grep 'PAGENAME\|tabName'

grep 'PAGENAME\|tabName'  for multiple search

:/ERROR   for ERROR search in VI
:set nu   for line no

grep -r devapp214 ./|grep tst2
./ -s

./ -s
find ./ -name

sdiff  ./pdf.css  /opt/dev2adm/liferay-portal-6.0-ee-sp2/jboss-5.1.0/server/default/deploy/PDMPortlet.war/css/pdf.css

unzip ServicesConf-0.0.2-SNAPSHOT.rar

du -k | sort -nr | head -25

 to check the env setup:

To check the current shell:

grep ts2adm /etc/passwd

. ./.bashrc

Disk used:
Df -h
du -sh 

To show the details of soft link
ls -ltr
lrwxrwxrwx 1 opadm opadm   13 Jun  5 15:39 ->

date +%Y%m%d -s "20081128"
date +%T -s "11:18:00"

Gives the time stamp

Stat file.txt

newest=$(find subdir -newer timestamp -printf "%A%p\n" |
                sort -n |
                tail -1 |
                cut -d: -f2- )
     touch -r "${newest:-timestamp}" timestamp
The command above works by generating a list of the timestamps and names of all the files which are newer than the timestamp. The sort, tail and cut commands simply pull out the name of the file with the largest timestamp value (that is, the latest file). The touch command is then used to update the timestamp,
The "${newest:-timestamp}" expression simply expands to the value of $newest if that variable is set, but to timestamp otherwise. This ensures that an argument is always given to the ‘-r’ option of the touch command.

java -Denv=ts2 -DpropertyPath=/opt/ts2adm/ -jar dalIdClient.jar &