Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

alias hello='echo Hello' - why doesn't this work after a restart?

Tags:

bash

All over the internet you see this commands

alias hello='echo Hello' 

Yes, I know the above is a lame example, but it's beside the point. If I execute that, it works. But when I restart my computer, it is lost. Why? a bug with the alias command? Why would it only work until a restart is executed?

Thanks

like image 598
Nadine Avatar asked Dec 25 '22 22:12

Nadine


1 Answers

You will need to write it into your ~/.bashrc like

echo "alias hello='echo hello'" >> ~/.bashrc

This appends the string to your .bashrc and will be read when you start a bash in xterm or even pure command line.

like image 157
bash.d Avatar answered Mar 27 '23 00:03

bash.d