Tuesday, May 20, 2008

Usefull shell commands

1) Unzippin tar.gz
------------------
gzip -cd name_of_the-file.tar.gz | tar xfv -


2)Farwading to dev/null log when start up
----------------------------------------
./start_app.sh &> /dev/null &


3) Redirecting a log to dev/null
-------------------------------
ln -s /dev/null event.log


4) Splitting a file into parts
------------------------------
split -b1024*1024*50 event.log


5)Create multiple directories
-----------------------------
mkdir -p test_data/sap/in


6) Zipping a file
------------------
zip -r zip_file_name.zip dir_name/


7) Get the system usage
------------------------
Create a shaell scrip and add folowing:
uptime >> system_load.log
vmstat >> system_load.log
sar -u 10 1 >> system_load.log


8) Get the heap size in64 bit machine
--------------------------------------
Get the applicatin process id >ps -ef| grep java (say its 19543)
jmap -heap -d64 19543


9) Get the machine IP in Solaris
---------------------------------
/sbin/ifconfig -a


10) Get the capasity of the current directory
----------------------------------------------
du -sh


11) Extract and compress jar files
----------------------------------
1. jar -xvf abc.jar ->extract
2. go to the directory with all the directories, jar -cvf abc.jar * ->compress


12) Extracting a war file
-------------------------
jar -xvf customercare.war

No comments: