Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Here is a script that you can use to set DuckDuckGo as the default search engine in Google Chrome on Linux using the command line:
- #!/bin/bash
- # Path to the Chrome preferences file
- PREFS_FILE="$HOME/.config/google-chrome/Default/Preferences"
- # Search engine settings to add to the Chrome preferences
- SEARCH_ENGINE='{"default_search_provider":{"enabled":true,"encodings":{"query":"UTF-8","search_url":"UTF-8"},"favicon_url":"https://duckduckgo.com/favicon.ico","id":"1","image_url":"https://duckduckgo.com/assets/logo.icon.svg","image_url_post_params":"","instant_url":"","keyword":"duckduckgo.com","name":"DuckDuckGo","search_url":"https://duckduckgo.com/?q={searchTerms}","suggest_url":""}}'
- # Check if the Chrome preferences file exists
- if [ ! -f "$PREFS_FILE" ]; then
- echo "Error: Chrome preferences file not found"
- exit 1
- fi
- # Update the Chrome preferences file with DuckDuckGo as the default search engine
- sed -i 's%"default_search_provider":{[^}]*}%'$SEARCH_ENGINE'%' "$PREFS_FILE"
- echo "Success: DuckDuckGo set as the default search engine in Google Chrome"
- Save this script to a file, for example, set_default_search_engine.sh, make it executable with chmod +x set_default_search_engine.sh, and run it in the terminal. This script will update the Chrome preferences file with DuckDuckGo as the default search engine.
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement