Important! This is an automatic machine translated page. If you can read english, you should Click Here to read the original English version of the article.

Set the Default Browser on Ubuntu From the Command Line Thiết lập trình duyệt mặc định trên Ubuntu Từ Command Line

Ubuntu Linux has a default browser functionality that will automatically launch the correct browser when clicking on a link in a gnome gui application. Ubuntu Linux có một chức năng trình duyệt mặc định rằng sẽ tự động khởi chạy trình duyệt đúng khi nhấp vào một liên kết trong một ứng dụng gui gnome. It's easy enough to Thật dễ dàng, đủ để set the default browser using the GUI tools thiết lập trình duyệt mặc định bằng cách sử dụng các công cụ GUI , but sometimes it's easier to set it using the command line client.. , Nhưng đôi khi nó dễ dàng hơn để thiết lập nó bằng cách sử dụng các khách hàng dòng lệnh .. for instance, if you are trying to remotely administer a machine. Ví dụ, nếu bạn đang cố gắng để quản lý từ xa một máy.

To change this setting, we'll use the update-alternatives command. Để thay đổi cài đặt này, chúng tôi sẽ sử dụng lệnh update-alternatives.

sudo update-alternatives –config x-www-browser sudo update-alternatives-config x-www-trình duyệt

You should see something similar to this. Bạn sẽ thấy một cái gì đó tương tự như sau. You'll notice that konqueror is the default browser on my computer right now. Bạn sẽ nhận thấy rằng Konqueror là trình duyệt mặc định trên máy tính của tôi ngay bây giờ.

$ sudo update-alternatives –config x-www-browser $ Sudo update-alternatives-config x-www-trình duyệt

There are 2 alternatives which provide `x-www-browser'. Có 2 lựa chọn thay thế trong đó cung cấp cho `x-www-trình duyệt '.

Selection Alternative Lựa chọn thay thế
———————————————– ----------------
1 /usr/bin/firefox 1 / usr / bin / firefox
*+ 2 /usr/bin/konqueror * + 2 / usr / bin / Konqueror

Press enter to keep the default[*], or type selection number: Bấm Enter để giữ giá trị mặc định [*], hoặc gõ số lựa chọn:

If I wanted to select firefox as the default browser, I could just type 1 and hit enter. Nếu tôi muốn chọn firefox là trình duyệt mặc định, tôi có thể chỉ cần gõ 1 và nhấn Enter.

This article was originally written on 12/5/06 Tagged with: Bài viết này ban đầu được viết ngày 12/5/06 Tagged với: Ubuntu Ubuntu , , Ubuntu Tips & Tweaks Ubuntu Tips & Tweaks

Daily Email Updates Email cập nhật hàng ngày

You can get our how-to articles in your inbox each day for free. Bạn có thể làm thế nào chúng tôi vào các bài viết trong hộp thư của bạn mỗi ngày miễn phí. Just enter your name and email below: Chỉ cần nhập tên và email của bạn dưới đây:


Name: Tên:
Email: Email:

