How to copy last 5 lines of a log file to the clipboard on OS X
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