LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Linux - General (https://www.linuxquestions.org/questions/linux-general-1/)
-   -   Changing the (what is it called?) (https://www.linuxquestions.org/questions/linux-general-1/changing-the-what-is-it-called-370085/)

freakin'me 10-05-2005 02:51 PM

Changing the (what is it called?)
 
Hi,

I just set up a debian (sarge) box, and now after every time I log in,ever line starts with:

Quote:

65:~#
I want to change this, how should I do this? (sorry, but I don't know what it is called)

Regards,

Freakin'me

SirSlappy 10-05-2005 02:57 PM

hostname
 
hostname

/etc/hostname

freakin'me 10-05-2005 03:02 PM

Thanks for your quick reply.

However, when I enter /etc/hostname, the only thing I see is "debian". I used this tutorial to set everything up: http://www.falkotimme.com/howtos/per...arge/index.php , I think one of the software has changed something, but I don't know what it was/is.

Regards,

Freakin'me

Dark_Helmet 10-05-2005 03:12 PM

I think you're after the "prompt."

If that is the case, then an environment variable needs to be changed/modified/updated. The actual name of the environment variable depends on the shell you use. For bash, it's PS1. For tcsh, I believe it's prompt. I'm not sure what other shells use (such as ksh, zsh, etc). Bash is popular, so I'll assume you have that one.

You can experiment with new prompts directly at the command line. For example:
Code:

export PS1='\u@\h:\w\$'
Executing that command (in the bash shell) will make the prompt be: <user name>@<hostname>:<working directory>($|#)

THe '$' or '#' at the end of the prompt indicates whether the user is a regular user or root; only root sees the '#' at the end.

The prompt may look like this after the change:
Code:

chris@deimos:~$
There are many different codes you can embed in the prompt with different information. Each shell is different in how you specify what information to display, and what information is available to display. You'll need to pull up the man page for your shell and read up on it. If you're using bash, it's located under the section titled "PROMPTING."

EDIT:
Forgot to mention, to make the change permanent, the export line above either needs to be put in /etc/profile or included in the user's ${HOME}/.bash_profile.

freakin'me 10-05-2005 03:22 PM

Thank you, that's exactly what I was looking for. However: My prompt is now: root@65.98.38.210:/etc/networking#

How do I change the 65.98.38.210 into serverdownstairs.lan?

Regards,

Freakin'me

freakin'me 10-05-2005 03:31 PM

Quote:

Originally posted by Dark_Helmet EDIT:
Forgot to mention, to make the change permanent, the export line above either needs to be put in /etc/profile or included in the user's ${HOME}/.bash_profile. [/B]
And what if I want to apply this to all users, and all new users? (Yes, I'm sorry, quite a n00b)

Dark_Helmet 10-05-2005 03:35 PM

## Hostname stuff
I don't use debian, so I can only make educated guesses. The man page for bash says the '\h' code gets "the hostname up to the first `.'"

For this one, SirSlappy was right on the mark. Use the hostname command to change your hostname, or put the desired hostname in /etc/hostname.

If that doesn't work, then you may need to look at the documentation for system startup to find how the hostname is set. Some distributions (like Red Hat) will keep the desired hostname in a different file, and execute "hostname <contents of other file>" on boot. Debian might do something similar.

## Global/personal prompt
Applying to all users is done by adding it to /etc/profile. That file is automatically read by bash when it starts up. It gives the administrator the opportunity to set up default settings (such as the prompt). The ${HOME}/.bash_profile is user specific. Keep in mind, you can't force users to use the prompt. They can override it with their own version in their personal .bash_profile.

freakin'me 10-05-2005 03:38 PM

Thanks for your reply.

My /etc/hostnames still contains nothing but "debian", so anybody who knows where debian (sarge) stores the hostname stuff?

freakin'me 10-06-2005 04:00 AM

After a reboot my prompt is again just debian$: or something like that. However, when I boot, postfix gives an error about the fact that 65.98.38.210 is a numeric hostname.....

I can remember that I got during the installation of postfix a notice that the hostname I'd use for postfix whould also be used for other apps.


All times are GMT -5. The time now is 04:12 PM.