General

Other General Configuration

Hosts File

Only one entry is normally needed from the outset

1
192.168.236.10 beast

bashrc

Your ~/.bashrc file is where you can configure how your command line experience with BASH will work. It can include functions, aliases, configuration, tab completions and lots more.

Your ~/.bashrc file is largely something that you will configure for your personal preferences, however the below file is a good starting point.

Also, this is the basic configuration that is used in the Cluster/Container infrastructure

If you want to have the same configuration for both root and you then you can put general configuration into /etc/profile.d/zz_edmondscommerce.sh and it will be included

We name it beginning with zz to ensure that it is applied last, otherwise other scripts in /etc/profile.d can override things.

bashrc duplicate aliases

When working in containers you may run into issues with duplicate aliases, see an example of this below.

The recent alias that has had this problem is the composer command.

composer

If you see this output "Could not open input file: alias" follow the instructions below to solve the issue.

  • What you will need to do first is go into your bashrc file which can be done by using this command -> Vim ~/.bashrc

  • When you are in the file, you want to look out for the below being duplicated. if you do see this what you need to do is remove one of them from the bashrc file.

1
2
3
4
alias php='phpNoXdebug'
alias phpx='/usr/bin/php'
alias composer="phpNoXdebug -f $(which composer) -- "
alias magento="phpNoXdebug -f $(which magento) -- "
  • When you have removed the duplicate entry simply :wq out and then restart your container session and then the issue should be fixed.

Suggested Additions to the /etc/profile.d/zz_edmondscommerce.sh File

Here is some suggested bash configuration to paste into the end of your /etc/profile.d/zz_edmondscommerce.sh file.

Git bash prompt

Install Dependencies

First you need to install dependencies:

1
2
3
dnf -y install bash-completion
cd ~
git clone https://github.com/magicmonty/bash-git-prompt.git .bash-git-prompt --depth=1
Paste Into /etc/profile.d/zz_edmondscommerce.sh

Then paste the below into /etc/profile.d/zz_edmondscommerce.sh

  1
  2
  3
  4
  5
  6
  7
  8
  9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 50
 51
 52
 53
 54
 55
 56
 57
 58
 59
 60
 61
 62
 63
 64
 65
 66
 67
 68
 69
 70
 71
 72
 73
 74
 75
 76
 77
 78
 79
 80
 81
 82
 83
 84
 85
 86
 87
 88
 89
 90
 91
 92
 93
 94
 95
 96
 97
 98
 99
100
101
102
103
104
105
106
107
# User specific aliases and functions

alias rm='rm -i'
alias cp='cp -i'
alias mv='mv -i'
alias ll='ls -alh --color'

# Make parent dirs if they are missing
alias mkdir='mkdir -pv'
# Lets include vim like exit commands
alias :q="exit"
alias :Q="exit"

#History
shopt -s histappend
shopt -s cmdhist
HISTCONTROL=ignoredups
export HISTFILESIZE=20000
export HISTSIZE=10000
export HISTIGNORE="&:ls:[bf]g:exit"



# Settings for interactive shell only inside this block
if [[ $- == *i* ]]
then


    #SSH Agent
    if [ -z "$SSH_AUTH_SOCK" ] ; then
        inTemp=$(find /tmp -maxdepth 2 -type s -name "agent*" -user $USER -printf '%T@ %p\n' 2>/dev/null |sort -n|tail -1|cut -d' ' -f2)
        if [[ "" != "$inTemp" ]]
        then
            SSH_AUTH_SOCK="$inTemp"
            export SSH_AUTH_SOCK
        else
            eval `ssh-agent -s`
            ssh-add
        fi
    fi

    #Prompt
    function redPrompt(){
        export PS1='\[\e[1m\]$PWD\[\e[0m\]'"\n\[\033[38;5;1m\]\u\[$(tput sgr0)\]\[\033[38;5;15m\]@\[$(tput sgr0)\]\[\033[38;5;9m\]\h\[$(tput sgr0)\] "
    }
    function bluePrompt(){
        export PS1='\[\e[1m\]$PWD\[\e[0m\]'"\n\[\033[38;5;32m\]\u\[$(tput sgr0)\]\[\033[38;5;15m\]@\[$(tput sgr0)\]\[\033[38;5;32m\]\h\[$(tput sgr0)\] "
    }
    if [[ "$(whoami)" == "root" ]]
    then
        redPrompt
    else
        bluePrompt
    fi

    #Prevent Ctrl+S Freezing things
    stty -ixon

    # fix spelling errors for cd, only in interactive shell
    shopt -s cdspell

    # More useful bash completelion setting
    bind "set completion-ignore-case on" # note: bind used instead of sticking these in .inputrc
    bind "set bell-style none" # no bell

    ## @see https://github.com/magicmonty/bash-git-prompt
    ## To install
    ##  cd ~
    ##  git clone https://github.com/magicmonty/bash-git-prompt.git .bash-git-prompt --depth=1
    [[ -f ~/.bash-git-prompt/gitprompt.sh ]] && source ~/.bash-git-prompt/gitprompt.sh
    GIT_PROMPT_ONLY_IN_REPO=1

    alias dnf="sudo dnf"
    alias gti=git

    ## To install
    ## dnf -y install bash-completion
    [[ $PS1 && -f /usr/share/bash-completion/bash_completion ]] && \
        . /usr/share/bash-completion/bash_completion

    ## ! Important !
    ## Required for Cluster Stuff
    if [[ -d /opt/Projects/snippets-edmondscommerce ]]
    then
        for f in  /opt/Projects/snippets-edmondscommerce/Cluster/bashrc/*.bash
        do
            #   echo $f
            source $f
        done
    fi

fi

# Moves up a number of dirs
up(){
    local d=""
    limit=$1
    for ((i=1 ; i <= limit ; i++))
    do
        d=$d/..
    done
    d=$(echo $d | sed 's/^\///')
    if [ -z "$d" ]; then
        d=..
    fi
    cd $d
}
Slow Terminal

If you have the prompt installed and experience a slow terminal, check what remotes you have. For example, if you have bitbucket in your project, you will likely want to remote it from your list of remotes to avoid slow down when traversing your project in the terminal.

If you do remove the remote, you need to ensure that you have a Bitbucket synchronisation script set up on post receive at the standard repository.

Installing the prompt

Post Receive Hook Setup