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

Linux NetworkManager command line configuration

 Configure Network Settings Using Network Manager in Linux Last updated: March 25, 2025 Written by:baeldung Network ConfigurationNetworkMana...