this post was submitted on 28 Nov 2023
43 points (100.0% liked)

Linux

48031 readers
1075 users here now

From Wikipedia, the free encyclopedia

Linux is a family of open source Unix-like operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991 by Linus Torvalds. Linux is typically packaged in a Linux distribution (or distro for short).

Distributions include the Linux kernel and supporting system software and libraries, many of which are provided by the GNU Project. Many Linux distributions use the word "Linux" in their name, but the Free Software Foundation uses the name GNU/Linux to emphasize the importance of GNU software, causing some controversy.

Rules

Related Communities

Community icon by Alpár-Etele Méder, licensed under CC BY 3.0

founded 5 years ago
MODERATORS
 

Someone tell me if there is a better way to do this, but I don't see how.

I needed a way to see which services I have enabled that I have manually stopped.

There oddly isn't a way to do this in one command, so I had to take the output of list-unit-files 'enabled', and use that to filter for 'list-units'. The command is here:

alias sysstop='systemctl list-units --state=failed,dead,exited $( systemctl list-unit-files --state=enabled --type=service | awk "/.*\.service/ {print }" )'

So now I can remember that I need to restart mariadb and nginx at some point:

$ sysstop
  UNIT                                 LOAD   ACTIVE   SUB    DESCRIPTION                                             
  blueman-mechanism.service            loaded inactive dead   Bluetooth management mechanism
  mariadb.service                      loaded inactive dead   MariaDB 11.2.2 database server
  NetworkManager-wait-online.service   loaded active   exited Network Manager Wait Online
  nginx.service                        loaded inactive dead   A high performance web server and a reverse proxy server
  systemd-homed-activate.service       loaded active   exited Home Area Activation
  systemd-networkd-wait-online.service loaded active   exited Wait for Network to be Configured

My other aliases are here, in case anyone finds these helpful. I use them frequently myself.

alias sysdis='systemctl list-unit-files --type=service --state=disabled'
alias sysdisuser='systemctl list-unit-files --type=service --state=disabled --user'
alias sysen='systemctl list-unit-files --type=service --state=enabled'
alias sysenuser='systemctl list-unit-files --type=service --state=enabled --user'
alias sysfail='systemctl list-units --type=service --state=failed'
alias sysrun='systemctl list-units --type=service --state=running'
alias sysrunuser='systemctl list-units --type=service --state=running --user'
alias sysstatic='systemctl list-units --type=service --state=static'
you are viewing a single comment's thread
view the rest of the comments
[–] cows_are_underrated@feddit.de 2 points 11 months ago

OK, that's nothing I can help you with.