2021-11-01

Linux - editing the HOSTS file - archive when starting changes

Four simple lines of bash/sh script to archive the /etc/hosts file before changing it. Don't leave home without this tiny gold nugget script.

#!/usr/bin/bash
xdate=`date +%Y%m%d%H%M`
cp /etc/hosts /etc/hosts.$xdate
vi /etc/hosts
scp /etc/hosts 10.10.10.43:/etc
# last line copies the new file to another Linux








No comments:

Post a Comment

Script to see network interface connection speed

cat network-speed #!/usr/bin/bash # ethtool enp2s0 | grep Speed ethtool $1 | grep Speed # mii-tool -v enp2s0 mii-tool -v $1   network-speed ...