Greg Townsend and his son, Greg Jr., have been preparing for this moment for quite some time.

The former Raiders defensive end would take his son out trick or treating, and they would wear matching jerseys. People would bark at 6-year-old Greg Jr. to get in his stance for some candy, and he was rewarded handsomely for his technique.

“We got a big kick out of Halloween,” the elder Townsend said Thursday. “People would see us coming, and it was a lot of fun.”

Townsend Jr. was wearing his Raiders jersey and in his stance again last weekend. But this time it was for real as he went to the team’s rookie camp trying to make the roster as an undrafted free agent. The 6-foot-3, 260-pound defensive end had an injury-marred career at USC, playing behind first-round pick Leonard Williams, and is trying to crack one of the deepest units on the team.

“Walking around the facility, going to work … this is all pretty amazing,” Townsend Jr. said. “I am in the same position he was.”

His dad called it “a dream come true.”

“We always felt like it was possible,” the elder Townsend said. “I would prefer they would have drafted him, but this works just fine.”

Townsend is the Raiders’ all-time sacks leader with 107.5, and his career total of 109.5 is No. 22 in NFL history. He made the Pro Bowl twice and won a Super Bowl XVIII ring in 1984.

Townsend Jr. didn’t get to hang around as a kid, as the players didn’t want children under 5 at training camp.

But Townsend Jr. got to know a lot of Raiders greats through his dad, was a fan growing up and … well, he’s always been a Raider.

“Everything in my house was Raiders ... Marcus (Allen) and Tim (Brown) used to come by,” Townsend Jr. said. “I have heard all the stories, seen the tapes, lived it. I always thought it was possible to be here, but don’t know if I really believed it.”

Townsend Jr. doesn’t have to look too far for a pep talk. His dad was a 235-pound fourth-round pick out of TCU.

“Someone told me I was going to sit on the bench behind Howie Long,” Townsend remembered. “I said, ‘The hell I am. I’m not anybody’s backup player.’”

Townsend tells his son that he is “in the same boat” as second-round pick Jihad Ward and third-round selection Shilique Calhoun, both defensive linemen, and former first-round picks on the roster like Khalil Mack and Bruce Irvin.

“Those guys will be in the first rotation at practice, because they’re (general manager Reggie McKenzie’s) picks,” Townsend said. “But they have to make the team, too. Greg can tell himself, ‘I have to prove that I should have been a first-round pick, that they made a mistake in taking those guys over me.’

“Give Reggie and (coach) Jack (Del Rio) a tough decision to make.”

Townsend said the coaches at USC didn’t let his son use all the moves that he had taught him, like the spin move. That’s one the elder Townsend learned from late Raiders defensive line coach Earl Leggett.

“I had one pass-rush move in college, the swim move, and then Earl Leggett taught me seven in one day,” Townsend said.

It’s that arsenal that made his game tapes a hot commodity. The late Reggie White told him that he studied Townsend’s film, and just last week, Mack told Townsend Jr. that he has learned from watching his dad on YouTube.

Townsend Jr. is happy to share some of his dad’s stories with Mack and Irvin.

“And then I pick their brains,” he said. “I really am learning a lot."

Vic Tafur is a San Francisco Chronicle staff writer. Email: vtafur@sfchronicle.com Twitter: VicTafur