On Linux (more precisely with the GNU and busybox implementations of cp as typically found on systems that have Linux as a kernel) and recent FreeBSD, this is how:
cp -al dirA dirB For a more portable solution, see answer using pax and cpio by Stéphane Chazelas