At Twitter, Mr. Musk has used many of those same tactics to upend the social media company in just a few weeks.

Since late last month, the 51-year-old has laid off 50 percent of Twitter’s 7,500 employees and accepted the resignations of 1,200 or more. On Monday, he began another round of layoffs, two people said. He tweeted that he was sleeping at Twitter’s offices in San Francisco. And he has applied mission-driven language, telling Twitter’s workers that the company could go bankrupt if he wasn’t able to turn it around. Those who want to work on “Twitter 2.0” must commit to his “hard core” vision in writing, he has said.

David Deak, who worked at Tesla from 2014 to 2016 as a senior engineering manager overseeing a supply chain for battery materials, said Mr. Musk “clearly thrives in existential circumstances.” He added, “He quasi creates them to light the fire under everybody.”

The similarities between Mr. Musk’s approach to Twitter and what he did at Tesla and SpaceX are evident, added Tammy Madsen, a management professor at Santa Clara University. But it’s unclear if he will find the means to motivate employees at a social media company as he did with workers whose quests were to move people away from gas-powered cars or send humans into space.

“At Tesla and SpaceX, the approach has always been high risk, high reward,” Dr. Madsen said. “Twitter has been high risk, but the question is: What is the reward that comes out of it?”