Showing posts with label Linux. Show all posts
Showing posts with label Linux. Show all posts

23 January, 2017

Vi editor ubuntu terminal is not working properly

Ubuntu terminal is not working properly in vi editor



As we all know vi editor is one of the major editing tool for developers. Sometimes its obvious to handle the issue if its not response properly. There are few scenario where this kind of behavior occurs. 


If you have newly installed the ubuntu , or you have not updated the terminal with latest update. 

Just try to update the terminal by using below command.

sudo apt-get update


Now check your vi editor behavior , if not yet resolved then try the below command to install the vi (vim) editor.

Install Vim Editor using below command :-

sudo apt-get install vim


Now check your vi editor, I hope its fixed. It worked for me and its working awasome :)



Hope this will help you!!!

Follow for more details on Google+ and @Facebook!!!

Find More :-



20 November, 2016

How to set java version in Linux

How to set java version in Linux or Unix.


Here I have used Linux Mint, but this setup can work for other Linux distributions. 

Checking the existing java version on your linux machine.
dev@developer-desktop ~ $ java -version
java version "1.6.0_36"
OpenJDK Runtime Environment (IcedTea6 1.13.8) (6b36-1.13.8-0ubuntu1~12.04)
OpenJDK 64-Bit Server VM (build 23.25-b01, mixed mode)

 

The above command shows the existing java version installed on this machine. Now I can check the alternative version to set. These alternative versions are available for installation. The below command will prompt with sudo password and selection number. Try with below command :


dev@developer-desktop ~ $ sudo update-alternatives --config java
[sudo] password for dev: ***********
There are 3 choices for the alternative java (providing /usr/bin/java).

  Selection    Path                                            Priority   Status
------------------------------------------------------------
* 0            /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java   1061      auto mode
  1            /usr/bin/gij-4.6                                 1046      manual mode
  2            /usr/lib/jvm/java-6-openjdk-amd64/jre/bin/java   1061      manual mode
  3            /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java   1051      manual mode

Press enter to keep the current choice[*], or type selection number: 3
update-alternatives: using /usr/lib/jvm/java-7-openjdk-amd64/jre/bin/java to provide /usr/bin/java (java) in manual mode.

In the above command, I have opted the Selection 3 , because I want java 1.7 version. You can choose as per your requirements. 


Now you can check whether version 7 is installed or not ? Try the check version command again as below.

dev@developer-desktop ~ $ java -version
java version "1.7.0_79" -----> This is newly installed.
OpenJDK Runtime Environment (IcedTea 2.5.6) (7u79-2.5.6-0ubuntu1.12.04.1)
OpenJDK 64-Bit Server VM (build 24.79-b02, mixed mode)




Hope this will help you.








Follow for more details on Google+ and @Facebook!!!

Find More :-


30 June, 2016

How to test web service using command line curl

How to test web service using command line curl.


How to test web service using command line curl, is a very often requirement.

This is always very easy to call the web service via a java client,  but sometimes we need to call the service using curl.

One thing you know ? its really very tactical to  call the web service from terminal/command line using curl command.


I have  steps with sample example :-


You need to know the below things before calling the service via curl.

Service Endpoint - The web service endpoint you want to call.

Example - http://myserverip.mycorpnet.com.au:16500/NaaSAutomation/NaaSManageService

Operation Name - The operation name , you want to execute.

Example - readProviderRequest

SoapAction - The soap action defined in WSDL.

Example - SOAPAction:/NaaSAutomation/Resources/WSDLs/ESB/Service/NaaSManageService-service0.serviceagent/NaaSManageServicePortEndpoint0/ManageProviderRead

Create sample valid request xml for sending to the service.

Request.xml
------------------

<soapenv:Envelope xmlns:soapenv="http://schemas.xmlsoap.org/soap/envelope/" xmlns:dto="http://dto.service.myservice.networkservice.test.service.mycorp.com.au/">
   <soapenv:Header/>
   <soapenv:Body>
      <dto:readProviderRequest>
         <callerIdentity>myIdentity</callerIdentity>
         <dto:ProviderName>JDevelopersGuide</dto:ProviderName>
      </dto:readProviderRequest>
   </soapenv:Body>
</soapenv:Envelope>



Curl Command :-

curl --header "Content-Type: text/xml;charset=UTF-8" --header "SOAPAction:/NaaSAutomation/Resources/WSDLs/ESB/Service/NaaSManageService-service0.serviceagent/NaaSManageServicePortEndpoint0/ManageProviderRead" --data @Request.xml http://myserverip.mycorpnet.com.au:16500/NaaSAutomation/NaaSManageService



