この記事の目的
Linuxにログインすると出てくる以下ような表示がプロンプトの表記の変更をする
[hoge@hoge01 ~]$
設定ファイル(.bashrc)を開いて値を変更
$ vim ~/.bashrc
.bashrcのデフォルト状態(CentOS7.5)
# .bashrc
# Source global definitions
if [ -f /etc/bashrc ]; then
. /etc/bashrc
fi
# Uncomment the following line if you don't like systemctl's auto-paging feature:
# export SYSTEMD_PAGER=
# User specific aliases and functions
"# User specific aliases and functions"以降に以下を追加
PS1='(\t)[\u@\h \W]\$ '
HISTTIMEFORMAT='%Y-%m-%d %T '
結果
(22:42:24)[hoge@hoge01 ~]$
感想
地味に便利!!