====== systemd ======
使用 [[https://wiki.archlinux.org/index.php/Systemd|systemd]] 全家桶。
===== NTP =====
使用 `timedatectl` 开启 NTP 同步服务即可。
timedatectl set-ntp true
如果想配置 NTP 服务器,可编辑 ''/etc/systemd/timesyncd.conf'' 。可参考:[[linux:ntp|NTP]]
===== timezone =====
设置时区为 +0800
timedatectl set-timezone Asia/Shanghai
查看可用的时区
timedatectl list-timezones
===== network =====
使用 ''systemd-networkd'' 替代容易出错的 ''netctl'' ,个人感觉效果还不错,适用于不切换 WiFi 或者使用有线网络的场景。
更多奇怪的用法详见:[[https://wiki.archlinux.org/index.php/Systemd-networkd|systemd-networkd - Archlinux wiki]]
首先使用 ''networkctl list'' 列出网口号,并复制。
==== wired network ====
有线网络的网口号一般以 en 开头,例如 ''enp6s0'' 。
编辑创建配置文件:
[Match]
Name=enp6s0
[Network]
DHCP=ipv4
并且重启 ''systemd-networkd'' service 即可生效。
=== 8021X ===
See [[linux:8021x|8021X]].
===== Journal =====
Clean old logs, from [[https://unix.stackexchange.com/questions/139513/how-to-clear-journalctl|stackexchange]]:
# Retain only the past 30 days:
journalctl --vacuum-time=30d
===== alias =====
# Copy from oh-my-zsh
user_commands=(
list-units is-active status show help list-unit-files
is-enabled list-jobs show-environment cat list-timers)
sudo_commands=(
start stop reload restart try-restart isolate kill
reset-failed enable disable reenable preset mask unmask
link load cancel set-environment unset-environment
edit)
for c in $user_commands; do; alias sc-$c="systemctl $c"; done
for c in $sudo_commands; do; alias sc-$c="sudo systemctl $c"; done
for c in $user_commands; do; alias scu-$c="systemctl --user $c"; done
for c in $sudo_commands; do; alias scu-$c="systemctl --user $c"; done
alias sc-enable-now="sc-enable --now"
alias sc-disable-now="sc-disable --now"
alias sc-mask-now="sc-mask --now"
alias scu-enable-now="scu-enable --now"
alias scu-disable-now="scu-disable --now"
alias scu-mask-now="scu-mask --now"
===== Reference =====
* [[https://wiki.archlinux.org/index.php/Systemd-networkd|systemd-networkd - Archlinux wiki]]
* [[https://wiki.archlinux.org/index.php/Systemd|Systemd - Archlinux wiki]]
* [[https://xuanwo.io/2019/06/13/switch-to-systemd-networkd/|从 netctl 切换到 systemd-networkd]]