In this guide, we will see how to use the terminal to change the computer name or hostname under Debian temporarily or permanently.
To check your current computer name, open the Terminal and run this command:
The output you get is your current computer name. To change your hostname temporarily, run these commands via the terminal:
Replace "new_name" with any name of your choice you want to assign to your computer. The assigned computer name will be replaced with your default hostname once you reboot your system. If you want to change the hostname permanently, then follow these instructions:
1. Via the Terminal, edit this file using these commands:
3. Replace now your default hostname with the new name you want to assign to your computer, then save your file and close it.
4. Reboot now your server to apply the new changes.