Skip to main content

How to Setup Bash

img

Configuration Items

Configuring Bash Consists of 4 main elements

Bash Alias are ways for you to make shortcuts and combine multiple commands together. You can also use functions!

Here are a few

New Alias File -- $HOME/bash/alias.sh
#!/usr/bin/env bash

alias c="clear"
alias ll="ls -la"

function sb(){
echo "Reloading .bash_profile to update env...."
source ~/.bash_profile
}

function showPath(){
if [[ -z "$1" ]]; then
echo -e $(echo -e $PATH | sed 's/:/\\n/g');
else
echo -e $(echo -e $PATH | sed 's/:/\\n/g') | grep $1
fi
}

function findFile(){
find . -type f -iname "*$1*"
}

function encode(){
echo -n "$1" | base64
echo ""
}
function decode(){
echo -n "$1" | base64 -d
echo ""
}

In your bash_profile you would source it at the top like this

tip

source env files first so you can use them in alias commands

Bash Entrypoint -- $HOME/.bash_profile
#!/usr/bin/env bash
source $HOME/bash/env.sh
source $HOME/bash/alias.sh