-
How to Allow SNMP ports in Redhat/CentOS 7
firewall-cmd –zone=public –add-port=161/udp –permanent firewall-cmd –zone=public –add-port=161/tcp –permanent firewall-cmd –zone=public –add-port=162/udp –permanent firewall-cmd –zone=public –add-port=162/tcp –permanent firewall-cmd –reload
-
Remove Special Characters in a file using sed
sed “s/[!@#\$%^’&* ()]//g”
-
Compare two files and show the differences only using shell command
awk ‘BEGIN { while ( getline < "file1.txt" ) { arr[$0]++ } } { if (!( $0 in arr ) ) { print } }' file2.txt
-
Sample Ping Script
It’s just a simple ping script. #!/bin/bash # Program name: test.sh date cat /root/listping.txt | while read output do ping -c 1 “$output” > /dev/null if [ $? -eq 0 ]; then echo “node $output is up” else echo “node $output is down” fi done