<p>The 'update-alternatives' command in Linux is used to manage alternatives for various commands or executable files. It allows you to install, update, and switch between different versions of these programs.</p>
<p><strong>Syntax:</strong></p>
<pre><code>update-alternatives --install '&lt;link&gt;' '&lt;name&gt;' '&lt;path&gt;' '&lt;priority&gt;'
</code></pre>
<p><strong>Parameters:</strong></p>
<ul>
<li>'<link>': The symbolic link to be created or updated.</li>
<li>'<name>': The name of the alternative.</li>
<li>'<path>': The path to the actual executable file.</li>
<li>'<priority>': A numerical value determining the default alternative (higher priority takes precedence).</li>
</ul>
<p><strong>Example:</strong></p>
<p>To install 'vim' as an alternative for the 'editor' command with a priority of 100:</p>
<pre><code>sudo update-alternatives --install /usr/bin/editor editor /usr/bin/vim 100
</code></pre>
<p>This command creates a symbolic link '/usr/bin/editor' that points to '/usr/bin/vim'.  You can then use the following command to select the default editor:</p>
<pre><code>update-alternatives --config editor
</code></pre>
<p>This command will list all available alternatives for 'editor' and allow you to choose the default one.</p>
Linux update-alternatives Command: Install and Manage Alternatives

原文地址: https://www.cveoy.top/t/topic/nNO2 著作权归作者所有。请勿转载和采集!

免费AI点我,无需注册和登录