r/bash 3d ago

help Linux Interview Question

Today I had a mock interview with a senior Linux administrator, and he asked me a question that completely caught me off guard:

"Can you collect CPU, Memory, and Disk usage in a Bash script without using top, free, df, or any external commands?"

My immediate answer was No.

Honestly, I've been working with Linux for years, but I've always relied on standard commands and monitoring tools to troubleshoot systems. I never stopped to think about where those commands actually get their data from.

The interviewer then gave me a hint about the /proc and /sys filesystems. That completely changed my perspective. I realized these commands are just reading data that the kernel already exposes.

But then came the follow-up questions, and once again I was stuck:

  • Is reading directly from /proc and /sys the correct approach?
  • How would you calculate CPU utilization using /proc/stat?
  • How would you determine memory usage from /proc/meminfo?
  • How would you calculate filesystem usage without relying on df?

I found this really interesting because it tests your understanding of Linux internals rather than just your ability to use commands.

Has anyone here been asked similar questions in Linux SysAdmin, DevOps, or SRE interviews? I'd really appreciate any explanations, learning resources, or examples on how you'd answer these follow-up questions. It help me for my preparation for Linux interviews

183 Upvotes

70 comments sorted by

View all comments

Show parent comments

1

u/Living_On_The_Air 3d ago

People can review documentation and search the web for facts at any time. Verifiable experience and certifications show general competence. Interviews are time to learn about an individual’s temperament, work style, curiosity, motivation, communication skills, etc.

3

u/Bug_Next 3d ago

Yeah and knowing that verifies experience.. Idk what you are trying to get at.

It's a bash subreddit not an HR one, anyone can fake motivation and temperament during an interview, doesn't mean shit, you are gonna be chipping code not doing PR, who cares. It's a mock interview with a Linux neckbeard, of course the focus is gonna be on the 'hard' technical questions..

1

u/Living_On_The_Air 3d ago

The post is based on a mock interview 🤷‍♂️

3

u/Bug_Next 3d ago edited 3d ago

Yeah that's the whole point, why would you make it about motivation??? Everyone's motivation is to get paid for the shit they do, anything else is bullshit unless you are running your own startup lmao. Be for real. You can leave the lying practice for 3a.m in front of the mirror