Difference between revisions of "System Control"
| (5 intermediate revisions by the same user not shown) | |||
| Line 1: | Line 1: | ||
= systemd = | |||
Systemd is a suite of basic building blocks for a Linux system. It provides a system and service manager that runs as PID 1 and starts the rest of the system.</br> | |||
== Use == | |||
<code>systemctl status <unit></code> show status</br> | |||
<code>systemctl start <unit></code> start $unit</br> | |||
<code>systemctl stop <unit></code> stop $unit</br> | |||
</br> | |||
<code>systemctl is-enabled <unit></code> show if $unit is en- or disabled</br> | |||
<code>systemctl enable <unit></code> enable autostart</br> | |||
<code>systemctl enable --now <unit></code> enable autostart and stop $unit</br> | |||
<code>systemctl disable <unit></code> disable autostart</br> | |||
<code>systemctl disable --now <unit></code> disable autostart and stop $unit</br> | |||
</br> | |||
<code>systemctl list-unit-files</code> show all units and their state</br> | |||
<code>systemctl list-unit-files --state=enabled</code> show all enabled units</br> | |||
<code>systemctl list-unit-files --state=disabled</code> show all disabled units</br> | |||
</br> | |||
<code>systemctl edit --full <unit></code> edit settings for $unit</br> | |||
</br> | |||
<code>systemctl daemon-reload</code> check units for changes</br> | |||
== Useful Flags == | |||
<code>--user</code> make changes in the user context</br> | |||
<code>--no-pager</code> don't pipe output into a pager</br> | |||
</br> | |||
= sysctl = | = sysctl = | ||
Reads/sets kernel settings from the virtual /proc file system.</br> | Reads/sets kernel settings from the virtual /proc file system.</br> | ||
Values can be edited directly with <code>echo 1/0 >> /proc/net/ipv6/conf/all/disable_ipv6</code> or by editing /etc/sysctl.conf or /etc/sysctl.d/parameter. | Values can be edited directly with <code>echo 1/0 >> /proc/net/ipv6/conf/all/disable_ipv6</code> (fleeting) or by editing /etc/sysctl.conf or /etc/sysctl.d/parameter (persistent). | ||
== | == Settings == | ||
<code>sysctl -a</code> list all settings</br> | <code>sysctl -a</code> list all settings</br> | ||
<code>sysctl -a | grep net.ipv6.conf.all.disable_ipv6</code> list specific setting</br> | <code>sysctl -a | grep net.ipv6.conf.all.disable_ipv6</code> list specific setting</br> | ||
<code>sysctl net.ipv6.conf.all.disable_ipv6</code> list specific setting</br> | <code>sysctl net.ipv6.conf.all.disable_ipv6</code> list specific setting</br> | ||
<code>sysctl -w parameter=value</code> change $parameter to $value</br> | <code>sysctl -w parameter=value</code> change $parameter to $value (fleeting)</br> | ||
<code>sysctl -p</code> reload settings</br> | <code>sysctl -p</code> reload settings</br> | ||
== Disable IPv6 on Debian == | |||
<pre>echo "net.ipv6.conf.all.disable_ipv6 = 1" >> /etc/sysctl.conf | |||
echo "net.ipv6.conf.default.disable_ipv6 = 1" >> /etc/sysctl.conf | |||
echo "net.ipv6.conf.lo.disable_ipv6 = 1" >> /etc/sysctl.conf | |||
sysctl -p</pre> | |||
Latest revision as of 16:14, 15 September 2025
systemd
Systemd is a suite of basic building blocks for a Linux system. It provides a system and service manager that runs as PID 1 and starts the rest of the system.
Use
systemctl status <unit> show status
systemctl start <unit> start $unit
systemctl stop <unit> stop $unit
systemctl is-enabled <unit> show if $unit is en- or disabled
systemctl enable <unit> enable autostart
systemctl enable --now <unit> enable autostart and stop $unit
systemctl disable <unit> disable autostart
systemctl disable --now <unit> disable autostart and stop $unit
systemctl list-unit-files show all units and their state
systemctl list-unit-files --state=enabled show all enabled units
systemctl list-unit-files --state=disabled show all disabled units
systemctl edit --full <unit> edit settings for $unit
systemctl daemon-reload check units for changes
Useful Flags
--user make changes in the user context
--no-pager don't pipe output into a pager
sysctl
Reads/sets kernel settings from the virtual /proc file system.
Values can be edited directly with echo 1/0 >> /proc/net/ipv6/conf/all/disable_ipv6 (fleeting) or by editing /etc/sysctl.conf or /etc/sysctl.d/parameter (persistent).
Settings
sysctl -a list all settings
sysctl -a | grep net.ipv6.conf.all.disable_ipv6 list specific setting
sysctl net.ipv6.conf.all.disable_ipv6 list specific setting
sysctl -w parameter=value change $parameter to $value (fleeting)
sysctl -p reload settings
Disable IPv6 on Debian
echo "net.ipv6.conf.all.disable_ipv6 = 1" >> /etc/sysctl.conf echo "net.ipv6.conf.default.disable_ipv6 = 1" >> /etc/sysctl.conf echo "net.ipv6.conf.lo.disable_ipv6 = 1" >> /etc/sysctl.conf sysctl -p