From 91c7aa93de3923848a38e307adaba477a8626013 Mon Sep 17 00:00:00 2001 From: George Rawlinson Date: Sun, 24 Jan 2016 10:58:42 +1300 Subject: [PATCH] Added old bash config for backup. --- bash/.bash_aliases | 31 ++++++++++ bash/.bash_profile | 7 +++ bash/.bashrc | 143 +++++++++++++++++++++++++++++++++++++++++++++ bash/README.md | 3 + 4 files changed, 184 insertions(+) create mode 100644 bash/.bash_aliases create mode 100644 bash/.bash_profile create mode 100644 bash/.bashrc create mode 100644 bash/README.md diff --git a/bash/.bash_aliases b/bash/.bash_aliases new file mode 100644 index 0000000..93c391c --- /dev/null +++ b/bash/.bash_aliases @@ -0,0 +1,31 @@ +# some more ls aliases +alias ll='ls -alF' +alias la='ls -A' +alias l='ls -CF' + +# User defined functions [Arch] +# Pacman alias examples +alias pacupg="sudo pacman -Syu" # Synchronize with repositories and then upgrade packages that are out of date on the local system. +alias pacdl="pacman -Sw" # Download specified package(s) as .tar.xz ball +alias pacin="sudo pacman -S" # Install specific package(s) from the repositories +alias pacins="sudo pacman -U" # Install specific package not from the repositories but from a file +alias pacre="sudo pacman -R" # Remove the specified package(s), retaining its configuration(s) and required dependencies +alias pacrem="sudo pacman -Rns" # Remove the specified package(s), its configuration(s) and unneeded dependencies +alias pacrep="pacman -Si" # Display information about a given package in the repositories +alias pacreps="pacman -Ss" # Search for package(s) in the repositories +alias pacloc="pacman -Qi" # Display information about a given package in the local database +alias paclocs="pacman -Qs" # Search for package(s) in the local database +alias paclo="pacman -Qdt" # List all packages which are orphaned +alias pacc="sudo pacman -Scc" # Clean cache - delete all the package files in the cache +alias paclf="pacman -Ql" # List all files installed by a given package +alias pacown="pacman -Qo" # Show package(s) owning the specified file(s) +alias pacexpl="pacman -D --asexp" # Mark one or more installed packages as explicitly installed +alias pacimpl="pacman -D --asdep" # Mark one or more installed packages as non explicitly installed + +# Additional pacman alias examples +alias pacupd="sudo pacman -Sy && sudo abs" # Update and refresh the local package and ABS databases against repositories +alias pacinsd="sudo pacman -S --asdeps" # Install given package(s) as dependencies +alias pacmir="sudo pacman -Syy" # Force refresh of all package lists after updating /etc/pacman.d/mirrorlist + +# NPM +alias npmls="npm -g ls --depth=0" # List globally installed packages. diff --git a/bash/.bash_profile b/bash/.bash_profile new file mode 100644 index 0000000..f07ff4c --- /dev/null +++ b/bash/.bash_profile @@ -0,0 +1,7 @@ +# +# ~/.bash_profile +# + +[[ -f ~/.bashrc ]] && . ~/.bashrc + +[[ -z $DISPLAY && $XDG_VTNR -eq 1 ]] && exec startx diff --git a/bash/.bashrc b/bash/.bashrc new file mode 100644 index 0000000..3b975a4 --- /dev/null +++ b/bash/.bashrc @@ -0,0 +1,143 @@ +# +# ~/.bashrc +# + +# If not running interactively, don't do anything +[[ $- != *i* ]] && return + +# 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=90000 +HISTFILESIZE=${HISTSIZE} + +# 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 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='\[\033[01;31m\]\u\[\033[01;33m\]@\[\033[01;36m\]\h \[\033[01;33m\]\w \[\033[01;35m\]\$ \[\033[00m\]' +else + PS1='\u@\h:\w\$ ' +fi +unset color_prompt force_color_prompt + +# 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 + +# 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 + +# If this is an xterm set more declarative titles +# "dir: last_cmd" and "actual_cmd" during execution +# If you want to exclude a cmd from being printed see line 156 +case "$TERM" in +xterm*|rxvt*) + PS1="\[\e]0;${debian_chroot:+($debian_chroot)}\$(print_title)\a\]$PS1" + __el_LAST_EXECUTED_COMMAND="" + print_title () + { + __el_FIRSTPART="" + __el_SECONDPART="" + if [ "$PWD" == "$HOME" ]; then + __el_FIRSTPART=$(gettext --domain="pantheon-files" "Home") + else + if [ "$PWD" == "/" ]; then + __el_FIRSTPART="/" + else + __el_FIRSTPART="${PWD##*/}" + fi + fi + if [[ "$__el_LAST_EXECUTED_COMMAND" == "" ]]; then + echo "$__el_FIRSTPART" + return + fi + #trim the command to the first segment and strip sudo + if [[ "$__el_LAST_EXECUTED_COMMAND" == sudo* ]]; then + __el_SECONDPART="${__el_LAST_EXECUTED_COMMAND:5}" + __el_SECONDPART="${__el_SECONDPART%% *}" + else + __el_SECONDPART="${__el_LAST_EXECUTED_COMMAND%% *}" + fi + printf "%s: %s" "$__el_FIRSTPART" "$__el_SECONDPART" + } + put_title() + { + __el_LAST_EXECUTED_COMMAND="${BASH_COMMAND}" + printf "\033]0;%s\007" "$1" + } + + # Show the currently running command in the terminal title: + # http://www.davidpashley.com/articles/xterm-titles-with-bash.html + update_tab_command() + { + # catch blacklisted commands and nested escapes + case "$BASH_COMMAND" in + *\033]0*|update_*|echo*|printf*|clear*|cd*) + __el_LAST_EXECUTED_COMMAND="" + ;; + *) + put_title "${BASH_COMMAND}" + ;; + esac + } + preexec_functions+=(update_tab_command) + ;; +*) + ;; +esac diff --git a/bash/README.md b/bash/README.md new file mode 100644 index 0000000..e458124 --- /dev/null +++ b/bash/README.md @@ -0,0 +1,3 @@ +# bash + +Backup of old bash scripts.