linux

This magazine is from a federated server and may be incomplete. Browse more on the original instance.

Tetsuo, (edited ) in My First Regular Expressions

Good job !

I highly recommend trying out the various online regex editor.

These WISIWIG kind of editors are great because you immediately see what the regex is catching and for what reason.

I took the first one in my search results but try different ones.

regex101.com

Also I used GPT to get some regex for some specific strings and it can be helpful to get a quickstart at building a specific regex.

In that case I was building a regex for a specific log from postfix.

PS: just make sure to select the correct flavor of regex you are using in these online tools.

Edit: Also one of my favorite YT channels has pretty cool videos on RegEx : youtu.be/6gddK-cOxYc?si=0bnNkSDzifjdxwjU

malijaffri,

Piggybacking onto this to mention my go-to online RegEx editor: RegExr. It lets you test the regex as you type, explains the particular symbols used, as well as has a sidebar where you can see different pattern types categorically. I’ve been using it for almost 2 years now, and haven’t had any reason to use much else (after I discovered this).

harsh3466, (edited )

Thank you very much. I will definitely check out the regex builders. That’ll be super useful

Edit: fix stupid autocorrect turning regex into Reyes.

virku,

Wait. Are there flavors of regex? Every time I have to use regex it hurts my brain and I never need to do it enough to actually sit down and learn it properly like OP is doing. Just knowing there are different ways of doing the same things in an already mind baffeling language blows me away even more.

ricecake,

Yes. Most things use pcre, or Perl Compatible Regular Expressions, but there are other flavors. Usually they lack features or have slightly different syntax.

remotelove, (edited )
@remotelove@lemmy.ca avatar

Yeah. The only one you really need to care about (especially under Linux) is PCRE, the good 'ol Perl Compatible Regular Expressions. For the most part, every other flavor is a derivative of that. Microsoft had a weird version for a while, but that may be completely dead now, thankfully.

Learning the syntax of regex is fairly easy. Hell, I still have to use this cheat sheet more often now that my perl skills are no longer needed or even relevant.

Regex isn’t that hard. The challenge is identifying and understanding patterns in the data that you are filtering. Here is a brain hack: As an example, if to have pages and pages of logs that you need to filter, open up one of the log files, stare at the screen and hold the page down key for several dozen pages. Patterns can be easily seen in the blur of text that is quickly scrolling across the screen. (Our brains love to find patterns in noise, btw.) The patterns that you see will give you focus points for developing regular expressions to match. ie: You start breaking strings into chunks and seeing the ebb and flow of data streaming across a screen helps. Anomalies in the data “stream” are are easy to spot as well.

From a security and efficiency standpoint, you should also understand where the most processing takes place so you don’t kill whatever platform you are working on.

Sorry for the rambling, but I am getting older and feel the need to pass on a ton of tips and tricks whenever I can for these “archaic” languages.

harsh3466,

That screen scrolling tip is gold. I’ve often used that trick to spot anomalies in data. Hadn’t considered using it to spot the patterns for regex.

virku,

Thanks for the comprehensive reply! I have only used it for quite simple things like getting the id’s out of log lines where this and this key word exist. Great tip about pattern searching!

Merry Christmas

bizdelnick, (edited )

The only one you really need to care about (especially under Linux) is PCRE,

Well, no. sed, grep, awk, vi etc. use POSIX regexes. GNU implementations also provide perl compatible mode via an unportable option. In modern programming languages like go and rust standard regex engines are compatible to RE2 - relatively new dialect developed in Google that is not described in the Friedl’s book (you may think of it as an extension of extended POSIX dialect). Even raku has its own dialect incompatible to perl as well as other ones.

Nowadays it is common to move away from perl-like engines, however they are still widely used in PCRE based software and software written in python, JS etc.

remotelove,
@remotelove@lemmy.ca avatar

POSIX? Never heard of her.

While you are likely 100% correct, the legacy perl developer side of me is making nasty comments to you with illegible syntax.

bizdelnick,

Perl has introduced powerful backtracking regexes that were widely adopted. However they can be damn slow in some cases, that’s why RE2 refused backtracking while using some perl-like elements. Both basic and extended POSIX regexes are also non-backtracking because they are older than perl.

