How to automaticaly run terminal commands on startup?

Title. I switch between Fedora and Windows a lot. During the day I work and play single-player games with Fedora, but play with my friends on Windows in competitive games (anti-cheats and all).

How I could create a key/desktop shortcut so I can start “throttled” and “s-tui” every boot, with sudo permissions?

KDE has an autostart option that you can use to launch applications or terminal scripts on startup. The page below has an example:

https://www.simplified.guide/kde/automatically-run-program-on-startup

1 Like

So I think my question should be: how do I write a terminal script? I just go on Kwrite and put the commands there, or it is more complicated than that?

Generally it’s as simple as editing a textfile e.g. myscript.sh and placing this in it:

#!/bin/bash
<name of the command>

After saving you would make the script executable like this:

$ chmod +x myscript.sh

For throttled however their github page lists these installation instructions for Fedora:

$ sudo dnf copr enable abn/throttled
$ sudo dnf install -y throttled

$ sudo systemctl enable --now throttled

So you wouldn’t have to write your own script for that.

s-tui is a monitoring program that you would run manually in a terminal to see system stats, so you probably wouldn’t need to autostart that on login.

1 Like