Ubuntu: bash
~/.profile
printf "%-8s %-25s %-4s %s\n" @@@@@ ~/.profile '==>' Commence # ~/.profile: executed by Bourne-compatible login shells. if [ "$BASH" ]; then if [ -f ~/.bashrc ]; then . ~/.bashrc fi fi mesg n 2> /dev/null || true printf "%-8s %-25s %-4s %s\n" @@@@@ ~/.profile '==>' Closure
~/.bashrc
printf "%-8s %-25s %-4s %s\n" @@@@@ ~/.bashrc '==>' Commence # ~/.bashrc: executed by bash(1) for non-login shells. # see /usr/share/doc/bash/examples/startup-files (in the package bash-doc) # for examples # If not running interactively, don't do anything [ -z "$PS1" ] && return # don't put duplicate lines in the history. See bash(1) for more options # ... or force ignoredups and ignorespace HISTCONTROL=ignoredups:ignorespace # append to the history file, don't overwrite it shopt -s histappend # for setting history length see HISTSIZE and HISTFILESIZE in bash(1) HISTSIZE=1000 HISTFILESIZE=2000 # check the window size after each command and, if necessary, # update the values of LINES and COLUMNS. shopt -s checkwinsize # make less more friendly for non-text input files, see lesspipe(1) [ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" # set variable identifying the chroot you work in (used in the prompt below) if [ -z "$debian_chroot" ] && [ -r /etc/debian_chroot ]; then debian_chroot=$(cat /etc/debian_chroot) fi # set a fancy prompt (non-color, unless we know we "want" color) case "$TERM" in xterm-color) color_prompt=yes;; esac # uncomment for a colored prompt, if the terminal has the capability; turned # off by default to not distract the user: the focus in a terminal window # should be on the output of commands, not on the prompt #force_color_prompt=yes if [ -n "$force_color_prompt" ]; then if [ -x /usr/bin/tput ] && tput setaf 1 >&/dev/null; then # We have color support; assume it's compliant with Ecma-48 # (ISO/IEC-6429). (Lack of such support is extremely rare, and such # a case would tend to support setf rather than setaf.) color_prompt=yes else color_prompt= fi fi if [ "$color_prompt" = yes ]; then PS1='${debian_chroot:+($debian_chroot)}\[\033[01;32m\]\u@\h\[\033[00m\]:\[\033[01;34m\]\w\[\033[00m\]\$ ' else PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' fi unset color_prompt force_color_prompt # If this is an xterm set the title to user@host:dir case "$TERM" in xterm*|rxvt*) PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\u@\h: \w\a\]$PS1" ;; *) ;; esac # enable color support of ls and also add handy aliases if [ -x /usr/bin/dircolors ]; then test -r ~/.dircolors && eval "$(dircolors -b ~/.dircolors)" || eval "$(dircolors -b)" alias ls='ls --color=auto' #alias dir='dir --color=auto' #alias vdir='vdir --color=auto' alias grep='grep --color=auto' alias fgrep='fgrep --color=auto' alias egrep='egrep --color=auto' fi # some more ls aliases alias ll='ls -alF' alias la='ls -A' alias l='ls -CF' # Alias definitions. # You may want to put all your additions into a separate file like # ~/.bash_aliases, instead of adding them here directly. # See /usr/share/doc/bash-doc/examples in the bash-doc package. if [ -f ~/.bash_aliases ]; then . ~/.bash_aliases fi # enable programmable completion features (you don't need to enable # this, if it's already enabled in /etc/bash.bashrc and /etc/profile # sources /etc/bash.bashrc). #if [ -f /etc/bash_completion ] && ! shopt -oq posix; then # . /etc/bash_completion #fi # >>> conda initialize >>> # !! Contents within this block are managed by 'conda init' !! __conda_setup="$('/opt/anaconda3/bin/conda' 'shell.bash' 'hook' 2> /dev/null)" if [ $? -eq 0 ]; then eval "$__conda_setup" else if [ -f "/opt/anaconda3/etc/profile.d/conda.sh" ]; then . "/opt/anaconda3/etc/profile.d/conda.sh" else export PATH="/opt/anaconda3/bin:$PATH" fi fi unset __conda_setup # <<< conda initialize <<< source /etc/init.d/init printf "%-8s %-25s %-4s %s\n" @@@@@ ~/.bashrc '==>' Closure
/etc/profile
printf "%-8s %-25s %-4s %s\n" @@@@@ /etc/profile '==>' Commence # /etc/profile: system-wide .profile file for the Bourne shell (sh(1)) # and Bourne compatible shells (bash(1), ksh(1), ash(1), ...). if [ "${PS1-}" ]; then if [ "${BASH-}" ] && [ "$BASH" != "/bin/sh" ]; then # The file bash.bashrc already sets the default PS1. # PS1='\h:\w\$ ' if [ -f /etc/bash.bashrc ]; then . /etc/bash.bashrc fi else if [ "`id -u`" -eq 0 ]; then PS1='# ' else PS1='$ ' fi fi fi if [ -d /etc/profile.d ]; then for i in /etc/profile.d/*.sh; do if [ -r $i ]; then . $i fi done unset i fi printf "%-8s %-25s %-4s %s\n" @@@@@ /etc/profile '==>' Closure
/etc/bash.bashrc
if [ $(id -u) == 0 ]; then printf "%-8s %-25s %-4s %s\n" @@@@@ /etc/bash.bashrc '==>' Commence # System-wide .bashrc file for interactive bash(1) shells. # To enable the settings / commands in this file for login shells as well, # this file has to be sourced in /etc/profile. # If not running interactively, don't do anything [ -z "$PS1" ] && return # check the window size after each command and, if necessary, # update the values of LINES and COLUMNS. shopt -s checkwinsize # set variable identifying the chroot you work in (used in the prompt below) if [ -z "${debian_chroot:-}" ] && [ -r /etc/debian_chroot ]; then debian_chroot=$(cat /etc/debian_chroot) fi # set a fancy prompt (non-color, overwrite the one in /etc/profile) # but only if not SUDOing and have SUDO_PS1 set; then assume smart user. if ! [ -n "${SUDO_USER}" -a -n "${SUDO_PS1}" ]; then PS1='${debian_chroot:+($debian_chroot)}\u@\h:\w\$ ' fi # Commented out, don't overwrite xterm -T "title" -n "icontitle" by default. # If this is an xterm set the title to user@host:dir #case "$TERM" in #xterm*|rxvt*) # PROMPT_COMMAND='echo -ne "\033]0;${USER}@${HOSTNAME}: ${PWD}\007"' # ;; #*) # ;; #esac # enable bash completion in interactive shells #if ! shopt -oq posix; then # if [ -f /usr/share/bash-completion/bash_completion ]; then # . /usr/share/bash-completion/bash_completion # elif [ -f /etc/bash_completion ]; then # . /etc/bash_completion # fi #fi # sudo hint if [ ! -e "$HOME/.sudo_as_admin_successful" ] && [ ! -e "$HOME/.hushlogin" ] ; then case " $(groups) " in *\ admin\ *|*\ sudo\ *) if [ -x /usr/bin/sudo ]; then cat <<-EOF To run a command as administrator (user "root"), use "sudo <command>". See "man sudo_root" for details. EOF fi esac fi # if the command-not-found package is installed, use it if [ -x /usr/lib/command-not-found -o -x /usr/share/command-not-found/command-not-found ]; then function command_not_found_handle { # check because c-n-f could've been removed in the meantime if [ -x /usr/lib/command-not-found ]; then /usr/lib/command-not-found -- "$1" return $? elif [ -x /usr/share/command-not-found/command-not-found ]; then /usr/share/command-not-found/command-not-found -- "$1" return $? else printf "%s: command not found\n" "$1" >&2 return 127 fi } fi printf "%-8s %-25s %-4s %s\n" @@@@@ /etc/bash.bashrc '==>' Closure fi
/etc/init.d/init
#--------------------------------------------------------------------- #--------------------------------------------------------------------- #--------------------------------------------------------------------- # History #--------------------------------------------------------------------- export HISTCONTROL=ignoredups export HISTFILE=$HOME/.bash_history export HISTFILESIZE=2000 export HISTSIZE=1000 shopt -s histappend if unset "${HISTTIMEFORMAT}" 2>/dev/null; then export HISTTIMEFORMAT="$(echo -e "\e[7m$(whoami)\e[0m") %F %T>> " typeset -r HISTTIMEFORMAT fi #--------------------------------------------------------------------- # Fedora Default Editor #--------------------------------------------------------------------- if grep -iq 'Fedora' /etc/os-release; then export EDITOR=/usr/bin/vim fi #--------------------------------------------------------------------- # Trap #--------------------------------------------------------------------- trap 'echo -e "\U26A1 \e[30;46mCommand >>$BASH_COMMAND<< failed with error code $?\e[0m \U1F300"' ERR trap 'echo $BASH_COMMAND > /dev/null' DEBUG #--------------------------------------------------------------------- # PS1 #--------------------------------------------------------------------- case $(awk '/^ID/' /etc/os-release | awk -F= '{print tolower($2)}' | tr -d \") in centos | fedora) source /usr/share/git-core/contrib/completion/git-prompt.sh esac function lampooner() { if git rev-parse --git-dir >&/dev/null; then message='' # git_dir if [[ $(git rev-parse --is-inside-git-dir 2>/dev/null) == true ]]; then PS1="\[\e[1;31m\]\u\[\e[0m\]@\[\e[1;32m\]\h\[\e[0m\][\[\e[1;33m\]\t\[\e[0m\]]:\[\e[36m\](GIT_DIR)\[\e[0m\]\[\e[1;34m\]\w\[\e[0m\]\\$ " return 0 fi # cherry-pick if git status 2>/dev/null | grep -q 'cherry-pick'; then message='|Cherry-pick' fi # rebase if git status 2>/dev/null | grep -q 'rebase'; then message+='|Rebase' fi # merge case $(git status --short | head -1 | cut --characters 1-2) in DD | AU | UD | UA | DU | AA | UU) message+='|Merging' ;; *) : ;; esac if git status | grep -qi conclude; then message+='|Resolved' fi # branch branch=$(git rev-parse --abbrev-ref HEAD 2>/dev/null) if [ "$branch" != "" ]; then if [ "$branch" == HEAD ]; then branch=$(git rev-parse --short HEAD 2>/dev/null) if [ $? != 0 ]; then branch=Lank fi fi fi PS1="\[\e[1;31m\]\u\[\e[0m\]@\[\e[1;32m\]\h\[\e[0m\][\[\e[1;33m\]\t\[\e[0m\]]:\[\e[36m\](${branch}${message})\[\e[0m\]\[\e[1;34m\]\w\[\e[0m\]\\$ " else PS1="\[\e[1;31m\]\u\[\e[0m\]@\[\e[1;32m\]\h\[\e[0m\][\[\e[1;33m\]\t\[\e[0m\]]:\[\e[1;34m\]\w\[\e[0m\]\\$ " fi } function languor() { if git rev-parse --git-dir >&/dev/null; then local msg msg=$(__git_ps1) msg=${msg:1} PS1="${VENV}${CONDA_PROMPT_MODIFIER}\[\e[1;31m\]\u\[\e[0m\]@\[\e[1;32m\]\h\[\e[0m\][\[\e[1;33m\]\t\[\e[0m\]]:\[\e[36m\]${msg}\[\e[0m\]\[\e[1;34m\]\w\[\e[0m\]\\$ " else PS1="${VENV}${CONDA_PROMPT_MODIFIER}\[\e[1;31m\]\u\[\e[0m\]@\[\e[1;32m\]\h\[\e[0m\][\[\e[1;33m\]\t\[\e[0m\]]:\[\e[1;34m\]\w\[\e[0m\]\\$ " fi } declare -x PROMPT_COMMAND=languor #--------------------------------------------------------------------- # User #--------------------------------------------------------------------- if [[ $(id -u) -eq 0 ]]; then echo -e "\U1F308\U2744\U1F319 \e[34;47mWelcome Root\e[0m \U1F31F\U1F320\U231B" else echo "\U1F31B\U1F31F Welcome Ordinary" fi #--------------------------------------------------------------------- # Distro #--------------------------------------------------------------------- DISTRO=$(tr "[:upper:]" "[:lower:]" </etc/os-release | grep -Poi '(debian|ubuntu|red hat|centos|fedora)' | sort | uniq) if [ -z "$DISTRO" ]; then DISTRO=unknow fi
【推荐】国内首个AI IDE,深度理解中文开发场景,立即下载体验Trae
【推荐】编程新体验,更懂你的AI,立即体验豆包MarsCode编程助手
【推荐】抖音旗下AI助手豆包,你的智能百科全书,全免费不限次数
【推荐】轻量又高性能的 SSH 工具 IShell:AI 加持,快人一步
· 震惊!C++程序真的从main开始吗?99%的程序员都答错了
· 【硬核科普】Trae如何「偷看」你的代码?零基础破解AI编程运行原理
· 单元测试从入门到精通
· 上周热点回顾(3.3-3.9)
· winform 绘制太阳,地球,月球 运作规律
2020-09-16 Unit示例Hello World(docker)
2020-09-16 systemd:Unit