Ghost diffraction and ghost imaging are investigated in a lensless imaging system. The evolution process from ghost diffraction to ghost imaging is discussed when the object is moved far away from the source in the test arm. The relation of ghost diffraction and imaging is also studied, and it is found that the visibility of ghost imaging is always better than that of ghost diffraction.