Linux centos7 Common Command "SYSTEMCTL replacement service"

Source: Internet
Author: User

See all NIC IP addresses--ip addr

Start firewall--systemctl start Firewalld.service

Stop firewall--systemctl Stop Firewalld.service

View FIREWALLD firewall status--firewall-cmd--state

Disable firewall boot--systemctl disable Firewalld.service

Lists the running service status--systemctl

Start a service--systemctl start Postfix.service

Close a service--systemctl stop Postfix.service

Restart a service:--systemctl restart Postfix.service

Displays the status of a service--systemctl status Postfix.service

Enable a service at boot--systemctl enable Postfix.service

Disable a service at boot--systemctl disable Postfix.service

Check to see if the service is booting--systemctl is-enabled Postfix.service;echo $?

View the list of services started--SYSTEMCTL List-unit-files|grep enabled

Set system default startup RunLevel 3--ln-sf/lib/systemd/system/multi-user.target/etc/systemd/system/default.target

Set system default startup RunLevel 5--ln-sf/lib/systemd/system/graphical.target/etc/systemd/system/default.target

Original address: http://www.centoscn.com/CentOS/help/2015/0618/5687.html

Firewall common commands are as follows:

Firewall-cmd--state # #查看防火墙状态, whether it's running

Firewall-cmd--reload # #重新载入配置, such as after adding a rule, you need to execute this command

Firewall-cmd--get-zones # #列出支持的zone

Firewall-cmd--get-services # #列出支持的服务, the service in the list is released

Firewall-cmd--query-service FTP # #查看ftp服务是否支持, return yes or no

Firewall-cmd--add-service=ftp # #临时开放ftp服务

Firewall-cmd--add-service=ftp--permanent # #永久开放ftp服务

Firewall-cmd--remove-service=ftp--permanent # #永久移除ftp服务

Firewall-cmd--add-port=80/tcp--permanent # #永久添加80端口

Iptables-l-N # #查看规则, this command is the same as Iptables

Man Firewall-cmd # #查看帮助

1, the basic use of FIREWALLD

Start: Systemctl start Firewalld

View status: Systemctl status Firewalld

Stop: Systemctl Disable FIREWALLD

Disable: Systemctl stop Firewalld

2.systemctl is the main tool in CentOS7 's service management tool, which incorporates the functionality of the previous services and Chkconfig.

Start a service: Systemctl start Firewalld.service

Close a service: Systemctl stop Firewalld.service

Restart a service: Systemctl restart Firewalld.service

Displays the status of a service: Systemctl status Firewalld.service

Enable a service at boot: Systemctl enable Firewalld.service

Disable a service at boot: systemctl disable Firewalld.service

Check if the service is booting: Systemctl is-enabled firewalld.service

To view a list of services that have been started: Systemctl List-unit-files|grep enabled

To view a list of services that failed to start: Systemctl--failed

3. Configure Firewalld-cmd

View version: Firewall-cmd--version

View Help: Firewall-cmd--help

Display Status: Firewall-cmd--state

View all open ports: Firewall-cmd--zone=public--list-ports

Update firewall rules: Firewall-cmd--reload

View area information: Firewall-cmd--get-active-zones

View the specified interface area: Firewall-cmd--get-zone-of-interface=eth0

Reject All packages: Firewall-cmd--panic-on

Cancel deny status: Firewall-cmd--panic-off

To see if rejected: Firewall-cmd--query-panic

So how do I open a port?

Add to

Firewall-cmd--zone=public--add-port=80/tcp--permanent (--permanent permanent, no failure after this parameter restart)

Re-loading

Firewall-cmd--reload

View

Firewall-cmd--zone= Public--query-port=80/tcp

Delete

Firewall-cmd--zone= Public--remove-port=80/tcp--permanent

Linux centos7 Common Command "SYSTEMCTL replacement service"

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.