{"id":2625,"date":"2018-02-19T11:27:30","date_gmt":"2018-02-19T10:27:30","guid":{"rendered":"http:\/\/www.xenonique.co.uk\/blog\/?p=2625"},"modified":"2020-10-18T06:13:17","modified_gmt":"2020-10-18T05:13:17","slug":"my-favourite-bash-profile-linux-and-mac-os-x-updated-for-2018","status":"publish","type":"post","link":"https:\/\/www.xenonique.co.uk\/blog\/2018\/02\/19\/my-favourite-bash-profile-linux-and-mac-os-x-updated-for-2018\/","title":{"rendered":"My favourite Bash profile Linux and Mac OS X updated for 2018"},"content":{"rendered":"\n<h2>Bash Shell Programming Course?!<\/h2>\n\n\n\n<p>Are you interested in Linux and Bash shell programming online video course? If the answer is yes, then sign up to my VIP mailing list,. alternatively, hit me up on Twitter with the message a like:<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><span style=\"color: #000080;\"> \"Hi @peter_pilgrim I am interested in a Bash \/ Shell programming course.\"<br><\/span><\/pre>\n\n\n\n<div class=\"d-flex justify-content-center mt-4 mb-4\">\n\n    <div class=\"card  chimp-subscription-form-box\">\n        <div class=\"card-header\">\n            Exclusive VIP Access\n        <\/div>\n        <div class=\"card-body\">\n            <p class=\"subscription-form-text\">\n                Signup to my VIP mailing list in order to\n                get notified &amp; receive my biggest discount off the listed price.\n            <\/p>\n\n            <form action=\"https:\/\/xenonique.us10.list-manage.com\/subscribe\/post?u=0f813896d4942960a433ff400&amp;id=63b72af8b2\" method=\"post\" id=\"peat-mc-embedded-subscribe-form\" name=\"mc-embedded-subscribe-form\" class=\"validate\" target=\"_blank\" novalidate=\"\">\n                <div class=\"row\">\n                    <div class=\"peat-col-xxs-12  col-md-6\">\n                        <input type=\"text\" id=\"peat-mce-FNAME\" name=\"FNAME\" class=\"form-control\" placeholder=\"First name\">\n                    <\/div>\n                    <div class=\"peat-col-xxs-12  col-md-6\">\n                        <input type=\"text\" id=\"peat-mce-LNAME\" name=\"LNAME\" class=\"form-control\" placeholder=\"Last name\">\n                    <\/div>\n                <\/div>\n                <div class=\"row\">\n                    <div class=\"peat-col-xxs-12  col-md-6\">\n                        <input type=\"text\" id=\"peat-mce-WORK-ROLE\" name=\"EMAIL\" class=\"form-control\" placeholder=\"Email address\">\n                    <\/div>\n                    <div class=\"peat-col-xxs-12  col-md-6\">\n                        <select name=\"MMERGE6\" class=\"form-control\" id=\"peat-mce-MMERGE6\">\n                            <option value=\"__UNDEFINED__\">Where do you work?<\/option>\n                            <option value=\"self-employed\">Self-Employed<\/option>\n                            <option value=\"director\">Director<\/option>\n                            <option value=\"full-time-employee\">Full TIme Employee<\/option>\n                            <option value=\"professional-other\">Other Professional<\/option>\n                            <option value=\"student\">Student<\/option>\n                            <option value=\"not-working\">Not Working<\/option>\n                        <\/select>\n                    <\/div>\n                <\/div>\n                <div class=\"row\">\n                    <div class=\"peat-col-xxs-12  col-md-6\">\n                        <strong>Email Format <\/strong>\n                        <div class=\"form-check\">\n                            <input class=\"form-check-input\" type=\"radio\" name=\"EMAILTYPE\" id=\"peat-mce-EMAILTYPE-0\" value=\"html\">\n                            <label class=\"form-check-label\" for=\"peat-mce-EMAILTYPE-0\">\n                                HTML\n                            <\/label>\n                        <\/div>\n                        <div class=\"form-check\">\n                            <input class=\"form-check-input\" type=\"radio\" name=\"EMAILTYPE\" id=\"peat-mce-EMAILTYPE-1\" value=\"text\" checked=\"\">\n                            <label class=\"form-check-label\" for=\"peat-mce-EMAILTYPE-1\">\n                                Text\n                            <\/label>\n                        <\/div>\n                        <div id=\"xmce-responses\" class=\"clear\">\n                            <div class=\"response\" id=\"xmce-error-response\" style=\"display:none\"><\/div>\n                            <div class=\"response\" id=\"xmce-success-response\" style=\"display:none\"><\/div>\n                        <\/div>    <!-- real people should not fill this in and expect good things - do not remove this or risk form bot signups-->\n                        <div style=\"position: absolute; left: -5000px;\" aria-hidden=\"true\"><input type=\"text\" name=\"b_0f813896d4942960a433ff400_63b72af8b2\" tabindex=\"-1\" value=\"\"><\/div>\n                    <\/div>\n                <\/div>\n                <div class=\"row  action-row\">\n                    <div class=\"peat-col-xxs-12  col-md-6\">\n                        <input type=\"submit\" value=\"GIVE ME THE DISCOUNT\" name=\"subscribe\" id=\"peat-mc-embedded-subscribe\" class=\"btn btn-primary\">\n                    <\/div>\n                <\/div>\n                <p class=\"subscription-form-privacy\">\n                    I will never share your email address with anybody and you can unsubscribe anytime.\n                <\/p>\n            <\/form>\n        <\/div>\n    <\/div>\n<\/div>\n\n\n\n<h2>2021<\/h2>\n\n\n\n<p>Some of you are here, because you are interested in hiring me for a contract engagement. I know this, because I look at the analytics.<\/p>\n\n\n\n<p>Next contract shall be<\/p>\n\n\n\n<ul><li>OUTSIDE IR35 or Statement of Work\n<ul>\n<li>(if you don&#8217;t know what these are then read <a href=\"https:\/\/www.qdoscontractor.com\/ir35\">QDOS IR35 for Contractors<\/a> and also read <a href=\"https:\/\/wttconsulting.co.uk\/ir35\/ir35-for-contractors\/\">WTT Consulting guide to Statement of Work<\/a>)<\/li>\n<\/ul>\n<\/li><li>Remote working for the foreseeable future<\/li><li>Contract rate \u00a3PRICE on application (SOW)\n<ul>\n<li>(In 2018-2019, in Central London, typical contract rates were \u00a3550 &#8211; \u00a3750 per day depending on the requirements and provided materials)<\/li>\n<\/ul>\n<\/li><li>Or stupidly insane permanent salary from \u00a3101K base in the United Kingdom<\/li><li>Or by the way, I will be the technical lead or senior designer.<\/li><\/ul>\n\n\n\n<p>Other you can&#8217;t deal with that, then it is waste of yours and my time.<\/p>\n\n\n\n<h2>Carry on<\/h2>\n\n\n\n<p>As a platform engineer, I want to keep a copy of a my favourite Linux Bash Profile in my blog on the public web, so that I do not have to keep making it up from scratch every time I configure a Virtual Machine.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n## MY FAVOURITE BASH PROFILE ~\/.bash_profile\n### Based of the https:\/\/www.xenonique.co.uk\/blog\/2018\/02\/19\/my-favourite-bash-profile-linux-and-mac-os-x-updated-for-2018\/\n### and https:\/\/www.xenonique.co.uk\/blog\/2012\/06\/29\/favourite-linux-and-unix-bash-aliases\/\n\n# Load workspace HTTP proxy configuration, if any\nif [ -f ${HOME}\/.workspace-http-proxy.sh.env ]; then\n    . ${HOME}\/.workspace-http-proxy.sh.env\nfi\n\nset -o emacs\n# Do not exit on EOF. To exit the shell type `exit'\nset -o ignoreeof\n# Do not allow output redirection (&amp;amp;amp;amp;amp;gt;) to overwrite an existing file\nset -o noclobber\n# set the core limit\nulimit -c 10240\n\n# As a platform engineer, I want to upgrade SHELL history to &quot;remember long time&quot;\nset history=1024\nset savehist=1024\n\n## Olde skool :-\/  export LDFLAGS='-lpthread' #Old skool\n## Slackware: export LS_OPTIONS='--8bit --color=tty -F -b -T 0'\n## export LS_OPTIONS='--color=tty -F -b --author'\nexport LS_OPTIONS='-F'\n\n# Aliases\nalias ls=&quot;\/bin\/ls $LS_OPTIONS&quot;\nalias ll='ls -l'\nalias lsd='ls -ld'\nalias la='ls -a'\nalias lf='ls -F'\nalias lr='ls -alFRt'\nalias lx='ls -xF'\nalias llar='ls -laFR'\nalias lt='ls -lartF'\nalias lrt='ls -lrt'\n\nalias home='cd ${HOME}'\nalias up='cd ..'\nalias up2='cd ..\/..'\nalias up3='cd ..\/..\/..'\nalias up4='cd ..\/..\/..\/..'\nalias up5='cd ..\/..\/..\/..\/..'\nalias pe='printenv'\nalias senv='env | sort'\nalias pu='pushd'\nalias po='popd'\nalias pud='pushd .'\nalias rot='pushd +1'\nalias jobs='jobs -l'\nalias mroe=more\nalias lses=less\nalias lsse=less\nalias l=ls\nalias f=file\nalias c=cat\nalias m=more\nalias j=jobs\nalias k=kill\nalias d=dirs\nalias h=history\nalias his=history\nalias hm='history | less'\nalias sy3='sync; sync; sync; echo &quot;sync 3 times ...&quot;'\nalias del='rm -i'\nalias bye=exit\nalias ciao=exit\n\n## Some quick GIT alias\nalias gpull='git pull origin master'\nalias gpush='git push origin master'\n# As a platform engineer, I want to configure Git cache to remember my password for one month on average\nalias set_git_cache='git config --global credential.helper &quot;cache --timeout=2548800&quot; '\n\nalias macjava=\/usr\/libexec\/java_home\n\n# Switch between JDK 8,9,10 and 11\nfunction checkSetJdk() {\n    if [ $# -ne 0 ]; then\n        \/usr\/libexec\/java_home -v $@ &amp;amp;amp;amp;amp;gt; \/dev\/null 2&amp;amp;amp;amp;amp;gt;&amp;amp;amp;amp;amp;amp;1\n        status=$?\n        if [ $status -ne 0 ]; then\n            echo &quot;*ERROR*: Sorry, this version of the JDK [$@] does not exist. (status:$status)&quot; 1&amp;amp;amp;amp;amp;gt;&amp;amp;amp;amp;amp;amp;2\n            return 1\n        else\n            removeFromPath '\/System\/Library\/Frameworks\/JavaVM.framework\/Home\/bin'\n            if [ -n &quot;${JAVA_HOME+x}&quot; ]; then\n                removeFromPath $JAVA_HOME\n            fi\n            export JAVA_HOME=`\/usr\/libexec\/java_home -v $@`\n            # echo -e &quot;\\n*FINAL* setting JAVA_HOME to ${JAVA_HOME}&quot;\n\n            # Does the older JRE folder exist\n            if [ -d ${JAVA_HOME}\/jre ]; then\n                export PATH=$JAVA_HOME\/jre\/bin:$PATH\n            fi\n            export PATH=$JAVA_HOME\/bin:$PATH\n            # echo -e &quot;\\n*FINAL* setting PATH to $PATH&quot;\n        fi\n    fi\n }\n\nfunction removeFromPath() {\n    export PATH=$(echo $PATH | sed -E -e &quot;s;:$1;;&quot; -e &quot;s;$1:?;;&quot;)\n    ### echo -e &quot;\\n*DEBUG setting now to PATH=$PATH&quot;\n}\n\n## See this Apple Support Discussion https:\/\/discussions.apple.com\/thread\/4158054\nalias restart-webcam='sudo killall VDCAssistant'\n\nalias vibashpro='vi ~\/.bash_profile'\nalias rebashpro='. ~\/.bash_profile'\n\n## Where is GO Language installed?\nexport GO_HOME=\/opt\/go\n\n## Where is Java installed?\nexport JAVA_HOME=`\/usr\/libexec\/java_home`\nexport JAVA_HOME=\/usr\/lib\/jvm\/jdk1.8.0\/jdk1.8.0_181\nexport JAVA8_HOME=\/usr\/lib\/jvm\/jdk1.8.0\/jdk1.8.0_181\n\nexport JAVAFX_HOME=${JAVA_HOME}\n\n# Where is Scala installed (Mac OS X)?\n## export SCALA_HOME=\/Library\/opt\/scala\/scala-2.11.7\nexport SCALA_HOME=${HOME}\/.sdkman\/candidates\/sbt\/current\n\n# Where is SBT installed (Mac OS X)?\n## export SBT_HOME=\/Library\/opt\/sbt\/sbt-0.13.12\nexport SBT_HOME=${HOME}\/.sdkman\/candidates\/sbt\/current\/bin\/sbt\n\n# Where is Groovy installed (SDK Man)\n## export GROOVY_HOME=${HOME}\/.sdkman\/groovy\/current\nexport GROOVY_HOME=${HOME}\/.sdkman\/candidates\/groovy\/current\n\n# Where is Ant installed (Mac OS X)?\nexport ANT_HOME=${HOME}\/.sdkman\/candidates\/ant\/current\n\n# Where is Maven installed (Mac OS X)?\nexport M2_HOME=${HOME}\/.sdkman\/candidates\/maven\/current\n\n# https:\/\/stackoverflow.com\/questions\/13161387\/set-the-permgen-size-for-the-child-jvm-processes-that-maven-will-spin-off\nexport MAVEN_OPTS=&quot;-XX:MaxPermSize=256m -Xms512m -Xmx1024m&quot;\n\n# Where is Gradle installed (Mac OS X)?\nexport GRADLE_HOME=${HOME}\/.sdkman\/candidates\/gradle\/current\n\n# Where is Node installed?\nexport NODE_PATH=\/usr\/local\/lib\/node_modules\n\n## Where is IntelliJ installed?\nexport INTELLIJ_HOME=\/opt\/intellij-idea\n\n## Define PATH\nexport PATH=.:${HOME}\/bin:${HOME}\/.local\/bin:\\\n${SCALA_HOME}\/bin:${SBT_HOME}\/bin:\\\n${GROOVY_HOME}\/bin:${M2_HOME}\/bin:${ANT_HOME}\/bin:${GRADLE_HOME}\/bin:\\\n${GO_HOME}\/bin:\\\n${JAVA_HOME}\/bin:${JAVA_HOME}\/jre\/bin:\\\n${INTELLIJ_HOME}\/bin:\\\n\/usr\/local\/sbin:\/usr\/local\/bin:\/usr\/sbin:\/usr\/bin:\/sbin:\/bin:\/usr\/games:\/usr\/local\/games\n\n## Keep a copy of the original PATH\nexport ORIGINAL_PATH=${HOME}\/bin:${HOME}\/.local\/bin:\/usr\/local\/sbin:\/usr\/local\/bin:\/usr\/sbin:\/usr\/bin:\/sbin:\/bin:\/usr\/games:\/usr\/local\/games\n\n### This is the original PS1 on Debian (e.g Ubuntu or Linux Mint)\n#### &quot;${debian_chroot:+($debian_chroot)}\\u@\\h \\w \\$ &quot;\nexport SAVED_PS1=&quot;${debian_chroot:+($debian_chroot)}\\u@\\h \\w [\\$HISTCMD] \\$ &quot;\n\n## Ansi Color XTerm (tested on LinuxMint )\n## See also https:\/\/askubuntu.com\/questions\/558280\/changing-colour-of-text-and-background-of-terminal\n#export PS1=&quot;\\e[38;5;034m\\u@\\h \\e[0m\\e[38;5;039m\\W\\e[0m [\\$HISTCMD] &amp;amp;amp;amp;amp;gt; &quot;\n\n# Add the Git Bash completion, if it exists\n\nif [ -f ${HOME}\/git-completion.bash -a -r ${HOME}\/git-completion.bash ]; then\n    #### echo ${HOME}\/git-completion.bash (see also https:\/\/raw.githubusercontent.com\/git\/git\/master\/contrib\/completion\/git-completion.bash )\n    . ${HOME}\/git-completion.bash\nfi\n\n#THIS MUST BE AT THE END OF THE FILE FOR SDKMAN TO WORK!!!\n[[ -s &quot;$HOME\/.sdkman\/bin\/sdkman-init.sh&quot; ]] &amp;amp;amp;amp;amp;amp;&amp;amp;amp;amp;amp;amp; source &quot;$HOME\/.sdkman\/bin\/sdkman-init.sh&quot;\n\n## This is for Ruby Version Manager\n[[ -s &quot;$HOME\/.rvm\/scripts\/rvm&quot; ]] &amp;amp;amp;amp;amp;amp;&amp;amp;amp;amp;amp;amp; source &quot;$HOME\/.rvm\/scripts\/rvm&quot; # Load RVM into a shell session *as a function*\n\n## This is for Node Version Manager\nexport NVM_DIR=&quot;$HOME\/.nvm&quot;\n[ -s &quot;$NVM_DIR\/nvm.sh&quot; ] &amp;amp;amp;amp;amp;amp;&amp;amp;amp;amp;amp;amp; . &quot;$NVM_DIR\/nvm.sh&quot;\n\n## END\n<\/pre><\/pre>\n\n\n\n<p>That was my user story from last week.<\/p>\n\n\n\n<p>Addendum<\/p>\n\n\n\n<p>I want to also share this BASH configuration in Home office and Work office situation. In work office, like you I work behind a HTTP Proxy so I extracted shell as an environment script to source-in.<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\"><pre class=\"brush: bash; title: ; notranslate\" title=\"\">\n## File: ~\/.workspace-http-proxy.sh.env\n## set the proxy connections# set the proxy connections# set the proxy connections\n#export HTTP_PROXY='https:\/\/user2018:Pass2018@corporateproxy.com:8080'\n#export HTTPS_PROXY='https:\/\/user2018:Pass2018@corporateproxy.com:8080'\n#export NO_PROXY=&quot;localhost, 127.0.0.1, 10.24*, *corporateproxy.com, *.corp&quot;\n#export http_proxy=${HTTP_PROXY}\n#export https_proxy=${HTTPS_PROXY}\n#export ALL_PROXY=${HTTPS_PROXY}\n#export no_proxy=$NO_PROXY\n<\/pre><\/pre>\n\n\n\n<p>Save this this shell source scripts as <code>${HOME}\/.workspace-http-proxy.sh.env<\/code> and then the file private to your user with the command: <code>chmod 600 ${HOME}\/.workspace-http-proxy.sh.env<\/code>.<\/p>\n\n\n\n<p>Have fun and enjoy your day.<\/p>\n\n\n\n<p>+PP+<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Bash Shell Programming Course?! Are you interested in Linux and Bash shell programming online video course? If the answer is yes, then sign up to my VIP mailing list,. alternatively, hit me up on Twitter with the message a like: &#8220;Hi @peter_pilgrim I am interested in a Bash \/ Shell programming course.&#8221; Exclusive VIP Access [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[194,59,133,81,138,139],"tags":[],"_links":{"self":[{"href":"https:\/\/www.xenonique.co.uk\/blog\/wp-json\/wp\/v2\/posts\/2625"}],"collection":[{"href":"https:\/\/www.xenonique.co.uk\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.xenonique.co.uk\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.xenonique.co.uk\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.xenonique.co.uk\/blog\/wp-json\/wp\/v2\/comments?post=2625"}],"version-history":[{"count":37,"href":"https:\/\/www.xenonique.co.uk\/blog\/wp-json\/wp\/v2\/posts\/2625\/revisions"}],"predecessor-version":[{"id":2918,"href":"https:\/\/www.xenonique.co.uk\/blog\/wp-json\/wp\/v2\/posts\/2625\/revisions\/2918"}],"wp:attachment":[{"href":"https:\/\/www.xenonique.co.uk\/blog\/wp-json\/wp\/v2\/media?parent=2625"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.xenonique.co.uk\/blog\/wp-json\/wp\/v2\/categories?post=2625"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.xenonique.co.uk\/blog\/wp-json\/wp\/v2\/tags?post=2625"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}