syntax.us Let the syntax do the talking
Blog Contact Posts Questions Tags Hire Me

You are here: Linux101 > Shell 101 > shell101_vi_bashrc

Linux Shell 101

Question:
In Linux101 how to vi ~ann/.bashrc ?

After I create the ann account and then learn vi, how do I vi ~ann/.bashrc ?

First I login as ann with a command like this:
ssh ann@localhost
Then I type these shell commands:
mv .bashrc .bashrc.bak
vi .bashrc
Inside of vi I press esc which should put me in CM1.

Then I press i which should put me in IM.

Then I copy paste in this text:
# .bashrc for ann

export PS1="`id -un`@`hostname` \w $ "

# If I have ~/.bash_aliases ]
# I should dot it.
if [ -f ~/.bash_aliases ]; then
    .   ~/.bash_aliases
fi

# If I have some bin folders,
# I should add them to my PATH env variable:

if [ -e        ~/bin ]; then
  export PATH="~/bin:$PATH"
fi

if [ -e        ${HOME}/anaconda/bin ]; then
  export PATH="${HOME}/anaconda/bin:$PATH"
fi

if [ -e        ${HOME}/anaconda3/bin ]; then
  export PATH="${HOME}/anaconda3/bin:$PATH"
fi
I press esc which should put me in CM1.

I press ZZ which writes the file and then exits me from vi.

Congratulations to me. I just wrote a shell program!

I check my work with this shell command:
cat .bashrc




You are here: Linux101 > Shell 101 > shell101_vi_bashrc
You can ask questions in Dan's Machine Learning Class Forum:
https://groups.google.com/forum/#!forum/dan101

syntax.us Let the syntax do the talking
Blog Contact Posts Questions Tags Hire Me