美文网首页
Linux基本命令介绍

Linux基本命令介绍

作者: 程序员小华 | 来源:发表于2019-01-04 11:08 被阅读0次

本文命令都是基于CentOS7系统

一、防火墙相关命令
  • 临时关闭防火墙
[root@localhost ~]# systemctl stop firewalld
  • 禁止防火墙开机启动
[root@localhost ~]# systemctl disable firewalld
  • 开启防火墙
[root@localhost ~]# systemctl start firewalld
  • 查看防火墙状态
[root@localhost ~]# systemctl status firewalld
● firewalld.service - firewalld - dynamic firewall daemon
   Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled; vendor preset: enabled)
   Active: active (running) since 五 2019-01-04 10:47:18 CST; 53s ago
     Docs: man:firewalld(1)
 Main PID: 1738 (firewalld)
   CGroup: /system.slice/firewalld.service
           └─1738 /usr/bin/python -Es /usr/sbin/firewalld --nofork --nopid

1月 04 10:47:17 localhost.localdomain systemd[1]: Starting firewalld - dynamic firewall daemon...
1月 04 10:47:18 localhost.localdomain systemd[1]: Started firewalld - dynamic firewall daemon.
[root@localhost ~]#
  • 重启防火墙
[root@localhost ~]# systemctl restart firewalld
二、开放端口相关命令
  • 查看已经开放的端口
[root@localhost ~]# firewall-cmd --zone=public --list-ports
  • 查看某个端口是否开放
[root@localhost ~]# firewall-cmd --zone=public --query-port=80/tcp
yes

  • 开放端口
[root@localhost ~]# firewall-cmd --zone=public --add-port=80/tcp --permanent

参数解释:
1. --zone:作用域
2. --add-port=80/tcp:添加端口,格式为:端口号/通讯协议
3. --permanent:永久生效,没有此参数重启失效

  • 移除开放端口
[root@localhost ~]# firewall-cmd --zone=public --remove-port=80/tcp --permanent

相关文章

  • 关于常见Linux命令介绍

    常见 Linux 命令的介绍 这是一篇关于常见 Linux 命令的介绍 基本命令行: 文件的路径问题 pwd用于查...

  • Linux 学习笔记--来自实验楼<1>

    Linux 系统介绍 linux 基本概念及操作 shell 命令: · echo "Hello world" =...

  • Linux基本命令

    什么是Linux 这篇文章介绍什么是Linux,以及Linux的基本命令,掌握这几个基本命令将保证你能熟练完成基础...

  • Linux / Mac 下 基本的 bash shell 命令

    Linux / Mac 下 基本的 bash shell 命令详解 前言 本篇主要介绍了在Linux / Mac ...

  • 课程内容

    Day 01 计算机组成基本原理 linux 环境简介 linux 基本命令介绍练习 linux vim编辑器使用...

  • Linux基本命令介绍

    永久修改主机名 把用户加入sudoers 首先将sudoers的权限改为640 然后编辑/etc/sudoers文...

  • Linux基本命令介绍

    本文命令都是基于CentOS7系统 一、防火墙相关命令 临时关闭防火墙 禁止防火墙开机启动 开启防火墙 查看防火墙...

  • 9.Linux基本命令操作

    目录: • Linux终端介绍 Shell提示符 Bash Shell基本语法。• 基本命令的使用:ls、pw...

  • Lesson 004 —— Linux 基本命令

    Lesson 004 —— Linux 基本命令 Linux 命令格式 一些基本的命令 ls: list,列出当前...

  • 文件和目录操作命令-02-cd命令

    1. 命令介绍 cd 命令可以说是Linux中最基本的命令语句,是change directory的缩写,其他的命...

网友评论

      本文标题:Linux基本命令介绍

      本文链接:https://www.haomeiwen.com/subject/jvhhrqtx.html