开启apache服务(单次)
systemctl start httpd
设置apache开机启动
systemctl enable httpd
查看apache状态
systemctl status httpd
关闭apache服务
systemctl stop httpd
开启ftp服务(单次)
systemctl start vsftpd
设置ftp开机启动
systemctl enable vsftpd
查看ftp状态
systemctl status vsftpd
关闭ftp服务
systemctl stop vsftpd
开启ssh服务(单次)
systemctl start sshd
设置ssh开机启动
systemctl enable sshd
查看ssh状态
systemctl status sshd
关闭ssh服务
systemctl stop sshd
开启xrdp服务(单次)
systemctl start xrdp
设置xrdp开机启动
systemctl enable xrdp
查看xrdp状态
systemctl status xrdp
关闭xrdp服务
systemctl stop xrdp
开启mysql服务(单次)
systemctl start mysqld
设置mysql开机启动
systemctl enable mysqld
查看mysql状态
systemctl status mysqld
关闭mysql服务
systemctl stop mysqld
(这里为什么很多服务后边都有个d呢,其实这个d是 Daemon的意思,守护进程,他可以持续地等待从客户端发来的请求)
开启防火墙(单次)
systemctl start firewalld.service
设置防火墙开机启动
systemctl enable firewalld.service
关闭防火墙
systemctl stop firewalld.service
永久关闭防火墙
systemctl disable firewalld.service
查看防火墙状态
systemctl status firewalld.service
设置防火墙开通80端口
firewall-cmd --zone=public --add-port=80/tcp --permanent
查询80端口是否开启
firewall-cmd --query-port=80/tcp
重启防火墙
firewall-cmd --reload
查看开机启动项(有三种状态enabled/disabled/static,其中状态为static的服务,是作为其他服务的依赖而存在)
systemctl list-unit-files |grep enabled
查看SVN端口号和进程号,其中$7~"svn"即$7包含svn
netstat -anp | head -1 ; netstat -anp | awk '{if ($7~"svn") print }'
netstat -anp | awk '{if ($7~"svn") print $4 }' |awk -F ':' '{print "端口号是 : " $2}'
netstat -anp | awk '{if ($7~"svn") print $7 }' |awk -F '/' '{print "进程号是 : " $1}'
已知进程号查看进程
ps aux |head -1 ; ps aux | awk '{if ($2=="1312") print}'