Posts

How to Change Mac Address in Linux

Image
In this tutorial, we'll explore the process of changing MAC addresses in Linux. MAC addresses are used to uniquely identify devices on a network. Altering a MAC address can be useful for enhancing anonymity and security while connected to networks. Steps to Change MAC Address in Linux: 1. Open Terminal: Begin by opening the terminal and listing all network interfaces on your server using the following command: ip link show The output terminal below: 2. Select Interface: Identify the network interface for which you want to change the MAC address. For example, let's select the docker0 network interface. 3. Take Interface Down: Before changing the MAC address, take the selected network interface down using the following command: sudo ifconfig docker0 down 4. Change MAC Address: Now, you can change the MAC address to your desired value. For instance, to change from 02:42:c2:c6:e8:39 to 02:42:b2:b6:c8:40, use the following command: sudo ifconfig docker0 hw ether 02:42:b2:b6:c8:40

Removing Blank Lines Using the Grep Command

Image
In this tutorial, we'll explore how to utilize the grep command to eliminate blank lines. The grep command proves invaluable for searching text and strings within files, providing efficient ways to manage content. Learn the process of removing unwanted blank lines with ease and precision. For example 1 The content grep_command.txt file is as follows: welcome to huuphan.com I'm Huu [server@xxx$] other web site devopsroles.com [server@xxx$] [server@xxx$] test Tip tip The result, welcome to huuphan.com I'm Huu other web site devopsroles.com Tip tip Use command below: grep -v "\$[[:space:]]*" grep_command.txt The output terminal as below: For example 2 The content grep_command2.txt file as below phan van huu The result, phan van huu Use command as below: grep -v "^[[:space:]]*$" grep_command2.txt # or grep -v "^$" grep_command2.txt The output terminal as below: Explained The -v makes it print lines that do not completely match ^              matc