When you fly on a long-haul flight, chances are you'll see pilots sleeping in the crew rest area behind the cockpit and above first class. These small cabins typically have a bed or reclining seats, but they're a far cry from the kind of privacy and luxury passengers enjoy in a private suite.
On aircraft carriers, pilots sleep in similar cramped quarters. Some 5,000 sailors and air wing personnel live aboard these Nimitz-class carriers for months at a time, working, eating, and sleeping in tight spaces.
The majority of sailors sleep in berthing compartments, called racks, that are stacked two or three deep and crammed together like bunk beds. Each sailor has a personal locker, a tiny stowage bin and an upright cabinet for clothes, as well as a shared bathroom. Officers have slightly better accommodations, with more space and a few more amenities such as armchair seats with fold-up table tops. They can swap rooms with other sailors if they get tired of their a$shole roommates or don't like the noise level.
While there's little doubt that the living conditions on aircraft carriers aren't as comfortable as they could be, they're certainly adequate for the mission at hand. Studies of fatigued airline pilots have found that the vast majority are able to complete their work safely. However, there are some notable exceptions, such as the overtired pilot who missed his Hawaii landing in 2008 and came close to crashing into another plane on the runway at San Francisco International Airport in 2017. Both pilots were fined and suspended from flying duties, and this is why airlines are so careful about crew fatigue and its consequences.