harsh3466,

Computerphile! I’ll check those out.

fuckwit_mcbumcrumble,

Regex101 is amazing. It tends to balk at backtracing which we rely on a lot for work, but it’s such a good visual.

Chat GPT can also save a lot of time writing regex, but it tends to write very unreadable regex because it thinks it’s being clever when it really isnt.

Regex is an art form, and writing readable regex is another step above that.

llothar, in Arch on semi-critical pc? (Also EndeavourOS vs raw Arch?)

If the goal is to have the most up to date bleeding edge software, but have it on a critical machine, consider immutable distro like Fedora Silverblue or OpenSuse Aeon. Especially the latter will be just days behind Arch, and if an update breaks something you just roll back and try updating again in a week.

I used Silverblue as my main work system and this saved me a few times.

Bomal,

Yeahh immutable system is the way, I spent so much energy reinstalling systems that felt dirty and slow or just distro hopping. Then I tried NixOS believe me I’m not going anywhere else

Helix,

can you rollback on boot like with NixOS? This is one feature I found really cool, but NixOS itself completely turns me off. They have several bootloader entries where you could just boot into a previous system configuration, which is not a filesystem snapshot like with grub-btrfs+pacman-boot-backup-hook or similar.

Spectacle8011, in Debian 12: how do I get Gnome Files to display preview thumbnails/icons for large video files? Right now it just shows generic icons
@Spectacle8011@lemmy.comfysnug.space avatar

On Arch, I use ffmpegthumbnailer to accomplish this.

Kickass Women isn’t going to see this comment because this user is from lemmy.world, which has blocked my instance.

swab148, (edited )
@swab148@startrek.website avatar

On Arch, I use ffmpegthumbnailer to accomplish this.

Kickass Women isn’t going to see this comment because this user is from lemmy.world, which has blocked my instance.

Reposted for you, I don’t think they’ve blocked mine

kariboka,

Good idea

Spectacle8011,
@Spectacle8011@lemmy.comfysnug.space avatar

Cheers!

eksb, in What's your favorite music player on Linux?
@eksb@programming.dev avatar

mpd + ncmpc

I am but a simple man. All my music is FLAC. It is arranged neatly in folders. I just want to select an album to play. I do not need album covers, playlists, search, streaming, tags, lyrics, analyzers, or scrobbling.

wesker,
@wesker@lemmy.sdf.org avatar

Agreed, with the exception of album covers. I like it all to look nice on my Hidizs when I’m on the go.

Twig, (edited )
@Twig@sopuli.xyz avatar

More of a gmpc kinda person. Unless there’s a better GUI for mpd out there?

There’s always mpdas for scrobbling

seliaste, (edited ) in How do I have Japanese fonts displayed in Fedora?
@seliaste@lemmy.blahaj.zone avatar

“By default it displays kanji as Chinese characters” Not quite sure what you mean by that
Edit: my bad, I read the other comment’s link and had not encountered the issue yet. Wish you luck to solve this

gary_host_laptop,
@gary_host_laptop@lemmy.ml avatar

I think it’s pure luck what font does your OS prefer, I was using Pop_OS and it defaulted to Japanese, but I think it’s more common to default to Chinese because of the population size.

embed_me,
@embed_me@programming.dev avatar

I think it defaults to Japanese every time in my experience

gary_host_laptop,
@gary_host_laptop@lemmy.ml avatar

Not this time it seems.

AI_toothbrush, in Flakes aren't real and cannot hurt you: a guide to using Nix flakes the non-flake way

This a plea for help: is there any other distro that does immutability like nix without the configurstion of nixos. I love nix but its just so complicated. When something breaks i spend half an hour just to fix some small problem because i have to get the config then rebuild then test, etc. Idk if i was the one making nixos how would i fix it tho. Also its too teminal based for most people.

Atemu,
@Atemu@lemmy.ml avatar

There’s the WIP NixOS-based SnowflakeOS that aims to make NixOS approachable for mere mortals but that’s still declarative configuration and of course still NixOS under the hood.

There’s a bunch of immutable distros out there that use OStree or some other imperatively managed snapshotting mechanism such as Fedora Silverblue or VanillaOS.

AI_toothbrush,