Response got from Curl :-



<SOAP-ENV:Envelope xmlns:SOAP-ENV="http://schemas.xmlsoap.org/soap/envelope/">
   <SOAP-ENV:Body>
      <ns0:ManageProviderCreateRes xmlns:ns0="http://www.mycorpnet.com.au/NaaSAutomation/Resources/Schemas/CreateRequest.xsd">
         <ns0:response>
            <ns0:providerName>JDevelopersGuide</ns0:providerName>
            <ns0:createStatus>SUCCESS</ns0:createStatus>
            <ns0:rollbackInitiated>TRUE</ns0:rollbackInitiated>
         </ns0:response>
      </ns0:ManageProviderCreateRes>
   </SOAP-ENV:Body>
</SOAP-ENV:Envelope>



Hope it will help you.
Follow for more details on Google+ and @Facebook!!!

Find More :-

22 January, 2016

Linux / Unix: Find And Remove Files With One Command

Linux / Unix: Find And Remove Files With One Command.




This is really very easy in Linux/Unix. This is the reason why Linux/Unix is so popular in most of the industries.  

COMMAND :-

find - search for files in a directory hierarchy
 


SYNOPSIS 

find [-H] [-L] [-P] [-D debugopts] [-Olevel] [path...] [expression]

SYNTAX

find <dir-name> <criteria> <action>

dir-name - The directory which you want to search.
criteria - This is searching criteria, what you want to search.
action(if required) - This is command action you want to execute.

There are many options or expressions you can use to find your relevant files and folders.

Example :- The below command for finding all files with extension .xml


dev@jdg-developer-desktop ~ $ find soap_projects/  -name "*.xml"
 

soap_projects/folk-enabler-no-sec--soapui-project.xml
soap_projects/aim-localhost-tomcat-soapui-project.xml
soap_projects/roamenable-service-soapui-project.xml
soap_projects/search-enabler-soapui-project.xml


Find all the files , which file name contains "data" and extensions with .txt

dev@jdg-developer-desktop ~/workspace_test $ find .  -name "*data*.txt"  

./test_data_file.txt



Example for finding and delete all all files with "find" command.


find . -name "*data*.txt" -exec rm -rf {} \;

Example for finding and delete all .xml files.

find / -name "*.xml" -exec rm -f {} \;


Example for finding and delete all .xml files.

find /searchdirectory -name "*.xml" -exec rm -f {} \;


Delete command for all file with find command result :-

-exec rm -rf {} \;



Hope it will help you.



Follow for more details on Google+ and @Facebook!!!

Find More :-




23 December, 2015

How to install SQLPLUS client in linux

 How to install SQL * PLUS client in Linux ?


Its really very simple steps to do this, and very crazy while dependency for compatibility with OS (x32 bit or x64 bit).

I have done for x64 bit Linux UBUNTU. Usally Oracle provides .rpm packages , and you need to download those packages into  your machine.

Download here.

Assuming that you have already installed Oracle Database , else you are connecting some remote database. Because, this post only show the sqlplus installation to connect existing database.

Downloaded files :-

oracle-instantclient12.1-basic-12.1.0.2.0-1.x86_64.rpm
oracle-instantclient12.1-devel-12.1.0.2.0-1.x86_64.rpm
oracle-instantclient12.1-sqlplus-12.1.0.1.0-1.x86_64.rpm

Copy these files to your prefered location. I have  used below location.

/usr/java


Now time for convert these .rpm packages into debian specific package and install on your Ubuntu. Use alien command to convert.


Follow the below steps and install one-by-one.

First install the sqlplus :-


dev@javadevelopersguide-developer-desktop /usr/java $ sudo alien -i oracle-instantclient12.1-sqlplus-12.1.0.1.0-1.x86_64.rpm

[sudo] password for dev:

dpkg --no-force-overwrite -i oracle-instantclient12.1-sqlplus_12.1.0.1.0-2_amd64.deb

Selecting previously unselected package oracle-instantclient12.1-sqlplus.

(Reading database ... 226951 files and directories currently installed.)

Unpacking oracle-instantclient12.1-sqlplus (from oracle-instantclient12.1-sqlplus_12.1.0.1.0-2_amd64.deb) ...

Setting up oracle-instantclient12.1-sqlplus (12.1.0.1.0-2) ...


Second install the basic (packages) :-


dev@javadevelopersguide-developer-desktop /usr/java $ sudo alien -i oracle-instantclient12.1-basic-12.1.0.2.0-1.x86_64.rpm
dpkg --no-force-overwrite -i oracle-instantclient12.1-basic_12.1.0.2.0-2_amd64.deb

