This is a fo'c's'le song probably sung by sailors on the last leg of a long voyage. The melody is beautiful and sticks in your head. The guys in our band found the lyrics to be overly sentimental. Of course, we teenagers had no experience of months-long voyages which would justify the sentimentality of a song about returning home.
The origins of the song are uncertain. There are versions from England, Ireland, Scotland, Australia, Germany, Sweden and America. There is a version written by Charles Mackay, who wrote it on May 26, 1858 while he was on board “The Europe” going home. There is some controversy about whether the shanty was derived from the poem or the poem was inspired by an existing chanty.
The melody was used for the Irish rebel ballad "Kevin Barry".
It was recorded by The Golden Ring and numerous others. It was printed in Hugill's Shanties from the Seven Seas (1961), Ives' The Burl Ives Songbook (1953) and many other sources.
I learned it from The Burl Ives Song Book and Ed Trickett.