this post was submitted on 30 Aug 2026
105 points (99.1% liked)

technology

24470 readers
336 users here now

On the road to fully automated luxury gay space communism.

Spreading Linux propaganda since 2020

Rules:

founded 6 years ago
MODERATORS
 

No more zip files gunking up your downloads folder. Just extract and delete all at once

you are viewing a single comment's thread
view the rest of the comments
[–] insurgentrat@hexbear.net 3 points 2 weeks ago* (last edited 2 weeks ago) (1 children)

Wow that sounds kinda rad, I sure wish I knew how to just write a script or conjure a program or whatever.

The cool thing is that you can learn! Python is approachable and shell is an extremely simple language so you could pick either. It's more straight-forward to use shell as you can use all the lovely existing programs by just writing their name, no need to manage libraries/call out to stuff.

sed 's/_/-/ text_with_underscores will replace underscores with hyphens for example in the text. so one part of a script renaming everything would be

`for filename in *

do

NEWNAME=sed '/_/-/ $filename

mv $filename $NEWNAME

done`

off the top of the dome so maybe a mistake in it.

Dunno what "regex/patterns" is here or how to use qmk for any of that, but I know about completion, in fish it shows what it'll autocomplete if you press Right Cursor Key which is neat.

expansion patterns are stuff like the asterisk above, it matches any character any number of times. So e.g. prefix_* matches all strings that start with prefix_. Regex is a language for describing strings and performing operations on them, you can do stuff like ask for "the string that has 3 letters, none of which are Z, followed by a number between 2 and 8 at least once, then anything. Output a string made of the number, then the rest of the string"

Very powerful for finding and manipulating text, and since all linux software takes text as arguments and outputs text extremely useful for sophisticated software chains (when you compose things with pipes in console to get complex behaviour from simple software).

[–] ashinadash@hexbear.net 2 points 2 weeks ago (1 children)

The cool thing is that you can learn! Python is approachable and shell is an extremely simple language

There is always this learn-to-code but never any specificity.

`for filename in *

do

NEWNAME=sed '/_/-/ $filename

mv $filename $NEWNAME

done`

Hexbear's formatting sucks for copypasting code, that's like pretty simple though I guess.

like the asterisk above, it matches any character any number of times.

Ah my beloved LOAD "*",8,1, that's a classic, I see. Much ado about computer programs...


Remember to enable JPEG-XL support in your browser, even on your phone!

[–] insurgentrat@hexbear.net 3 points 2 weeks ago (1 children)

If you do want your computer to be more comfortable then rather than the nebulous "learn to code" learning to script (simple programs that run from top to bottom) to automate annoying or repetitive tasks is a really good way.

I am biased, I started as a system administrator and learned to program that way (now I'm an ok programmer, slow but I try and make very robust programs that are performant).

On my computer I have a /home/rat/bin/ folder on my PATH variable (that determines how console evaluated "programname command" type entries, it looks on the PATH for programname and invokes it) that I fill with little half baked helpers for myself.

Just yesterday I decided I needed something to remind me to stretch, so I added a little piece of code (literally just "notify-send 'Take a stretch break'") and added a systemd timer unit to call it 20 minutes after boot and twenty minutes after that. There's lots of ways I could improve it (pause when inactivity, overrule DnD, add pausing functions, add a systray applet thing) but no need to start with all that and no need to dive right in to some bloated piece of crap bundling electron for something that just increases how much I stretch.

You'll probably have stuff you do often: clearing out old downloads, searching for files in a particular directory, opening a set of programs together, switching between night and say brightness and volume, renaming stuff, setting up folder structures and so on. If you find yourself repeating something you can ask "Is there a way to just have this happen automatically?"

Linux's POSIX (mostly) compliance makes it really easy because you can just start by going "I guess I'll chain my most common commands together" and worry about adding arguments/error recovery/logs etc if it's ever relevant.

[–] ashinadash@hexbear.net 2 points 2 weeks ago* (last edited 2 weeks ago)

I started as a system administrator and learned to program that way

michael-laugh How 2 become a sysadmin

I've done 'rename every file in x folder manually' and I didn't know how scripting, but I knew it would be cool to have. Thanks for chatting in response to my frankly silly bullshit though.


Remember to enable JPEG-XL support in your browser, even on your phone!