龙空技术网

linux常用命令(1)

kaycici 24

前言:

此刻小伙伴们对“centos7vim命令行编辑”可能比较珍视,朋友们都需要分析一些“centos7vim命令行编辑”的相关资讯。那么小编在网上网罗了一些对于“centos7vim命令行编辑””的相关文章,希望咱们能喜欢,大家一起来学习一下吧!

(基于centos7.4)

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 <on|off|reset> chkconfig --level 2345 tomcat1 <on|off|reset> 即将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

crontab -l

列出定时任务

crontab -e

编辑定时任务

标签: #centos7vim命令行编辑 #centos查找文本信息 #centos编辑文本

上一篇「系统安全」linux禁止root用户

下一篇没有了