一.查找命令
1. find(指定目录查找)
2. locate(数据库中查找)
3. whereis(程序名查找)
4. which(环境变量中查找)
5. type
二.防火墙
1、开放端口
firewall-cmd --zone=public --add-port=5672/tcp --permanent # 开放5672端口
firewall-cmd --zone=public --remove-port=5672/tcp --permanent #关闭5672端口
firewall-cmd --reload # 配置立即生效
systemctl start firewalld.service #开启防火墙
2、查看防火墙所有开放的端口
firewall-cmd --zone=public --list-ports
3.、关闭防火墙
如果要开放的端口太多,嫌麻烦,可以关闭防火墙,安全性自行评估
systemctl stop firewalld.service
4、查看防火墙状态
firewall-cmd --state
三、查看监听的端口
netstat -lnpt
PS:centos7默认没有 netstat 命令,需要安装 net-tools 工具,yum install -y net-tools
四、检查端口被哪个进程占用
netstat -lnpt |grep 5672
五、查看进程的详细信息
ps 6832
六、中止进程
kill -9 6832
七.nginx命令
1.nginx启动,停止,状态
systemctl start nginx.service
systemctl stop nginx.service
systemctl reload nginx.service
systemctl status nginx.service
2.找到nginx的安装位置
whereis nginx
八.查看php.ini在哪
php -i | grep "Loaded Configuration File"
或者查看phpinfo
查看FTP服务是否运行中:service vsftpd status
查看本地是否含有包含ftp的进程开启:ps -ef | grep ftp
FTP设置开机自动运行:chkconfig vsftpd on
关闭FTP开机自动运行:chkconfig vsftpd off
查看所有服务开启自动运行的情况:chkconfig --list
启动FTP服务:service vsftpd start
停止FTP服务:service vsftpd stop
重启FTP服务:service vsftpd restart
注:service vsftpd status 是红帽服务启动(start) 停止(stop) 状态(status) 的操作方式。 如果不是红帽可能无法执行
十.systemd使用
systemctl --version
,查看版本。whereis systemctl
,查看位置。systemctl list-unit-files
,列出所有可用单元(服务)。systemctl list-units
,列出所有运行中的单元。systemctl --failed
,列出所有失败的单元。systemctl list-unit-files | grep enable
,查看自启动的软件。systemctl is-enabled mysqld.service
,查看某个单元是否开机启动。systemctl status mysqld.service
,查看某个单元的状态。systemctl start mysqld.service
,启动某个单元。systemctl restart mysqld.service
,重启某个单元。systemctl stop mysqld.service
,停止某个单元。systemctl daemon-reload
,修改了某个单元的配置文件后,重载配置文件。systemctl reload mysqld.service
,重载某个单元。systemctl enable mysqld.service
,设置开机自启动。systemctl disable mysqld.service
,关闭开机自启动。systemctl kill mysqld
,杀死单元。