centos7防火墙关闭命令_linux常用命令(1)

(基于centos7.4)

ff8aef0a1bd5c454364188c208c12c26.png

1、centos7用文本编辑命令 vim强于vi

2、netstat -ntlp //查看当前所有tcp端口·

netstat -ntulp |grep 80 //查看所有80端口使用情况·

netstat -an | grep 3306 //查看所有3306端口使用情况·

3、linux远程另外一台服务器

ssh 192.168.137.43 -l root -p 22

4.拷贝文件到远程服务器 -r(递归) -P(指定端口)

scp -P 1222 error.log root@192.168.1.120:/opt/

5.关闭防火墙

systemctl stop firewalld.service #关闭防火墙

systemctl disable firewalld.service #开机不启动防火墙

查看状态:systemctl status firewalld

**关闭selinux

sudo sestatus -v |grep status--查看状态

#在/etc/selinux/config 把SELNUX=enforcing换成SELINUX=disabled

sed -i 's/SELINUX=enforcing/SELINUX=disabled/' /etc/selinux/config

grep SELINUX=disabled /etc/selinux/config --查看刚才修改的内容

setenforce 0 --设置SELinux 成为permissive模式 setenforce 1为enforcing模式

6、chkconfig(centos7以后有systemctl)

主要用来更新(启动或停止)和查询系统服务的运行级信息,重启后生效。

chkconfig --list [name] 展示

chkconfig --add name 添加服务

chkconfig --del name 删除服务

chkconfig [--level levels] name chkconfig --level 2345 tomcat1 即将tomcat启动级别2345全关闭,打开,重置

chkconfig [--level levels] name

chkconfig 没有参数运行时,显示用法。如果加上服务名,那么就检查这个服务是否在当前运行级启动。

7.查看历史连接用户信息

last

8.linux7 systemctl

是RHEL 7 的服务管理工具中主要的工具,它融合之前service和chkconfig的功能于一体。可以使用它永久性或只在当前会话中启用/禁用服务。

启动一个服务:systemctl start postfix.service

关闭一个服务:systemctl stop postfix.service

重启一个服务:systemctl restart postfix.service

显示一个服务的状态:systemctl status postfix.service

在开机时启用一个服务:systemctl enable postfix.service

在开机时禁用一个服务:systemctl disable postfix.service

查看服务是否开机启动:systemctl is-enabled postfix.service

查看已启动的服务列表:systemctl list-unit-files|grep enabled

查看启动失败的服务列表:systemctl --failed

9.定时任务crontab

查看ssh登录历史 less /var/log/secure

0e33c9b17c057139991927b3298f8f39.png

crontab -l

列出定时任务

crontab -e

编辑定时任务

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值