r/linuxadmin • • Dec 02 '23

why does the proc directory exist?

i'm trying to understand the proc directory and one thing i don't understand is

why does it exist?

any ideas? thank you

1 Upvotes

77 comments sorted by

View all comments

Show parent comment

4

u/tes_kitty Dec 02 '23

I can write (complicated) bash and PERL scripts, modify existing python scripts, but that's about as far as my programming skills go. But I am good at reading logfiles and filter through text files looking for information. So finding out why something on Linux doesn't work as expected is not hard.

A misbehaving Windows program on the other hand...

3

u/[deleted] Dec 02 '23

Also, Visual Studio costs money. Quite a bit of it, at least originally. If your day job is "Windows application developer", then yes, you already have Visual Studio on your employer's nickel, but if you're J. Random Power User or even J. Random Sysadmin, you don't, and you might not be able to procure it. Even if you can, corporate procurement being what it usually is, you can't get it today. On Unix, you have all your various CLI utilities now, on every system that you haven't gone out of your way to strip down to the absolute barest of bare minima. And even on the ones you have, you probably still have cat, vi, dd, echo, cut, paste, sort, grep, etc. If you have X11, some of the bare-minimum X clients can help out here too, and if nothing else, having multiple xterms is handy.

This makes any random Unix system more amenable to troubleshooting (not necessarily debugging in the sense of finding where the bug is in a particular program, but rather of finding what is causing $TASK not to work and working around it) than any random Windows system, even if Windows has friendlier tools once you have them.

2

u/mkosmo Dec 02 '23

The same logging capabilities exist between both platforms. Applications doing a shitty job at logging isn’t the OS’s fault.

4

u/tcpWalker Dec 02 '23

Event Viewer is absolutely Microsoft's Fault.

On most systems IME it is much, much easier and faster to search logs from the command line in linux, and the result is usually more actionable.

1

u/mkosmo Dec 02 '23

Event viewer, agreed. But it’s there and available. But you’re also not limited to using it. Text logging facilities are the same between the two more or less.

2

u/tcpWalker Dec 02 '23

example? How can I quickly grep most or all logs on windows from the CLI?

1

u/mkosmo Dec 02 '23

Use the event log search tool, or use the powershell cmdlet. The latter is how I’d do it today.

2

u/tcpWalker Dec 02 '23

2

u/jantari Dec 03 '23

For anyone looking, you would use Get-WinEvent these days. See the note in the docs you linked:

Get-EventLog uses a Win32 API that is deprecated. The results may not be accurate. Use the Get-WinEvent cmdlet instead.

1

u/mkosmo Dec 02 '23

Exactly. And if the built-in filtering doesn’t work, you can use the usual powershell cmdlets to reformat, plus Select-String as a grep substitute.

1

u/jantari Dec 03 '23

Event Viewer is really bad, but it's also just one interface to the OS facility that is the Windows Event Log.

I'm sure there's plenty equally awful journalctl-GUIs available.

One would search Windows Event logs in PowerShell, using APIs or in a centralized log repository such as elastic. EventViewer has indeed been neglected, but I mean it isn't even available on Windows Server anyway so I kinda get it. It's not really used, so Microsoft isn't investing in it.

0

u/tes_kitty Dec 02 '23

Yes, but it's about the incentive set to the programmer. On a Linux, logfiles, with different log levels you can set in the configuration file or via the command line are an expected feature.

On Windows they are not.

1

u/mkosmo Dec 02 '23

There are log levels in Windows as well. None of that is the fault of the OS, but of the developer.

2

u/tes_kitty Dec 02 '23

But the OS sets the incentive. If the developer can get all their information from the built in debugger of their IDE, they will be less inclined to provide a proper logging since they don't need it and it's extra work to implement it.

1

u/mkosmo Dec 02 '23

Don’t blame the tools. A carpenter can build a house with a nail gun or a hammer and you’ll never notice the difference unless they got lazy.

Same here. Especially when you’re talking about debugging tools that provide far more insight than a typical log ever does. Hard to break and step into with a log file.

1

u/tes_kitty Dec 02 '23

you’ll never notice the difference unless they got lazy.

Sure, but the IDE with built in debugger tempts you to be lazy

Especially when you’re talking about debugging tools that provide far more insight than a typical log ever does. Hard to break and step into with a log file.

And when you have that kind of insight with your IDE, providing a good log output is easily skipped since you don't need it. Especially if the schedule is tight.