Monday, May 6, 2024
0
rated 0 times [  0] [ 0]  / answers: 1 / hits: 3316  / 2 Years ago, sun, november 13, 2022, 11:48:31

I have changed my host and hostname by editing the files /etc/hosts and /etc/hostname.



But this won't affect what appears as my terminal prompt. It still shows my old_host@new_hostname. How to get the prompt show up new_host@new_hostname?


More From » gnome-terminal

 Answers
5

What appears at your command prompt is stored in the variable $PS1. It is generally in the format username@hostname:~$ (depending on your current directory and whether you are root of course).



It sounds like your hostname was changed successfully. I'm not sure why you edited your /etc/hosts file but I doubt it would have achieved what you're thinking it should...



Update: Here is some info on changing your username and home folder



Your options are to create a new user (and have your old home folder contents moved) or rename your old user and home folder.



You won't be able to change your username while logged in under the same account, so you have several options for getting around this:




  1. Sign in as another user (with sudo rights). Create a temporary user if necessary.

  2. Boot into Recovery Mode (hold Shift while booting), go into Advanced options for Ubuntu, select the recovery mode for the latest kernel, then select root (Drop to root shell prompt).

  3. Enable the root account and use that.



There is too much to get into here, so you should read over the content on the following links for details on the exact steps to take. Don't do anything until you feel comfortable with the steps.



How do I change my username?

http://www.ubuntututorials.com/change-username-ubuntu-12-04/

https://www.liberiangeek.net/2012/12/how-to-easily-change-your-username-in-ubuntu-12-10-quantal-quetzal/


[#22801] Tuesday, November 15, 2022, 2 Years  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
ingssex

Total Points: 21
Total Questions: 122
Total Answers: 98

Location: Sweden
Member since Fri, Mar 26, 2021
3 Years ago
;