Skip to main content

Posts

Linux get default gateway and assigned IP address

Recent posts

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.

Check Chrony logs on.Linux

Chrony service maintains synchronizing with external time sources like NTP servers. In Redhat, Rocky or Alma Linux, Chrony logs can be checked using journalctl. Example: sudo journalctl -u chronyd -xe The output will be limited only to the.log or entries of Chronyd service. To check status of Chronyd, use systemctl status chronyd To further check any log entries pertaining to chronyd, browse to /var/log cd /var/log And type: egrep "*chrony*" . This will check all log entries that has the string chrony, include the dot at the end to check all files on the current path. You can examine those files.if need to troubleshoot further, or just view the configuration of Chrony for any misconfiguration such as typo error, or unsupported Chrony settings. To view the chrony configuration,.type: grep ^[^#] /etc/chrony.conf This will view only the configuration that are currently enabled or uncommented lines, and also remove any blank lines. chronyc sources -v  The above command will show

Linux clear logs or big files

To easily clear a log file or empty a big file. Type this on a terminal,.make sure to zip or backup the file if you feel you might need it later. > MyBigLog_file.txt Yes, just type greater than sign,.followed by the filename of a log file or any file. Don't do this in Production if not sure of the consequences. If the file exists it will empty the file, if the file doesn't exist it will create the file. Test it on a VM, to see what it really does before rolling out to production. Cheers,. enjoy Linux and command line. Be still and know God is in control!

Python create simple function

Basic function in Python. def multiply(x,y):   return x*y x=2 y=5 z=multiply(x,y) print("Product is: ", z) print(x, " * " , y ," is equals to = ", z) Sample output: That's it, a simple and basic functin in Python! Keep your feet on the ground! and kneel down to pray! Prayer is the ultimate connection to the creator.

How to trim leading and trailing spaces

How to trailing spaces, leading space or both on a CSV file or any text file? Notepad++ can easily do this task without any fuss. Can be done easily in 3 clicks, provided you have Notepad++ installed on your system. Notepad++ can easily be downloaded just search Notepad++ on your favorite search engine. Or try visiting this link: https://notepad-plus-plus.org/downloads/v8.6.7/ If your file that needs to be trimmed with leading or trailing spaces or both is on CSV or in a text file format, just export it or copy to Notepad++. For the sake of clarity and for anyone of what's trailing or leading space means. Leading spaces, are the spaces that are inserted at the front of any string. Since spaces are typically not shown on any editor, unless some settings are set to on the editor to show the spaces.So, leading spaces may appear like its not align to the left or beginning of any editor. While trailing spaces, appear at the end of the string. One way to check if the string has

Linux VM always disconnected after a few seconds or minutes

VM on VMware or vSphere always got disconnected after a few seconds or minutes. CentOS or RHEL VM cannot be accessed via SSH and unable to activate or make the Interface UP. Typing: ip link show nmcli dev status nmcli gen staus Shows that VM interface is not yet UP. Typing: ip link set ens192 up Will bring the interface UP but still SSH is not working and not able to reach the VM. Typing: nmcli con up ens192 Shows "STATE" connecting but will never shows "connected". Restarting the VM and creating new interface will not help either. Typing: nmtui (network manager text user interface) It shows that the interface has been assigned with correct IP Address, DNS and Gateway But the VM still not available on the network and SSH cannot access to the VM. Well the solution, might just be an overlooked by configuring so fast the VM that a simple option was not carefully set. If the VM was set with IP Address, DNS and Gateway manually, however,

How to get assigned ESXi license on vCenter

There are few ways to get the assigned license to a host on vCenter, it could be done via ESXi Shell, PowerCLI, or via License Administration. However, it can be also done via Host Inventory option. Click "Inventory" option and select the host in which you want to check or verify on what is the License Key assigned to the particular host. After selecting or clicking the host, go to the "Configure" tab option. Click and expand the "System" drop down menu and click "licensing", then the license key details that has been assigned or applied to the host will be shown on the right pane on the same window. The "License" will be the name that was assigned to the License Key like, "License for Server1", or "Nginx Host License Key" it can be any name that was created by the administrator, descriptive name that can easily identify the server or host is much better. And the "License Key" is the details of