Hostname
- ultracentos
- Posts: 15
- Joined: 2017/03/20 20:55:21
Hostname
What caused it I don't know!
Hostname suddenly appeared with the directory "Documents" appended at the end. --> [Delano@Gateway-Centos-6.10 Documents]$
I've checked all the host files where hostname is managed, and the hostname reads is as it should read: [Delano@Gateway-Centos-6.10]$
I've tried to get rid of the intruder "Documents" with no success. Are there any ideas out there on how to rid of this intruder
[Moderator: moved post from CentOS 8 forum and deleted duplicate in this one]
Hostname suddenly appeared with the directory "Documents" appended at the end. --> [Delano@Gateway-Centos-6.10 Documents]$
I've checked all the host files where hostname is managed, and the hostname reads is as it should read: [Delano@Gateway-Centos-6.10]$
I've tried to get rid of the intruder "Documents" with no success. Are there any ideas out there on how to rid of this intruder
[Moderator: moved post from CentOS 8 forum and deleted duplicate in this one]
Re: Hostname
That looks normal to me. The standard command prompt is set up to display the following:
That's \u = user, \h = hostname, \W = current working directory.
so if you cd then it will put your current working directory back to your home dir and the "Documents" on the end of the command prompt will change to "~".
Code: Select all
[trevor@c6test ~]$ echo $PS1
[\u@\h \W]\$
so if you cd then it will put your current working directory back to your home dir and the "Documents" on the end of the command prompt will change to "~".
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke
- ultracentos
- Posts: 15
- Joined: 2017/03/20 20:55:21
Re: Hostname
I don't believe it's normal, and here is the reason why:
Hoastname -->> [Delano@Gateway-centOS-6]$ Now before a change in the hostname occurs I must cd and pick a directory such as: Documents then
the hostname changes to [Delano@Gateway-centOS-6 Documents]$ now if I cd the hostname returns to [Delano@Gateway-centOS-6]$
There is no reason why Documents or any other directory should appear within the hostname until cd is applied and an directory is chosen. Yes I've used the cd to drop Documents from the hostname i.e.
[hostname Documents]$ cd -->> [hostname]
I'm very curious as to why this happened. Several wierd things occur off and on with this OS, however, I'm greatly satisfied with the distro and do not intend to move from it.
cheers
Hoastname -->> [Delano@Gateway-centOS-6]$ Now before a change in the hostname occurs I must cd and pick a directory such as: Documents then
the hostname changes to [Delano@Gateway-centOS-6 Documents]$ now if I cd the hostname returns to [Delano@Gateway-centOS-6]$
There is no reason why Documents or any other directory should appear within the hostname until cd is applied and an directory is chosen. Yes I've used the cd to drop Documents from the hostname i.e.
[hostname Documents]$ cd -->> [hostname]
I'm very curious as to why this happened. Several wierd things occur off and on with this OS, however, I'm greatly satisfied with the distro and do not intend to move from it.
cheers
Just happy to be here
cheers
Gateway-centOS-6.10-i686
cheers
Gateway-centOS-6.10-i686
Re: Hostname
Run echo $PS1 and see if you get the same output as I showed you. If you do then what you are seeing is perfectly normal and in fact is standard on an unmodifed CentOS install. The \W bit of the PS1 sets the latter portion of the command prompt to the last bit of the current working directory (i.e the one you just cd'ed into).
So if you cd ~/Documents then you will see Documents there. If you cd /etc then it will show "etc" then if you cd skel it will show you "skel" and your current working directory will be /etc/skel which is the location of the standard .bash* files that get copied to each user's home directory when the user is created.
The PS1 variable is set from the file /etc/bashrc which is executed when each bash shell starts up.
So if you cd ~/Documents then you will see Documents there. If you cd /etc then it will show "etc" then if you cd skel it will show you "skel" and your current working directory will be /etc/skel which is the location of the standard .bash* files that get copied to each user's home directory when the user is created.
The PS1 variable is set from the file /etc/bashrc which is executed when each bash shell starts up.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke
- ultracentos
- Posts: 15
- Joined: 2017/03/20 20:55:21
Re: Hostname
Below - Documents included with hostname:
[Delano@Gateway-centOS-6 Documents]$ echo $ps1
[Delano@Gateway-centOS-6 Documents]$
///////////////////////////////////////////////////////////////////////////////////////////////////////
Below - Documents removed from hostname:
[Delano@Gateway-centOS-6 Documents]$ cd
[Delano@Gateway-centOS-6 ~]$ echo $ps1
[Delano@Gateway-centOS-6 ~]$
I'm I doing this correctly??
[Delano@Gateway-centOS-6 Documents]$ echo $ps1
[Delano@Gateway-centOS-6 Documents]$
///////////////////////////////////////////////////////////////////////////////////////////////////////
Below - Documents removed from hostname:
[Delano@Gateway-centOS-6 Documents]$ cd
[Delano@Gateway-centOS-6 ~]$ echo $ps1
[Delano@Gateway-centOS-6 ~]$
I'm I doing this correctly??
Just happy to be here
cheers
Gateway-centOS-6.10-i686
cheers
Gateway-centOS-6.10-i686
Re: Hostname
It's $PS1 not $ps1. Everything is case sensitive in linux.
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke
- ultracentos
- Posts: 15
- Joined: 2017/03/20 20:55:21
Re: Hostname
[Delano@Gateway-centOS-6 Documents]$ echo $PS1
[\u@\h \W]\$
[Delano@Gateway-centOS-6 Documents]$ cd
[Delano@Gateway-centOS-6 ~]$ echo $PS1
[\u@\h \W]\$
I wonder what that's telling me
[\u@\h \W]\$
[Delano@Gateway-centOS-6 Documents]$ cd
[Delano@Gateway-centOS-6 ~]$ echo $PS1
[\u@\h \W]\$
I wonder what that's telling me
Just happy to be here
cheers
Gateway-centOS-6.10-i686
cheers
Gateway-centOS-6.10-i686
Re: Hostname
What you are missing is the "~" in:ultracentos wrote: ↑2020/01/22 22:57:35[Delano@Gateway-centOS-6 Documents]$ echo $PS1
[\u@\h \W]\$
[Delano@Gateway-centOS-6 Documents]$ cd
[Delano@Gateway-centOS-6 ~]$ echo $PS1
[\u@\h \W]\$
I wonder what that's telling me
Code: Select all
[Delano@Gateway-centOS-6 ~]$
- ultracentos
- Posts: 15
- Joined: 2017/03/20 20:55:21
Re: Hostname
Maybe I'm beginning to get-it, but why does "Documents" show in the host name, and not some other Directory such as "Downloads."Whoever wrote: ↑2020/01/23 03:48:48What you are missing is the "~" in:ultracentos wrote: ↑2020/01/22 22:57:35[Delano@Gateway-centOS-6 Documents]$ echo $PS1
[\u@\h \W]\$
[Delano@Gateway-centOS-6 Documents]$ cd
[Delano@Gateway-centOS-6 ~]$ echo $PS1
[\u@\h \W]\$
I wonder what that's telling meThis tells you that you have set the cd to your home directory. So it is just the same as the example for Documents.Code: Select all
[Delano@Gateway-centOS-6 ~]$
Just happy to be here
cheers
Gateway-centOS-6.10-i686
cheers
Gateway-centOS-6.10-i686
Re: Hostname
Because you haven't cd'ed to ~/Downloads. If you had then it would.why does "Documents" show in the host name, and not some other Directory such as "Downloads."
I think you're missing the point about $PS1 too. It won't change just because you cd to a different directory. The contents of $PS1 tell bash how to format the command prompt. It says [\u@\h \W]\$ which means set the command prompt to a square bracket followed by the username (\u) then an @ sign, followed by the hostname (\h) and a space then the current working directory (\W) and lastly, close off the square brackets and follow it with a dollar sign.
So if you are logged on as user "joe" on host linux101.example.com and you cd /etc then the prompt in your bash screen will say
[joe@linux101 etc]$
The future appears to be RHEL or Debian. I think I'm going Debian.
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke
Info for USB installs on http://wiki.centos.org/HowTos/InstallFromUSBkey
CentOS 5 and 6 are deadest, do not use them.
Use the FAQ Luke