I have to travel by plane at 5 a.m from the Tunis airport in Tunisia. I don't have anywhere to spend the night since I live in another city. I have to get there 'early' because of transport availability. How can I stay awake the whole night?
It sounds like you're going to be at the airport from the evening before your flight until the boarding process begins shortly before 5. It's going to be airport-dependent whether you can get through security when you first arrive, and wait near the gate, or whether you'll have to wait before security. Your airport is covered at Sleeping in Airports: http://www.sleepinginairports.net/africa/tunis-airport.htm
If you can get through to the gate, you probably don't need to stay awake. Set yourself an alarm for about 4am, add a note if you're worried you'll sleep through it, and relax. Related: Best way to sleep at Vancouver International Airport and wake up on time?
If you can't get through, then you'll be in a more public and less secure area. There may be restaurants and stores - again, this depends what airport you're in. You can read, buy coffee, talk to the people who are working overnight, and so on. Or everything may be shut down entirely and there may be no-one around other than a bored security guard. This will be very hard to stay awake through.
Probably the best thing to do is stay at an airport hotel. Even if you don't book a room, hang out in the lobby and use the shuttle to get to the airport in the morning. The staff won't let you sleep in the lobby but they may let you hang out if you ask nicely.
Do you need to stay awake? Most airports allow sleeping, in varying degrees of comfort, and there's even a site devoted to this. Just set an alarm (or three) to wake you up before your flight: two hours early if you haven't checked in yet, one hour if you have.
It's usually also perfectly safe to sleep in airports, especially airside (after security & immigration), although obviously it's good to keep close to your valuables. I recommend using your backpack as a pillow and bringing a bicycle lock or equivalent so you can chain any larger bags/backpacks to something solid.
Larger airports will also have on-site transit hotels where you can sleep in a proper bed. Obviously these cost money, but you can often rent them by the hour, and a stay of a few hours probably won't cost too much.