Open firewalld permanently in CentOS 7

centos

CentOS 7 was shipped together with firewalld which a layer above iptables.

Unlike iptables, no rc.local need to be update to make sure a permanent firewall configuration with firewalld.


Command

  • To permanently open TCP port 80
    $ sudo firewall-cmd --permanent --zone=public --add-port=80/tcp
  • The port is yet to open, unless we reboot the machine, else just reload service
    $ sudo firewall-cmd --reload
  • Make sure port open correctly by listing all allowed port/service
    $ firewall-cmd --list-all

Listing only directory in CentOS

centos

Efficiently navigating file systems is a fundamental skill for Linux administrators and users alike. We are about to explore a focused aspect of directory management in CentOS – the art of listing only directories using command-line tools


  • Usual listing with ls
$ ls -l
-rw-rw-r-- 1 user user 2809 Apr 23 2017 a.out
drwxrwxr-x 4 user user 4096 Mar 8 2018 bootstrap-4.0.0-dist.zip
-rw-rw-r-- 1 user user 1001 Aug 11 2018 social-icons.css
-rw-rw-r-- 1 user user 48312 Jan 23 2019 tmp.out
  • To list folder only, in current directory
  • $ ls -d */
    bootstrap-4.0.0-dist.zip/
  • To list folder only, in different path
    $ ls -d /your/own/path/*/