This question already has an answer here:
I want to save my alias commands forever like the default ones when I type "alias" so I don't retype them every time I leave my bash
In Ubuntu, the default .bashrc skeleton file looks for a
Create a file called something like
In this file, stick a bunch of commands:
Now run the file like so:
It will print the date, and you can now use the aliases. The date command is just to show you that you can pretty much stick anything you want in there, and it will run.
Now you still have to manually source this file, which isn't so convenient. Luckily, when you start up a new shell, there are a few files like this that are automatically called. Since you're using a bash shell,
So, you might as well stick your aliases in
If you want your aliases to be extra permanent, you can always create a
This will let you easily share them across machines.
First copy all your existing aliases to a new file, e.g.
You then need to create (or edit) the file bash executes when it logs out, i.e.
Of course, if you open multiple sessions and define different aliases in each, then you will need something more complicated to handle this.
You have to save your alias's at
Open your terminal and type this
it will open a text file and in that text file place your alias command at the last line and save it and close .
Logout and login to apply changes and check .
edit :Also, instead of a logout/login, you may run source ~/.bashrc to immediately apply the new .bashrc file
Hope that helps .