Daily tip

How do I list HBA devices and WWN?

#systool -c fc_host -v

or

$lspci |grep -i hba

or write a script containing

if [ -e /sys/class/fc_host ]; then
for HOST in $(ls /sys/class/fc_host)
do cat /sys/class/fc_host/$HOST/node_name
done
else
echo “No fiber host adapter found.”
fi

Daily tip

How to transparently redirect HTTP requests on port 80 to a http proxy on port 8080?

By using the iptable nat

First pre-requisite is enabling IP forwarding on the system

#echo “net.ipv4.conf.all.forwarding =1”>>/etc/sysctl.conf && sysctl -p

Then issue the below iptable command

#iptables -t nat -A PREROUTING -p tcp –dport 80 -j REDIRECT –to-port 8080


Daily tip

I have installed CentOS minimal and the commands, ifconfig, netstat and traceroute are not recognized: how come?

These are considered now deprecated or legacy commands/utilities, please get more info on their equivalent (in the order):

ip
ss
tracepath

Daily tip.

How do I display a substring of a variable in bash?

For example, you want to display the first seven characters from a string passed from the command line

echo ${$1:0:7}

Of course you can also save the value somewhere

substr=${$1:0:7}

Daily tip

How do I revoke a certificate in Openssl?

#openssl -ca revoke openssl ca -revoke /etc/ssl/certs/cert.pem

Of course replace path and filename to reflect your configuration.

Daily tips

How to prevent changing SELinux policy?

#setsebool secure_mode_policyload on

After that the SELinux policy (enforced or permissive) can be changed only after rebooting