tag: ubuntu linux linux-admin alternatives title: update-alternatives examples See [thomasventurini article](https://thomasventurini.com/articles/how-to-use-update-alternatives/) ```bash sudo update-alternatives --install $(which vim) vim $(which nvim) 10 ``` or ```bash sudo update-alternatives --install /usr/bin/vi vi /usr/local/bin/nvim 10 sudo update-alternatives --set vi /usr/local/bin/nvim ``` so ```bash sudo update-alternatives --install TARGET NAME PATH PRIORITY sudo update-alternatives --set NAME PATH ``` the TARGET is e.g. /usr/bin/vi -- where you want your alternative to appear in the filesystem the NAME is what you pass to `update-alternatives --set`, the PATH is the path to the executable you want TARGET to be a symlink to, and PRIORITY is used when e.g. a package is removed and a new alternative is needed (e.g. if you remove neovim, then `/usr/bin/vi` will then point to e.g. `/usr/bin/vim.basic` or something).