If you’ve never created an alias before, create a file called .bash_aliases in your $HOME path if it doesn’t exist yet.
Open a terminal and make sure that you are located in the $HOME directory.
$ cd ~
Create the .bash_aliases file
$ touch .bash_aliases
Everything inside .bash_aliases will be run because of the following code inside .bashrc
# You may want to put all your additions into a separate file like
# ~/.bash_aliases, instead of adding them here directly.
# See /usr/share/doc/bash-doc/examples in the bash-doc package.
if [ -f ~/.bash_aliases ]; then
Step 2 — Adding your own commands.
Now we can open the .bash_aliases file. And start adding our own custom commands!
You could edit the file with nano inside your terminal:
$ nano .bash_aliases
Or with a graphical text editor:
$ gedit .bash_aliases
Creating an alias.
Inside the file you can add your own custom commands:
alias testcommand='echo "waiting 3 seconds…"; sleep 3; echo "It worked!!"'
This is just an example command. You can basically do whatever you want in here, to make things more convenient for yourself.
Post a Comment