The paper has obtained a unified final solution for the waterhammer equations. The proposed solution, covering all kinds of initial conditions and boundary conditions, has been proved to be written in the form of the d'Alembert's wave functions. The periodical influence of the initial conditions on the results is discussed. The proposed solution, with two kinds of algebraic equations containing only finite terms, is suitable for numerical calculation, convenient for programming and liable to dealing with complex pipe systems. An example has been given to show the use of the method. The skill to perform the inverse Laplace transform in obtaining the solution is different from the traditional ones and can be extended to use in many other problems including the FSI waterhammer problem.