Let the base of the cube be $O,A,B,C$ and the top face be $ D,E,F,G$
so that $O$ is origin, $A$ on $x\:axis,$ $C$ on $y\:axis$ and $E$ on $z\:axis$.
$\therefore$ the vertices of the cube are given by $O(0,0,0),\:A(a,0,0),\:B(a,a,0),\:C(0,a,0),\:D(0,a,a),$
$E(0,0,a),\:F(a,0,0),\:G(a,a,a)$
The diagonals of the cube are $OG,\:AD,\:BE\:and\:CF$
Take any two diagonals and write them as vectors. For example, diagonal-1 = $\overrightarrow A = \hat i + \hat j + \hat k$ and diagonal-2 = $\overrightarrow B = - \hat i + \hat j + \hat k$
The angle between these two vectors can be determined by the dot.product: Take any two diagonals and write them as vectors. For example, diagonal-1 = $\overrightarrow A . \overrightarrow B = |\overrightarrow A | |\overrightarrow B| \cos \theta$
$\Rightarrow \theta = \cos^{-1} \bigg ( \large\frac{\overrightarrow A . \overrightarrow B}{|\overrightarrow A| . |\overrightarrow B|}$$\bigg)$
$\overrightarrow A . \overrightarrow B = (\hat i + \hat j + \hat k) .(-\hat i + \hat j + \hat k) = -1+1+1 = 1$
$\Rightarrow \theta = \cos^{-1} \large\frac{1}{\sqrt 3.\sqrt 3}$$ = \cos^{-1} \large\frac{1}{3}$