During the lesson this morning, a student wondered whether our alias definition would persist in the future sessions once it was defined. Remember we did, as an example:
I mentioned the ~/.bashrc. This (hidden) file is located in your home directory and contains instructions which are executed during the bash session start. Thus, the way to persist comands such as aliases is to add them to this file. You can edit the file with your preferred editor or, as we learned this morning, use some bash instructions to do it:
echo 'alias lt="ls -ltr"' >> ~/.bashrc
Once the file is modified, you will need to start a new bash shell session to take effect, or source it into the current session:
During the lesson this morning, a student wondered whether our
aliasdefinition would persist in the future sessions once it was defined. Remember we did, as an example:I mentioned the
~/.bashrc. This (hidden) file is located in your home directory and contains instructions which are executed during the bash session start. Thus, the way to persist comands such as aliases is to add them to this file. You can edit the file with your preferred editor or, as we learned this morning, use some bash instructions to do it:Once the file is modified, you will need to start a new bash shell session to take effect, or source it into the current session: