Hostname

General support questions
User avatar
jlehtone
Posts: 4523
Joined: 2007/12/11 08:17:33
Location: Finland

Re: Hostname

Post by jlehtone » 2020/01/23 13:04:33

ultracentos wrote:
2020/01/23 04:44:33
... show in the host name
The command prompt is not the hostname.
Prompt happens to show hostname, and some other information too.
You see username, hostname, and directory in the prompt.


(Poor) analogy:
You are in a house. House has a door. You ask: "Why there is a door in me?", like the house were part of you.

User avatar
ultracentos
Posts: 15
Joined: 2017/03/20 20:55:21

Re: Hostname

Post by ultracentos » 2020/01/23 19:57:28

TrevorH wrote:
2020/01/23 08:43:31
why does "Documents" show in the host name, and not some other Directory such as "Downloads."


Because you haven't cd'ed to ~/Downloads. If you had then it would.

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]$


> Because you haven't cd'ed to ~/Downloads. If you had then it would.

>> I cd'ed to ~/Downloads. Closed the terminal then opened the terminal and the terminal had changed back to Documents.

> I think you're missing the point about $PS1 too. It won't change just because you cd to a different directory.

>> No doubt I'm missing "something" on this subject. But I do understand whatever is typed at the terminal with "cd" will not have an permanent effect on the command prompt. I fully understand your point here.

>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.

>> Here is what I know: Change 'HOSTNAME'

#vi /etc/sysconfig/network
NETWORKING=yes
NETWORKING_IPV6=no
HOSTNAME="Gateway-centOS-6.10"
NTPSERVERARGS=iburst

#vi /etc/host
Delano@Gateway-CentOS-6.10

$echo $PS1
[\u@\h \W]]\$

You say: > 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]$

Your point here is true, however, my point is: When I log on as joe the bash screen says [joe@linux 101 Documents]$. I do not need to cd /Documents for the prompt to read [joe@linux101 Documents]$
Just happy to be here :D

cheers


Gateway-centOS-6.10-i686

User avatar
ultracentos
Posts: 15
Joined: 2017/03/20 20:55:21

Re: Hostname

Post by ultracentos » 2020/01/23 20:01:23

jlehtone wrote:
2020/01/23 13:04:33
ultracentos wrote:
2020/01/23 04:44:33
... show in the host name
The command prompt is not the hostname.
Prompt happens to show hostname, and some other information too.
You see username, hostname, and directory in the prompt.


(Poor) analogy:
You are in a house. House has a door. You ask: "Why there is a door in me?", like the house were part of you.
Thank you.
Just happy to be here :D

cheers


Gateway-centOS-6.10-i686

User avatar
jlehtone
Posts: 4523
Joined: 2007/12/11 08:17:33
Location: Finland

Re: Hostname

Post by jlehtone » 2020/01/24 10:09:15

ultracentos wrote:
2020/01/23 19:57:28
my point is: When I log on as joe the bash screen says [joe@linux 101 Documents]$. I do not need to cd /Documents for the prompt to read [joe@linux101 Documents]$
When you log on, get the "bash screen", and do:

Code: Select all

pwd
What do you get?

Is it /home/joe/Documents, /home/Delano/Documents, etc?

If yes, then the appropriate question is: What makes the "bash screen" start with that working directory?

How do you "open bash"?

User avatar
ultracentos
Posts: 15
Joined: 2017/03/20 20:55:21

Re: Hostname

Post by ultracentos » 2020/01/24 17:21:08

[Delano@Gateway-centOS-6 Documents]$ pwd
/home/Delano/Documents
[Delano@Gateway-centOS-6 Documents]$

There is an terminal icon at the panel. I simply click on the icon and terminal opens with the prompt as indicated above.

wanting to start bash with the "HOME" directory i.e. "Delano" in play.

thanks for the interest.


cheers
Just happy to be here :D

cheers


Gateway-centOS-6.10-i686

User avatar
jlehtone
Posts: 4523
Joined: 2007/12/11 08:17:33
Location: Finland

Re: Hostname

Post by jlehtone » 2020/01/24 18:42:38

Perhaps, in the properties of the icon, there is a "start in" setting?

User avatar
ultracentos
Posts: 15
Joined: 2017/03/20 20:55:21

Re: Hostname

Post by ultracentos » 2020/01/24 19:29:02

terminal: no "properties" adjustment, however, there is - "profile" and "profile preference" - neither of which offers help on this subject.

thank you for your interest
Just happy to be here :D

cheers


Gateway-centOS-6.10-i686

User avatar
ultracentos
Posts: 15
Joined: 2017/03/20 20:55:21

Re: Hostname/SOLVED

Post by ultracentos » 2020/01/25 00:33:26

OK - Here's what I did to solve my problem

[Delano@centOS-6: Documents]$ cd --------------> cd ---------> ~ -------> home/Delano
[Delano@centOS-6: ~]$ rm -r Documents --------> dropped the "s" on Documents
[Delano@centOS-6: ~]$ mkdir Document ---------> made directory Document -- this works for me!
[Delano@centOS-6: ~]$ ls -------------------------------> check it out
{{ Desktop fontconfig mail My_Stuff Public xorriso -
Document Mail News Templates -
Downloads gpk-application-desktop~ Music Pictures Videos }}

command prompt: which i wanted -------> [Delano@centOS-6: ~]$ --------> [user: "Delano" / host: "centOS-6" / working directory " ~ "]

Thank all of you centOS geeks for your interest and worthy suggestions taken together your suggestions led me to an solution.

btw: perhaps i missed it, but doesn't this forum a means to mark the thread SOLVED ?
also I dropped Gateway from the command prompt.


After testing terminal which included many open and closed actions. I decided to return centos to its original form and mkdir Documents and remove the directory Document. I'm now of the opinion: The solution is more straight forward than the above solution. I believe now - simply removing the directory Documents then a reboot then a mkdir Documents is the solution to the problem.
Just happy to be here :D

cheers


Gateway-centOS-6.10-i686

Post Reply