manywaypark's Blog
개발, 검색, 함수

update-alternatives

tips & tricks/Linux/Unix 2007. 3. 3. 18:32 by manywaypark
update-alternatives를 사용하면 기본 명령어의 symbolic link들을 손쉽게 관리할 수 있다. 기본 설정을 변경하지 않았다면, /etc/alternatives에 있는 symbolic link들을 사용할 것이다.
기본 편집기를 변경하는 예를 들어 간단히 설명하겠다.
~$ ls -xalh /etc/alternatives/editor
lrwxrwxrwx 1 root root 23 2007-03-02 14:28 /etc/alternatives/editor -> /bin/nano

~$ update-alternatives --list editor
/usr/bin/vim.tiny
/bin/ed
/bin/nano
/usr/bin/emacs-snapshot

~$ sudo update-alternatives --config editor

There are 4 alternatives which provide `editor'.

Selection Alternative
-----------------------------------------------
1 /usr/bin/vim.tiny
2 /bin/ed
*+ 3 /bin/nano
4 /usr/bin/emacs-snapshot

Press enter to keep the default[*], or type selection number: 4
Using `/usr/bin/emacs-snapshot' to provide `editor'.

~$ ls -xalh /etc/alternatives/editor
lrwxrwxrwx 1 root root 23 2007-03-03 18:02 /etc/alternatives/editor -> /usr/bin/emacs-snapshot

이제부터는 명령행에서 editor를 실행하면, 예전의 nano대신 emacs가 실행될 것이다.
(*는 현재 선택된 것을, +는 기본 값을 나타낸다.)

기본 편집기를 변경한다는 것의 의미는 각종 응용프로그램이 사용자 편집을 받을 경우에 기본편집기를 사용하게 된다는 것이다.
ex) svn commit 메시지 입력, crontab -e에서의 예약작업 편집 등.

happy hackin'

분류 전체보기 (306)
잡담 (20)
함수형 언어 (65)
emacs (16)
java (18)
tips & tricks (154)
사랑 (1)
가사 (0)
독서 (4)
mobile (6)
비함수형 언어 (2)

공지사항

최근에 올라온 글

최근에 달린 댓글

최근에 받은 트랙백

03-19 11:02