Selecting previously unselected package oracle-instantclient12.1-basic.

(Reading database ... 226963 files and directories currently installed.)

Unpacking oracle-instantclient12.1-basic (from oracle-instantclient12.1-basic_12.1.0.2.0-2_amd64.deb) ...

Setting up oracle-instantclient12.1-basic (12.1.0.2.0-2) ...

Processing triggers for libc-bin ...

ldconfig deferred processing now taking place
 

Third install the devel :-




dev@javadevelopersguide-developer-desktop /usr/java $ sudo alien -i oracle-instantclient12.1-devel-12.1.0.2.0-1.x86_64.rpm

dpkg --no-force-overwrite -i oracle-instantclient12.1-devel_12.1.0.2.0-2_amd64.deb

Selecting previously unselected package oracle-instantclient12.1-devel.

(Reading database ... 226981 files and directories currently installed.)

Unpacking oracle-instantclient12.1-devel (from oracle-instantclient12.1-devel_12.1.0.2.0-2_amd64.deb) ...

Setting up oracle-instantclient12.1-devel (12.1.0.2.0-2) ...

Once these installation complete, you can start sqlplus using below command. Either you can use your specific user/password with correct server address.


dev@javadevelopersguide-developer-desktop /usr/java $ sqlplus / as sysdba

Good to go if no error, else follow with fixing below !! Good luck.


Note - You may face the below library missing issue while executing sqlplus command. Error below :-


dev@javadevelopersguide-developer-desktop /usr/java $ sqlplus / as sysdba

sqlplus: error while loading shared libraries: libsqlplus.so: cannot open shared object file: No such file or directory



Now this issue saying the lib is not loading, the sqlplus is complaining about the missing library.


So you need to edit the oracle.conf and provide the correct lib path (i.e : /usr/lib/oracle/12.1/client64/lib).Add this path into oracle.conf file.




dev@javadevelopersguide-developer-desktop /usr/java $ sudo vi /etc/ld.so.conf.d/oracle.conf

/usr/lib/oracle/12.1/client64/lib





Now, you should be able to connect to your preferred Database. I have connected to our remote server as below :



dev@javadevelopersguide-developer-desktop /usr/java $ sqlplus my_user/my_password@z2customdb01.ztest/z2custom.zenv.mycompanyadd.com.in
SQL*Plus: Release 12.1.0.1.0 Production on Wed Dec 23 16:30:02 2015
Copyright (c) 1982, 2013, Oracle. All rights reserved.
Last Successful login time: Wed Dec 23 2015 16:18:22 +11:00

Connected to:

Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production

With the Partitioning option
SQL>

SQL>



Yes, its working. Hope it will help you.




Follow for more details on Google+ and @Facebook!!!

Find More :-

11 September, 2015

How to find list of all open files in Linux/UNIX

How to find list of all open files in Linux/UNIX


Its really very simple to find the list of open files on UNIX/Linux. As you know linux/unix kernel has many powerful commands which helps a lot.

For checking the list of all open files on your system, you can use the command

Command :-

lsof

lsof - list open files , this has many command options.Some important options as below :

-p - for specific PID
-u - for specific user


Example :-

lsof -u manoj


Output :-

