首页 > 其他分享 >.bashrc 给文件夹添加颜色

.bashrc 给文件夹添加颜色

时间:2024-05-20 12:51:33浏览次数:13  
标签:chroot prompt alias color bashrc 文件夹 添加 debian bash

.bashrc 给文件夹添加颜色

# ~/.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

  

标签:chroot,prompt,alias,color,bashrc,文件夹,添加,debian,bash
From: https://www.cnblogs.com/xiluhua/p/18201651

相关文章

  • Zabbix添加自定义监控项
    1.查看zabbix_agent配置文件cat/etc/zabbix/zabbix_agentd.conf|grep-v"^$"|grep-v"^#"上图中,自定义监控项的配置文件可以放到Include项目中,Include可以有多个2.添加或修改自定义监控项配置文件cd/etc/zabbix/zabbix_agentd.d/vicustomized_cpu.confUserParameter......
  • 如何从多个文件夹里各提取相应数量的文件放一起到新文件夹中形成多文件夹组合
    首先,需要用到的这个工具:度娘网盘提取码:qwu2蓝奏云提取码:2r1z 首先,说明一下情况文件夹:1、2、3里面分别放置了各100张动物的图片,模拟实际情况的各种文件操作:这里演示的是从3个文件夹里各取2张图片实际情况中,可以从多个文件夹里进行多个文件提取进行放置如:可以从2个文件......
  • 在Linux中,如何添加一个用户到特定的组?
    在Linux中,将一个用户添加到特定的组是一个常见的管理任务,可以通过usermod命令轻松完成。下面是如何将用户添加到已存在的特定组的详细步骤:1.确认组的存在在开始之前,确保你想要添加用户进入的组已经存在。可以通过cat/etc/group命令查看系统中所有的组,或者使用grep命令搜索特定......
  • 在CMakeLists.txt中添加源文件的几种方法
    单个.cpp源文件的情况用这段代码进行测试,CMake中添加一个可执行文件作为构建目标:#include<cstdio>intmain(){printf("Hello,world!\n");}指定源文件的时候可以有两种方式。在创建目标的时候直接指定源文件add_executable(mainmain.cpp)先创建目标,再添加源......
  • 『手撕Vue-CLI』添加自定义指令
    前言经上篇『手撕Vue-CLI』添加帮助和版本号的介绍之后,已经可以在控制台中输入nue--help来查看帮助信息了,但是在帮助信息中只有--version,--help这两个指令,而vue-cli中还有很多指令,例如create,serve,build等等,所以本章将继续添加自定义指令,例如create指令。添加create......
  • 【uniapp 篇 】动态添加 表单,所添加元素展示在同一行
    动态添加表单,所添加元素展示在同一行1<uni-formslabelWidth="68px">23<uni-forms-itemv-for="(item,index)inbaseFormData.dynamicTable.timeField.array"4......
  • 如何把多个文件(夹)平均复制到多个文件夹中
    首先,需要用到的这个工具:度娘网盘提取码:qwu2蓝奏云提取码:2r1z 假定的情况是,共有20个兔兔的图片,想要平均的复制4个文件夹里,那么每个文件夹里面就有5个图片(如果是5个,那每个自然是4个,具体除数是多少,根据实际情况即可)打开工具,切换到文件批量复制版块找到右下角的设置,点......
  • 如何把多个文件(夹)随机复制到多个文件夹中
    首先,需要用到的这个工具:度娘网盘提取码:qwu2蓝奏云提取码:2r1z 先看文件的情况一共20个兔兔的图片,4个文件夹,把全部的图片随机的复制这些地方去打开工具,切换到文件批量复制版块找到右下角的设置,点击打开勾选“随机复制”,把文件进行随机的复制选中全部的兔兔图片,C......
  • 『手撕Vue-CLI』添加帮助和版本号
    前言经过上一篇『手撕Vue-CLI』编码规范检查之后,手撕Vue-CLI已经进阶到了代码规范检查这一步,已经将基本的工程搭建好了,然后代码规范约束也已经加入了,并且将nue-cli指令绑定到了全局当中,可以在任何地方使用了。正文接下来这篇文章呢,就要来实现一下大多数的命令行工具都会有......
  • 如何从多个文件夹内转移全部文件(忽略文件夹的结构)(进行复制)(再打包)
    首先,需要用到的这个工具:度娘网盘提取码:qwu2蓝奏云提取码:2r1z 04文件夹里面有只有1个名称为"1"的文件夹,“1”里面有“2”,“2”有“3”,“3”有“4”,从“1”开始,都有5个兔兔的图片,这是“1”里面的文件夹结构,现在要做的就是忽略文件夹结构,提取出全部的兔兔图片合并成一个压缩......