跳至内容
sdvcrx's wiki
用户工具
登录
站点工具
搜索
工具
显示页面
过去修订
Export to Markdown
反向链接
最近更改
媒体管理器
网站地图
登录
>
最近更改
媒体管理器
网站地图
您的足迹:
linux:systemd
本页面只读。您可以查看源文件,但不能更改它。如果您觉得这是系统错误,请联系管理员。
====== systemd ====== 使用 [[https://wiki.archlinux.org/index.php/Systemd|systemd]] 全家桶。 ===== NTP ===== 使用 `timedatectl` 开启 NTP 同步服务即可。 <code bash> timedatectl set-ntp true </code> 如果想配置 NTP 服务器,可编辑 ''/etc/systemd/timesyncd.conf'' 。可参考:[[linux:ntp|NTP]] ===== timezone ===== 设置时区为 +0800 <code bash> timedatectl set-timezone Asia/Shanghai </code> 查看可用的时区 <code bash> timedatectl list-timezones </code> ===== network ===== 使用 ''systemd-networkd'' 替代容易出错的 ''netctl'' ,个人感觉效果还不错,适用于不切换 WiFi 或者使用有线网络的场景。 更多奇怪的用法详见:[[https://wiki.archlinux.org/index.php/Systemd-networkd|systemd-networkd - Archlinux wiki]] 首先使用 ''networkctl list'' 列出网口号,并复制。 ==== wired network ==== 有线网络的网口号一般以 en 开头,例如 ''enp6s0'' 。 编辑创建配置文件: <code ini /etc/systemd/network/20-wired.network> [Match] Name=enp6s0 [Network] DHCP=ipv4 </code> 并且重启 ''systemd-networkd'' service 即可生效。 === 8021X === See [[linux:8021x|8021X]]. ===== Journal ===== Clean old logs, from [[https://unix.stackexchange.com/questions/139513/how-to-clear-journalctl|stackexchange]]: <code bash> # Retain only the past 30 days: journalctl --vacuum-time=30d </code> ===== alias ===== <code bash> # 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" </code> ===== 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]]
linux/systemd.txt
· 最后更改: 2023/12/03 10:24 由
127.0.0.1
页面工具
显示页面
过去修订
反向链接
Export to Markdown
回到顶部