How to permanantly delete an alias

So after completing this lesson, I want to undo (or permanently delete) my aliases that the lesson wanted me to create . For some background info, I created these aliases in nano ~/.bash_profile:

echo “Hello, Hola, Ni Hao, Bonjour, and Kon’nichiwa! Welcome to our translation services.”
alias md=“mkdir”
alias d=“date”
alias hy=“history”
export PS1="Lingua Franca > "

I’ve looked on multiple forums on how to delete them, but they all give instructions for removing temporary aliases. I want to use the original commands, not the aliases, and make the change permanent. I’m using Git Bash on my Windows 10 laptop.

Can you share what are the forums you’ve looked into, what are their answers and why they do not apply to your case?

1 Like

An alias in bash is always temporary. I’d suggest having a look into what .bash_profile actually is and what the contents are used for. It’s worth knowing this anyway so hopefully it’s not too ambiguous a response.

Here’s the article:

I had tried running unalias twice and it didn’t work. So what I did was I deleted all the lines of code in nano and closed the terminal. When I opened it up, I saw the default shell prompt ($), and when I typed alias I no longer saw the aliases I had created. Maybe I did it right, I’m not sure.

1 Like

Yeah I do need to look into it more. Appreciate the tip!

1 Like

Yeah you did it right, the alias commands are always temporary, they were just being sourced anew whenever you started up gitbash.

Typically you’d stick alias commands in .bashrc though (if not their own alias file) which would source those commands for every new interactive shell you created. In many unix based distros .bash_profile is typically only read once by default, when first logging in as a user, so it might be good to get in the habit of using .bashrc. This should also be compatible on more systems (so you just copy your .bashrc to OSX, Ubuntu etc. for the same behaviour).

1 Like