bash 搜尋.bash_history下過的command Ctrl + R
查版本 uname -a
lsb_release -a
找DNS IP 1 2 3 4 5 6 7 8 $ scutil --dns DNS configuration resolver nameserver[0 ] : 192.168 .43.1 if _index : 5 (en1) flags : Request A records reach : Reachable,Directly Reachable Address
讀取java位置 1 2 3 4 5 [ec2-user@ip-172 -31 -22 -146 opt]$ readlink -f $(which java) /usr/lib/jvm/java-1.8 .0 -openjdk-1.8 .0.45 -30 .b13.el7_1.x86_64/jre/bin/java /*redhat版本*/ [ec2-user@ip-172 -31 -22 -146 ~]$ cat /etc/redhat-release Red Hat Enterprise Linux Server release 7.1 (Maipo)
查詢檔案類型 1 2 # file /bin/grep /bin/grep: ELF 64 -bit LSB executable, x86-64 , version 1 (SYSV), dynamically linked (uses shared libs), for GNU/Linux 2 .6 .32 , BuildID[sha1]=0x2695c3bf69db3cd5a6ea3f71ce1d0658e53ba354, stripped
設定redirect 80 到 8080 (-A) 1 2 3 iptables -t nat -A PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8080 /* 移除設定 (-D)*? iptables -t nat -D PREROUTING -p tcp --dport 80 -j REDIRECT --to-port 8080
CentOS 7 open port 8080 on firewall 1.ensure firewalld
is active.
1 2 3 4 5 6 7 8 9 10 firewalld.service - firewalld - dynamic firewall daemon Loaded: loaded (/usr/lib/systemd/system/firewalld.service; enabled) Active: active (running) since 三 2015 -11 -25 09 :11 :43 CST; 5 h 4 min ago Main PID: 654 (firewalld) CGroup: /system.slice/firewalld.service └─654 /usr/bin/python -Es /usr/sbin/firewalld --nofork --nopid 11 月 25 09 :11 :42 f6s systemd[1 ]: Starting firewalld - dynamic firewall daemon...11 月 25 09 :11 :43 f6s systemd[1 ]: Started firewalld - dynamic firewall daemon...
2.pre-check firewall rule.
1 2 3 4 5 6 7 8 9 10 [root@f6s sysconfig] public (default, active) interfaces: ens32 sources: services: dhcpv6-client ssh ports: masquerade: no forward-ports: icmp-blocks: rich rules:
3.add rule.
1 2 [root@f6s sysconfig] success
4.rule not applied
1 2 3 4 5 6 7 8 9 10 [root@f6s sysconfig] public (default, active) interfaces: ens32 sources: services: dhcpv6-client ssh ports: masquerade: no forward-ports: icmp-blocks: rich rules:
5.reload firewalld
1 2 [root@f6s sysconfig] success
6.rule applied
1 2 3 4 5 6 7 8 9 10 [root@f6s sysconfig] public (default, active) interfaces: ens32 sources: services: dhcpv6-client ssh ports: 8080 /tcp masquerade: no forward-ports: icmp-blocks: rich rules:
Remove it as needed:
1 2 3 4 5 6 7 8 9 10 11 12 13 14 [root@f6s sysconfig] success [root@f6s sysconfig] success [root@f6s sysconfig] public (default, active) interfaces: ens32 sources: services: dhcpv6-client ssh ports: masquerade: no forward-ports: icmp-blocks: rich rules:
reference CentOS 7 / RHEL 7 – Open ports
PowerShell Start-Process hexo s
or start hexo s