Ubuntu commands list for daily use

 Ubuntu commands list for daily use

list of ubuntu commands for daily use and interview questions

                 File Commands

1. ls - Directory listing
2. ls –al - Formatted listing with hidden files
3. ls -lt - Sorting the Formatted listing by time modification
4. cd dir - Change directory to dir
5. cd - Change to home directory
6. pwd - Show current working directory
7. mkdir dir - Creating a directory dir
8. tail file - Output the last 10 lines of the file
9. tail -f - file Output the contents of file as it grows,starting withthe last 10 lines
10. touch - file Create or update file
11 rm -rf - dir Force to remove the directory dir
12. cp file1 file2 - Copy the contents of file1 to file2
13. cp -r dir1 dir2 - Copy dir1 to dir2;create dir2 if not present
14. mv file1 file2 - Rename or move file1 to file2,if file2 is an existingdirectory

                        Process management

1. ps - To display the currently working processes
2. top - Display all running process Unix/Linux Command Reference
3. pkill - pattern Will kill all processes matching the pattern

                         File permission

1. chmod octal file Change the permission of file to octal,which can be found separately for
user,group,world by adding,
• 4-read(r)
• 2-write(w)
• 1-execute(x)
2. chown - change file owner and group
-h - no-dereference affect each symbolic link instead of any referencedfile
-R, - recursive operate on files and directories recursively

                           System Info

1. date - Show the current date and time
2. uptime - Show current uptime
3. w - Display who is on line
4. whoami - Who you are logged in as
5. df - Show the disk usage
6. du - Show directory space usage
7. free - Show memory and swap usage


1. tar xf file.tar - Extract the files from file.tar
2. tar xzf file.tar.gz - Extract a tar using Gzip
3. tar xjf file.tar.bz2 - Extract a tar using Bzip2


1. ping - host Ping host and output results
2. wget - file Download file
3. ifconfig - ip address of the machine
1.apt-get update - updating the packages list from the repository
2. apt-cache search {package-name} - Search package name in the repository
3. apt-get install {package-name} - Installing the selected package

basic cdn links for java developers

basic cdn links for java developers

list of cdn links for easy use and access

<!--  bootstrap cdn -->

  <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/css/bootstrap.min.css">
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.0/jquery.min.js"></script>
  <script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.7/js/bootstrap.min.js"></script>

 <!-- jquery cdn -->
  <script src="https://ajax.googleapis.com/ajax/libs/jquery/3.2.0/jquery.min.js"></script>

   <!-- Include jQuery Mobile stylesheets -->
  <link rel="stylesheet" href="https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.css">

  <!-- Include the jQuery library -->
  <script src="https://code.jquery.com/jquery-1.11.3.min.js"></script>

  <!-- Include the jQuery Mobile library -->
  <script src="https://code.jquery.com/mobile/1.4.5/jquery.mobile-1.4.5.min.js"></script>

 <!-- angular cdn -->
  <script src="https://ajax.googleapis.com/ajax/libs/angularjs/1.4.8/angular.min.js"></script>

  <!-- w3 cdn -->
  <link rel="stylesheet" href="https://www.w3schools.com/w3css/4/w3.css">

  <!-- google maps -->
  <script src="https://maps.googleapis.com/maps/api/js?key=YOUR_KEY&callback=myMap"></script>

  <!-- fonts asome cdn -->
  <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">

  <!-- code mirror cdn link -->

java8 installation in ubuntu server

java8 installation  in ubuntu server
in this method you don't need to manually configure java path it will be set by default

Enter step by step in command promt

sudo apt-add-repository ppa:webupd8team/java
sudo update-alternatives --config java
sudo apt-get install oracle-java8-set-default

best blog tips for blogger

Basic SEO Guide For Blogger with best blog tips  

basic seo guide for blogger with best blog tips

Be No one blogger and word press by following these ideas ,blog best practices and little to know blog basics.Start today for  free.

these are the  best winning strategies that you could ever get for blogger.if you follow the below  steps you would likely to get great organic and live search traffic that may not be viral but you will get there soon.if are a free loader like me with no money start with blogger get some experience and move to word press. there is a saying no pain no gain. so bear the pain now so you can enjoy the gain later.

choosing a  right  custom domain name :

choosing a  right  custom domain name

