Zmiana nazwy terminala w centach

3

Jestem bardzo nowy w tym terminalu centos i aws. Chciałbym zapytać, jak zmienić nazwę terminala i zastąpić domyślną nazwę ec2user @ ip. Proszę pomóż mi.

user617081
źródło

Odpowiedzi:

2

Czy mówimy o zachęcie terminala? Jeśli tak, patrzysz na zmienną PS1. Od basha można to zmienić, na przykład, wydając export PS1=\u@\h\$ (który jest prawdopodobnie podobny do tego, co już masz). Zmień część po = na co tylko chcesz.

W zależności od tego, co chcesz jako monit, potrzebujesz różnych zmiennych w eksporcie. Oto lista dostępnych:

 \d   The date, in "Weekday Month Date" format (e.g., "Tue May 26"). 
 \h   The hostname, up to the first . (e.g. deckard) 
 \H   The hostname. (e.g. deckard.SS64.com)
 \j   The number of jobs currently managed by the shell. 
 \l   The basename of the shell's terminal device name. 
 \s   The name of the shell, the basename of $0 (the portion following the final slash). 
 \t   The time, in 24-hour HH:MM:SS format. 
 \T   The time, in 12-hour HH:MM:SS format. 
 \@   The time, in 12-hour am/pm format. 
 \u   The username of the current user. 
 \v   The version of Bash (e.g., 2.00) 
 \V   The release of Bash, version + patchlevel (e.g., 2.00.0) 
 \w   The current working directory. 
 \W   The basename of $PWD. 
 \!   The history number of this command. 
 \#   The command number of this command. 
 \$   If you are not root, inserts a "$"; if you are root, you get a "#"  (root uid = 0) 
 \nnn   The character whose ASCII code is the octal value nnn. 
 \n   A newline. 
 \r   A carriage return. 
 \e   An escape character (typically a color code). 
 \a   A bell character.
 \\   A backslash. 
 \[   Begin a sequence of non-printing characters. (like color escape sequences). This
      allows bash to calculate word wrapping correctly.
 \]   End a sequence of non-printing characters.

Eksperymentuj z różnymi wartościami w PS1, a kiedy już znajdziesz zestaw, który ci się podoba, możesz go wkleić ~/.bashrc aby zmiana była trwała.

Jarmund
źródło