When installed overlooked, now in the terminal is displayed

victor@victor-HP-pavilion-g6-PC:~ 

how to make it shorter? eg

 victor@victor 
  • You can change the PS1 to ~ / .bashrc as your heart desires. - 0xdb

1 answer 1

judging by the example given by you, you want to change not the name of the user, but the name of the computer.

in the line you cited, victor@victor-HP-pavilion-g6-PC (by the way, a very common and even standardized indication of a computer пользователь@компьютер is a пользователь@компьютер . vasja-pupkin@mail.ru you ever wondered what, for example, vasja-pupkin@mail.ru ?) the username is victor , and victor-HP-pavilion-g6-PC is just the computer name.

You need to change the computer name in two files:

  • /etc/hostname
  • /etc/hosts

in the second of them, this name will appear at the beginning of the file in a line of approximately the same type

 127.0.1.1 имя 

the computer will then need to restart.


The current user name can be found, for example, in the following ways:

 $ echo $USER $ whoami $ id 

etc.


By the way, what you noticed is called the command prompt and in the shells of unix-like operating systems it is determined by the PS1 environment variable