Friday, 1 November 2019

Setting default configuration in putty , to apply on all the server sessions

Hi All,

One may come across situations when one have to work with multiple linux servers.
And the default putty configuration is not convenient. One ends up modifying the configuration every time a new session is opened.

This can be simplified by saving the settings as Default Settings as highlighted in the below snapshot:



Just configuration the session as you want (i.e. update the Appearance settings etc) and then save this settings as Default_Settings!!

Tuesday, 29 October 2019

Self levitating holy stone at Kamar ali durvesh dargah!

It's rightly said, faith can move mountains. Although, we may not be able to witness such a thing, we can definitely witness faith moving a fragment of it, in the holy Kamar ali durvesh dargah. Situated on the pune-satara highway, is this 700 years old dargah. Devotees from all walks of life throng here round the year to witness this miracle first hand.







Even science has not been able to explain the miracle of self levitating holy stone. This stone is around 90kgs in weight. But when 11 people come together, place their index finger below this stone, and chanting the holy name of 'Kamar ali durvesh' lift the stone to nearly 10 feet above the ground, we are naturally inclined to believe that miracles do happen provided we have enough faith!




I myself became party to this holy event on my recent visit to this pious dargah few days back. Video below :)



This place is known to fulfill the desires and hence invites people from all castes , religions etc. alike.
And it's nearness to highway makes it convenient to reach. One can offer prayer and tie thread on the holy border. And can offer chadar etc. to pay respect.

I really enjoyed my visit and am pretty sure there would be more such visits in near future!!

PS: Let me know in case of any query (s), and I will try to respond as soon as I can.

Happy travelling!!!

Friday, 11 October 2019

How to use awk to modify the file on Linux

Hi,

Am giving a sample use case here.

Say, there is a file called detectionData.csv which has data separated with pipe symbol ( | )

And, you wish to update the 5th column of all the records, you can use something like below:

cat detectionData.csv | awk 'BEGIN { OFS=FS="|" } { $5="PartyExtreme00003"; print }' > detectionDataNew3.csv

Now, say, you wish to do the above but only every 10th row and not all the rows, you can use something like below:

cat detectionData.csv | awk 'BEGIN { OFS=FS="|" } { if (NR % 10==1) {$5="PartyExtreme00001"}; print }' > detectionDataNew10.csv

And, now say, you wise to do for part of the file, say for the first 50000 records, you can use something like below:

cat detectionData_1L.csv | awk 'BEGIN { OFS=FS="|" } { if (NR < 50000) {$5="PartyExtreme00001"} else {$5="PartyExtreme00003"}; print }' > detectionData_1L_50_50.csv
Enjoy!

How to copy files from Linux machine to Windows machine

Hi,

This is what you need to do:

1. Install putty on your local windows machine via below link

https://www.chiark.greenend.org.uk/~sgtatham/putty/latest.html

2. By default, it will get installed at below location (for 64 bit machine)

C:\Program Files\PuTTY



3. Copy your key file i.e. .ppk file at the above location (see, baseline.ppk as e.g. copied above)

4. Now, open command window from this same location (Shift + Right Click, select Open command window here Option)

5. Run the below command (say, to copy 165.zip from home location on the Linux server to this location)

 .\pscp.exe -i ".\baseline.ppk" ec2-user@10.220.XXX.XXX:165.zip .

Notice the . at the end, this actually means, copy to this current location. You can give any actual path here to copy to that location(say, D:\Here)

  .\pscp.exe -i ".\baseline.ppk" ec2-user@10.220.XXX.XXX:165.zip D:\Here
Likewise,  if you want to copy the file not from the home directory but from other location on the server, say, /home/ec2-user/rahul/, below command can be used

  .\pscp.exe -i ".\baseline.ppk" ec2-user@10.220.XXX.XXX:/home/ec2-user/Test.txt D:\Here
Done!

Hope you find it useful.. let me know in the comment section in case of any query!


Thursday, 29 August 2019

How to find the list of all the large files in the system [/dev/xvda1/ is 100% full error]

Hi All,

You might have seen this error xvda1 is 100% full and might have felt the need to check what are the files that are occupying so much space.

You can get this information and write to an output file via below command:

sudo find / -type f -size +500M -exec ls -lh {} \; > largeFiles.txt

You can then remove the unwanted files using the rm command.

Enjoy!

Thursday, 8 August 2019

wsimport command not found error [SOLVED]

[Issue]

The wsimport tool is used to parse an existing WSDL [Web Services Description Language] file. And generate the required files ( i.e. JAX-WS portable artifacts) for web service client to access the published web services. 

This wsimport tool is normally present in the $JDK/bin folder.

[Root Cause]

So if the system is not able to find this command, this means that either the JAVA_HOME system variable is incorrectly configured or not present at all.

[Resolution]


Create the JAVA_HOME system variable as shown below and add “;%JAVA_HOME%\bin;” at the end of the PATH system variable:

Now the system will be able to find the wsimport command successfully!

How to create a list of the EC2 instances for any account

1. Find out the IP address of the jenkins slave for the particular account

2. Connect to this IP using putty using ec2-user

3. Switch to root using command : sudo -i

4. Run the below command to write the output to a text file :
[root@...] # aws ec2 describe-instances >> instancesDetails.txt

Similar command can be executed to output the list of AMIs as well, as shown below:
[root@...] # aws ec2 describe-images >> imagesDetails.txt

5. Now you can use the Data filter functionality of excel to just capture, say, IP address, instance id etc.

Another quick way to list out the IDs is as below,
1. Click on the Check box to the left of the Name field as shown below

2. This will select all the instances on the particular page
3. Navigate to bottom of the list section and you will see all the details in a notepad sort of window
4. You can copy all the details from here and paste it into notepad++ / excel
5. Enjoy!