I am preparing for a Systems Admin(linux) role for a big company(top 10 companies) and one of the requisite is knowledge of a language like perl, python or Ruby. I have a phone interview which involves sharing a editor with the interviewer, now what kind of coding exercise can I expect on a phone interview or a regular interview?

I have used shell for most of my day-to-day tasks and occasionally Perl and python for bigger tasks. Now I don't expect them to ask

Write a script that syncs AD users to LDAP.

I don't think data structures, algorithms or sorting questions apply to me role? Can you give me any examples of SysAdmin related coding questions?


I don't think data structures, algorithms or sorting questions apply to me role?

Why don't you think that? Mabe not knowing the differences betwen O(n) and O(1) and O(log n) but writing good code - and scripts are code - definatly needs a basic understanding of those three things.

When I intervied for my current job I was asked at least the below quesiotns (I may have forgotten some) I was allowed to use the language of my choice.

  • FizzBuzz
  • Givin four points and a co-ordinate determine if the co-ordinate is inside or outside the square/rectangle
  • Givin a list of names and test scores how would you find who got the high score and average. The test could be retaken so there may be more than one entry per name, only count their high score. How would you find the high score for a particular student.

Some sysadmin specific things:

  • How would you search a 100GB log file for entries matching $Pattern?
  • Given a list of 1000 people containing: First Name, Last Name, Department and phone number how would you add these people to $Dirctory or $10 *nix servers w/o a central auth system?
  • How would you correlate an error event with related logs in 3 different log files?
  • How would you convert a log file into a MySQL Database with Structure given to you? How would you change the structure of the database?
  • 1
    A real-world example I've dealt with: every 15 minutes iterate over 30K-300K events and upload selected entries into a database. Loop efficiency REALLY MATTERS in something like that. – sysadmin1138 Jan 11 '11 at 3:21
  • The geometry question doesn't seem like something a sysadmin would regularly see. The answers look pretty complex for an interview question, but maybe I am assuming a more complex structure. – Zoredache Jan 11 '11 at 23:07
  • @Zoredache probably not ... the devs aske me, but it is interesting to see how someone reacts out of their comfort zone. Also it was limited to a square or a rectangle, nothing fancier – Zypher Jan 12 '11 at 3:10

I don't like interviews to feel like exams. It should be more about figuring out if the person is overall a good fit for the position and for the organization, and not so much about putting the interviewee on the spot. Now, sure, a good sysadmin has to be able to whip up a useful script under pressure, but it's not the same kind of pressure.

Therefore, rather than asking a series of questions, I'd be more inclined to chat a bit about scripting language preferences, culture, and so on. (This should be particularly effective for Python, Perl, or Ruby!) Generally, this should be enough to get a feel for the interviewee's engagement with the language or languages of choice, which is more important than the ability to answer some carefully-selected clever question right there on paper.

You can always ask for sample scripts to be e-mailed after the interview. (And then you can Google bits of the code to see if it's plagiarized....)


In my experience sysadmin questions in interviews tend to often be based on file processing. For example, "take this logfile and extract the unique IP addresses along with a count of each" is something I was asked in an interview not too long ago.

The FizzBuzz test remains one of favorite programming questions too.

  • If they do that logfile question and don't use awk | wc -l, the followup question is "why not???" – mattdm Jan 12 '11 at 0:52

Other folks have provided some great examples of exercises you might encounter, so I'll leave that as handled. I want to mention, though, that as important as getting the code running is making it maintainable - this is maybe more important in sysadmin-land than anywhere else, since we're the kind of people who tend to write a script and then forget about it for years until something breaks it, unlike application developers who spend a lot of time in close contact with their codebase and can get used to its idiosyncrasies. I've hired for sysadmin positions, and that clarity is something I look for in code samples.

Intelligible variable names following a consistent naming scheme; sufficient commenting; separating configuration from code (a lot of my perl-programming coworkers have the very bad habit of storing their script configuration in big comma-delimited inline string scalars, a typo in which turns what should have been a warning into a full-on messy die); etc. I heartily recommend Damian Conway's 'Perl Best Practices' as a reference in this area. Hope it helps; good luck with your interview!

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.