Ill try some of your suggestions. Thanks

antsu, in Friendly reminder

Timeshift with BTRFS kicks ass. I have mine set for daily snapshots, retained for a week. Only the changes between snapshots are stored, so the extra disk usage is minimal, and easily justified by the peace of mind in case of fuck-ups or broken updates.

dan, (edited )
@dan@upvote.au avatar

Only the changes between snapshots are stored, so the extra disk usage is minimal

If you want to use a similar approach for backups, Borgbackup is a pretty nice piece of software. I have two backups of my most important files: One on my NAS at home, and one “in the cloud” on a storage VPS (ends up way cheaper than using S3, B2 or anything like that).

NanoooK,

Which storage VPS have you selected? I’m looking at Hetzner atm.

dan, (edited )
@dan@upvote.au avatar

I’ve got one with HostHatch that’s 10TB of space for $10/month. It was an offer they had during Black Friday 2020. They had a similar offer during Black Friday 2023 but I think it was around $20/month, paid yearly.

I live in the San Francisco Bay Area and my storage server is in Los Angeles, which is around 10ms round-trip ping time from my home internet connection.

Hetzner is good too. They have relatively cheap “storage boxes” that are a shared environment rather than a VPS. You don’t get proper SSH access, but they do support FTPS, SFTP, Samba, Borgbackup, Restic, rclone, rsync and WebDAV. www.hetzner.com/storage/storage-box

Borgbackup encrypts the backups, so the host won’t be able to actually view your backups.

jelloeater85,
@jelloeater85@lemmy.world avatar

Just make sure you back up your stuff to a second disk❤️

liforra, in Friendly reminder
@liforra@endlesstalk.org avatar

When u realize you dont even use a backup software rn

TimeSquirrel, (edited )
@TimeSquirrel@kbin.social avatar

I just copy my whole-ass home dir to an external drive every so often like a caveman.

reallyzen, (edited )
@reallyzen@lemmy.ml avatar

Which you should absolutely do even if you snapshot the eff out of your system. What about hardware failure, eh? Can’t snap that nvidia shit can you?

optimal, in Flakes aren't real and cannot hurt you: a guide to using Nix flakes the non-flake way
@optimal@lemmy.blahaj.zone avatar

Guix is so good that it doesn’t need flakes

Atemu,
@Atemu@lemmy.ml avatar

How do you compose Guix projects?

jelloeater85, in Linux reaches new high 3.82%
@jelloeater85@lemmy.world avatar

I mean, it’s no secret that the SteamDeck is a huge reason why. Praise Gaben, may we game on every platform equally.

henfredemars, (edited )

I’ve seriously been writing down the pros and cons thinking about switching over to Linux on my main desktop at home. It covers all the games I play now. I was very surprised.

Without the games to hold me back, I don’t see why I wouldn’t.

Follow Up: I’m on Linux mint! And my two favorite Windows games work just fine with zero configuration with Steam.

UnRelatedBurner,

Do it. I switched a couple of months ago. I hated it at first, then cought on to what’s different. Long story short; I never want to go back to windows.

Crashumbc,

My only extreme concern, is, I run a Nvidia system. And even if my current list works, I’d be concerned about future games.

olafurp,

Nvidia will probably be even better supported in the future and opensource drivers are getting close to proprietary feature sets.

Wayland support has also been improving in major ways so we can have fractional scaling, HDR and all those nice things soonish.

Then in general there will be an even bigger push for games to support Linux via DXVK, Wine etc to support Steam Deck.

I would recommend trying out dual boot setup for a while and then deleting Windows when you’re ready.

Mikina,

I’m also running NVIDIA (RTX 4070), and while I did have to try drivers from a few different sources, I eventually got it working pretty quickly.

But my mistake was choosing an OS that doesn’t bundle non-free drivers (Fedora), from what I’ve heard some distros like Ubuntu come with NVIDIA support by default, so I guess that’s also an option.

henfredemars,

I’m on an Ubuntu derivative called Mint, and on the first boot it gave me a pop up from the driver tool recommending that I change to the proprietary driver with an option for one click automatic download and install.

You are correct that this is detected and handled.

BCsven,

Nvidia hosts their own RPM packages for OpenSUSE and I believe Fedora. On new installs it is just adding the nvidia repo

