centos - linux 如何修改 这个机器名 root@localhost
黄舟
黄舟 2017-04-17 11:56:59
0
5
731

linux(centos6.4) 如何将 root@35dalu 修改 成 root@localhost

[root@35dalu /]# hostname
35dalu.com
[root@35dalu /]#
黄舟
黄舟

人生最曼妙的风景,竟是内心的淡定与从容!

reply all(5)
巴扎黑

The environment variable PS1 under Linux is simply to set the content displayed by the command prompt, as follows:

root@10.1.1.200:~# 

The meanings of the prompts in the PS1 variable:
d: represents the date, the format is weekday month date, for example: "Mon Aug 1"
H: Full host name. For example: My machine name is: fc4.linux, then the name is fc4.linux
h: Only take the first name of the host, as in the above example, it is fc4, .linux is omitted
t: Display time in 24-hour format, such as: HH:MM:SS
T: Display time in 12-hour format
A: The display time is in 24-hour format: HH:MM
u: Current user’s account name
v: BASH version information
w: The complete working directory name. The home directory will be replaced by ~
W: Use basename to obtain the working directory name, so only the last directory will be listed
$: Prompt character. If you are root, the prompt is: #, for ordinary users: $

vi ~/.bashrc
    export PS1="[\u@localhost \w]$"
#如果希望立即生效的话
source ~/.bashrc
刘奇

Why do you all change the command prompt?
I usually change it directly /etc/hosts

刘奇

/etc/hostnameChange it inside

小葫芦

PS1='[\u@localhost \W]\$'

刘奇

Directly

hostname localhost

or modify /etc/hostname

Just log in again after making changes

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!