Debian Linux: Configure Network Interfaces As A Bridge / Network Switch

In Debian Linux, you can configure network interfaces as a bridge, also known as a network switch, using the brctl utility and the /etc/network/interfaces file. Here’s an example of how to configure two network interfaces, eth0 and eth1, as a bridge: Install the bridge-utils package: sudo apt-get install bridge-utils Create a bridge device: sudo brctl … Read more

How to change directory in Linux terminal

In the Linux terminal, you can change the current working directory using the cd command. Here’s how you can use the cd command to change to a different directory: cd path/to/directory where path/to/directory is the path of the directory you want to change to. For example, to change to the /home directory, you would use … Read more

Linux Rename Eth0 Network Interface Card Name [ Udev ]

In Linux, you can change the name of a network interface card using the udev subsystem. Here’s how you can change the name of the eth0 interface to new_name: Create a new udev rule file: sudo nano /etc/udev/rules.d/10-network.rules Add the following lines to the file: SUBSYSTEM==”net”, ACTION==”add”, DRIVERS==”?*”, ATTR{address}==”xx:xx:xx:xx:xx:xx”, NAME=”new_name” where xx:xx:xx:xx:xx:xx is the MAC … Read more

less Command Display Line Numbers

To display line numbers while using the less command, you can add the -N option when running the less command: less -N file.txt In this example, the -N option causes less to display line numbers in front of each line of the file. This can be useful when you need to refer to specific lines … Read more

Python Delete/Remove a File If Exists On Disk

In Python, you can remove/delete a file from disk using the os module’s remove function. Here’s an example: import os file_path = “path/to/file.txt” if os.path.exists(file_path): os.remove(file_path) print(“File removed successfully.”) else: print(“File not found.”) In this example, we first check if the file exists using the os.path.exists function. If the file exists, we remove it using … Read more

How to change DNS ip address in RHEL (Red Hat Enterprise Linux)

You can change the DNS IP address in Red Hat Enterprise Linux by editing the network configuration file. Here’s how: Open the network configuration file: sudo nano /etc/sysconfig/network-scripts/ifcfg-<interface> where <interface> is the name of your network interface (e.g. eth0). Modify the DNS line to the desired IP address, e.g.: DNS1=8.8.8.8 Save the file and exit … Read more