Mikina,

True, but iirc there are several alternatives, from different repositories, and i was unlucky enough that j choose the wrong one for the first time.

J4g2F, (edited )
@J4g2F@lemmy.ml avatar

I know some Linux users trash talk Nvidia on Linux like it just a piece of shit. But it’s simply okay. Don’t get me wrong it’s not great. But it works.

But if you have a simple setup it will probably work. My SO PC has a rtx 2060 and one monitor and it works fine.

You can of course always dual boot. I still have windows for VR gaming and just in case. I do recommend a stable os with Nvidia (especially if you just starting out with Linux). Something like pop os. Don’t go with arch just for the meme.

With dual booting you can try Linux and test if it’s okay for you. If not just give the disk space back to windows. If not great keep using Linux.

BCsven,

I have used nVidia on OpenSUSE since 2017, it has been 100% fine, no issues. it may help that nVidia maintains their own OpenSUSE repo for leap and tumbleweed etc

leopold,

Nvidia drivers are mostly bad for Wayland afaik. Games shouldn’t be particularly problematic.

Shialac,

Yeah its really awesome how many games work without a flaw on Linux now, was my main reason why I still hat a Windows Partition for a long time

Its just sad that some Multiplayer Games wont work on Linux because they want to install Spyware or something that wont work

toastal, (edited )

The more the number change in that direction, the more game devs will not choose to ignore non-Microsoft Windows options too moving the needle to native support. Imagine a future where a game only works after enabling WSL with command flag workarounds if you want to play on a proprietary OS 😂

Mikina,

I literally did this two weeks ago, switched Win11 for Fedora and so far it has been an amazing experience. So far, I only had to dual boot to Win once, and that was because I wanted to play some SteamVR games, which is the only thing I didn’t manage to get working (I know there’s ALVR, but SteamVR refuses to launch for me unfortunately).

Just go for it, get a new SSD drive and dual boot your choice of distro. You can always go back, and unless you use bitlocker you can just access your windows files from the Linux, so there’s not need to move stuff around that much. With dualboot, you have nothing to loose.

henfredemars,

I don’t have money for a new SSD right now but my current SSD is mostly empty, 2TB. I turned off BitLocker to facilitate easy copying of files and because I’m pretty sure secure boot would be a pain. I’m running Linux Mint and I hope to go back into the windows install as little as possible. Maybe one day I’ll dump it entirely.

iopq, in Is DNS Bloat too?

It’s insecure, which lets governments like China poison it. They straight up block encrypted DNS

knfrmity,

The EU regularly forces DNS server operators to remove entries or redirect certain domains. It’s super easy to circumvent but most users don’t know that.

domi,
@domi@lemmy.secnd.me avatar

I still remember that time some judge ruled to ban a IP belonging to Cloudflare and the internet was on fire for a day in my country.

blog.cloudflare.com/consequences-of-ip-blocking/

knfrmity,

The sites I’m thinking of never had their IPs completely blocked, the DNS entries for the domains were just removed. If you were to switch to a non-EU or self-hosted DNS server you’d get to the site.

But the domains in question are generally ones the US/EU/NATO propaganda machine has told people are bad, so there’s no outrage when they’re blocked. In many cases there are often cheers.

uiiiq,

As long as there is an oversight and rules, I don’t have a problem with that

moon,

It’s not insecure at all, quite the opposite. Also with DoH, it blends into regular traffic.

iopq,

DoH is blocked in China, they cut any TLS connection to a known DNS server (1.1.1.1, 8.8.8.8, 9.9.9.9, etc.)

lemmyvore, in Is it actually dangerous to run Firefox as root?

You seriously need to stop what you’re doing. Log in with ssh only. If you need multiple terminals use multiple ssh sessions, or screen/tmux. If you need to search something do it on your desktop system.

The server should not have Firefox installed, or KDE, or anything related to desktop apps. There’s no point and nothing good can come of it.

Dirk,
@Dirk@lemmy.ml avatar

This. Thread should have officially ended here.

Falcon,

Yeah there’s a bit of scope to review what op is doing here.

Why is there even a DE on a server if it’s headless. If it’s not headless why not write up some Dockerfiles and manage it from a non-root account?

