#! /bin/zsh # # this file: # https://dataswamp.org/~incal/conf/.zsh/distro services () { local state=${1:-enabled} systemctl list-unit-files \ --full \ --no-legend \ --state=$state \ --type=service | awk '{ print $1 }' } services-disabled () { services disabled } services-do-to () { local do=$1 shift local to=($@) sudo systemctl $do $to } services-start-all () { local to=("${(@f)$(services disabled)}") services-do-to start $to } services-enable-all () { local to=("${(@f)$(services disabled)}") services-do-to enable $to } services-disable-all () { local to=("${(@f)$(services enabled)}") services-do-to disable $to # exceptions sudo systemctl enable \ 'getty@.service' \ console-setup.service \ keyboard-setup.service \ ntp.service }