Home
Main website
Display Sidebar
Hide Ads
Recent Changes
View Source:
Aliases
Edit
PageHistory
Diff
Info
LikePages
Can you think of a REALLY long command that you use on a regular basis? If so, aliases are for you! An alias is a small command or name to execute a long string. They couldn't be easier to make. At your terminal, type: <tt>alias <name>='<command to perform>'</tt> If you type <tt>alias staz='echo you rock Staz'</tt>, and then type <tt>staz</tt> at the terminal, you will be told that Staz rocks. Of course there are much more useful aliases to be made than the one above! Take for example: <tt>alias apt='sudo vim /etc/apt/sources.list'</tt> Think about how many times you have edited this file. Wouldn't typing 'apt' be so much nicer? This alias will only last while you have this terminal window open if you want a permanent one, read on :) To list the aliases available to you, simply type 'alias'. To remove an alias do: *<tt>unalias <nameofalias></tt> !Making aliases permanent First we edit your ~~/.bashrc file. *<tt>sudo vim ~~/.bashrc</tt> Now scroll down to find: <verbatim> #if [ -f ~/.bash_aliases ]; then # . ~/.bash_aliases #fi </verbatim> Uncomment these three lines (or if they don't exist add them). Now save. Now do: *<tt>vim ~~/.bash_aliases</tt> Add all your aliases (in the same format as above) with each being on a separate line. Save when you are done. Good stuff, now open a new terminal. Hopefully your aliases will work like a charm. --- CategoryBeginners
No page links to
Aliases
.