Are the services running as root?

Also, is it being accessed via wireguard/ovpn? It would be unwise to run a server as root with an open port.

desmosthenes,
@desmosthenes@lemmy.world avatar

came to say this

Montagge, in What's your favorite music player on Linux?
@Montagge@kbin.social avatar

VLC

Redjard,
@Redjard@lemmy.dbzer0.com avatar

mpv

troyunrau,
@troyunrau@lemmy.ca avatar

I also mostly use VLC these days. I also use it on android, with a copy of my flac library on my microSD there too.

yuki2501, in Linux reaches new high 3.82%
@yuki2501@lemmy.world avatar

For me the turning point was when a failed Windows forced upgrade ended up deleting me important files. I had backups, but I lost days of work because Microsoft felt so insecure in the face of piracy that they had to upgrade my computer despite me constantly telling them not to do so.

That was around 10 years ago. I went through various KDE distros; in the end I settled for Kubuntu.

The recent developments in KDE plasma are excellent. I haven’t had to open a command prompt in years. I hadn’t had a tech problem until this year when my tmp folder got full.

phoenixz,

I haven’t had to open a command prompt in years

Awesome!

I’m from the other side, though. I’m a developer and systems administrator on Kubuntu and I live by the command line. I use yakuake, which is totally awesome, and have about 50 or so shells open pretty much permanently, all nicely tucked away in tabs and sub sections in a programmable drop down that automatically starts all those command line shells when my computer boots. It’s pure awesomeness, Linus os pure awesomeness!

Hadriscus, (edited )

Damn, you know, I love automation and customization, and your description sounds awesome. I certainly will jump the gap at some point, but the thought of having to relearn an entire OS and suite of tools, and inevitably make mistakes that will cost me time and -probably- multiple reinstalls discourages me quite a bit. I remember using Fedora 20-something ten years ago on my laptop and the amount of things for which I needed a terminal was overwhelming. I also remember trying to learn file management by copying/backing up files from the terminal, and ending up batch-deleting entire folders worth of pictures. I never had a reliable “readme” for learning all this, that didn’t already assume I knew all the lingo and was proficient in some programming language.

Hammerheart,

I started using powershell more because it comes with a lot of bash aliases out of the box. Besides a brief period of using ubuntu in like 2006 because my windows install got corrupted, its my first foray into linux. Ive been daily driving debian 12 and i love it. I feel like getting used to the lingo helped ease the transition.

But if you actually use powershell for more than simple tasks and take advantage of its object oriented nature, it might make the switch harder. If you plan to use the command line as little as possible i think the switch is trivial. Your biggest worry is going to be analysis paralysis with all the options, but i just installed debian with the defaults and trying out different desktop environments is really easy and i havent yet had a problem that wasnt simple to solve with a google search.

Churbleyimyam,

Try a live USB - you might be surprised how easy and intuitive it is to use now.

yuki2501, (edited )
@yuki2501@lemmy.world avatar

Well, I have opened commands prompts, but only because because they’re fast at doing stuff with files and I like that.

But I haven’t NEEDED to open them to fix or configure stuff.

Back in the early 00s that was pretty much par for three course.

DumbAceDragon, (edited ) in What's your favorite music player on Linux?
@DumbAceDragon@sh.itjust.works avatar

Rhythmbox. It was pre-installed on Ubuntu back when I was on Ubuntu, and I kinda just got used to it. Strawberry looks really cool though, I may have to give it a try

DannyBoy,

Rhythmbox is great and works well for editing tags for my 15,000 track library. I went to Lollypop for a while trying to get some more features but I ended up back at Rhythmbox.

  • All
  • Subscribed
  • Moderated
  • Favorites
  • linux@lemmy.ml
  • localhost
  • All magazines
  • Loading…
    Loading the web debug toolbar…
    Attempt #

    Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 18878464 bytes) in /var/www/kbin/kbin/vendor/symfony/http-kernel/Profiler/FileProfilerStorage.php on line 171

    Fatal error: Allowed memory size of 134217728 bytes exhausted (tried to allocate 10502144 bytes) in /var/www/kbin/kbin/vendor/symfony/error-handler/Resources/views/logs.html.php on line 36