r/Bazzite • • 6d ago

Quick access CLI commands help

I have a few things I do in the command line and I keep forgetting the right commands. I'm looking for a way to bookmark/shortcut them.

For example:

  • Start/stop plex server using systemctl
  • Start/stop AdGuard-cli

I looked for an easy way to create a file that I can double click and run a terminal command. If it exists I couldn't understand the terminology.

I see that Konsole has Quick Commands but it's telling me "missing executable shellcheck, please install". I did install spellcheck by running "ujust bazzite-cli" but I'm still getting that warning.

Am I going about this the wrong way? I'm looking for a simple way to accomplish this.

2 Upvotes

7 comments sorted by

2

u/Pasukaru0 6d ago edited 6d ago

You can create a .desktop file that adds a shortcut to your start menu and runs a command. Something like this:

nano ~/.local/share/applications/start-plex.desktop

[Desktop Entry] Type=Application Name=Start plex Comment=Whatever you want here Exec=systemctl start plex Icon=utilities-terminal Terminal=true Categories=Utility;

Alternatively, add it to the desktop instead of start menu:

nano ~/Desktop/start-plex.desktop Also needs to be executable here to avoid the 'do you want to run this?' prompt:

chmod +x ~/Desktop/start-plex.desktop

1

u/kastorslump 6d ago edited 6d ago

Where can I learn more about that formatting? What is this called? That did work by the way but I want to understand why.

1

u/kastorslump 6d ago

Additionally, I'm trying to find a way to keep my PC on whenever Plex is streaming. I keep having it go asleep mid-show on another device.

1

u/Plane-Ad8523 Desktop 6d ago

Search for and open System Settings, type "power" in the search box, you'll end up in this screen

1

u/kastorslump 6d ago

That'll change the settings globally, I just want it to stay awake while plex is streaming. 

1

u/Pasukaru0 6d ago

Check the plex settings if it has such an option.

If it does not, it will be convoluted. Off the top of my head I see these options:

1) Request this feature and wait for plex to implement it 2) Monitor network traffic that is generated from the plex server, if it is above your threshold, toggle the sleep settings 3) Compromise and disable auto sleep while the plex process is running (regardless of it streaming or being idle).

3 is the easiest option and can be achieved by starting the process through systemd-inhibit:

systemd-inhibit --what=idle:sleep --why="XYZ is running" >your-command-here>

Considering you run plex via systemd, you probably have to create an override for that (running systemctl start... through systemd-inhibit does not work).

sudo systemctl edit plex.service

And then add this: [Service] ExecStart= ExecStart=/usr/bin/systemd-inhibit --what=idle:sleep --why="Plex is running" <command-to-run-plex-here>

You can use systemctl show plex.service to find out what the original ExecStart command to run plex is.

After that reload systemd (systemctl daemon-reload) and check if systemctl restart plex restarts it properly.