centos命令
systemctl
使用方法: systemctl 动作 服务名.service
systemctl start httpd.service /启动Apache httpd
systemctl restart httpd.service /重新启动
systemctl stop httpd.service /停止服务
systemctl enable httpd.service /开机启动httpd
systemctl disable httpd.service /禁止开机启动httpd
systemctl status httpd.service /httpd当前状态
systemctl status NetworkManager.service –l /输出完整命令
systemctl list-unit-files 等同于 chkconfig --list
[root@localhost ~]# systemctl status
● localhost.localdomain
State: running
Jobs: 0 queued
Failed: 0 units
Since: Mon 2017-09-25 00:09:21 CST; 20min ago
CGroup: /
├─1 /usr/lib/systemd/systemd --switched-root --system --deserialize 21
├─user.slice
│ └─user-0.slice
│ ├─session-2.scope
│ │ ├─10371 sshd: root@pts/0
│ │ ├─10375 -bash
│ │ ├─10413 systemctl status
│ │ └─10414 systemctl status
│ └─session-1.scope
│ ├─ 696 login -- root
│ └─4745 -bash
└─system.slice
├─tuned.service
│ └─1235 /usr/bin/python -Es /usr/sbin/tuned -l -P
├─postfix.service
│ ├─2357 /usr/libexec/postfix/master -w
│ ├─2378 pickup -l -t unix -u
│ └─2379 qmgr -l -t unix -u
├─sshd.service
│ └─1233 /usr/sbin/sshd -D
├─polkit.service
│ └─916 /usr/lib/polkit-1/polkitd --no-debug
├─wpa_supplicant.service
│ └─915 /usr/sbin/wpa_supplicant -u -f /var/log/wpa_supplicant.log -c /etc/wpa_supplicant/wpa_supplicant.conf -u -f /var/log
├─NetworkManager.service
│ └─771 /usr/sbin/NetworkManager --no-daemon
├─crond.service
│ └─694 /usr/sbin/crond -n
├─rsyslog.service
│ └─691 /usr/sbin/rsyslogd -n
├─systemd-logind.service
│ └─690 /usr/lib/systemd/systemd-logind
├─dbus.service
│ └─682 /bin/dbus-daemon --system --address=systemd: --nofork --nopidfile --systemd-activation
├─firewalld.service
│ └─677 /usr/bin/python -Es /usr/sbin/firewalld --nofork --nopid
├─auditd.service
│ └─654 /sbin/auditd -n
├─systemd-udevd.service
│ └─547 /usr/lib/systemd/systemd-udevd
├─lvm2-lvmetad.service
│ └─544 /usr/sbin/lvmetad -f
└─systemd-journald.service
└─525 /usr/lib/systemd/systemd-journald
IP命令
# ip link show # 显示网络接口信息
# ip link set eth0 upi # 开启网卡
# ip link set eth0 down # 关闭网卡
# ip link set eth0 promisc on # 开启网卡的混合模式
# ip link set eth0 promisc offi # 关闭网卡的混个模式
# ip link set eth0 txqueuelen 1200 # 设置网卡队列长度
# ip link set eth0 mtu 1400 # 设置网卡最大传输单元
# ip addr show # 显示网卡IP信息
# ip addr add 192.168.0.1/24 dev eth0 # 设置eth0网卡IP地址192.168.0.1
# ip addr del 192.168.0.1/24 dev eth0 # 删除eth0网卡IP地址
# ip route list # 查看路由信息
# ip route add 192.168.4.0/24 via 192.168.0.254 dev eth0 # 设置192.168.4.0网段的网关为192.168.0.254,数据走eth0接口
# ip route add default via 192.168.0.254 dev eth0 # 设置默认网关为192.168.0.254
# ip route del 192.168.4.0/24 # 删除192.168.4.0网段的网关
# ip route del default # 删除默认路由