Raspberry pi os
Remove .local from hostname/network alias
Raspberry pi os seems to use avahi to make itself availably using the .local ending.
But we want just the hostname without the .local!
Using NetworkManager (tested)
Open the NetworkManager hostname config:
Add the following and set the hostname you want to use:
Then restart NetworkManager
Using dhcpcd (untested pls report in an issue if worked/or not)
If you are using an older os you might need to change the dhcpcd configuration.
Open the config:
Search for a hostname entry, remove the # at the start of the line and reboot the pi.
Done, now your pi should be available with your custom hostname without using .local
Disabling avahi
Now we can disable the avahi daemon: