Delete an alias
Djik
-
lami20j Posted messages 21506 Registration date Status Moderator, Security Contributor Last intervention -
lami20j Posted messages 21506 Registration date Status Moderator, Security Contributor Last intervention -
Hi,
I would like to know how to delete an alias? (on Debian)
Thank you
I would like to know how to delete an alias? (on Debian)
Thank you
Configuration: Linux Debian Mozilla 1.8.1.1
2 answers
-
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.
-
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 linelami20j@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 .bashrclami20j@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 aliaseslami20j@debian:~$ unalias {ll,vi}
6. display the aliases after removal - vi and ll are no longer therelami20j@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 restartlami20j@debian:~$ source .bashrc
8. display the aliaseslami20j@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