Skip to main content

Posts

Showing posts from November, 2024

Linux get default gateway and assigned IP address

How to check default gateway and assigned IP address in Linux? There are quite a few ways to do this in a Linux system. However, in systemd or newer version of Linux systems which support the ip route command all the information is there already. The output of the ip route command shows the default gateway and the assigned or primary IP address of the VM or server. Here's an example to show the default gateway of a Linux system. The IP Address after the word "default via" is the default gateway of the system. Command is: ip r | grep default To show only the default gateway IP Address, we need to use RegEx and match the IPV4 address only. Here's the command: ip r | grep default | grep -Eoh '[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}' Sample output image: To show the assigned primary IP address on the VM or server, type the command below. Here's the command: ip r | grep -oP 'src \K\d+\.\d+\.\d+\.\d+' Sample output imag

Postfix read or view the email in queue from the terminal window

Check or read the contents of the email on Terminal for troubleshooting purposes. The Postfix command below will show the entire original message with headers and body, or the email itself in raw format. Like reading email as a text file. Get or grab the postfix ID, by typing: mailq or postqueue -p Once the ID is known use the postcat command to view the contents of the ID. postcat -bh -q F0ABD910CDE33 | less ## this command will show the contents of the email that is on the queue To delete an email use the command below: postqueue -d ID ## delete the queue ID / delete the email with the specific ID, the email will be deleted on the queue used sparingly Proverbs 3:7 Do not consider yourself wise, fear God, and turn away from evil.