mywiki/linux/cli/ddg.md

123 lines
4.8 KiB
Markdown
Raw Normal View History

2023-06-18 17:22:52 +02:00
# ddgr
Si tratta di un utility da linea di comando per ricercare su DuckDuckgo.
## Installazione
```bash
cd
mkdir git/
cd git/
git clone https://github.com/jarun/ddgr.git
cd ddgr/
sudo make install
```
## Sintassi
```bash
usage: ddgr [-h] [-n N] [-r REG] [--colorize [{auto,always,never}]] [-C]
[--colors COLORS] [-j] [-t SPAN] [-w SITE] [-x] [-p URI]
[--unsafe] [--noua] [--json] [--gb] [--np] [--url-handler UTIL]
[--show-browser-logs] [-v] [-d]
[KEYWORD [KEYWORD ...]]
DuckDuckGo from the terminal.
positional arguments:
KEYWORD search keywords
optional arguments:
-h, --help show this help message and exit
-n N, --num N show N (0<=N<=25) results per page (default 10); N=0
shows actual number of results fetched per page
-r REG, --reg REG region-specific search e.g. 'us-en' for US (default);
visit https://duckduckgo.com/params
--colorize [{auto,always,never}]
whether to colorize output; defaults to 'auto', which
enables color when stdout is a tty device; using
--colorize without an argument is equivalent to
--colorize=always
-C, --nocolor equivalent to --colorize=never
--colors COLORS set output colors (see man page for details)
-j, --ducky open the first result in a web browser; implies --np
-t SPAN, --time SPAN time limit search [d (1 day), w (1 wk), m (1 month), y (1 year)]
-w SITE, --site SITE search sites using DuckDuckGo
-x, --expand Show complete url in search results
-p URI, --proxy URI tunnel traffic through an HTTPS proxy; URI format:
[http[s]://][user:pwd@]host[:port]
--unsafe disable safe search
--noua disable user agent
--json output in JSON format; implies --np
--gb, --gui-browser open a bang directly in gui browser
--np, --noprompt perform search and exit, do not prompt
--rev, --reverse list entries in reversed order
--url-handler UTIL custom script or cli utility to open results
--show-browser-logs do not suppress browser output (stdout and stderr)
-v, --version show program's version number and exit
-d, --debug enable debugging
omniprompt keys:
n, p, f fetch the next, prev or first set of search results
index open the result corresponding to index in browser
o [index|range|a ...] open space-separated result indices, ranges or all
O [index|range|a ...] like key 'o', but try to open in a GUI browser
d keywords new DDG search for 'keywords' with original options
should be used to search omniprompt keys and indices
x toggle url expansion
c index copy url to clipboard
q, ^D, double Enter exit ddgr
? show omniprompt help
* other inputs are considered as new search keywords
```
## Configurazione
Alias per la ricerca in italiano:
```bash
alias dd='ddgr --colorize always --reg it-it'
```
## Utilizzo
```bash
> dd Wikipedia Linux
1. Linux [it.wikipedia.org]
GNU/Linux, comunemente noto come Linux, è una famiglia di sistemi operativi liberi e open source di tipo
Unix-like, pubblicati in varie distribuzioni, aventi la caratteristica comune di utilizzare come nucleo il
kernel Linux: oggi molte importanti società nel campo dell'informatica come: Google, Microsoft, Amazon, IBM,
Oracle, Hewlett-Packard ...
2. Linux [en.wikipedia.org]
Linux (/ ˈ l iː n ʊ k s / LEE-nuuks or / ˈ l ɪ n ʊ k s / LIN-uuks) is a family of open-source Unix-like
operating systems based on the Linux kernel, an operating system kernel first released on September 17, 1991,
by Linus Torvalds. Linux is typically packaged as a Linux distribution, which includes the kernel and
supporting system software and libraries, many of which are provided by ...
3. Distribuzione Linux [it.wikipedia.org]
Una distribuzione Linux, in informatica, è una distribuzione software di un sistema operativo realizzato a
partire dal kernel Linux, un sistema di base GNU e solitamente anche diversi altri applicativi. Tali
distribuzioni appartengono quindi alla sottofamiglia dei sistemi operativi GNU e, più in generale, alla
famiglia dei sistemi ...
```
Premere il numero corrispondente per aprire il collegamento nel browser predefinito dal sistema.
### bang
```bash
> ddgr \!amazonit emacs manuale
```
e viene immediatamente aperta la rispettiva ricerca nel browser. Per la lista completa delle `bangs`:
[https://duckduckgo.com/bangs](https://duckduckgo.com/bangs)
## Collegamenti
- [https://github.com/jarun/ddgr](https://github.com/jarun/ddgr)