it will nearly cost you around $1 to $2 dollars think it as a investment to your future and you wont be needing anymore than this.

you can choose a domain name in two ways 
1. name relevant to the type of blog or niche you are building
2.name not relevant to anything
and finding a right domain name that exists is a little tiresome but take your time in finding a right domain. 
you can't go in the middle of your website and change its name whatever the work you have done will go in vain as google provides
page rank and domain authority and indexing to your blog's domain name.

easier indexing with backlinkg strategy:

in order to get easier indexing with google you need to place some back links(link building) in the web 2.0 sites.do place your link not more than 2 times
otherwise it may be treated as duplicate content penalty. use tools like freeseotools for linkbuilding and plugraism checking.

internal linking strategy:

use internal linking like linking one of your blog post to your other related content posts
which improves your indexing

blog's title:

blog's title

what is your blog all about in one or two words about 70 characters.
blog's description : 
about a sentence  and half regarding your blog and niche
privacy :make your content available for public use 

meta description :

meta description

Help users choose to click on your blog in search results by writing a compelling summary of what your blog is all about
should not be greater than 150 words.make it more cache and relative.by enabling meta description search description will also be enabled in your blog.

search description:

search description

not more than 150 words.about your specific blog post .it plays a import role in page ranking so make sure that use relevant keywords.

custom robots.txt

custom robots.txt

User-agent: Mediapartners-Google
User-agent: *
Disallow: /search
Allow: /
Sitemap: http://javatospring.com/feeds/posts/default?orderby=UPDATED

Don’t forget to change url with your own

Custom Robots Header Tags:

Custom Robots Header Tags

title customization:

Find this code

And replace it with this
<b:if cond='data:blog.pageType == "item"'>
        <data:blog.pageName/> | <data:blog.title/>

image optimization:

don't copy images from the google because most of the images are copyrighted it leads to removal of ad sense in the future.better to use own images
or search images which are not copyrighted or use advance google search feature that allows copyright free images for commercial use.use alt tag for images. bogger gives you 1gb of fee image upload space use it for the best use image compression tools to reduce the image size.

keyword's search:

