A colonoscopy is a diagnostic procedure that allows a doctor to examine the inner lining of the large intestine (rectum and colon). This is done using a long, flexible tube called a colonoscope, which has a camera and light at its tip. The procedure is commonly used to detect changes or abnormalities in the colon and rectum.