Suppose in your career history there is a time of about 2 years where you were not working fully but only for like a few months and then there is a gap of few months and then again an employment of few months and then again a gap for few months and this period is about 2 years, how do you put it in resume? Can you just write like: 2010-2012 various jobs and some employment gaps?
It's better to show the actual jobs. Writing something vague like you suggest will raise more questions and concerns in a potential employer's mind. You ought to just show your actual employment record for that period.
If extenuating circumstances were behind the unusual history, explain this. This will help allay any potential concerns. For example:
From 2010-2012 there were some gaps in my employment history due to needing to care for an ill family member / working on completing my degree / fulfilling my long time goal of hiking the Appalachian trail / etc.
I would not add a written explanation if it was due to normal work circumstances, such as being unable to find permanent work, getting fired or laid off, or quitting jobs you didn't like. But be ready to talk about the reasons.
All in all, given that it was five years ago, it probably won't be a big deal--assuming you have had stable employment since then. The main concern of an employer is whether you will be a reliable employee now. If you have demonstrated that over the last several years, some older history that is more questionable will not be so important.
Even if it was completely your fault, having a story like "In those years I lacked a direction and didn't really commit myself to anything, but eventually I realized that I needed to get my act together, so I did XYZ" probably won't hurt you. In fact such a story can be pretty compelling in an interview.
Actually this comes up quite a bit and is not at all unusual for one to have gaps in their resume. Went back to school, move to another country, change of career, freelancing, sickness, family leave, children, layoff, etc. so many reasons for a gap or two. I would list the years as you have it, but put in the jobs that you were working. For example, for a freelancer, there would be gaps, so 2008 - 2011, Freelancer then list the names of companies if they were more than three months or you have a good reference from them if a short time. I do not list actual references on a resume, the standard "references available upon request" will suffice, because I worked hard for those references and I don't want them contacted unless and until a serious offer is in the the works from the prospective employer for me. When called in for an interview or over the phone, be ready with a clear concise explanation. Practice with someone you trust to go over what you will say when asked about the gap. Good luck!