CentOS7 tutorials on commands to view open ports, view port occupancy, open ports, kill processes and other commands.

王林
Release: 2024-02-19 10:54:25
forward
835 people have browsed it

CentOS7 tutorials on commands to view open ports, view port occupancy, open ports, kill processes and other commands.

The following is a tutorial on how to view open ports, view port occupancy, open ports and kill processes on CentOS 7:

  1. View open ports:

    • Use the
      firewall-cmd command to view the ports open in the current firewall rules:

      sudo firewall-cmd --list-ports
      Copy after login
  2. Check port occupancy:

    • Use the
      netstat command to view the occupancy of all ports on the current system:

      netstat -tuln
      Copy after login
    • If you only want to view the occupancy of the specified port, you can replace the port number with the port you want to view.
  3. Open port:

    • Use the
      firewall-cmd command to open the specified port:

      sudo firewall-cmd --add-port=<port_number>/tcp --permanentsudo firewall-cmd --reload
      Copy after login

      Replace
      <port_number> with the port number you want to open. The
      --permanent option will persist the modifications to the firewall configuration, and the
      --reload option will reload the firewall rules to make them effective.

  4. Kill the process:

    • Use the
      ps command to find the PID of the process:

      ps -ef | grep <process_name>
      Copy after login

      Replace
      <process_name> with the name of the process you want to kill.

    • Use the
      kill command to kill the process:

      sudo kill <PID>
      Copy after login

      Replace
      <pid></pid> with the PID of the process to be killed.

Please note that when executing commands involving system configuration and process management, make sure you have sufficient permissions. At the same time, proceed with caution to avoid unforeseen effects on the system.

The above is the detailed content of CentOS7 tutorials on commands to view open ports, view port occupancy, open ports, kill processes and other commands.. For more information, please follow other related articles on the PHP Chinese website!

source:mryunwei.com
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template