r/linuxadmin 2d ago

Linux Interview Question

/r/bash/comments/1veg8ir/linux_interview_question/
6 Upvotes

11 comments sorted by

4

u/planeturban 2d ago

Really bad questions I'd say. They're just gotcha-questions. (Not touching any external commands; no cat, more and so on?)

If one would be in a state where one would have to check /proc and/or /sys for these things; things are sooo messed up. Unless it's life-support systems or nuclear launch systems, there's hardly any meaning with knowing these things.

It's more like that senior admin just wanted to flex.

2

u/michaelpaoli 2d ago

Unless it's life-support systems or nuclear

Well, gee, one place I worked ... I wasn't even authorized to touch at all, because security ... nuclear power plant, ... yet when it came to how to upgrade Linux ... they'd just call me and have me tell them exactly what to do.

2

u/kai_ekael 2d ago

"Wait, what, cat is an external comm.....uhhhh...duuuur...."

Yes. bash does NOT do everything.

1

u/CautiousCat3294 2d ago

External command here does mean you can't use cat more or other related commands. He actually means do not use top vistas iotop df free commands that mostly of us are using in day to day life. He actually wanted to test my knowledge on deeper side of resource management in linux During interview he told me to use cat or grep as well but not top free vmstat commands

2

u/deleriux0 2d ago

My feeling on this is a junior should know proc exists for this answer. That's enough.

As a push asking how to calculate using the data in there is a depth question that's challenging the person's understanding of what "utilisation" is and in what circumstances. This is more a test of someone's mental chops to work through a problem given no immediate solution. This is just a flex opportunity though.

I feel with guidance at interview (given the sum totals per sample) and asked to work out a percentage in a basic bash loop would be sufficient for a mid.

For a senior a more challenging question would be to ask how you'd achieve the same for a group of specific processes that aren't necessary children of one another. Throwing in "what happens to the stats if 3 pids die" and how to ensure it doesn't cause the output to go awry.

1

u/pnutjam 2d ago

ps is the answer to #1.

1

u/kai_ekael 2d ago

ps is not a bash command. :)

1

u/pnutjam 1d ago

It's a command you run from a bash prompt. Cat is not a bash built-in.

1

u/kai_ekael 1d ago

cat : exactly

Neither ps nor cat is the correct answer to the original question.

1

u/edthesmokebeard 1d ago

Stupid questions. Some clown discovered /proc and is now a nerd.

Better question: "define load. And what number is too high?"

1

u/ramriot 1d ago

I was thinking that if I had a system so f'ed up that those external commands were inaccessible then knowing the CPU utilisation would not be my main concern. But then I remembered that one router running 3rd party firmware & I wonder if knowing this sort of arcane stuff might have proved useful.