How can I change the hostname that is in the command prompt.
I have
[root@domU-12-31-19-93-37-71 ~]# ls
Can I change to
[root@jasonvaritek ~]# ls
How can I change the hostname that is in the command prompt.
I have
[root@domU-12-31-19-93-37-71 ~]# ls
Can I change to
[root@jasonvaritek ~]# ls
The easiest way is to change the hostname for the machine permanently, rather than on the CLI with the 'hostname' command. You can make this change in /etc/sysconfig/network on a RHEL/Centos/Fedora machine at least. Once you reboot the machine the hostname in the command prompt should reflect your change.
You can also make the change through the PS1 variable if using a bash shell. For example, running
echo $PS1
Will show something along the lines of "[\u@\h \W]\$". Here, \u is the username, \h is the hostname and \w displays the basename of the current working directory, with $HOME abbreviated with a tilde.
To change the hostname, you just needto set $PS1 to reflect your value instead of your hostname, like this
PS1="[\u@jasonvaritek \W]\$"
Of course, if you want this change to persist you'll need to set the environment variable in your bash profile settings.