When you opens a terminal it displays the username and the machine name. As an example mine shows: romeo@romeo-Satellite-C660D:~$
. It's really annoying because it's kinda big. Can i make this smaller, like, only show romeo?
I know it sounds stupid, but I'm new with Unix based OSes.
You need to alter PS1
variable in your environment. PS1
is responsible of how fancy your command prompt will look alike, and what information it will contain.
Permanent change
Following is the excerpt of default .bashrc
file in Ubuntu 10.04 LTS:
if [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ '
fi
This makes command prompt look like this: username@hostname:~/directory$
이것을 변경하고 @\h
에서 부분을 삭제 PS1
하면 명령 프롬프트에서 호스트 이름 부분이 제거됩니다.
if [ "$color_prompt" = yes ]; then
PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ '
else
PS1='${debian_chroot:+($debian_chroot)}\u:\w\$ '
fi
결과: username:~/directory$
임시 변경
PS1
현재 bash
세션 에서 재정의 :
export PS1="\u:\w\$ "
자원:
이 기사는 인터넷에서 수집됩니다. 재 인쇄 할 때 출처를 알려주십시오.
침해가 발생한 경우 연락 주시기 바랍니다[email protected] 삭제
몇 마디 만하겠습니다