The $N$-qubit Greenberger-Horne-Zeilinger (GHZ) states are the maximally entangled states of $N$ qubits, which have had many important applications in quantum information processing, such as quantum key distribution and quantum secret sharing. Thus how to distinguish the GHZ states from other quantum states becomes a significant problem. In this work, by presenting a family of the generalized Clauser-Horne-Shimony-Holt (CHSH) inequality, we show that the $N$-qubit GHZ states can be indeed identified by the maximal violations of the generalized CHSH inequality under some specific measurement settings. The generalized CHSH inequality is simple and contains only four correlation functions for any $N$-qubit system, thus has the merit of facilitating experimental verification. Furthermore, we present a quantum phenomenon of robust violations of the generalized CHSH inequality, in which the maximal violation of Bells inequality can be robust under some specific noises adding to the $N$-qubit GHZ states.