Help us understand the problem. What is going on with this article?

【mac】ターミナルのプロンプトの変更

More than 3 years have passed since last update.

デフォルトの指定

/etc/bashrc内のPS1に設定がある。

/etc/bashrcの設定
export PS1='\h:\W \u\$ '

項目設定:

\h ホスト名(最初の.まで)
\H ホスト名
\W ディレクトリ
\w ディレクトリ(フルパス)
\u ユーザ名
\t 時間
\$ 一般ユーザの時は"$"、rootだと"#"になる

色の設定:

\[\e[0;30m\]色をつけたい部分\[\e[0;0m\]
\[\e[0;31m\]色をつけたい部分\[\e[0;0m\]
\[\e[0;32m\]色をつけたい部分\[\e[0;0m\]
\[\e[0;33m\]色をつけたい部分\[\e[0;0m\]
\[\e[0;34m\]色をつけたい部分\[\e[0;0m\]
\[\e[0;35m\]色をつけたい部分\[\e[0;0m\]
\[\e[0;36m\]色をつけたい部分\[\e[0;0m\]
\[\e[0;37m\]色をつけたい部分\[\e[0;0m\]

設定箇所:

ホームディレクトリ内の.bash_profileに設定する。

例:.bash_profile
#赤色になる
export PS1='\[\e[0;31m\][\h@\w]\$\[\e[0;0m\] '
Why not register and get more from Qiita?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
No comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
ユーザーは見つかりませんでした