Domain adaptation (DA) methods have been widely used in cross-domain fault diagnosis to mitigate the distribution discrepancy between data from different working conditions. However, traditional DA methods are designed for specific one known category shift between domains. When prior knowledge about relationships between source and target label sets is unknown, the applicability of these methods is limited. To address this issue, a universal domain adaptation method named two-head classifier guided domain adversarial learning (THC-DAN) is proposed, which can handle all category shift scenarios in DA, including closed-set, partial-set, open-set, and open-partial-set. Specifically, we develop a domain adversarial network with an elegantly designed two-head classifier and adapt it to target domain. During adaptation, we first introduce an informative consistency score based on the two-head classifier to distinguish target private samples. Then, the consistency separation loss is proposed to push these samples away from classification boundaries. Finally, to realize the safe alignment on common classes between domains, the weighted adversarial learning based on the two-head classifier's prediction probability is presented to weaken effects of source private samples. Experiments under all DA scenarios on datasets from Case Western Reserve University, Paderborn University, and our own Drivetrain Prognostics Simulator demonstrate the effectiveness of THC-DAN.