Unlike most jobs, pilots and flight attendants can live in any city they want with the convenience of flying to work. I use the word convenience liberally. Some are forced to commute due to financial or family issues. Whatever the reason those who choose to commute are faced with challenges not faced by those who live in base.
Most airlines have cities (called domiciles) in which flight crews are based. Being based there means your flight assignments will always start and stop in that city. The flght assignment might start with a deadhead (flying in the back as a passenger) to a new city before you start working, but again they will always start in your assigned domicile.
Commuting can be rough when a pilot first starts at an airline. A new pilot will likely be very junior and thus will be on reserve. Commuting to reserve is very different than commuting to a line.
A pilot on reserve is typically assigned a set number of days where they must be available to fly. The airline always assumes a reserve pilot is somewhere in the domicile on that assigned reserve day. On reserve a pilot has no idea what they will be doing. They could be assigned a flight, airport standby or just to be available to fly with a 2 hour notice. I will use a reserve pilot who is assigned a 5 day reserve stint starting on a Monday. This pilot lives in Phoenix, Arizona but is based out of Los Angeles, California.
The pilot is a brand new First Officer. Due to being so junior he will likely get a reserve call out or airport standby. If he does get airport standby and doesn't get a flight, he will have to either fly home to Phoenix for the night, pay for a hotel, sleep in the airport or pay for a crashpad. Flying home isn't really an option if he is on reserve the next day. Paying for a hotel can get expensive. Sleeping in the airport isn't very comfy. Best option...a crashpad.
A crashpad is a house/apartment where crew members from various airlines stay temporarily. There are various levels from cheap and decent to expensive and nice. Many times other crew members who live in the area run the crashpad. Some crash pads have 3 bedrooms with as many as 12 beds while others have 3 bedrooms with 3-6 beds. The more beds the cheaper the rent and the more people who might be snoring/annoying. The prices vary widely but posting in my crewroom have decent ones for $200-$400 a month. This is a good chuck of change but is much cheaper than a hotel. The best crash pads have bus/shuttle service nearby that crew members can use to get to the airport. Otherwise....gotta buy a cheap car.
Living in Phoenix the pilot has quite a few options for getting to work. Phoenix is a hub for US Airways. Los Angeles is a focus city/hub for United, American and Southwest all of which offer non-stop flights. So on any given day he has 4 airlines to use for a ride to work. This is pretty good. Those living in smaller cities might have 1 or 2 airlines to get to work and might have to make a two leg commute. If the same pilot lived in Springfield, Missouri, he also has 4 airlines to choose from. Of those 4 airlines none have direct flights to Los Angeles. The pilot will now have to fly through a hub and connect to a flight to Los Angeles. Two leg commutes are riskier as he could get stuck in the middle due to full flights. For now, back to getting to work for a 5 day reserve stint.
Saturday morning the pilot begins to look at the flight options to commute to work. He was assigned morning airport standby starting at 6AM Monday morning. There are no flights he can take on Monday that arrive before 6AM so he will have to fly in Sunday.
He uses an industry website to check the loads. The morning flights are wide open while the afternoon/evening flights are rather full. He can get the jumpseat in the cockpit if the flights were full. One problem is most airlines have a priority for the cockpit jumpseat. Most airlines give the jumpseat to it's pilots first and then other airlines. Additionally there are likely other pilots commuting from PHX to LAX. To make sure he gets to work he picks US Airways flight 24 leaving at 8:30AM on a 757. The bigger the flight, the more seats. This is the only 757 between PHX and LAX that day. Starting so early, if he can't get on the flight he has several more options through the day. Leaving so early he will be wasting one of his days off. One less day at home.
The flight is open and he gets on just fine. By 11AM he is sitting in his crashpad. For the first 4 days of reserve he gets to fly, but no overnights. Thankfully he has the crashpad to use for rest. On day 5 he hopes to not get used and to be released so he can fly home the same day. Unfortunately he is assigned a trip that doesn't get back until 7PM. Long day as he started at 6AM for morning airport standby.
One his way back he studies the flights going back to PHX that night. There is the 7:25PM US Airways flight 117 on an Airbus. He might make it if he rushes over to the gate. After that the last flight is a 10:30PM flight on United....but its on a CRJ 700. Hmm not so great.
His flight lands right at 7PM. After the passengers get off, he grabs his stuff and rushes through the terminal to the US Airways flight. No joy, full flight and the jumpseat is taken by a US Airways pilot also commuting home. With time to spare he heads to the crewroom and stores his flight kit. Hours later he heads to the United flight. The flight is full, but the jumpseat is open. He sees the Captain heading toward the jetbridge and has a quick chat and ask if he can get a ride home. The Captain says he won't leave without him. After all the passengers load up, the gate agent tell the pilot he can't get on and closes the door. Thankfully the Captain kept his word and refused to leave without the jumpseater. This scenario happens more than one would think. The Captain of the flight controls the jumpseat. A gate agent can allow a pilot to get on a plane to ask for the jumpseat, but it's the Captains authority to allow someone to use it. The majority of crews will do whatever it takes to get a jumpseater on....as long as they know there is a jumpseater.
The flight leaves on time and lands at nearly 1AM in PHX. By 2AM the pilot is home. The whole house is sleeping. He is happy to be home for 3 days before starting the whole game over again. He could just as easily been stuck in LAX for the night and commuted home on his day off giving him just 1 or 2 days truly off a week.
Commuting to a line is a little easier. If a line holder has 4 day trips that start at Noon and end a Noon he can likely commute in on day 1 and commute home on day 4. Those lines are great for commuters. Many times a line holder has a trip that starts at 7AM and ends at 4PM. He can commute home easily on day 4, but will have to commute in the day before the trip to make the 7AM start time. Line holders don't need crashpads as on most 4 day trips they stay in hotels each night. Line holders who commute do still run the risk of finding somewhere to stay. If on day 2 the flight to the overnight cancels, they have no where to stay. The pilot can choose to commute home (unlikely), stay in the airport (not comfy) or pay for a hotel (most likely).
Most major airports have hotels that give generous crew discounts. Many times the hotels charge under $45 a night including tax. These aren't the best hotels, but they serve the purpose.
I have jumpseated a few times (for personal travel) due to full planes. Recently I was "stuck" in a major hub for 5 hours due to full flights and other pilots getting the jumpseat before me. I was finally able to secure the jumpseat and get a ride home. I am grateful for the ability to jumpseat and always ask the Captain for the jumpseat in a respectful manner. One bad thing about the jumpseat....most of them are the most uncomfortable seats you will ever sit on.
I am currently not commuting. I live just a few miles from my base. Being able to drive home each night to my own bed is something I don't take for granted. There are quite a few pilots who are friends of mine who do commute. One of my friends lives in my base, but can't hold it due to his low seniority. He has a bid to be based where he lives, but for now is forced to live the life a commuter. Commuting through an airport where you could be based really sucks, but is one of the many prices one pays to work in this business.