Hi,
My prompt looks like this
[root@x1-6-00-c0-9f-cc-er-57 ~]#
It used to be something like
[root@localhost ~]#
What is wrong? Can any one help? Thanks..
Hi,
My prompt looks like this
[root@x1-6-00-c0-9f-cc-er-57 ~]#
It used to be something like
[root@localhost ~]#
What is wrong? Can any one help? Thanks..
Nothing is wrong with Bash. Your prompt is showing the current hostname (via \h). It used to be "localhost", but your machine has since picked up a different hostname (likely from DHCP), so \h now expands to that long string. You can confirm with:
hostname If you want the old style back, fix the hostname instead of hardcoding the prompt. On modern, systemd-based distros:
hostnamectl set-hostname localhost Then ensure /etc/hosts maps 127.0.0.1 (or 127.0.1.1 on Debian/Ubuntu) to that name. See the hostnamectl man page for details man7.org/linux/man-pages/man1/hostnamectl.1.html.
About the "Permission denied": you tried to run ~/.bashrc as a program. .bashrc is a config file, not executable. Open it with a text editor, add a PS1 line, then source it so the change takes effect immediately. For example:
PS1='[\u@\h \w]\$ '
source ~/.bashrc Note: \$ prints # for root and $ for normal users (using \# would show the command number instead). Bash’s prompt escapes are documented here gnu.org/software/bash/manual/bash.html#Controlling-the-Prompt.
Tip: If your hostname keeps changing on boot, your DHCP client or NetworkManager may be setting it. Either set a static hostname as above or disable accepting hostnames from DHCP in your network configuration.
Jump to Post— Sturm 270To change it look in ~/.bashrc. It should have an entry that looks like this
PS1='\u \w\# '. Change it tooPS1='[\u@\h \w] \# '
To change it look in ~/.bashrc. It should have an entry that looks like this PS1='\u \w\# ' . Change it too PS1='[\u@\h \w] \# '
To change it look in ~/.bashrc. It should have an entry that looks like this
PS1='\u \w\# '. Change it tooPS1='[\u@\h \w] \# '
thanks,
how do I open it though?
If I do this then here is what I get
[root@x1-6-00-c0-9f-bb-ba-57 ~]# ~/.bashrc
bash: /root/.bashrc: Permission denied
What to do? Thanks...
With a text editor nano ~/.bashrc
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.