Let b, n is an element of Z, n >= 1, and D-1 ,..., D-tau(n) be all positive divisors of n. For 1 <= l <= tau(n), define C-l := {1 <= x <= n : (x, n) = D-l}. In this paper, by combining ideas from the finite Fourier transform of arithmetic functions and Ramanujan sums, we give a short proof for the following result: the number of solutions of the linear congruence x(1)+ center dot center dot center dot + x(k) = b (mod n), with kappa(l) = vertical bar{x(1), ..., x(k)} n Cl vertical bar, 1 <= l <= tau(n), is 1n Sigma(d vertical bar n) c(d)(b) (tau(n))Pi(l =1) (c n/D-l (d))(kappa l), where c(d)(b) is a Ramanujan sum. Some special cases and other forms of this problem have been already studied by several authors. The problem has recently found very interesting applications in number theory, combinatorics, computer science, and cryptography. The above explicit formula generalizes the main results of several papers, for example, the main result of the paper by Sander and Sander [J. Number Theory 133 (2013) 705-718], one of the main results of the paper by Sander [J. Number Theory 129 (2009) 22602266], and also gives an equivalent formula for the main result of the paper by Sun and Yang [Int. J. Number Theory 10 (2014) 1355-1363].