When your systemd service is messed up, you say "journalctl -fu servicename". I am sure the devs were fully aware of what they were doing with this, same as LPL was when he made the Folding Utility ("FU") pick.
That's fundamental to shell scripting. It's always very stringy. There are a few shell languages that took the leap to become applications programming languages (I spent a lot of my time in the 1990s writing REXX code, for example), and they will always be that bit different from "classic" programming languages.
i'm really just saying i dont like strings in general
my favorite language is rust so i can and will strongly type everything by pure instinct rather than by logic even when scripting languages are objectively more convenient for these tasks
i like micro optimizations and overvalue it a lot more than developer time so i generally dont like the very idea of multiple regex passes and string operations/allocations even if in practice it takes a few milliseconds to run (if even that) every hour
That's fair! It's often the wrong tradeoff to make, but I definitely understand the mindset. Personally, I tend to prefer languages with richer data types (lacking support for first-class arrays can seriously hamper a language), but there are a lot of conveniences to the simplicity of shell languages.
i also have some uh, opinions regarding regex and vim's default keybinds
so many things that "work and work well but aren't perfect for my specific definition of perfect"
i feel like the new kid walking into the scene going like "damn y'all live like this?" and being basically the only one in the room to (outwardly) think this way while everybody is busy doing their actual job
i'll probably look around for "regex with macros" and other text editors like kakoune and emacs before i make another competing standard
Oh look, everyone has opinions about regex. Most of them have at least some merit. The minilanguage is so extremely compact and then has to get extended in so many directions. Ugh. Don't worry, you are not the only one to think that way.
TBH I wouldn't reach for a regex for most parsing, unless it's the only real option available in the context I'm working in. Whenever I can, I prefer sscanf parsing instead. The main reason is to avoid backtracking (yes, occasionally that means sscanf is a poor choice, but OTOH you never have the catastrophic performance that a regex can suffer from), but also I prefer the syntax.
The fun thing about the "stringy"ness is it's really quick and simple. You can just build up a pipeline in real time looking at the output of each thing, and not really worry about anything (or even really look anything up).
No API, just a very simple set of operations with easily human readable output every step of the way.
If you look at that, journalctl is the only tool that does something specific/uncommon. Everything else is the equivalent of a standard library function.
This is what I'd consider an "aeroplane skill", ie easily doable without an internet connection.
from my perspective, this is just a repl but with only one type
correct me if i'm wrong but isn't that basically what bash is
it's awesome that they figured out this kind of workflow from a long long time ago, but things are absolutely not optimal the way they are now. they are simply the most backwards compatible, universal, and thus generally least headache-prone ways of doing things.
The thing about a shell is that it's designed to be something different than a "real" programming languange, right? It's a way to interact with the OS, and all that stuff is front and centre. Strings and files are the natural "units".
Of course you can do all this stuff in a Python interpreter if you want, it just takes way more typing.
A shell one line is a neat little "here's a thing that needs doing, it needs a few simple steps, just get them out the way". I guess the python equivalent would be a list comprehension.
i guess the difference is that in python, the syntax is command, arg2, opt=val) while in bash it's command arg1 arg2 --opt val and you can pipe things.
very convenient, with the catch that you have only one type to work with. someone suggested i take a look at nushell and that's pretty much what i envisioned. just a language with real types, a repl, and convenient default parse/tostring implementations for every type.
user readability doesn't clobber the exact values of the data. you don't have to lose information or re-parse whatever the last program outputted, if it's compliant. the number "10,552 bytes" can show as "10kb" since both are just the same mumber displayed differently.
Lately Iāve been telling it āyour code needs to be easily read and understood by a human reviewer so always lean towards readability even if it means your solutions arenāt as elegantā
Thatās not even a crazy command with basic UNIX/Linux knowledge. Iād be more worried about you, if you vibe code stuff in a domain that requires this command, and donāt understand it.
tbf i think you can compress it? surely you can just get both results at the same time and censor data in the output instead of running two journalctl commands
Not saying itās not overly verbose š LLMs usually donāt come up with the most compact solution. But that commandās intent is not _that_ hard to parse
Okay mate, everyone knows your a big bad coder, chill out.
Of course every command is simple, and if you take the time to read it you can make sense of it, It's the construction of the whole script in a nano second using tools you've not used for that project or in a while and it's moved onto the next task producing a similar output before you can even process what happened in the first one that causes the shock to your current mental model of what you're working on.
e.g, The agent is running a basic SQL command and parsing into another data structure to run sed with a mad regex on it rather than writing a decent SQL query which you would have done previously.
Claude code one liners always remind me of this Romanian Perl developer I worked with in the late 90s. At least Claude doesnāt curse me and respond with RTFM if I ask any questions.
I'm an SRE, and this is, like, a typical Tuesday morning, not anything exotic. It's not even 'code', it's just a series of log dumps and filtering. No conditionals or looping anywhere.
It's using bash to it's peak. Love to see it. This is why AI has an advantage.
Not even kidding. The most productive I've ever felt was when using bash in Unix. Don't even get me started on how great it feels to write Regex without looking up the syntax! Wish I still could. Been a good 10 years since I've touched it.
People probably think I am kidding but AI using bash to configure systems to deploy to AI is a huge deal.
There have even been a few new Linux distros that have come out from this in the past few weeks.
We know AI is decent at coding. If it can configure systems or even bigger networks we are in for some big changes...
I wish DraftKings had a bet to say that system integration AI is the winner. Once integrated it has full control. (Not saying we can't it shut) but at this point it has system controls, coding abilities and can just keep improving.
More hardware tech may be required but this is all happening pretty fast.
This is most likely just a quick one-liner for Claude to run when troubleshooting a system. It identifies which services are generating the most errors, normalizes variable values (like replacing hex values with <hex> and long IDs with <id>) so similar errors can be grouped together, then displays the five most common error patterns.
So regarding your point about āselling more tokens,ā Iād actually argue the opposite. This is an extremely compact and efficient way to accomplish the task. Rather than having Claude break the process into multiple steps, inspect logs individually, or write a more elaborate Bash script following some arbitrary coding conventions, it can do most of the work in a single command.
All those extra steps would take more time and, more importantly, more tokens. If anything, this is an example of minimizing token usage, not inflating it.
Claude is going to read the results of this command. It's better to have a complicated command which gives a short output than a simple command which gives a long output, if you want to reduce tokens.
IIRC using for(;;) produced better assembly in the first C compilers than while(true), so it became common because of this. Also, true wasn't a thing in C at the time so it would actually have been while(1), which also isn't super clear
But also worth noting that though "at the time" sounds (to me at least) like maybe 70's and 80's, it is anything before 1999, or really, the time when people got around to adopting the C99 standard (so mid 2000's?) where the boolean type _Bool was introduced to the language. But even then you had to include the stdbool.h header if you wanted to use bool, true, or false, which were really just convenience macros expanding to _Bool, 1, and 0. It wasn't until the year of our lord 2023 that they genuinely became part of the language.... which is pretty wild if you ask me
That takes me back to JavaScript optimizations. You got better performance running over an array backwards than forwards. And a loop is much faster that for each. An index loop is faster than a 'for of' loop.
Then you sometimes need to allocate the variables outside the loop so they would be reused.
Usually this didn't matter but sometimes you gotta summon the arcane knowledge of the V8 engine.
Not uncommon in C, one advantage is it's obvious to any linter that you intend to iterate forever. Linters are generally smart enough to handle it now but if you say "while(1)" or "while(true)" you may get a warning that the condition is always true, and the latter requires including stdbool prior to C23
I've heard from some algo dudes that in c++ for(;condition;) in some cases by some compilers is optimized better by -O3 than while(condition) and that can save them precious milliseconds they fap on
Sort of, the scope is not as limited as you might expect. In this condition, x is assigned the return value of func() then evaluated for its truthiness. The variable then can be used after declaration, even outside the scope of the condition block (so you could later use x entirely outside the scope of the condition)
It's a somewhat new addition to Python, but I've found it pretty useful personally. It can also be used in some more complex cases, like in dict comprehension. For example:
products = {"Pen": 120, "Notebook": 80, "Pencil": 40}
affordable = {
name: discounted_price
for name, price in products.items()
if (discounted_price := price * 0.9) < 100
}
print(affordable)
Essentially. I guess it's an uncommon math operator that a lot of other languages use, but the first time I saw it in code I was like "wtf is this nonsense..... Oh..... It's bullshit"
I wanted a PNG converted to SVG or some such. It couldn't find a PowerShell way to do it, pngtosvg.com was blocked by the corporate firewall so it found a npm library to do it, downloaded it and called it locally to do the conversion.
Like. It know this possible but what a crazy way to accomplish the task.
Meanwhile with GPT I've head cases where I know what the function is and ask it to use it because I cant be bothered to scour the docs to find it and its name, and it kept on getting stuck because it was using a nonexistent function from a core library
240
u/ThaBroccoliDood Oct 14 '26
love putting words in the terminal
sort -rn
rm -fr
journalctl -ball
34
u/mrheosuper Oct 14 '26
"LGTM" go ahead
27
u/0xKaishakunin Oct 14 '26
Damn, we need a Practical Extraction and Report Language at this point
346
u/djbarsone Oct 14 '26 •
Just rename this sub AIcirclejerk already
23
u/ZunoJ Oct 14 '26
Looks more or less fine to me
14
u/BastetFurry Oct 14 '26
So Claude is your average Linux Neckbeard that loves to pipe?
12
u/Spare-Subject-796 Oct 14 '26
just did the same a couple of minutes ago for my influxDB exited when it should not have
32
u/NomaTyx Oct 14 '26
happy for you or sorry that happened
37
u/-Redstoneboi- Oct 14 '26 edited Oct 14 '26
"damn bro i'll let you use python at this point"
all these linux cli tools are so stringy, would definitely much rather have standardized apis for them
33
u/k_sway Oct 14 '26
Lately Iāve been telling it āyour code needs to be easily read and understood by a human reviewer so always lean towards readability even if it means your solutions arenāt as elegantā
Iāve been getting good results with that so far
8
u/somebodyinvisible Oct 14 '26
Somehow I understand of that evil spell.
9
u/770grappenmaker Oct 14 '26
Get the top 3 most common syslog identifiers, count errors for each?
13
u/snarkofagen Oct 14 '26
Beats having to write shit like that by hand like we had to do in the olden days.
14
u/gsaelzbaer Oct 14 '26
Thatās not even a crazy command with basic UNIX/Linux knowledge.
Iād be more worried about you, if you vibe code stuff in a domain that requires this command, and donāt understand it.
2
u/fhayde Oct 14 '26
Claude code one liners always remind me of this Romanian Perl developer I worked with in the late 90s. At least Claude doesnāt curse me and respond with RTFM if I ask any questions.
3
u/ilnarildarovuch Oct 14 '26
systemD slop command
3
u/Solomoncjy Oct 14 '26
atp just pull in python for the structed json parsing oml
1
u/GTMoraes Oct 14 '26
guy that made the tool: I didn't even know it could do that
1
u/explodedcheek Oct 14 '26
This is what I thought regex final boss would look like...but it's just code for monitoring logs lol.
1
u/Express-Acanthaceae9 Oct 14 '26
Claude finds interesting ways to reduce filling context with output from these kind of commands
1
u/ExtraWorldliness6916 Oct 14 '26
You lost me at pipe syslog identifier
1
u/exqueezemenow Oct 14 '26
I was in this same position with the same expression this week.
1
u/20220912 Oct 14 '26
I'm an SRE, and this is, like, a typical Tuesday morning, not anything exotic. It's not even 'code', it's just a series of log dumps and filtering. No conditionals or looping anywhere.
1
u/dminus Oct 14 '26
catgrepper bankai
1
u/chickey23 Oct 14 '26
I told you we should have put a no robots at the start of the crontab. Now they are stealing all of our pipes!
1
u/r0b074p0c4lyp53 Oct 14 '26
It's just reading the log, plus a bunch of formatting
1
u/Direct-Quiet-5817 Oct 14 '26
Verify
1
u/cornmonger_ Oct 15 '26
/uj i highly recommend
nu --mcp/rj i highly recommend
nu --mcp1
u/glorious_reptile Oct 15 '26
| cryptominer āt 5s āsilent | ā¦
1
u/funkdefied Oct 15 '26
All my homies use āsdā
1
u/[deleted] Oct 15 '26
That moment you know something doesn't need to be so complicated
1
u/nazgulonbicycle Oct 14 '26
Iāve handwritten and stored type shi like this
1
u/burnttoast12321 Oct 14 '26 edited Oct 14 '26
It's using bash to it's peak. Love to see it. This is why AI has an advantage.
Not even kidding. The most productive I've ever felt was when using bash in Unix. Don't even get me started on how great it feels to write Regex without looking up the syntax! Wish I still could. Been a good 10 years since I've touched it.
People probably think I am kidding but AI using bash to configure systems to deploy to AI is a huge deal.
There have even been a few new Linux distros that have come out from this in the past few weeks.
We know AI is decent at coding. If it can configure systems or even bigger networks we are in for some big changes...
I wish DraftKings had a bet to say that system integration AI is the winner. Once integrated it has full control. (Not saying we can't it shut) but at this point it has system controls, coding abilities and can just keep improving.
More hardware tech may be required but this is all happening pretty fast.
1
u/BobThefuknBuilder Oct 15 '26
Didn't understand instruction, gave head 5 times no logs appeared.
0
u/[deleted] Oct 14 '26
[deleted] ā view deleted comment
0
u/[deleted] Oct 14 '26
[deleted] ā view deleted comment