Security video footage showed the gunman pull out the .45-caliber pistol, raise it and point it across the aisle before putting it back against his side, authorities told the San Francisco Chronicle in a story on Monday.
The man drew the gun several more times and once wiped his nose with the hand holding the weapon.
"These weren't concealed movements - the gun is very clear," District Attorney George Gascon said. "These people are in very close proximity with him, and nobody sees this. They're just so engrossed, texting and reading and whatnot. They're completely oblivious of their surroundings."
Authorities declined a request by The Associated Press for the surveillance footage, citing an ongoing investigation.
San Francisco police officials say people who pay too much attention to digital technology are also vulnerable to theft.
"Oftentimes when you interview people who get their phones stolen, when you ask them to describe where the person came from, what he was wearing, they have no idea," said police Chief Greg Suhr.
Nikhom Thephakaysone, 30, has pleaded not guilty to charges including murder in the Sept. 23 attack on Justin Valdez, 20, a student at San Francisco State University who was shot in the back of the head as he left the train.
Thephakaysone also has been charged with assault with a semi-automatic handgun. Prosecutors said he stuck a handgun in another man's back earlier the same night he shot Valdez as he looked for a victim.
He did not pull the trigger and went on the hunt again for a victim for more than an hour, at one point waving a gun outside a Thai restaurant, Assistant District Attorney Scot Clark has said.
He was also charged with illegally possessing an assault weapon after police said they seized two such rifles, combat knives and razors at his home.
Police said he was carrying $20,000 in cash when he was arrested.