0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

【Rocky Linux 9】04.Bash設定

Last updated at Posted at 2023-02-28

Bash設定

  • /etc/bashrcをいじらず、/etc/bashrcが読み込んでいる/etc/profile.d/*.shに配置する
  • ログイン後の画面をカスタム
  • コマンドエイリアスを追加
/etc/profile.d/user_settings.sh
# 一番下に追記する
case ${UID} in
    0)
        PS1='\[\e[1;35m\]\H\[\e[0m\] \[\e[4;31m\]\[\e[1;31m\]${PWD}\[\e[0m\]\[\e[1;31m\]\$\[\e[0m\] '
        PS2='\[\e[1;31m\]>\[\e[0m\] '
        ;;
    *)
        PS1='\[\e[0;35m\]\H\[\e[0m\] \[\e[4;34m\]${PWD}\[\e[0m\]\[\e[0;34m\]\$\[\e[0m\] '
        PS2='\[\e[0;34m\]>\[\e[0m\] '
        ;;
esac

HISTTIMEFORMAT='%Y-%m-%d %T '
export HISTTIMEFORMAT

PATH="$PATH:/usr/local/sbin:/usr/local/bin"
export PATH

alias ls='ls --color=tty -F'
alias ll='ls --color=tty -Flh'
alias la='ls --color=tty -FlhA'
alias mv='mv -i'
alias cp='cp -i'
alias rm='rm -i'
alias vi='/usr/bin/vim'

当該変更は、次回のログイン時以降、適用されるようになる。
即時適用するには、source /etc/profileを実行する。

0
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
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?