How to work with colliders

I just wanna know if how to work with colliders …

I have 2 box here with rigidbody and colliders.

When I move the red one with green , I want the red to disappear. Help me I really need it

using UnityEngine;
using System.Collections;

public class TouchAndDestroy : MonoBehaviour
{
  void OnTriggerEnter2D(Collider2D other)
  {
    Destroy(other.gameObject);
  }
}

Save this as TouchAndDestroy.cs and drag it onto the green object. Everything that collides with it will be destroyed.