dd bs=1MB if=/dev/sda of=sda.img
Where if is your input device and of is your output file.
Note bs sets how much to read at once, in our case 1MiB. It doesn’t affect the image integrity in any way. Larger values use more memory but can potentially run faster.