逆引きUNIXコマンド/alternativesの対象一覧を確認する
をテンプレートにして作成
[
トップ
] [
新規
|
一覧
|
検索
|
最終更新
|
ヘルプ
]
開始行:
#navi(../)
* update-alternativesの対象一覧を確認する [#c71789dd]
update-alternativesコマンドでデフォルトとして使用するもの...
しかし、--configなどで渡す対象となるキーワードが分からな...
#contents
#htmlinsertpcsp(linux_ads_top.html,linux-sp.html)
* alternatives設定のありか [#v9a8b2b0]
alternatives設定は、以下のディレクトリにあります。
-Debian/Ubuntu~
/var/lib/dpkg/alternatives~
- CentOS~
/var/lib/alternatives~
-openSUSE~
/var/lib/rpm/alternatives
上記のディレクトリ内にあるファイルはテキストなので、エデ...
** Debian8の出力例 [#z289d8ed]
sakura@debian:~$ lsb_release -d
Description: Debian GNU/Linux 8.6 (jessie)
sakura@debian:~$ ls -l /var/lib/dpkg/alternatives/
合計 456
-rw-r--r-- 1 root root 200 11月 25 22:39 appletviewer
-rw-r--r-- 1 root root 1024 11月 25 20:59 aptitude
-rw-r--r-- 1 root root 207 11月 25 20:20 awk
-rw-r--r-- 1 root root 83 11月 25 20:20 builtins.7.gz
-rw-r--r-- 1 root root 36 11月 25 21:21 c++
-rw-r--r-- 1 root root 111 11月 25 21:21 c89
-rw-r--r-- 1 root root 111 11月 25 21:21 c99
-rw-r--r-- 1 root root 35 11月 25 21:21 cc
-rw-r--r-- 1 root root 32 11月 25 21:00 cpp
<snip>
-rw-r--r-- 1 root root 160 11月 25 22:39 idlj
-rw-r--r-- 1 root root 129 11月 25 21:00 infobrowser
-rw-r--r-- 1 root root 155 11月 25 22:39 jar
-rw-r--r-- 1 root root 185 11月 25 22:39 jarsigner
-rw-r--r-- 1 root root 168 11月 25 21:02 java
-rw-r--r-- 1 root root 165 11月 25 22:39 javac
-rw-r--r-- 1 root root 175 11月 25 22:39 javadoc
-rw-r--r-- 1 root root 165 11月 25 22:39 javah
-rw-r--r-- 1 root root 165 11月 25 22:39 javap
-rw-r--r-- 1 root root 160 11月 25 22:39 jcmd
<snip>
-rw-r--r-- 1 root root 127 11月 25 21:00 www-browser
-rw-r--r-- 1 root root 171 11月 25 21:02 x-cursor-theme
-rw-r--r-- 1 root root 163 11月 25 21:01 x-session-mana...
-rw-r--r-- 1 root root 389 11月 25 21:01 x-terminal-emu...
-rw-r--r-- 1 root root 146 11月 25 21:02 x-window-manager
-rw-r--r-- 1 root root 231 12月 14 09:50 x-www-browser
-rw-r--r-- 1 root root 155 11月 25 22:39 xjc
* alternativesの対象 [#y3a631fb]
alternativesの対象を確認したい場合は、以下のディレクトリ...
/etc/alternatives/
** Debian8の出力例 [#f4f38449]
sakura@debian:~$ lsb_release -d
Description: Debian GNU/Linux 8.6 (jessie)
sakura@debian:~$ ls -l /etc/alternatives/
合計 28
lrwxrwxrwx 1 root root 18 11月 25 21:00 Mail -> /usr/bi...
lrwxrwxrwx 1 root root 34 11月 25 21:00 Mail.1.gz -> /u...
-rw-r--r-- 1 root root 100 5月 3 2016 README
lrwxrwxrwx 1 root root 49 11月 25 22:39 appletviewer ->...
lrwxrwxrwx 1 root root 59 11月 25 22:39 appletviewer.1....
lrwxrwxrwx 1 root root 24 11月 25 20:59 aptitude -> /us...
lrwxrwxrwx 1 root root 40 11月 25 20:59 aptitude.8.gz -...
lrwxrwxrwx 1 root root 43 11月 25 20:59 aptitude.cs.8.g...
lrwxrwxrwx 1 root root 43 11月 25 20:59 aptitude.de.8.g...
lrwxrwxrwx 1 root root 43 11月 25 20:59 aptitude.es.8.g...
lrwxrwxrwx 1 root root 43 11月 25 20:59 aptitude.fi.8.g...
lrwxrwxrwx 1 root root 43 11月 25 20:59 aptitude.fr.8.g...
lrwxrwxrwx 1 root root 43 11月 25 20:59 aptitude.gl.8.g...
lrwxrwxrwx 1 root root 43 11月 25 20:59 aptitude.it.8.g...
lrwxrwxrwx 1 root root 43 11月 25 20:59 aptitude.ja.8.g...
lrwxrwxrwx 1 root root 43 11月 25 20:59 aptitude.pl.8.g...
lrwxrwxrwx 1 root root 13 11月 25 20:19 awk -> /usr/bin...
lrwxrwxrwx 1 root root 29 11月 25 20:19 awk.1.gz -> /us...
lrwxrwxrwx 1 root root 38 11月 25 20:20 builtins.7.gz -...
lrwxrwxrwx 1 root root 12 11月 25 21:21 c++ -> /usr/bin...
lrwxrwxrwx 1 root root 16 11月 25 21:21 c89 -> /usr/bin...
lrwxrwxrwx 1 root root 32 11月 25 21:21 c89.1.gz -> /us...
lrwxrwxrwx 1 root root 16 11月 25 21:21 c99 -> /usr/bin...
lrwxrwxrwx 1 root root 32 11月 25 21:21 c99.1.gz -> /us...
lrwxrwxrwx 1 root root 12 11月 25 21:21 cc -> /usr/bin/...
lrwxrwxrwx 1 root root 12 11月 25 21:00 cpp -> /usr/bin...
lrwxrwxrwx 1 root root 60 11月 25 20:58 desktop-backgro...
lrwxrwxrwx 1 root root 40 11月 25 20:58 desktop-backgro...
lrwxrwxrwx 1 root root 45 11月 25 20:58 desktop-grub ->...
lrwxrwxrwx 1 root root 50 11月 25 20:58 desktop-splash ...
lrwxrwxrwx 1 root root 9 11月 25 20:20 editor -> /bin/...
lrwxrwxrwx 1 root root 29 11月 25 20:20 editor.1.gz -> ...
lrwxrwxrwx 1 root root 16 11月 25 22:09 ex -> /usr/bin/...
<snip>
出力を見るとシンボリックリンクで切り替えているのが確認で...
実際に ls /etc/alternatives/ で出力されたものをピックアッ...
- x-www-browser (デフォルトブラウザの設定)
sakura@debian:~$ sudo update-alternatives --config x-www...
[sudo] password for sakura:
alternative x-www-browser (/usr/bin/x-www-browser を提供...
選択肢 パス 優先度 状態
--------------------------------------------------------...
0 /usr/bin/vivaldi-stable 200 自動...
1 /usr/bin/firefox-esr 70 手動...
* 2 /usr/bin/midori 39 手動...
3 /usr/bin/vivaldi-stable 200 手動...
-cppの設定
sakura@debian:~$ sudo update-alternatives --config cpp
リンクグループ cpp に 1 つの alternative のみがあります ...
設定は行いません。
* alternativesの仕組み [#af89fdae]
例えばjavaコマンドとかはどうなっているか確認してみます。~
~$ which java
/usr/bin/java
~$ ls -l `which java`
lrwxrwxrwx 1 root root 22 10月 26 00:50 /usr/bin/java ->...
~$ ls -l /etc/alternatives/java
lrwxrwxrwx 1 root root 41 10月 25 17:05 /etc/alternative...
上記の出力をみればわかる通り、~
/usr/bin/javaは/etc/alternatives/javaで、/etc/alternative...
update-alternativesコマンドでシンボリックリンクを切り替え...
以上、update-alternativesコマンドについての資料でした。
#htmlinsertpcsp(linux_ads_btm.html,linux-sp.html)
終了行:
#navi(../)
* update-alternativesの対象一覧を確認する [#c71789dd]
update-alternativesコマンドでデフォルトとして使用するもの...
しかし、--configなどで渡す対象となるキーワードが分からな...
#contents
#htmlinsertpcsp(linux_ads_top.html,linux-sp.html)
* alternatives設定のありか [#v9a8b2b0]
alternatives設定は、以下のディレクトリにあります。
-Debian/Ubuntu~
/var/lib/dpkg/alternatives~
- CentOS~
/var/lib/alternatives~
-openSUSE~
/var/lib/rpm/alternatives
上記のディレクトリ内にあるファイルはテキストなので、エデ...
** Debian8の出力例 [#z289d8ed]
sakura@debian:~$ lsb_release -d
Description: Debian GNU/Linux 8.6 (jessie)
sakura@debian:~$ ls -l /var/lib/dpkg/alternatives/
合計 456
-rw-r--r-- 1 root root 200 11月 25 22:39 appletviewer
-rw-r--r-- 1 root root 1024 11月 25 20:59 aptitude
-rw-r--r-- 1 root root 207 11月 25 20:20 awk
-rw-r--r-- 1 root root 83 11月 25 20:20 builtins.7.gz
-rw-r--r-- 1 root root 36 11月 25 21:21 c++
-rw-r--r-- 1 root root 111 11月 25 21:21 c89
-rw-r--r-- 1 root root 111 11月 25 21:21 c99
-rw-r--r-- 1 root root 35 11月 25 21:21 cc
-rw-r--r-- 1 root root 32 11月 25 21:00 cpp
<snip>
-rw-r--r-- 1 root root 160 11月 25 22:39 idlj
-rw-r--r-- 1 root root 129 11月 25 21:00 infobrowser
-rw-r--r-- 1 root root 155 11月 25 22:39 jar
-rw-r--r-- 1 root root 185 11月 25 22:39 jarsigner
-rw-r--r-- 1 root root 168 11月 25 21:02 java
-rw-r--r-- 1 root root 165 11月 25 22:39 javac
-rw-r--r-- 1 root root 175 11月 25 22:39 javadoc
-rw-r--r-- 1 root root 165 11月 25 22:39 javah
-rw-r--r-- 1 root root 165 11月 25 22:39 javap
-rw-r--r-- 1 root root 160 11月 25 22:39 jcmd
<snip>
-rw-r--r-- 1 root root 127 11月 25 21:00 www-browser
-rw-r--r-- 1 root root 171 11月 25 21:02 x-cursor-theme
-rw-r--r-- 1 root root 163 11月 25 21:01 x-session-mana...
-rw-r--r-- 1 root root 389 11月 25 21:01 x-terminal-emu...
-rw-r--r-- 1 root root 146 11月 25 21:02 x-window-manager
-rw-r--r-- 1 root root 231 12月 14 09:50 x-www-browser
-rw-r--r-- 1 root root 155 11月 25 22:39 xjc
* alternativesの対象 [#y3a631fb]
alternativesの対象を確認したい場合は、以下のディレクトリ...
/etc/alternatives/
** Debian8の出力例 [#f4f38449]
sakura@debian:~$ lsb_release -d
Description: Debian GNU/Linux 8.6 (jessie)
sakura@debian:~$ ls -l /etc/alternatives/
合計 28
lrwxrwxrwx 1 root root 18 11月 25 21:00 Mail -> /usr/bi...
lrwxrwxrwx 1 root root 34 11月 25 21:00 Mail.1.gz -> /u...
-rw-r--r-- 1 root root 100 5月 3 2016 README
lrwxrwxrwx 1 root root 49 11月 25 22:39 appletviewer ->...
lrwxrwxrwx 1 root root 59 11月 25 22:39 appletviewer.1....
lrwxrwxrwx 1 root root 24 11月 25 20:59 aptitude -> /us...
lrwxrwxrwx 1 root root 40 11月 25 20:59 aptitude.8.gz -...
lrwxrwxrwx 1 root root 43 11月 25 20:59 aptitude.cs.8.g...
lrwxrwxrwx 1 root root 43 11月 25 20:59 aptitude.de.8.g...
lrwxrwxrwx 1 root root 43 11月 25 20:59 aptitude.es.8.g...
lrwxrwxrwx 1 root root 43 11月 25 20:59 aptitude.fi.8.g...
lrwxrwxrwx 1 root root 43 11月 25 20:59 aptitude.fr.8.g...
lrwxrwxrwx 1 root root 43 11月 25 20:59 aptitude.gl.8.g...
lrwxrwxrwx 1 root root 43 11月 25 20:59 aptitude.it.8.g...
lrwxrwxrwx 1 root root 43 11月 25 20:59 aptitude.ja.8.g...
lrwxrwxrwx 1 root root 43 11月 25 20:59 aptitude.pl.8.g...
lrwxrwxrwx 1 root root 13 11月 25 20:19 awk -> /usr/bin...
lrwxrwxrwx 1 root root 29 11月 25 20:19 awk.1.gz -> /us...
lrwxrwxrwx 1 root root 38 11月 25 20:20 builtins.7.gz -...
lrwxrwxrwx 1 root root 12 11月 25 21:21 c++ -> /usr/bin...
lrwxrwxrwx 1 root root 16 11月 25 21:21 c89 -> /usr/bin...
lrwxrwxrwx 1 root root 32 11月 25 21:21 c89.1.gz -> /us...
lrwxrwxrwx 1 root root 16 11月 25 21:21 c99 -> /usr/bin...
lrwxrwxrwx 1 root root 32 11月 25 21:21 c99.1.gz -> /us...
lrwxrwxrwx 1 root root 12 11月 25 21:21 cc -> /usr/bin/...
lrwxrwxrwx 1 root root 12 11月 25 21:00 cpp -> /usr/bin...
lrwxrwxrwx 1 root root 60 11月 25 20:58 desktop-backgro...
lrwxrwxrwx 1 root root 40 11月 25 20:58 desktop-backgro...
lrwxrwxrwx 1 root root 45 11月 25 20:58 desktop-grub ->...
lrwxrwxrwx 1 root root 50 11月 25 20:58 desktop-splash ...
lrwxrwxrwx 1 root root 9 11月 25 20:20 editor -> /bin/...
lrwxrwxrwx 1 root root 29 11月 25 20:20 editor.1.gz -> ...
lrwxrwxrwx 1 root root 16 11月 25 22:09 ex -> /usr/bin/...
<snip>
出力を見るとシンボリックリンクで切り替えているのが確認で...
実際に ls /etc/alternatives/ で出力されたものをピックアッ...
- x-www-browser (デフォルトブラウザの設定)
sakura@debian:~$ sudo update-alternatives --config x-www...
[sudo] password for sakura:
alternative x-www-browser (/usr/bin/x-www-browser を提供...
選択肢 パス 優先度 状態
--------------------------------------------------------...
0 /usr/bin/vivaldi-stable 200 自動...
1 /usr/bin/firefox-esr 70 手動...
* 2 /usr/bin/midori 39 手動...
3 /usr/bin/vivaldi-stable 200 手動...
-cppの設定
sakura@debian:~$ sudo update-alternatives --config cpp
リンクグループ cpp に 1 つの alternative のみがあります ...
設定は行いません。
* alternativesの仕組み [#af89fdae]
例えばjavaコマンドとかはどうなっているか確認してみます。~
~$ which java
/usr/bin/java
~$ ls -l `which java`
lrwxrwxrwx 1 root root 22 10月 26 00:50 /usr/bin/java ->...
~$ ls -l /etc/alternatives/java
lrwxrwxrwx 1 root root 41 10月 25 17:05 /etc/alternative...
上記の出力をみればわかる通り、~
/usr/bin/javaは/etc/alternatives/javaで、/etc/alternative...
update-alternativesコマンドでシンボリックリンクを切り替え...
以上、update-alternativesコマンドについての資料でした。
#htmlinsertpcsp(linux_ads_btm.html,linux-sp.html)
ページ名: