| Rev | Author | # | Line |
|---|---|---|---|
| 5 | CraigBox | 1 | Can you think of a REALLY long command that you use on a regular basis? If so, aliases are for you! |
| 1 | BenStaz | 2 | |
| 5 | CraigBox | 3 | An alias is a small command or name to execute a long string. They couldn't be easier to make. At your terminal, type: |
| 1 | BenStaz | 4 | |
| 5 | CraigBox | 5 | <tt>alias <name>='<command to perform>'</tt> |
| 1 | BenStaz | 6 | |
| 5 | CraigBox | 7 | 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. |
| 8 | |||
| 9 | Of course there are much more useful aliases to be made than the one above! | ||
| 1 | BenStaz | 10 | |
| 11 | Take for example: | ||
| 7 | BenStaz | 12 | <tt>alias apt='sudo vim /etc/apt/sources.list'</tt> |
| 1 | BenStaz | 13 | |
| 14 | Think about how many times you have edited this file. Wouldn't typing 'apt' be so much nicer? | ||
| 15 | This alias will only last while you have this terminal window open if you want a permanent one, read on :) | ||
| 3 | BenStaz | 16 | |
| 4 | BenStaz | 17 | To list the aliases available to you, simply type 'alias'. |
| 18 | |||
| 3 | BenStaz | 19 | To remove an alias do: |
| 5 | CraigBox | 20 | *<tt>unalias <nameofalias></tt> |
| 1 | BenStaz | 21 | |
| 5 | CraigBox | 22 | !Making aliases permanent |
| 1 | BenStaz | 23 | |
| 2 | BenStaz | 24 | First we edit your ~~/.bashrc file. |
| 7 | BenStaz | 25 | *<tt>sudo vim ~~/.bashrc</tt> |
| 1 | BenStaz | 26 | Now scroll down to find: |
| 27 | |||
| 28 | <verbatim> | ||
| 29 | #if [ -f ~/.bash_aliases ]; then | ||
| 30 | # . ~/.bash_aliases | ||
| 31 | #fi | ||
| 32 | </verbatim> | ||
| 33 | |||
| 34 | Uncomment these three lines (or if they don't exist add them). Now save. | ||
| 35 | |||
| 36 | Now do: | ||
| 7 | BenStaz | 37 | *<tt>vim ~~/.bash_aliases</tt> |
| 1 | BenStaz | 38 | |
| 39 | Add all your aliases (in the same format as above) with each being on a separate line. Save when you are done. | ||
| 5 | CraigBox | 40 | Good stuff, now open a new terminal. Hopefully your aliases will work like a charm. |
| 6 | CraigBox | 41 | |
| 42 | --- | ||
| 43 | CategoryBeginners |
lib/blame.php:177: Warning: Invalid argument supplied for foreach()