[range]y

:[range]y will yank (copy) the range of lines you declare. If you wish to paste the yanked lines, press p or P.

:y will copy the current line. :1,$y will yank the entire file as $ represents last line in the file.
:5,10y will yank lines 5 through 10.
:'<,'>y will yank from the beginning of the last selection, through the end of the last selection.

Further Reading

:h :y

More Gifs