White Green Red Lights get stuck while uploading

My Yun has started behaving wiedly. Sometimes it'll stop working. Sometimes it wont allow to upload that is port not found. Sometimes when uploading 3 lights get stuck thats of USB, On and L13 and get stuck then I'll have to remove and reconnect USB. Uploading works sometimes. I have tried on multiple PC results are same.
I'm just running a test on LDR sensor to see its analog values in different conditions with example code.

// the setup routine runs once when you press reset:
void setup() {
  // initialize serial communication at 9600 bits per second:
  Serial.begin(9600);
}

// the loop routine runs over and over again forever:
void loop() {
  // read the input on analog pin 0:
  int sensorValue = analogRead(A0);
  // print out the value you read:
  Serial.println(sensorValue);
  delay(1);        // delay in between reads for stability
}

@HamBIL,
you might have a flaky USB cable. Check if you have others you can test with.
NOTE: some USB cable only transmit power, make sure all your USB cables transmit power AND data.

On the LEDs, you might want to read this:
Arduino Yun LEDs
http://codesnippets.altervista.org/documentation/yun/leds/leds.html

Jesse

@jessemonroy650
Now condition is even worse only green ON light comes. DOesnt connect to my network nor its wifi runs on. Im using same cable from begining of the project so it works. I also tried connecting to different pc with different cable. Is there anything that can be done or should i just buy a new one.

HamBIL:
@jessemonroy650
Now condition is even worse only green ON light comes. DOesnt connect to my network nor its wifi runs on. Im using same cable from begining of the project so it works. I also tried connecting to different pc with different cable. Is there anything that can be done or should i just buy a new one.

@HamBIL,
do not despair.

On the LED, the green LED next to [ON] is only for power. For LEDs, read Arduino Yun LEDs.

On your network, we will make it work.

It is too hard to work with just one cable. You said, you "connecting to different pc with different cable", but are you sure they are power AND data? Have you test the cables with different pieces of hardware? and not just the Arduino?

Let's back up and try the three important sketchs.
I've written this out eariler. Here it is:

Yun wifi connectivity issues

Go ahead and try the WiFiStatus first.

Thanks
Jesse