use long tail keywords with low competition and higher search volume by monthly views to get better ranking . use tools like KeywordPlanner(https://adwords.google.com), keywordtool use some italicized and bold words for keys.

high cpc keywords:

high cpc keywords

its important right from the start to know how much does cost per click (cpc) is going to effect your ad sense 
revenue to get high cpc keywords you keyword spy tool this the best tool you could get .

blog's post content:

content  plays a big role in getting clicks from users .blog post title will become your blog URL use keywords carefully in your blog post title.use shot and sweet as they perform better in the body basically around 7 to 16 keywords for every five hundred to thousand words . write in simpler and easy words so don't you high terminology,use less fillers like is,and,are ,there etc... . use relevant and reusable  content for grouping and internal linking. don't ever copy content from other website but use can reuse the same in different styles and formats. write blog posts that can live for longer without any further modifications.use word counter to know keyword density and relevance. 

using mobile friendly templates:

mobile friendly

its better to have your own custom template for blogger because by default blogger templates are not optimized for SEO .you can get free custom
templates or paid templates for around $5 to $10 otherwise footer-ed templates would be available .If you have some programming knowledge you could easily customize and edit 
the template or you could take help from others who has the knowledge. 

use social media for traffic:

the best and easier way to get fast traffic is to share on google plus and social media plugins like 'add this' and getsitecontrol makes it easier to integrate
with blogger for this you need to go to your blog's html and edit it to place before the blog closing body tag </body>. use printerest ,linked in,buffer,tumbler 
and Instagram,reddit .use feed burner for site feed.

email subscribers: 

email subscribers

email subscribers plays important role in the long run which helps to make you blog or website live for longer .so get mail subscribers right
from the start.if you can afford money use something like mail chimp and aweber.

use forums and comments:

discus forums for blog's feed

 but last not the least comments and forums also makes impact so ask your users to comment on your post's. use discus comments in place of blogs comments.


blog seo

use webmasters and google analytics tools to track your visitors .it is a continuous iteration process .

how to find a niche and make money online with your blog?

i have been searching for years to find a good  niche and have been questioning my self what drive people to come their websites / blog .i had been thinking why only the content ? the bloggers all know that content is king ,writing content is not that easy and even though  you manage to write the content there is no people/traffic  to read the content the way back lies finding the right niche.niche plays a major role to drive traffic.
how to find a niche and make money online with your blog?

i had seen quite a content like

how to start your own blog?
how to drvie traffic to you blog?
how to create your own blogger tempate?
how to drvie organic trafficto blog?
how to write content for blogger?
how to create guest blogging on blogger?
how to create a adsense account for bloggers?

how to find the niche for bloggers?

what are the best fonts for a website?
Want to make money from your blog? 
Learn professional blogging from me?
what is google tag manager and hos to use it,how google tag manager works?
5 Easy Ways to Help Reduce Your Website’s Page Loading Speed?

the best niche i found out for blogger  is writting  about blog itself what makes blog so special is that you can make money and if show the way for others how to make it then you are the best . I have seen most of problogges their nicie is all about seo,blooging,wordpress,socialmarketing,how to make money ..that what people drives to come to your website. most of the visitors that come to your wesite is blogger only.If are reading this post you should have understood that already.

there are other ways to find a niche but you need to skilled enough and if your skilled enough you wont be needing a blog you would have got a job that gives you faster income.sorry to be so dramatic but that the truth. If this post helped to find your niche please sure to comment on this post.

java interview questions for freshers

java  interview questions

java programming questions that helped me during my interviews

how to generate a log file in java
import java.util.logging.Logger;
import java.util.logging.FileHandler;
import java.util.logging.SimpleFormatter;
import java.io.IOException;

class  Log
 public static void main(String[] args) {  

    Logger logger = Logger.getLogger("MyLog");  
    FileHandler fh;  

    try {  

        // This block configure the logger with handler and formatter  
        fh = new FileHandler("C:/Users/myworld/Desktop/MyLogFile.log");  
        SimpleFormatter formatter = new SimpleFormatter();  

        // the following statement is used to log any messages  
        logger.info("My first log");  

    } catch (SecurityException e) {  
    } catch (IOException e) {  

    logger.info("Hi How r u?");  

how to check a email is valid or not 
import java.util.*;

class IsValidEmailAddress 
 public boolean isValidEmailAddress(String email) {
           String ePattern = "^[a-zA-Z0-9.!#$%&'*+/=?^_`{|}~-]+@((\\[[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\.[0-9]{1,3}\\])|(([a-zA-Z\\-0-9]+\\.)+[a-zA-Z]{2,}))$";
           java.util.regex.Pattern p = java.util.regex.Pattern.compile(ePattern);
           java.util.regex.Matcher m = p.matcher(email);
           return m.matches();
 public static void main(String[] args) 
  IsValidEmailAddress valid = new IsValidEmailAddress();


how to generate a guid
import java.util.UUID;

public class UniqueIDTest {
 public static void main(String[] args) {
  UUID uniqueKey = UUID.randomUUID();
  System.out.println (uniqueKey);
how to validate a phone number
import java.util.regex.Matcher;
import java.util.regex.Pattern;
import VerhoeffAlgorithm;

class ValidationRE 
     public Boolean phoneNumberValidation( String sPhoneNumber){
  //regular expression pattern for mobile number
      Pattern pattern = Pattern.compile("^[2-9]{2}[0-9]{8}$"); 

   Matcher matcher = pattern.matcher(sPhoneNumber);

   if (matcher.matches()) { return true;}
      else {return false; }


how to validate aadhar number
  public static boolean validateAadharNumber(String aadharNumber){
        Pattern aadharPattern = Pattern.compile("\\d{12}");
        boolean isValidAadhar = aadharPattern.matcher(aadharNumber).matches();
            isValidAadhar = VerhoeffAlgorithm.validateVerhoeff(aadharNumber);
        return isValidAadhar;
how to generate first n prime numbers 
import java.util.Scanner;

class PrimeNumberDemo
   public static void main(String args[])
      int n;
      int status = 1;
      int num = 3;
      //For capturing the value of n
      Scanner scanner = new Scanner(System.in);
      System.out.println("Enter the value of n:");
      //The entered value is stored in the var n
      n = scanner.nextInt();
      if (n >= 1)
         System.out.println("First "+n+" prime numbers are:");
         //2 is a known prime number

      for ( int i = 2 ; i <=n ;  )
         for ( int j = 2 ; j <= Math.sqrt(num) ; j++ )
            if ( num%j == 0 )
               status = 0;
         if ( status != 0 )
         status = 1;
how to generate String Recursive Reversal 
public class StringRecursiveReversal {

    String reverse = "";
    public String reverseString(String str){
        if(str.length() == 1){
            return str;
        } else {
            reverse += str.charAt(str.length()-1)
            return reverse;
    public static void main(String a[]){
        StringRecursiveReversal srr = new StringRecursiveReversal();
        System.out.println("Result: "+srr.reverseString("Javatospring"));
how to generate gcd of two numbers 
import java.util.Scanner;
class GCD
 public static void main(String[] args) 
  Scanner sc = new Scanner(System.in);
  System.out.print("enter a  :");
  int a = sc.nextInt();
  System.out.print("enter b :");
  int b = sc.nextInt();
     while (a != b)
   if(a > b)
     a = a-b;
  System.out.println("GCD : " + a);
how to generate chron job
import java.util.Timer;
import java.util.TimerTask;
class MyTask extends TimerTask{
   static int i =0;

   public MyTask(){
     //Some stuffs

   public void run() {
     System.out.println( i+" : Hi see you after 1 seconds");


public class CronJob{
   public static void main(String[] args){

     Timer t = new Timer();
     MyTask mTask = new MyTask();
     // This task is scheduled to run every 1 seconds

     t.scheduleAtFixedRate(mTask, 0, 1000);

how to generate random password generator 
import java.util.Random;

public class passGen{

    //Verison 1.0
    private static final String dCase = "abcdefghijklmnopqrstuvwxyz";
    private static final String uCase = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
    private static final String sChar = "!@#$%^&*";
    private static final String intChar = "0123456789";
    private static Random r = new Random();
    private static String pass = "";

    public static void main (String[] args) {
        System.out.println ("Generating pass...");
        while (pass.length () != 6){
            int rPick = r.nextInt(4);
            if (rPick == 0){
                int spot = r.nextInt(25);
                pass += dCase.charAt(spot);
            } else if (rPick == 1) {
                int spot = r.nextInt (25);
                pass += uCase.charAt(spot);
            } else if (rPick == 2) {
                int spot = r.nextInt (7);
                pass += sChar.charAt(spot);
            } else if (rPick == 3){
                int spot = r.nextInt (9);
                pass += intChar.charAt (spot);
        System.out.println ("Generated Pass: " + pass);
how to generate factorial 
import java.util.Scanner;

class  Factorial
 static int fact = 1;

  public static void main(String[] args) 
  Scanner sc = new Scanner( System.in);

   System.out.print("\nenter the number to find factorial: " );
    fact = fact *num;

   System.out.println( fact);


spring crud restful web services

spring crud  restful web services

hi i am going to show how to create a spring crud with restful web services

this tutorial has prerequisite  on how to create a spring  creating spring project structure in eclipse

you can download the project from google drive

also download the spring jars from my goole drive only because i have used some other libraries.

for compilation i had used

1. tomcat 7
2. java 8

we are not using jdbc instead we are using ibatis (ORM)

before importing the project install PostgreSQL 9.4 and create a table that is given below

CREATE TABLE javatospring.student
  myname character varying,
  fathername character varying,
  mobileno character varying,
  email character varying,
  gender character varying,
  address character varying
use same name as it is given

you can see the video on how to create a table in postgres using pgadmin in the below video.

now import the spring crud project into eclipse go to build.xml file in the spring project structure

<project basedir="." default="war" name="springcrud">
    <description>Application build file</description>
    <target name="war">
        <mkdir dir="dist">
        <war destfile="dist/springcrud.war" webxml="web/WEB-INF/web.xml">
            <fileset dir="web">
            <classes dir="web/WEB-INF/classes">
        <copy flatten="true" todir="E:\software\tomcat\webapps">
                <file file="dist/springcrud.war">
now replace todir="E:\software\tomcat\webapps" with your tomcat webapps folder.

now to run the application right click on the build.xml and run as ant built.

note: Run your tomcat server before building your springCrud application.

after the build is successful you should go to browser address bar type

localhost:8080/springcrud . you should see your application running.

sprign crud

spring crud sample output

you can add,delete ,update,show like the above output.