常用Linux指令收集
防火墙操作
#添加-允许8084端口号出入
[_0_4_centos sbin]# firewall-cmd --add-port=8084/tcp --permanent
success
#重新加载防火墙规则
[_0_4_centos sbin]# firewall-cmd --reload
success
#查看防火墙规则
[_0_4_centos sbin]# firewall-cmd --list-all
public
target: default
icmp-block-inversion: no
interfaces:
sources:
services: ssh dhcpv6-client
ports: 8081/tcp 8080/tcp 8088/tcp 8089/tcp 8082/tcp 8083/tcp 8084/tcp
protocols:
masquerade: no
forward-ports:
source-ports:
icmp-blocks:
rich rules:
#关闭防火墙
[_0_4_centos sbin]# systemctl stop firewalld
#打开防火墙
[_0_4_centos sbin]# systemctl start firewalld
#查看防火墙状态
[_0_4_centos sbin]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
Loaded: loaded (/usr/lib/systemd/system/firewalld.service; disabled; vendor preset: enabled)
Active: active (running) since Fri 2020-01-31 11:18:25 CST; 3s ago
Docs: man:firewalld(1)
Main PID: 25686 (firewalld)
Tasks: 2
Memory: 28.0M
CGroup: /system.slice/firewalld.service
└─25686 /usr/bin/python -Es /usr/sbin/firewalld --nofork --nopid
查看端口占用情况
#netstat -tunlp查看有哪些端口号被占用
[ webapps]# netstat -tunlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address Foreign Address State PID/Program name
tcp 0 0 0.0.0.0:3306 0.0.0.0:* LISTEN 27893/mysqld
tcp 0 0 127.0.0.1:6379 0.0.0.0:* LISTEN 2770/redis-server 1
………………
复制文件
[ ~]# cd /opt/java/tomcat/webapps/
[ webapps]# pwd
/opt/java/tomcat/webapps##将/opt/java/tomcat/webapps/lop_project文件夹下的全部文件,复制到/opt/java/tomcat/webapps/lop_project_house目录下
[ webapps]# cp -r lop_project/. lop_project_house/