Comments (17) Comment (17)

  1. froyd froyd

    im trying to do that but i dont get anything in that list…. im cố gắng để làm điều đó nhưng i dont nhận được bất cứ điều gì trong danh sách đó .... my prob is i update from firefox to firefox2, everything is fine besides the fact that some apps when i click on link they dont open the browser anymore ( like gaim ) … im trying to set symlinks but with no luck , so i came to this side, setting default browser but got no luck either prob của tôi là tôi cập nhật từ firefox để firefox2, mọi thứ đều tốt đẹp, bên cạnh một thực tế là một số ứng dụng khi tôi nhấp vào liên kết họ không mở trình duyệt nữa (như Gaim) ... im đang cố gắng thiết lập symlink nhưng với may mắn không có, do đó, tôi đã đến này phụ, thiết lập trình duyệt mặc định, nhưng đã không có may mắn hoặc là

  2. Sneezy melon Sneezy melon

    Thanks for sharing. Cảm ơn bạn đã chia sẻ. Although, using GUI tools is much easier. Mặc dù các công cụ được sử dụng giao diện dễ dàng hơn nhiều.

  3. Sneezy melon Sneezy melon

    BTW, is there any way of configuring POP/IMAP access for Windows Live Mail in Evolution Mail ?? BTW, là có bất kỳ cách nào cấu hình POP / IMAP truy cập cho Windows Live Mail trong Evolution Mail??

  4. What is Firefox? Firefox là gì?

    Thank you! Cảm ơn bạn! Tell me, how can I change the default email client as well? Nói cho tôi, làm thế nào tôi có thể thay đổi các ứng dụng email mặc định không?

  5. Sawtooth Răng cưa

    Good advice. Lời khuyên tốt. But: I upgraded to ubuntu 8.04 which includes firefox-3 of course, which sucks, of course. Nhưng: Tôi nâng cấp lên 8,04 ubuntu bao gồm firefox-3 của khóa học, mà sucks, tất nhiên. After reverting to firefox-2, fixing the eye-damaging fonts, etc. I found that links from my emails/im etc didn't work. Sau khi quay trở lại firefox-2, sửa chữa mắt-phông gây thiệt hại, vv tôi thấy rằng các liên kết từ các email của tôi / im vv không làm việc. I suspected that something like the default browser was “confused” and tried to change that. Tôi nghi ngờ rằng một cái gì đó như trình duyệt mặc định là "nhầm lẫn" và cố gắng để thay đổi đó. This led me here. Điều này dẫn tôi ở đây. Typing the command I get: Cách gõ lệnh tôi nhận được:
    $ sudo update-alternatives –config x-www-browser $ Sudo update-alternatives-config x-www-trình duyệt
    There is only 1 program which provides x-www-browser Chỉ có 1 chương trình cung cấp x-www-trình duyệt
    (/usr/bin/firefox-2). (/ usr/bin/firefox-2). Nothing to configure. Không có gì để cấu hình.

    It seems that only by using the GUI i could add the -2 at the firefox %s command. Dường như chỉ bằng cách sử dụng i GUI có thể thêm vào -2% firefox s lệnh. After I changed it to firefox-2 %s the links worked fine. Sau khi tôi thay đổi nó để firefox-2% s các liên kết làm việc tốt.

  6. lcpetroski lcpetroski

    Great advice, but note that preceding the worh “config”, there are two dashes as: Great tư vấn, nhưng lưu ý là trước worh "config", có hai dấu gạch ngang như:
    sudo update-alternatives –config x-www-browser. sudo update-alternatives-config x-www-trình duyệt. Hard to see while editing, but it makes all the difference in execution. Khó thấy, trong khi chỉnh sửa, nhưng nó làm cho tất cả những sự khác biệt trong thực hiện.

  7. va9rant va9rant

    thanks for the tip!!! thanks for the tip! works like a charm say mê làm việc giống như một :)

  8. va9rant va9rant

    had a problem setting firefox to open html files after following this tip (konqueror still was the default file in opening html files), solved the problem after associating it with ff3 in kubuntu 8.04.1 by right-clicking the file, open with, selected ff3 and checked “Remember application association for this type of file” tick box có vấn đề cài đặt firefox để mở file html sau khi sau này tip (Konqueror vẫn được các tập tin mặc định trong việc mở các file html), giải quyết các vấn đề sau khi kết hợp nó với FF3 trong Kubuntu 8.04.1 bằng cách kích chuột phải vào tập tin, mở với, chọn FF3 và kiểm tra "Lưu liên kết áp dụng cho loại tập tin" đánh dấu vào ô :) just thought I'd add it here… chỉ nghĩ rằng tôi muốn thêm ở đây ...

  9. bravespear bravespear

    I am using Kubuntu Hardy 8.04. Tôi đang sử dụng Kubuntu Hardy 8,04.
    I have typed the command: Tôi đã gõ lệnh:

    sudo update-alternatives –config x-www-browser sudo update-alternatives-config x-www-trình duyệt

    There are 2 alternatives which provide `x-www-browser'. Có 2 lựa chọn thay thế trong đó cung cấp cho `x-www-trình duyệt '.

    Selection Alternative Lựa chọn thay thế
    ———————————————– ----------------
    * 1 /usr/bin/firefox-3.0 * 1 / usr/bin/firefox-3.0
    + 2 /usr/bin/konqueror + 2 / usr / bin / Konqueror

    Press enter to keep the default[*], or type selection number: 1 Bấm Enter để giữ giá trị mặc định [*], hoặc gõ số lựa chọn: 1
    Using '/usr/bin/firefox-3.0′ to provide 'x-www-browser'. Sử dụng '/ usr/bin/firefox-3.0' để cung cấp 'x-www-trình duyệt'.

    I have selected 1 for firefox but when I create a desktop url pointing to Tôi đã chọn 1 cho firefox nhưng khi tôi tạo ra một URL trỏ đến máy tính để bàn http://www.google.com http://www.google.com it automatically opens in Konqueror. nó sẽ tự động mở ra trong Konqueror.

    Any ideas? Bất cứ ý tưởng? I need to setup Firefox as the default web browser in a LiveCD I am creating. Tôi cần phải cài đặt Firefox là trình duyệt web mặc định trong một LiveCD tôi đang tạo ra.

  10. bunky bunky

    just use the GUI 'system', 'preferences', 'preferred applications' chỉ cần sử dụng của hệ thống giao diện ',' sở thích ',' các ứng dụng ưa thích '

  11. Ben Bến

    Sawtooth – Thanks for the tip and now the links work! Răng cưa - Thanks for the tip và bây giờ các công việc liên kết!

  12. RMY RMY

    “–config” not “-config” "-Config" không "-config"

  13. Navin Navin

    Thanks for this great tip. Thanks for this tip lớn. I just wanted to add that you could use '–set' instead of '–config' to set the path non-interactively. Tôi chỉ muốn thêm rằng bạn có thể sử dụng '-set' thay vì '-config' để thiết lập con đường không-tương tác. Like so: Cũng như vậy:

    sudo update-alternatives –set x-www-browser /usr/bin/firefox sudo update-alternatives-set x-www-trình duyệt / usr / bin / firefox

    Great, if you want to use this command in a script. Great, nếu bạn muốn sử dụng lệnh này trong một tập lệnh.

  14. Noah Coad Noah Coad

    How about for Windows? Làm thế nào về cho Windows? Any idea how to set the default web browser (Opera, Safari, Chrome, IE, Firefox, etc) from the command line in Windows (XP/Vista/Win7)? Bất cứ ý tưởng làm thế nào để thiết lập mặc định của trình duyệt web (Opera, Safari, Chrome, IE, Firefox, vv) từ dòng lệnh trong Windows (XP/Vista/Win7)? thanks! cảm ơn!

  15. V.Balaviswanathan V. Balaviswanathan

    Hi I happen to use mepsis on my laptop and I am using KDE as my desktop. Hi tôi xảy ra để sử dụng mepsis trên máy tính xách tay của tôi và tôi đang sử dụng KDE như máy tính để bàn của tôi. I configured wrongly and when I open trash can it opens with firefox and it says “This application cannot be opened in firefox” and how do I retreive it back to open in Konqueror. Tôi cấu hình sai và khi tôi mở thùng rác có thể nó sẽ mở ra với firefox và nó nói "Ứng dụng này không thể được mở trong firefox" và làm cách nào để truy xuất nó trở lại để mở trong Konqueror. Please help me Xin hãy giúp tôi

  16. V.Balaviswanathan V. Balaviswanathan

    This is a cool help site where I have seen all sort of answers regarding ubuntu we get Đây là một trang web giúp mát mẻ, nơi tôi đã thấy tất cả các loại câu trả lời liên quan đến ubuntu chúng tôi nhận được

  17. Ethnopunk Ethnopunk

    Firefox 3.5 always comes up as default, but it doesn't show up as default here: Firefox 3,5 luôn đi kèm lập là mặc định, nhưng nó không hiển thị như là mặc định ở đây:

    sudo update-alternatives –config x-www-browser sudo update-alternatives-config x-www-trình duyệt

    There are 10 alternatives which provide `x-www-browser'. Có 10 lựa chọn thay thế trong đó cung cấp cho `x-www-trình duyệt '.

    Selection Alternative Lựa chọn thay thế
    ———————————————– ----------------
    1 /usr/bin/firefox-3.0 1 / usr/bin/firefox-3.0
    2 /usr/bin/opera 2 / usr / bin / opera
    3 /usr/bin/seamonkey 3 / usr / bin / seamonkey
    4 /usr/bin/midori 4 / bin / usr / Midori
    5 /usr/bin/epiphany-gecko 5 / usr / bin / Epiphany-gecko
    6 /usr/bin/firefox-2 6 / usr/bin/firefox-2
    *+ 7 /usr/bin/galeon * + 7 / usr / bin / Galeon
    8 /usr/bin/kazehakase 8 / usr / bin / kazehakase
    9 /usr/bin/netsurf 9 / usr / bin / netsurf
    10 /usr/bin/firefox-3.5 10 / usr/bin/firefox-3.5

    Press enter to keep the default[*], or type selection number: Bấm Enter để giữ giá trị mặc định [*], hoặc gõ số lựa chọn:

    I have blackbox as alternative session, and Galeon is default there. Tôi có Blackbox như phiên thay thế, và Galeon là mặc định ở đó. How do I change the default for Gnome? Làm thế nào để thay đổi mặc định cho Gnome?


