Author Archives: Ahmed Tawfik

Unknown's avatar

About Ahmed Tawfik

Cybersecurity Professional, Systems Engineer, OSS & Linux Geek

Delete the last line in a text file using sed

sed -i ‘$d’ hobba -i: to change the file itself, not copy contents to another file or something$d: delete the last linehobba: the file name

Tagged , | Leave a comment

Insert a "new line" character in a text file using Bash

“echo -e “192.168.100.100\n192.168” >> hobba“  The ‘-e’ option does the magic, as it allows escape characters to be printed Source

Tagged | Leave a comment

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