I have an ec2 instance. When I log in, it will prompt this:
[ec2-user@ip-10-128-80-10 ~]$
I want to rewrite the ip-10-128-80-10 to some nickname, such as us1, us2, us3.
[ec2-user@us1 ~]$
How to set it ?
That's the system's hostname, which you can set in /etc/hostname
.
Next, execute this as root
$ service hostname restart
$ service hostname restart
.
Note that you don't have to change the hostname if you prefer not to. If you just want to change the prompt, you can set the shell variable PS1. At the moment, it's probably set to something like this:
PS1='[\u@\h \w]\$ '
You can set it to anything you like, e.g.
PS1='\u@test1234 \w\$ '