“sed -i 1,+2d file_name”
deletes starting from line ‘1’ and the next ‘2’ lines, i.e. deletes the first 3 lines
“sed -i 1,+2d file_name”
deletes starting from line ‘1’ and the next ‘2’ lines, i.e. deletes the first 3 lines
“ssh-keygen -R [host] “
helpful especially in clusters
“sudo apt-get install macchanger”
“sudo macchanger -A eth0”
where “eth0” is the network card you’d like to change its MAC.
Note: You have to edit your connection in Network Manager and change the old MAC with the new one, or – which is much better in my opinion – just remove the MAC from there to be obtained dynamically.
The following script worked great:
#!/bin/bash
#random_computer_name
sudo sed -i 1,10d /etc/hostname
function randnum
{
number=$[ ( $RANDOM % 15 ) + 8 ]
}
randnum
function randpass
{
newhostname=`
}
randpass
(echo ‘0a’; echo $newhostname; echo ‘.’; echo ‘wq’) | sudo ed -s /etc/hostname
sudo /bin/hostname $newhostname
Just add the above script in a file and execute it with “sudo”.
To add this file to your startup scripts, just follow the instructions in this post
Source: here
“sudo hostname new_name“
where “new_name” is the new hostname you’ll use