Learn to configure the shell environment by editing .bashrc
Let's practice configuring the Bash shell
- Edit the Bash configuration file
~/.bashrc
by using Vim,vim ~/.bashrc
or opening the Visual Studio Code Editor - Add the following statements at the end of the file:
export API="API-Key-Goes-Here"
echo "This is an example of using a variable at shell launch: " $API
- Test this out by sourcing the new config:
source ~/.bashrc
. What did you see?
- Open a new shell. What did you see?
- Echo the variable $API
echo $API
- What do you see?
- Edit the Bash configuration file
~/.bashrc
by using Vim,vim ~/.bashrc
or opening the Visual Studio Code Editor - Add the following statements at the end of the file:
alias root="cd /"
- Test this out by sourcing the new config:
source ~/.bashrc
. What did you see when you type inalias
? - What do you see when you type in
root
? Why could this be helpful to you personally?