LoginSignup
1
1

More than 5 years have passed since last update.

Linuxのプロンプトに時刻表示を追加する

Posted at

この記事の目的

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 ~]$

感想

地味に便利!!

1
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
1