How can I display hostname along with user when I login to Linux machine? Now I can see only part of host name where I could not able to identify the server name. would like to display as below; For example:


if changed to root then


Did you read the manual before asking the question?

PS1='[\u@\H]$ '

This has been answered in the Unix & Linux exchange already, but the answer is to add PS1="\H$ " to your /etc/bash.bashrc


  • 2
    Assuming "yourfullhostname" means the FQDN, \h is incorrect; it should be \H instead. – Tommiie Sep 28 '18 at 6:03

Your Answer

By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.