Alias what a blessing.
No not the TV show although the show wasn’t bad either LOL.
There are some commands I use allot and I do mean allot.
For instance
ssh madberry@example -v
what if I just had to type:
example
I can using the alias. We can just add it to the .bashrc file or use(as they tell you in .bashrc) put all your aliases in the .bash_aliases.
Here is how we go about doing it.
Open .bashrc
nano ~/.bashrc
and edit the lines:
# Alias definitions. # 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 # . ~/.bash_aliases # fi
to:
# Alias definitions. # 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 . ~/.bash_aliases fi
Now let’s create the .bash_aliases file:
nano ~/.bash_aliases
This will open a new file if you have never created one before. Note that this file is also in your home directory(that is what the ~ means).
Let’s explain the line we have to put in this file:
alias example='ssh madberry@example -v'
alias: The command we use to create the alias in addition typing this command in Terminal will give us a list of all available aliases.
example: The new alias for our command
ssh madberry@example -v: The command we want an alias for.
You can put allot of commands in here possibilities are endless.
Some examples:
Alias for updating through terminal:
alias update='sudo apt-get update && sudo apt-get -y upgrade'
Alias for ls -al:
alias al='ls -al'
Alias for ls -l:
alias ll='ls -l'
Alias for package not in /bin or /usr/bin:
alias mitter='/media/zooi/mitter-0.3.1/./mitter'
Alias for Kate:
alias k='kate'
Remember to put each new alias on a new line like so:
alias update='sudo apt-get update && sudo apt-get -y upgrade' alias al='ls -al' alias ll='ls -l' alias mitter='/media/zooi/mitter-0.3.1/./mitter' alias k='kate'
And also remember that new aliases won’t work unless you restart your Terminal(Konsole).
Tags: .bash_, /home, additions, aliases, amp, bashrc, bash_es, definitions, denitions, es, example bash, exle bash, fi, home directory, type bash, ~, ~/




LinkedIn
Myspace
Twitter
Facebook
Digg