0

Possible Duplicate:
Bash prompt on Ubuntu - FQDN (\H) same as hostname (\h)

Is it possible to customize ssh shell prompt to show domain name instead of ip e.g

ubuntu@ip-xx-xxx-xx-xxx:~$

with

ubuntu@dev.mydomain.com:~$

Edit: I do not want to hard code the domain name instead I want to fetch the associated domain name

sakhunzai
  • 173
  • 1
  • 7

1 Answers1

2

The shell prompt is decided by the PS1 variable in bash. My current PS1 is :

[ec2-user@phinfinity.com ~]$ echo $PS1
[\u@\H \W]\$

the parameter \H specifies to place the hostname. you can replace your bashrc to use something like export PS1="\u@dev.mydomain.com:\W$"

A better option should be to change your hostname to dev.mydomain.com . Check the man page of the hostname command to setup your hostname in linux.

Check : Linux Hostname Configuration

  • thanks, is it possible to retrieve domain name associated with the Amazon ec2 instance directly through some command ? So this can be done with all amazon instances –  Oct 15 '12 at 08:29