④. centos7服务查看
- ①. 有方便统一的管理方式(常用的方法)
systemctl start 服务名(xxxx.service) systemctl restart 服务名(xxxx.service) systemctl stop 服务名(xxxx.service) systemctl reload 服务名(xxxx.service) systemctl status 服务名(xxxx.service)
- ②. 查看服务的方法 /usr/lib/systemd/system
- ③. 查看服务的命令
systemctl list-unit-files
systemctl --type service
# 关闭防火墙 [root@TANG2021 opt]# systemctl list-unit-files | grep firewalld firewalld.service enabled [root@TANG2021 opt]# systemctl disable firewalld.service Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service. Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service. [root@TANG2021 opt]# systemctl list-unit-files | grep firewalld firewalld.service disabled [root@TANG2021 opt]# systemctl status firewalld.service ● firewalld.service - firewalld - dynamic firewall daemon Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled) Active: inactive (dead) Docs: man:firewalld(1) 7月 23 15:58:07 TANG2021.ybc systemd[1]: Starting firewalld - dynamic firewall daemon... 7月 23 15:58:07 TANG2021.ybc systemd[1]: Started firewalld - dynamic firewall daemon. 7月 23 17:06:20 TANG2021.ybc systemd[1]: Stopping firewalld - dynamic firewall daemon... 7月 23 17:06:21 TANG2021.ybc systemd[1]: Stopped firewalld - dynamic firewall daemon. [root@TANG2021 opt]#
#systemctl stop | start | status firewalld # 临时 (关闭|开启|状态) 防火墙 #systemctl disable firewalld # 禁止开机启动
⑤. netstat 查看系统的网络情况
⑤. netstat:查看系统的网络情况(netstat –anp|grep 8080 查看占用8080端口的进程)
-an 按一定顺序排列输出
-p 显示哪个进程在调用
⑥. grep命令
- ①. 查找文件里符合条件的字符串
用法:grep [选项]… PATTERN[FILE]…
grep lang anacondaks.cfg 在文件中查找lang grep lang anacondaks.cfg --color 高亮显示
②. 高亮显示(grep debug yum.conf --color)
③. 这里是往后再显示5个(grep debug yum.conf --color -A5)
④. 这里后面显示5个,往前显示5个(grep debug yum.conf --color -A5 -B5)
⑦. 重定向输出>和>>
- 重定向输出,覆盖原有内容; >>重定向输出,有追加功能
cat /etc/passwd > a.txt 将输出定向到a.txt cat /etc/passwd >> a.txt 输出并且追加 ifconfig > ifconfig.txt