Author Archives: Ahmed Tawfik

Unknown's avatar

About Ahmed Tawfik

Cybersecurity Professional, Systems Engineer, OSS & Linux Geek

How to delete certain lines of text from a file in Bash using sed

“sed -i 1,+2d file_name” deletes starting from line ‘1’ and the next ‘2’ lines, i.e. deletes the first 3 lines

Tagged , , | Leave a comment

Cleanup the SSH known_hosts file

“ssh-keygen -R [host] “ helpful especially in clusters

Tagged , , | Leave a comment

How to randomly change your MAC address on Ubuntu

“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 – … Continue reading

Tagged , | Leave a comment

Change your hostname randomly in Ubuntu

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 … Continue reading

Tagged , | Leave a comment

Change your computer’s hostname in Ubuntu

“sudo hostname new_name“ where “new_name” is the new hostname you’ll use

Tagged , | Leave a comment