From 7a99efad195ea476b0bb6b1e209f7fb3ed093580 Mon Sep 17 00:00:00 2001 From: Stefan Gaiselmann Date: Fri, 13 Nov 2020 08:01:45 +0100 Subject: [PATCH] Extended .bashrc.d configuration. --- dot_bashrc.d/executable_00.bash.init | 10 ++++++++++ dot_bashrc.d/executable_03.ENV | 22 ++++++++++++++++++++++ dot_bashrc.d/executable_08.alias | 19 +++++++++++++++++++ 3 files changed, 51 insertions(+) create mode 100644 dot_bashrc.d/executable_00.bash.init create mode 100755 dot_bashrc.d/executable_03.ENV diff --git a/dot_bashrc.d/executable_00.bash.init b/dot_bashrc.d/executable_00.bash.init new file mode 100644 index 0000000..7e7d8e6 --- /dev/null +++ b/dot_bashrc.d/executable_00.bash.init @@ -0,0 +1,10 @@ +#!/usr/bin/env bash + +# Bash Options +HISTCONTROL=ignoredups:ignorespace +HISTSIZE=3000 +HISTFILESIZE=3000 +export HISTTIMEFORMAT="%Y-%m-%d %H:%M:%S " +export HISTIGNORE=$'[ \t]*:&:[fb]g:exit:ls:ll:cd:pwd:history:z' + +# inspired (but not all commands used) by https://github.com/jdcapa/bashrc.d/blob/main/00.bash.init diff --git a/dot_bashrc.d/executable_03.ENV b/dot_bashrc.d/executable_03.ENV new file mode 100755 index 0000000..b3ed0d7 --- /dev/null +++ b/dot_bashrc.d/executable_03.ENV @@ -0,0 +1,22 @@ +#!/usr/bin/env bash + +# BINs and PATH +# extend path if directory exists and is not yet contained +# https://askubuntu.com/questions/432217/prevent-duplicate-entries-in-path +function extendPath() { + local new_dir=$1 + if [ -d "$new_dir" ]; then + [[ ":$PATH:" =~ :$new_dir: ]] || PATH="$new_dir:$PATH" + fi +} + +if [ -x /usr/bin/go ]; then + extendPath "$(go env GOPATH)/bin" + export GOPATH=$(go env GOPATH) +fi + +extendPath "$HOME/bin" +extendPath "/usr/local/bin" +extendPath "$HOME/.local/bin" + +export PATH diff --git a/dot_bashrc.d/executable_08.alias b/dot_bashrc.d/executable_08.alias index 1948577..b52d18b 100644 --- a/dot_bashrc.d/executable_08.alias +++ b/dot_bashrc.d/executable_08.alias @@ -3,6 +3,25 @@ # navigation alias ..='cd ..' alias ...='cd ../..' +alias ....='cd ../../..' + +# ls aliases +alias ll='ls -l --group-directories-first' +alias ls='ls -hF --color' # add colors for filetype recognition +alias lo='ls -o' # without group information +alias lr='ls -lrt' +alias la='ls -Al' # show hidden files +alias lx='ls -lXB' # sort by extension +alias lk='ls -lSr' # sort by size, biggest last +alias lc='ls -ltcr' # sort by and show change time, most recent last +alias lu='ls -ltur' # sort by and show access time, most recent last +alias lt='ls -ltr' # sort by date, most recent last +alias lm='ls -al |more' # pipe through 'more' +alias l='ls -CF' +alias lsd='ls -l | grep "^d"' #list only directories + +# git shortcut +alias gg='git graph' # tail alias alias tailer="tail --follow=name --retry"