lnlidawei

  博客园 :: 首页 :: 博问 :: 闪存 :: 新随笔 :: 联系 :: 订阅 订阅 :: 管理 ::

[linux]: 设置【PS1】

 

 

 

 

一、环境

 

  1.  操作系统:  Linux fedora 6.16.4-200.fc42.x86_64 #1 SMP PREEMPT_DYNAMIC Thu Aug 28 19:47:10 UTC 2025 x86_64 GNU/Linux

 

 

 

二、设置PS1

 

  1.  配置【 ~/.bashrc 】

#[config PS1]
#PS1="[\u@\h:\W]\\$ "
#PS1="[\033[32m\u@\h:\W\033[0m]\\$ "
COLOR_START='\033[32m'
COLOR_END='\033[0m'
PS1="[${COLOR_START@P}\u@\h:\W${COLOR_END@P}]\\$ "

 

 

 

三、配置文件完整版【~/.bashrc】

[wit@fedora:tmp]$ cat ~/.bashrc 
# .bashrc

# Source global definitions
if [ -f /etc/bashrc ]; then
    . /etc/bashrc
fi

# User specific environment
if ! [[ "$PATH" =~ "$HOME/.local/bin:$HOME/bin:" ]]; then
    PATH="$HOME/.local/bin:$HOME/bin:$PATH"
fi
export PATH

# Uncomment the following line if you don't like systemctl's auto-paging feature:
# export SYSTEMD_PAGER=

# User specific aliases and functions
if [ -d ~/.bashrc.d ]; then
    for rc in ~/.bashrc.d/*; do
        if [ -f "$rc" ]; then
            . "$rc"
        fi
    done
fi
unset rc




#[config PS1]
#PS1="[\u@\h:\W]\\$ "
#PS1="[\033[32m\u@\h:\W\033[0m]\\$ "
COLOR_START='\033[32m'
COLOR_END='\033[0m'
PS1="[${COLOR_START@P}\u@\h:\W${COLOR_END@P}]\\$ "


#[config_by_david] 2025-04-20
alias off1='sudo shutdown -h now '
alias off='sudo poweroff '
alias updateos='sudo dnf clean all && sudo dnf makecache && sudo dnf upgrade -y  '
alias reboot='sudo reboot '
alias vi='vim '
alias gpp='g++ -g -Wall '
alias gcc='gcc -g -Wall '
alias dnf='sudo dnf '


#[rust_config] 2025-08-12 config by david
export RUSTUP_UPDATE_ROOT='https://mirrors.tuna.tsinghua.edu.cn/rustup/rustup'
export RUSTUP_DIST_SERVER='https://mirrors.tuna.tsinghua.edu.cn/rustup'
rust_env="/home/wit"
source "${rust_env}/.cargo/env"
#source "$HOME/.cargo/env"


# setting by david; date-2025-04-20
TOOLS="/home/wit/fedora42/tools"
export PATH=$PATH:$TOOLS


WORK_DIR="/home/wit/fedora42/lidawei/tmp"
cd ${WORK_DIR}








[wit@fedora:tmp]$ 

 

 

 

四、参考资料

 

  1.  无

 

  .

 

posted on 2025-09-07 15:44  lnlidawei  阅读(22)  评论(0)    收藏  举报