The tail command can be used to get the last 5 lines from a text file. In the example below, we'll use it to output the most recent logs from the system log file.

tail -5 '/var/log/system.log'  

If you're using OS X, you can use the pbcopy command to copy the output to the clipboard.

tail -5 '/var/log/system.log' | pbcopy