I would like to create an alias with the function to perform a DuckDuckGo search with W3M via the Command Line Interface (CLI).
I have already created the alias and the DuckDuckGo search engine is called. However, I would also like to enter a search keyword after the alias in the CLI and I do not know how to do that. Example:
alias duckit="w3m https://lite.duckduckgo.com/lite/"
When I enter the command duckit
in the CLI, this alias calls the DuckDuckGo search engine and opens the web page.
But I want the alias to also enter the search keyword in DuckDuckGo and show me the results.
So I tried adding ?q=
at the end of the alias above:
alias duckit="w3m https://lite.duckduckgo.com/lite/?q="
However, running it as follows does not work:
duckit test
What do I need to do?
You cannot use an alias if you need to pass parameters to it, you need to use a function instead. Add this to your
~/.bashrc
file:Now open a new terminal and try
duckit test
.Installation guide
Install the W3M Web-Browser:
Or with image support (shows images on web pages):
Copy the following command into the CLI and press Enter:
4.Open a new CLI and run a search
DuckIt - Update Version 0.4
DuckDuckGo offers a pure HTML version of its search engine.
Since the W3M does not support JavaScript anyway, it is better to use the DDG-HTML page. This has one advantage, the HTML page contains no scripts and therefore less code. Less code means smaller HTML-file and therefore less data transfer, which makes the page load faster.
If you already have DuckIt-W3m installed, just change the string in the
~/.bashrc
file with your favorite text editor (e.g.nano ~/.bashrc
) fromlite
tohtml
.https://lite.duckduckgo.com/html/
DuckIt - Update Version 0.5
Some people like the Lynx web browser better, so I have two new aliases for you.
The alias has changed.
The DDG-Lynx alias is:
duckitl
Open a new CLI and run a search:
Probably the fastest search on Planet.