lsof      9963 manoj  mem       REG                8,1     52120 11276171 /lib/x86_64-linux-gnu/libnss_files-2.15.so
lsof      9963 manoj  mem       REG                8,1     47680 11276175 /lib/x86_64-linux-gnu/libnss_nis-2.15.so
lsof      9963 manoj  mem       REG                8,1     97248 11276165 /lib/x86_64-linux-gnu/libnsl-2.15.so
lsof      9963 manoj  mem       REG                8,1     35680 11276167 /lib/x86_64-linux-gnu/libnss_compat-2.15.so
lsof      9963 manoj  mem       REG                8,1   7224832  5511486 /usr/lib/locale/locale-archive
lsof      9963 manoj  mem       REG                8,1   1815224 11276120 /lib/x86_64-linux-gnu/libc-2.15.so
lsof      9963 manoj  mem       REG                8,1    149280 11276100 /lib/x86_64-linux-gnu/ld-2.15.so
lsof      9963 manoj  mem       REG                8,1     26258  5769171 /usr/lib/x86_64-linux-gnu/gconv/gconv-modules.cache
lsof      9963 manoj    0u      CHR              136,0       0t0        3 /dev/pts/0
lsof      9963 manoj    1u      CHR              136,0       0t0        3 /dev/pts/0
lsof      9963 manoj    2u      CHR              136,0       0t0        3 /dev/pts/0
lsof      9963 manoj    3r      DIR                0,3         0        1 /proc
lsof      9963 manoj    4r      DIR                0,3         0    64363 /proc/9963/fd
lsof      9963 manoj    5w     FIFO                0,8       0t0    64368 pipe
lsof      9963 manoj    6r     FIFO                0,8       0t0    64369 pipe
lsof      9964 manoj  cwd       DIR                8,1      4096  3932162 /home/manoj
lsof      9964 manoj  rtd       DIR                8,1      4096        2 /
lsof      9964 manoj  txt       REG                8,1    131312  5505664 /usr/bin/lsof
lsof      9964 manoj  mem       REG                8,1     52120 11276171 /lib/x86_64-linux-gnu/libnss_files-2.15.so
lsof      9964 manoj  mem       REG                8,1     47680 11276175 /lib/x86_64-linux-gnu/libnss_nis-2.15.so
lsof      9964 manoj  mem       REG                8,1     97248 11276165 /lib/x86_64-linux-gnu/libnsl-2.15.so
lsof      9964 manoj  mem       REG                8,1     35680 11276167 /lib/x86_64-linux-gnu/libnss_compat-2.15.so
lsof      9964 manoj  mem       REG                8,1   7224832  5511486 /usr/lib/locale/locale-archive
lsof      9964 manoj  mem       REG                8,1   1815224 11276120 /lib/x86_64-linux-gnu/libc-2.15.so
lsof      9964 manoj  mem       REG                8,1    149280 11276100 /lib/x86_64-linux-gnu/ld-2.15.so


Apart from there are many other options you can use to find more powerful lsof command.

Example 2:-

manoj@manoj-HP-ProBook-6450b:~$ ps -ef | lsof -p 9987
COMMAND    PID USER   FD      TYPE DEVICE SIZE/OFF NODE NAME
kworker/u 9987 root  cwd   unknown                      /proc/9987/cwd (readlink: Permission denied)
kworker/u 9987 root  rtd   unknown                      /proc/9987/root (readlink: Permission denied)
kworker/u 9987 root  txt   unknown                      /proc/9987/exe (readlink: Permission denied)
kworker/u 9987 root NOFD                                /proc/9987/fd (opendir: Permission denied)




Hope it will help you.
Follow for more details on Google+ and @Facebook!!!

Find More :-

20 June, 2015

How to install jd-gui ?

How to install graphical java decompiler (jd-gui) ?


Really this is very basic and very useful when you want to decompile the existing old legacy code . I faced this kind of situation many times and did the same thing. I am sharing this because it may help you .

I am using Linux (Ubuntu Maya). But, you can try with any other Linux distributions even windows OS also. You need to download the 

Download from here.


You  need to download the.tar.gz file  ( jd-gui-0.3.5.linux.i686.tar.gz) for Linux. Then extract the file and go to jd-gui-0.3.5.linux.i686 folder. You can extact via below command else you can try by right+click on the file and extract.

tar -xvf jd-gui-0.3.5.linux.i686.tar.gz

Check there are such below files in that directory.
dev@jdg-developer-desktop ~/Downloads/jd-gui-0.3.5.linux.i686 $ ls -ltr
total 1100
drwx------ 3 dev dev    4096 Aug 29  2012 contrib
-rwxrwxr-x 1 dev dev 1111160 Oct 16  2012 jd-gui
-rw-r--r-- 1 dev dev    2462 Oct 16  2012 readme.txt
-rw-r--r-- 1 dev dev     317 Jun  4 14:15 jd-gui.cfg
dev@jdg-developer-desktop ~/Downloads/jd-gui-0.3.5.linux.i686 $ 

Execute the jd-gui and open the application :
dev@jdg-developer-desktop ~/Downloads/jd-gui-0.3.5.linux.i686 $ ./jd-gui  




You can import multiple jar files for decompile and see the code.

Note - You may get some kind of library missing error , but it depends on you operating system.Whether you are using Fedora,Mint ,Cent Os or Ubuntu. So, you need to install the respective lib and need to update the OS terminal if required.You need to install the below extra libraries if its asking.

 sudo apt-get install libgtk2.0-0:i386 libxxf86vm1:i386 libsm6:i386 lib32stdc++6


I have fixed in my desktop, because of this missing lib I was getting some kind of library missing error. But you can fix this and TRY........Good Luck.




Follow for more details on Google+ and @Facebook!!!

Find More :-