Leave a Comment Để lại một Thảo luận




Leave your Để lại của bạn friendly thân thiện comment here. bình luận ở đây.

If you have a computer help question, Nếu bạn có một câu hỏi giúp máy tính, click here to leave it on the forums bấm vào đây để lại nó trên các diễn đàn instead. thay vì.

Note: Your comment may not show up immediately on the site. Lưu ý: Ý kiến của bạn có thể không hiển thị ngay lập tức trên trang web.

Our Friends Bạn bè của chúng tôi
Getting Started Bắt đầu


About How-To Geek Giới How-To Geek
What Is That Process? Quá trình đó là gì?
svchost.exe svchost.exe
jusched.exe jusched.exe
dwm.exe dwm.exe
ctfmon.exe ctfmon.exe
wmpnetwk.exe wmpnetwk.exe
wmpnscfg.exe wmpnscfg.exe
rundll32.exe rundll32.exe
wfcrun32.exe wfcrun32.exe
Ipoint.exe Ipoint.exe
Itype.exe Itype.exe
Wfica32.exe Wfica32.exe
Mobsync.exe Mobsync.exe
conhost.exe conhost.exe
Dpupdchk.exe Dpupdchk.exe Adobe_Updater.exe Adobe_Updater.exe

Copyright © 2006-2009 HowToGeek.com. Bản quyền © 2006-2009 HowToGeek.com. All Rights Reserved. Tất cả các quyền.