r/bash • u/CautiousCat3294 • Aug 03 '26
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
/procand/systhe 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
View all comments
Show parent comment
1
u/Bug_Next Aug 05 '26 edited Aug 05 '26
It's the official name lol, it's a tick count since system startup.
linux/include/linux/jiffies.h at master · torvalds/linux
There are HZ jiffies in a second, system uptime is calculated based on that, jiffies are quite important.
According to wikipedia the usage of the word in Linux traces back to 1975 and the "Jargon File" which was literally a file with computer jargon, people from MIT (of course it was MIT) used to pass it around, it reported a jiffy as 10ms, that's no longer the case but yeah that's where it comes from supposedly.
Jargon File
By 1996 they had already changed it to:
Edit: That file is absolute golden, just look up the definition of 'dahmum;
I think i'm gonna start using that one
Apparently, there was also a conspiracy theory that said UNIX was purposely bad so AT&T could take out their competitors after licensing UNIX to them lmao, they don't make haters like they used to.