-
Notifications
You must be signed in to change notification settings - Fork 1
/
systemd-ctl.cheat
76 lines (54 loc) · 2.3 KB
/
systemd-ctl.cheat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
% systemd-ctl, pushou
# some *ctl program
<LIST_CTL>
# networkctl
networkctl <NETWORKCTL_OPTIONS> <NETWORKCTL_ORDERS>
# set hostname
hostnamectl set-hostname hostname
# hostnamectl full-option
hostnamectl <HOSTNAMECTL_ORDERS>
# journalctl grep VALUE
journalctl -k --grep "UFW BLOCK"
# journalctl netfilter
journalctl -k | grep "IN=.*OUT=.*" | less
journalctl -k | grep "UFW BLOCK" | less
# journalctl kernel log
journalctl -kf
# journalctl verbose
journalctl -o verbose
# journalctl list-boots
journalctl --list-boots |from ssv -a
# journalctl full log for unbound
journalctl --no-pager --full -u unbound
# journalctl clean
journalctl --disk-usage
journalctl --vacuum-time="2 days"
journalctl --vacuum-size=4GB
# journalctl emergency to errors
journalctl -p emerg..err
# journalctl json output to nushell
journalctl --list-boots |from ssv -a
# timedatectl ntp
timedatectl set-ntp true
# timedatectl status
timedatectl status
# systemctl insactive failed
systemctl list-units -all --state=<STATE>
# test if unit service
systemctl is-active --quiet wazuh-agent || systemctl start wazuh-agent
# loginctl list users
loginctl list-users
# enable linger (services for the user are not stopped by logout)
loginctl enable-linger myuser
# systemd-run
systemd-run --unit stress-unit2 -p CPUQuota=50% -p MemoryLimit=512M -p OOMPolicy=continue /usr/bin/stress --cpu 4 --vm-bytes 8G
# systemd-run interactive with accounting
systemd-run -p IPAccounting=1 -t /bin/sh
systemd-run -p IPAddressDeny=any -p IPAddressAllow=8.8.8.8 -p IPAddressAllow=127.0.0.0/8 -t /bin/sh
systemd-run -p IPAccounting=yes -p IOAccounting=yes -p CPUAccounting=true -p MemoryAccounting=true -p TasksAccounting=true -p ProtectSystem=strict -p PrivateDevices=yes -t -S
systemctl --no-pager show ip-accounting run-u282.service|grep IP
$ STATE: echo 'active inactive failed' | tr ' ' '\n'
$ HOSTNAMECTL_ORDERS: echo 'status hostname icon-name chassis deployment location' | tr ' ' '\n'
$ NETWORKCTL_ORDERS: echo 'status list lldp label delete up down reload renew forcerenew reconfigure' | tr ' ' '\n'
$ NETWORKCTL_OPTIONS: echo '-a -s -l -asl' | tr ' ' '\n'
$ LIST_CTL: echo 'bluetoothctl bootctl grdctl localectl oomctl pactl snapctl swtpm_ioctl udisksctl boltctl busctl hostnamectl obexctl powerprofilesctl resolvectl switcherooctl timedatectl' | tr ' ' '\n'