Kassad posted:Nvidia is starting to provide open source kernel modules
|
|
# ? May 11, 2022 23:36 |
|
|
# ? Jun 9, 2024 02:18 |
|
Is there a magic one-line command (or tiny bash script) I can run to prepend an incrementing number to filenames sorted by Date Modified? For example, if I have these files in a folder: aasdf.txt, 2 hours old basdf.txt, 1 hour old casdf.txt, 3 hours old I'd like to run a command or bash script to rename them to: 01 basfd.txt 02 aasdf.txt 03 casdf.txt I know I can list files by Date Modified with 'ls -tr' and could probably set up some kind of loop that looks like: count=01 for file in *.txt do mv "$file" "$count$file" count++ done But I'm not finding a way to mash the two together and make sure they're numbered according to 'ls -tr'
|
# ? May 13, 2022 08:42 |
|
FILES=$(ls -tr) for filename in $FILES; do #stuff done Edit: if no files have spaces in them. If they do, try: ( IFS=$'\n' FILES=$(ls -tr1) for filename in $FILES; do #stuff done ) That temporary changes the field separator from space to newline. Pablo Bluth fucked around with this message at 09:33 on May 13, 2022 |
# ? May 13, 2022 09:22 |
|
Is there some kind of trigger/hook, for lack of a better word, that can listen to and preempt suspend events? Basically what I think I want to do is this: if I hit 'suspend' or leave the PC unattended for X minutes, instead of immediately going into sleep mode, it should perform some maintenance tasks (backup sync, app upgrade, etc.) and then suspend. Should I need to get the computer off right now, I'll do a shutdown instead of suspending. I suppose I could just write a script ending in 'systemctl suspend' as the last command, but then I would have to launch that script instead of using the default buttons / shortcuts, and jury-rig some way to have it trigger after inactivity. It would be much more elegant if I could stick the script somewhere that says 'whenever the system would suspend, first run this script and wait for it to finish' Context: Fedora 36 Kinoite (KDE Silverblue), desktop PC.
|
# ? May 13, 2022 13:17 |
The BSDs have /etc/rc.suspend and /etc/rc.resume, which according to acpiconf(8) gets read by devd(8) before the ACPI events are handled.
BlankSystemDaemon fucked around with this message at 14:33 on May 13, 2022 |
|
# ? May 13, 2022 14:30 |
|
BlankSystemDaemon posted:The BSDs have /etc/rc.suspend and /etc/rc.resume, which according to acpiconf(8) gets read by devd(8) before the ACPI events are handled. sir, this is the linux thread
|
# ? May 13, 2022 14:39 |
NihilCredo posted:Is there some kind of trigger/hook, for lack of a better word, that can listen to and preempt suspend events? Can system.d do conditional events like this? That'd be my guess. I've never been able to wrap my head around system.d scripting though so I can't help you there. You'd probably have do userspace ones though for Kinoite given the immutable nature of the system space and I don't know if they'd have the permissions to run updates?
|
|
# ? May 13, 2022 14:46 |
|
systemd has suspend.target so I thought maybe you could add a service that requires suspend.target, which would be triggered when it reaches suspend.target. Looking into that I also found this: https://www.freedesktop.org/software/systemd/man/systemd-suspend.service.html quote:Immediately before entering system suspend and/or hibernation systemd-suspend.service (and the other mentioned units, respectively) will run all executables in /usr/lib/systemd/system-sleep/ and pass two arguments to them. The first argument will be "pre", the second either "suspend", "hibernate", "hybrid-sleep", or "suspend-then-hibernate" depending on the chosen action. An environment variable called "SYSTEMD_SLEEP_ACTION" will be set and contain the sleep action that is processing. This is primarily helpful for "suspend-then-hibernate" where the value of the variable will be "suspend", "hibernate", or "suspend-after-failed-hibernate" in cases where hibernation has failed. Immediately after leaving system suspend and/or hibernation the same executables are run, but the first argument is now "post". All executables in this directory are executed in parallel, and execution of the action is not continued until all executables have finished. The inhibitor interface it mentions is here https://www.freedesktop.org/wiki/Software/systemd/inhibit/ and seems like it has a less hacky way of causing something to happen before the suspend happens.
|
# ? May 13, 2022 14:51 |
|
So I have something that works with just a systemd unit file. Works On My Machinetm (Debian 11, XFCE desktop) but it just uses a systemd unit file so it should work on anything with systemd like Fedora, I guess.code:
Put it in /etc/systemd/system/ as a .service file. Edit the ExecStart to whatever command you want and Description to a more useful name, and then sudo systemctl enable <filename>.service Note that it uses sleep.target, not suspend.target. I found documentation referring to suspend.target like I linked in the previous post (edit: and even in the drat man page for systemd-suspend.service on my own machine) but it looks like it's actually called sleep.target in the actual source for systemd-suspend.service on my machine (???) so maybe different versions of systemd have different names for the targets. edit: Here's the source of systemd-suspend.service from my machine (found in /usr/lib/systemd/system/systemd-suspend.service) to show what I based mine on: code:
BattleMaster fucked around with this message at 15:26 on May 13, 2022 |
# ? May 13, 2022 15:14 |
BattleMaster posted:sir, this is the linux thread
|
|
# ? May 13, 2022 15:21 |
|
Takes No Damage posted:Is there a magic one-line command (or tiny bash script) I can run to prepend an incrementing number to filenames sorted by Date Modified? For something like this I might use a Ruby one-liner: code:
|
# ? May 13, 2022 15:25 |
|
Thank you, those were some answers. I'll try the systemd unit file first, then it if fails the magic folder. Running an inhibitor, as cool and Star Trek-esque as it sounds, is definitely overkill as I'd need to learn to code against system APIs (I'm a filthy high-level dev), package it as a RPM to install it on Silverblue, and keep it running at all times - which would require a systemd file in the first place! I might do it as a learning exercise at some point.
|
# ? May 13, 2022 16:01 |
|
BlankSystemDaemon posted:I'm sorry, I can't hear you, you're gonna need to speak up - the sound of my T480s running FreeBSD and playing a MPEG-TS stream (from DVB-C via HDHomeRun+TVHeadend) is too deafeningly silent. I'm sorry can you repeat that I'm to busy playing modern video games to focus
|
# ? May 13, 2022 17:32 |
|
NihilCredo posted:Thank you, those were some answers. At the very least test it with just sleeps in a bash script or something and don't jump straight trying to upgrade your system and have the install ripped apart halfway through it what a nightmare if that was what happens I'm not finding what I was thinking of maybe its halt only, and the arch wiki suggests the unit file method so go hog wild https://wiki.archlinux.org/title/Power_management#Sleep_hooks Mr. Crow fucked around with this message at 17:51 on May 13, 2022 |
# ? May 13, 2022 17:36 |
|
Mr. Crow posted:I'm sorry can you repeat that I'm to busy playing modern video games to focus No one should ever need more than nethack
|
# ? May 13, 2022 17:47 |
Mr. Crow posted:I'm sorry can you repeat that I'm to busy playing modern video games to focus Is it possible to grow out of video games? RFC2324 posted:No one should ever need more than nethack
|
|
# ? May 13, 2022 18:02 |
|
Mr. Crow posted:At the very least test it with just sleeps in a bash script or something and don't jump straight trying to upgrade your system and have the install ripped apart halfway through it what a nightmare if that was what happens Silverblue e: though to be fair, I doubt even a regular Fedora nowadays could get borked if the power fails during a dnf upgrade, or could it?
|
# ? May 13, 2022 19:06 |
|
Pablo Bluth posted:FILES=$(ls -tr) After sleeping on it, I figured I could do something like: ls -tr >> sortfile.txt then use sortfile.txt as an input for a 'read' command, I've done that before with wget. But it looks like your command would do something similar in fewer steps, I'll check it out. ExcessBLarg! posted:You can do this with Bash, but I find relying on external processes to provide file names (which you need here to sort) can be brittle at times. Using a modified IFS can help, but what if your filename has a newline? Is Ruby a good script to have passing familiarity with for little file management stuff like this, compared to bash or python or whatever? I haven't written proper code since C (not ++) in college, but knowing some common tips and tricks for general Linux OS shenanigans is always a good thing.
|
# ? May 13, 2022 19:30 |
NihilCredo posted:Silverblue I'm a big fan of Silverblue. I think Redhat also re-did the partitions for a 36 fresh install so you can actually setup BTRFS snapshotting now? I mean that's less useful for Silverblue since the system files are read-only, but having your home directory snapshotted would be nice for rollbacks as well.
|
|
# ? May 13, 2022 19:35 |
|
NihilCredo posted:Is there some kind of trigger/hook, for lack of a better word, that can listen to and preempt suspend events? Yes, systemd-inhibit --list will show all the currently active ones on your system.
|
# ? May 13, 2022 19:39 |
|
Takes No Damage posted:Is Ruby a good script to have passing familiarity with for little file management stuff like this, compared to bash or python or whatever? I haven't written proper code since C (not ++) in college, but knowing some common tips and tricks for general Linux OS shenanigans is always a good thing. Python is definitely a more popular language than Ruby, but due to its syntax you can't write one-liners in it very well and are forced (for better or worse) to write a full-blown script.
|
# ? May 13, 2022 19:48 |
|
I'm looking for a simple TUI tool that will show real-time bandwidth usage across interfaces like https://github.com/tgraf/bmon, but doesn't segfault at higher network speeds. I had used bmon for this for years, but for whatever reason on Ubuntu 20.04 with bonded 10G lines, it's segfaulting after a couple of seconds whenever network traffic on a single interface is over 300MB/s-ish. What are your favorite tools for peeking at real-time up/down bandwidth usage?
|
# ? May 13, 2022 20:06 |
Twerk from Home posted:I'm looking for a simple TUI tool that will show real-time bandwidth usage across interfaces like https://github.com/tgraf/bmon, but doesn't segfault at higher network speeds. I had used bmon for this for years, but for whatever reason on Ubuntu 20.04 with bonded 10G lines, it's segfaulting after a couple of seconds whenever network traffic on a single interface is over 300MB/s-ish. BlankSystemDaemon fucked around with this message at 20:22 on May 13, 2022 |
|
# ? May 13, 2022 20:20 |
|
Twerk from Home posted:I'm looking for a simple TUI tool that will show real-time bandwidth usage across interfaces like https://github.com/tgraf/bmon, but doesn't segfault at higher network speeds. I had used bmon for this for years, but for whatever reason on Ubuntu 20.04 with bonded 10G lines, it's segfaulting after a couple of seconds whenever network traffic on a single interface is over 300MB/s-ish. I usually go with iftop for this, as it will break down the RX/TX traffic for a given interface into each host with a bar nice graph so I can see what the hell is making such a racket. I also like to use nload if I'm just looking for the overall usage of a given interface, again with a nice little graph that makes me feel warm inside.
|
# ? May 14, 2022 01:58 |
|
ExcessBLarg! posted:Personally, I think so. It's a good replacement for awk/sed/perl. I still write plain shell scripts for "simple" tasks where I'm primarily calling external commands, but for text processing or complicated file manipulation it's pretty good. I'm biased because I've done a ton of Rails work over the years, but yeah. Ruby was originally designed for this exact thing. The stdlib makes it very easy to chain and whip stuff together. I'd rate it noticeably easier to work with for this sort of thing that python, but not by so wide a margin that you should switch if you were already comfortable. Bless you if you can slice and dice with awk/sed like a pro off the top of your head, but no shame in reaching for something designed for humans instead if you can.
|
# ? May 14, 2022 02:41 |
|
BlankSystemDaemon posted:The sad part is, I haven't even played a video game because I couldn't - I just don't feel like playing video games anymore, and haven't for a long time. Haven't played in years and I have to say, I don't miss it.
|
# ? May 14, 2022 03:42 |
|
I've been using KDE on Fedora for a year and a half and it's generally been pretty stable. I do find it extremely frustrating realizing that maintenance of KDE within these distros will always come second place to GNOME because of a lack of risk-taking. Noting that developers like Mozilla and Document Foundation already use GTK for their programs so I'm assuming it's just easier to develop within the environment that's also based on GTK etc. It really seems no matter what GTK-based environments will always take first-priority (unless Red Hat or Canonical suddenly decided to switch their apps over to Qt within the nest 20 years, which is unlikely). Not knocking on Cinnamon or xfce but I can smell the GNOME residue all over 'em euroshopper fucked around with this message at 04:07 on May 14, 2022 |
# ? May 14, 2022 04:02 |
|
Chilled Milk posted:I'm biased because I've done a ton of Rails work over the years, but yeah. Ruby was originally designed for this exact thing. The stdlib makes it very easy to chain and whip stuff together. I'd rate it noticeably easier to work with for this sort of thing that python, but not by so wide a margin that you should switch if you were already comfortable. Bless you if you can slice and dice with awk/sed like a pro off the top of your head, but no shame in reaching for something designed for humans instead if you can. My secret shame is that I use R for things like this. Having a table as a native data type in addition to the usual arrays and dictionaries feels like a natural fit for a lot of things.
|
# ? May 14, 2022 12:24 |
|
euroshopper posted:I do find it extremely frustrating realizing that maintenance of KDE within these distros will always come second place to GNOME because of a lack of risk-taking. KDE, meanwhile, has its own goals, but its also inextricably linked to Qt, which itself has always tried to be the best batteries-included cross-platform C++ UI toolkit. I don't know that Firefox and LibreOffice are good examples to illustrate GTK's "marketshare superiority" or something like that. Both FireFox and LibreOffice are cross-platform behemoth projects that internally use their own abstraction layers (XUL, VCL) for which GTK is just one backend. So they're not necessarily chasing down the latest GTK/freedesktop.org developments either except where it directly benefits them. For a long time LibreOffice also had a Qt backend that was at parity to the GTK one, but I guess that's no longer the case. Perhaps for historical reasons, or perhaps due to the size of Qt 5, I think it's generally been more palatable for KDE-focused distributions to include GTK applications in addition to Qt, than GNOME-focused distribution to include Qt ones. Anyways, have you tried a KDE-focused desktop? euroshopper posted:It really seems no matter what GTK-based environments will always take first-priority (unless Red Hat or Canonical suddenly decided to switch their apps over to Qt within the nest 20 years, which is unlikely).
|
# ? May 14, 2022 12:49 |
|
Computer viking posted:My secret shame is that I use R for things like this. Having a table as a native data type in addition to the usual arrays and dictionaries feels like a natural fit for a lot of things. For years I used a combination of Ruby-calling-Rscript for my work. These days though that might be better handled with Pandas which, somehow, combines the method-chaining magic of Ruby with R's data-frames and numeric capabilities, in a language that's actually neither of them. ExcessBLarg! fucked around with this message at 12:59 on May 14, 2022 |
# ? May 14, 2022 12:55 |
|
Reading about these Ruby one liners has convinced me that it's the next language for me to pick up
|
# ? May 14, 2022 13:08 |
|
ExcessBLarg! posted:I'm a fan of R too, but its facilities for text-processing are definitely secondary to numerical processing/statistics, which makes it effectively the opposite of Ruby. For one, R doesn't have dictionaries. You can use lists as associative-arrays, but they're internally still just lists so key (name) lookups are O(N), not O(1). The only downside is that I really dislike working in pandas; something about it just does not mesh well with me. I enjoy plain python, though. Text processing in R is indeed not great. Using something like stringr helps, but then you suddenly depend on a package you need to install first. It would be fine for the concrete example above, though - file.info() gives you native date-time objects that should sort correctly, and you could glue the prefixes in with sprintf easily enough. As for dictionaries, you could always use environments? A bit clunky, but they're proper hashmaps with decent performance. (Supposedly - I haven't benchmarked it myself) As for Ruby - it is indeed neat. My boyfriend runs a website with nanoc, and his "compile articles into static html" Rakefile has gone a bit overboard over the years. I've helped him with it now and then without really knowing Ruby, and it does seem pleasant. One day I'll get around to learning it better. Computer viking fucked around with this message at 13:38 on May 14, 2022 |
# ? May 14, 2022 13:23 |
|
NihilCredo posted:Silverblue A friend of mine who I encouraged to install Fedora 35 a few months back came to me with a broken system a few weeks ago. He’s new to anything Linux so I told him to use the graphical gnome software app to do updates and it seems after one of these updates it left the system unbootable. It couldn’t find an initramfs for the most recent kernel and booting into a previous one just presented a generic “something went wrong” message after switching to the desktop. I was able to switch to a terminal with ctrl+alt+f3 where I pulled up the logs from the last boot with journalctl -b -1 -e and those logs ended about 70% of the way through an update as if the power had been cut. He claims there was no power loss and everything seemed normal to him so we just reinstalled the OS since I’m not experienced enough to be able to recover the system from that state. I taught him how to use dnf for updates so hopefully it doesn’t happen again but welp.
|
# ? May 14, 2022 14:22 |
|
Since folks have expressed an interest in Ruby I thought I'd explain this one a bit furhter:ExcessBLarg! posted:For something like this I might use a Ruby one-liner: Ruby code:
The equivalent in Python would be written as: Python code:
You could also write the Python version as a one-liner: code:
|
# ? May 14, 2022 19:13 |
|
ExcessBLarg! posted:Historically GTK and GNOME have fallen within RedHat's sphere of influence. Even freedesktop.org, which is nominally independent, has a lot of cross-over with them. So yes you tend to see RedHat/GNOME/freedesktop.org driven "next-gen desktop" projects all take place in Fedora. Without debating the long-term value of their efforts, I do find them to generally be narrowly-focused. If your needs fall outside of that, Fedora is probably not a great fit. Wasn't really specifically referring to Fedora/RedHat. My grievance is that the most popular and maintained distros tend to be GTK-based and the KDE distros that do exist tend to be derivatives or 'flavors' of the aforementioned GTK distros. OpenSUSE seems to be the main exception to this and isn't really marketed towards consumers (ex-Windows users more or less) in the way Ubuntu or Fedora is.
|
# ? May 14, 2022 21:21 |
|
euroshopper posted:Wasn't really specifically referring to Fedora/RedHat. My grievance is that the most popular and maintained distros tend to be GTK-based and the KDE distros that do exist tend to be derivatives or 'flavors' of the aforementioned GTK distros. OpenSUSE seems to be the main exception to this and isn't really marketed towards consumers (ex-Windows users more or less) in the way Ubuntu or Fedora is. KDE, however, is very well maintained in Fedora, and is (in my opinion) one of the better flavours of it. Yes, Gnome is where they put the majority of their efforts, but there's only so much polishing a turd one can do.
|
# ? May 14, 2022 21:59 |
|
Volguus posted:KDE, however, is very well maintained in Fedora, and is (in my opinion) one of the better flavours of it. Yes, Gnome is where they put the majority of their efforts, but there's only so much polishing a turd one can do. Genuinely have no idea why people poo poo on Plasma that much lol. It's pretty fast and has been increasingly light on resources w/o looking dated (sorry xfce/MATE). There are an increasing number of environments that are just GNOME 3+ forks which in turn retains all the design inconsistencies. Can't imagine it'll get better with some of the most commonly used apps being ported to GTK 4. I like Cinnamon but they haven't really revamped their design philosophy in an exiting way which, ngl, was one of the main reasons why I hadn't installed a Linux Mint distro since abt 3 years ago. euroshopper fucked around with this message at 22:45 on May 14, 2022 |
# ? May 14, 2022 22:42 |
|
euroshopper posted:My grievance is that the most popular and maintained distros tend to be GTK-based and the KDE distros that do exist tend to be derivatives or 'flavors' of the aforementioned GTK distros. One point in Kububtu's favor is that it's been around since 2005, whereas Ubuntu was faffing around with Unity for some time. euroshopper posted:OpenSUSE seems to be the main exception to this and isn't really marketed towards consumers (ex-Windows users more or less) in the way Ubuntu or Fedora is. ExcessBLarg! fucked around with this message at 23:32 on May 14, 2022 |
# ? May 14, 2022 23:28 |
|
ExcessBLarg! posted:What makes Kubuntu "derivative" other than not being called Ubuntu? What if Ubuntu renamed itself Gubuntu? Ubuntu gets most of the attention when it comes to development/financial support/making it look pretty. Kubuntu literally just slaps the default Plasma theme onto the Ubuntu base without changing much. Also important to note that Kubuntu almost became defunct when Canonical ended their sponsorship (big reason is they had very little faith in Plasma 4)
|
# ? May 14, 2022 23:46 |
|
|
# ? Jun 9, 2024 02:18 |
|
euroshopper posted:Ubuntu gets most of the attention when it comes to development/financial support/making it look pretty. Ubuntu dropped sponsorship of both GNOME and KDE when they adopted Unity as their flagship desktop. But they've since pivoted again away from the desktop to a cloud/IoT focus. Their readoption of GNOME was part motivated by their users' preference, but also because there isn't any value for Canonical in distancing from what RedHat/Fedora are doing (aside from Snaps). euroshopper posted:Kubuntu literally just slaps the default Plasma theme onto the Ubuntu base without changing much.
|
# ? May 15, 2022 00:29 |