What exactly is the linear layer in the transformer model? Please see this image:

There are linear layers to modify the Query, key and value matrices and one linear layer after the multi head attention as they mention also from here:

Are these linear layers simply dense or fully connected layers? Let's consider the weight matrix Wi Q. Does this represent a dense layer with &quot;Q&quot; nodes? As they are using matrices as input rather than 1D vectors, I am getting a little confused.
In the original Transformer article, these linear layers are just matrix multiplications.
As described in the paragraph you referred to in your question $W^Q$ is a matrix of dimensions $d_{model} \times d_k$, that is, it is a fully connected layer with $d_k$ units.
In practical implementations, these have the optional addition of a bias vector. You can see their actual definition in the fairseq code.