# ~/.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 case $- in *i*) ;; *) return;; esac # don't put duplicate lines or lines starting with space in the history. # See bash(1) for more options HISTCONTROL=ignoreboth # 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 # If set, the pattern "**" used in a pathname expansion context will # match all files and zero or more directories and subdirectories. #shopt -s globstar # make less more friendly for non-text input files, see lesspipe(1) [ -x /usr/bin/lesspipe ] && eval "$(SHELL=/bin/sh lesspipe)" # 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 --group-directories-first' #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 la='ls -A' alias l='ls -lh' alias ll='ls -Alh' export LC_ALL="C" # for sorting .files first alias b='byobu' # aliases for systemd using alias start='systemctl start' alias stop='systemctl stop' alias status='systemctl status' alias restart='systemctl restart' # Using color ls output throw less alias lsless='ls --color=always | less -r' alias laless='la --color=always | less -r' alias lless='l --color=always | less -r' alias llless='ll --color=always | less -r' alias update='sudo apt update && sudo apt upgrade' #https://gist.github.com/tlberglund/3714970 alias git-loglive='while : do clear git --no-pager log --graph --pretty=oneline --abbrev-commit --decorate --all $* sleep 1 done; ' . ~/.colors # https://github.com/git/git/tree/master/contrib/completion/git-completion.bash . ~/.git-completion.bash # https://stackoverflow.com/questions/592620/how-can-i-check-if-a-program-exists-from-a-bash-script if command -v screen &> /dev/null #if screen exist on the system then SCREEN=`screen -ls | grep Attached | awk '{print $1}'` # get pid.tty.host for attached session fi if [ ! -z "$SCREEN" ] then SCREEN=$Yellow"("$SCREEN$")"$Color_Off #adding color and brackets fi ERROR="\ \$(err=\$?; \ if [[ \$err == 0 ]]; \ then echo -e \$Green; \ else echo -e \"(\$err)\"\$Red; \ fi)" #PS1="\[$SCREEN\]\[$ERROR\]\u@\h:\[$Cyan\]\w\\$\[$Color_Off\] " # https://github.com/git/git/tree/master/contrib/completion/git-prompt.sh . ~/.git-prompt.sh export GIT_PS1_SHOWDIRTYSTATE=1 export GIT_PS1_SHOWCOLORHINTS=1 export GIT_PS1_SHOWSTASHSTATE=1 export GIT_PS1_SHOWUNTRACKEDFILES=1 export GIT_PS1_DESCRIBE_STYLE="tag" PROMPT_COMMAND='__git_ps1 "\[$SCREEN\]\[$ERROR\]\u@\h:\[$Cyan\]\w\[$Color_Off\]" "\[$Cyan\]\\\$\[$Color_Off\] " " \[$BYellow\][\[$Color_Off\]%s\[$BYellow\]]\[$Color_Off\]"' export LC_ALL=ru_RU.UTF-8 # Less Colors for Man Pages export LESS_TERMCAP_mb=$'\E[01;31m' # begin blinking (цвет мерцающего стиля) export LESS_TERMCAP_md=$'\E[01;38;5;74m' # begin bold (цвет полужирного стиля) export LESS_TERMCAP_me=$'\E[0m' # end mode #export LESS_TERMCAP_so=$'\E[38;5;246m' # begin standout-mode - info box (цвет и фон служебной информации) export LESS_TERMCAP_se=$'\E[0m' # end standout-mode export LESS_TERMCAP_us=$'\E[04;38;5;146m' # begin underline (цвет подчеркнутого стиля) export LESS_TERMCAP_ue=$'\E[0m' # end underline # 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 ! 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 # History completion #http://stackoverflow.com/questions/1030182/how-do-i-change-bash-history-completion-to-complete-whats-already-on-the-line bind '"\e[A": history-search-backward' bind '"\e[B": history-search-forward' if grep -q WSL2 /proc/version; then #echo "WSL2" alias explorer='explorer.exe' fi