Showing posts with label unix. Show all posts
Showing posts with label unix. 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 :-



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 :-




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 :-

25 June, 2015

X Error of failed request: BadFont (invalid Font parameter)


X Error of failed request:  BadFont (invalid Font parameter)


When I was trying to start WebSphere Developer Studio , faced the with below error. And this is very common error in unix. Because , there are many local and international languages.Its basically not able to find the respective font.

dev@jdg-developer-desktop /opt/IBM/WebSphereStudio/ApplicationDeveloper/v5.1.1 $ ./shortcut_wsappdev
Warning: locale not supported by C library, locale unchanged
X Error of failed request:  BadFont (invalid Font parameter)
  Major opcode of failed request:  55 (X_CreateGC)
  Resource id in failed request:  0x0
  Serial number of failed request:  180
  Current serial number in output stream:  184



You need to sure and make the language installed 

sudo apt-get install language-pack-en-base

Now reconfigure some local languages this is of ubuntu (try with super user):

sudo dpkg-reconfigure locales

Now you can try your local language :

locale -a

Now you can set your expected language as per your requirement. I tried all and set in my ubuntu linux machine. It worked for me.

export LC_ALL="en.utf-8"


export LC_ALL="en_US"
export LANG="en_US"
export LANGUAGE="en_NZ"
export C_CTYPE="en_US"
export LC_NUMERIC=
export LC_TIME=en"en_US"


Find more here about locale.




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

Find More :-

28 May, 2015

How to convert epoch to human readable format in UNIX

How to convert epoch to human readable format in UNIX ?


In this example the epoch time is 1432783870. Use the below command to convert the epoch time to human readable time.Technically epoch time known as UNIX time , also known as POSIX time. 

Example :-

dev@javadevelopersguide-developer-desktop ~/Epoch/ $ date -d @1432783870
Thu May 28 13:31:10 EST 2015
dev@javadevelopersguide-developer-desktop ~/Epoch/ $ date -d @1377360000
Sun Aug 25 02:00:00 EST 2013

Find more here.




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

Find More :-