faqts : Computers : Operating Systems : Linux

+ Search
Add Entry AlertManage Folder Edit Entry Add page to http://del.icio.us/
Did You Find This Entry Useful?

73 of 83 people (88%) answered Yes
Recently 7 of 10 people (70%) answered Yes

Entry

Linux: Alias: Operation: Store: File: In which file to permanently store aliases? [alias]

Aug 31st, 2005 08:35
franciska Terza, Knud van Eeden,


----------------------------------------------------------------------
--- Knud van Eeden --- 19 September 2003 - 04:36 pm ------------------

Linux: Alias: Operation: Store: File: In which file to permanently 
store aliases? [alias]

---
---

Method: global aliases, valid for all users on that computer:

Edit the file:

 /etc/bashrc

---

e.g.

1. Type the command:

 vi /ect/bashrc (or similar emacs /etc/bashrc)

2. then add the aliases
   (e.g. by adding them line by line after the entry
   '#system wide functions and aliases'

   e.g. add the line

    alias cls='clear'

3. save the result

   (in vi, type:

     <ESC>

     :save /etc/bashrc

     :q

    in emacs, type

     <CTRL><X><C>

     then 'y' to confirm

4. - From now it works in newly opened shell 

    in X-Windows close and open shell windov
    in text mode logout and login
    (no need to reboot in linux)

---
---

Method: local aliases, only valid for the currently logged in user:

Edit the file:

 /home/<your current user name>/.bashrc

This is a hidden file (indicated by the dot '.' in front of the
filename)

---

To edit:

 Steps: Overview:

  1. -Change to the home directory

       cd /home

  2. -Change to the current user directory

       cd <current userid>

  3. -Edit the .bashrc file (use vi, not emacs)

       vi .bashrc

  4. -Add your aliases

   (e.g. by adding them line by line after the entry
   '#User specific functions and aliases'

   e.g. add the line

    alias cls='clear'

  5. -Save your result

       <ESC>

       :save /home/<your current username>/.bashrc

       :q

  6. - From now it works in newly opened shell 

    in X-Windows close and open shell windov
    in text mode logout and login
    (no need to reboot in linux)

----------------------------------------------------------------------