标签:listen ... ons alias 管理系统 evel 默认 rescue ase
/etc/systemd/system
.path 文件系统目录
非有systemd启动的无法兼容
查看依赖服务:systemctl list-dependencies NAME.service
其他:systemctl halt/poweroff/reboot/suspend/hibernate(快照)/hybird-sleep(快照并挂起)
3.[Install] systemctl enable|disable 时用到的选项
Conflicts:冲突关系
Restart:重启运行的脚本
Wants:依赖
要执行systemctl daemon-reload
program = PATTERN{ACTION STATEMENTS;}
原理是处理每行$0,根据分隔符切片为$1,$2
如果省略item相当于print $0
[root@centos7-mould ~]# awk -F "[- ]" ‘{print $1}‘ /etc/fstab
#
#
#
#
#
#
#
UUID=4f8f9662
UUID=2ffce847
UUID=200259c9
### 变量
[root@centos7-mould ~]# awk -F "[- ]" -v OFS="\n" ‘{print $1,$2}‘ /etc/fstab
#
#
/etc/fstab
#
Created
#
#
Accessible
#
See
#
UUID=4f8f9662
22a0
UUID=2ffce847
9957
UUID=200259c9
e2bb
[root@centos7-mould ~]# awk -F "[- ]" -v ORS="\t" ‘{print $1}‘ /etc/fstab
# # # # # # # UUID=4f8f9662 UUID=2ffce847 UUID=200259c9 [
[root@centos7-mould ~]# awk -F "[- ]" ‘{print NR}‘ /etc/fstab
1
2
3
4
5
6
7
8
9
10
11
[root@centos7-mould ~]# awk -F "[- ]" ‘{print NF}‘ /etc/fstab
0
1
2
11
1
9
12
1
43
39
39
[root@centos7-mould ~]# awk -F "[- ]" ‘{print $NF}‘ /etc/fstab
#
/etc/fstab
2018
#
‘/dev/disk‘
info
#
0
0
0
[root@centos7-mould ~]# awk -F "[- ]" ‘{print FNR}‘ /etc/fstab /etc/hosts
1
2
3
4
5
6
7
8
9
10
11
1
2
[root@centos7-mould ~]# awk -F "[- ]" ‘BEGIN{for (i in ARGV) print ARGV[i];print ARGC}‘ /etc/fstab
awk
/etc/fstab
2
[root@centos7-mould ~]# awk -F "[- ]" ‘BEGIN{CMD="cmd\n";HELLO="hello\n";printf "%10s%10s",CMD,HELLO}‘ /etc/fstab
cmd
hello
[root@centos7-mould ~]# awk -F "[- ]" ‘BEGIN{CMD="cmd\n";HELLO="hello\n";YES=(HELLO=="hello\n")?"true\n":"false\n";printf "%10s",YES}‘ /etc/fstab
true
[root@centos7-mould ~]# awk -F " " ‘/o$/{print $NF}‘ /etc/fstab
info
[root@centos7-mould ~]# awk -F " " ‘(NR>=3&&NR<=4){print $NF}‘ /etc/fstab
/etc/fstab
2018
END{} 仅在完成后执行一次
输出语句
next 行间未执行完处理下一行,类似continue
遍历:for(var in array) {print array[var]}
[root@centos7-mould ~]# ss -tna|awk -F " " ‘(NR!=1){STATE[$1]++}END{for(i in STATE) {print i,STATE[i]}}‘
LISTEN 3
ESTAB 1
[root@centos7-mould ~]# ss -tna|awk -F " " ‘(NR!=1){gsub("L","l",$1);print $1}‘
lISTEN
lISTEN
ESTAB
lISTEN
[root@centos7-mould ~]# ss -tna|awk -F " " ‘(NR!=1){split($1,ARRAY,"E");for(i in ARRAY) {print ARRAY[i]};print "----"}‘
LIST
N
----
LIST
N
----
STAB
----
LIST
N
----
标签:listen ... ons alias 管理系统 evel 默认 rescue ase
原文地址:https://www.cnblogs.com/xuluchuan/p/9313256.html