Delete an alias

Hi,

I would like to know how to delete an alias? (on Debian)

Thank you
Configuration: Linux Debian Mozilla 1.8.1.1

2 answers

  1. Moderator
    Hello,
    unalias [-a] [name ...] Removes the name from the list of defined aliases. If the -a option is requested, all alias definitions are removed. The return value is true unless a name mentioned is not a defined alias.
    ;-))

    --
    Z'@+...che.
    JP: Zen, my Nuggets! ;-) Knowledge is only valuable when it is shared.
    8
    1. Moderator
      Hello,

      unalias permanently removes the aliases created with the alias command.
      If you have any aliases in the shell initialization file (.bashrc for example), you must remove the line corresponding to the alias to permanently delete the alias; otherwise, the alias will only be removed for the current session.

      1. I display the aliases (what I have in .bashrc)
      lami20j@debian:~$ alias alias ccmlinux='firefox http://www.commentcamarche.net/forum/forum-13-linux-unix &' alias ccmprog='firefox http://www.commentcamarche.net/forum/forum-3-developpement &' alias dem='/bin/ls' alias vi='/usr/bin/vim'

      2. I create an alias on the command line
      lami20j@debian:~$ alias ll='ls -l'

      3. I display the aliases (.bashrc + the newly created one)
      lami20j@debian:~$ alias alias ccmlinux='firefox http://www.commentcamarche.net/forum/forum-13-linux-unix &' alias ccmprog='firefox http://www.commentcamarche.net/forum/forum-3-developpement &' alias dem='/bin/ls' alias ll='ls -l' alias vi='/usr/bin/vim'

      4. aliases found in .bashrc
      lami20j@debian:~$ grep alias .bashrc # User specific aliases and functions alias dem='/bin/ls' alias vi='/usr/bin/vim' alias ccmlinux='firefox http://www.commentcamarche.net/forum/forum-13-linux-unix &' alias ccmprog='firefox http://www.commentcamarche.net/forum/forum-3-developpement &'

      5. removing aliases
      lami20j@debian:~$ unalias {ll,vi}

      6. display the aliases after removal - vi and ll are no longer there
      lami20j@debian:~$ alias alias ccmlinux='firefox http://www.commentcamarche.net/forum/forum-13-linux-unix &' alias ccmprog='firefox http://www.commentcamarche.net/forum/forum-3-developpement &' alias dem='/bin/ls'

      7. simulating session restart
      lami20j@debian:~$ source .bashrc

      8. display the aliases
      lami20j@debian:~$ alias alias ccmlinux='firefox http://www.commentcamarche.net/forum/forum-13-linux-unix &' alias ccmprog='firefox http://www.commentcamarche.net/forum/forum-3-developpement &' alias dem='/bin/ls' alias vi='/usr/bin/vim'
      You can clearly see that the vi alias still exists
      --
      lami20j
      4