はじめに
ターミナルからDuckDuckGo
を使う、ddgr
というコマンドがあるらしい。
これを使ってみる。
https://packages.ubuntu.com/noble/misc/ddgr
環境
Windows 11 Professional
WSL2 Ubuntu 24.04 LTS
ddgrコマンドのインストール
sudo apt-get install ddgr
ログ
sudo apt-get install ddgr
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following NEW packages will be installed:
ddgr
0 upgraded, 1 newly installed, 0 to remove and 124 not upgraded.
Need to get 36.5 kB of archives.
After this operation, 130 kB of additional disk space will be used.
Get:1 http://archive.ubuntu.com/ubuntu noble/universe amd64 ddgr all 2.2-1 [36.5 kB]
Fetched 36.5 kB in 1s (50.9 kB/s)
Selecting previously unselected package ddgr.
(Reading database ... 77182 files and directories currently installed.)
Preparing to unpack .../archives/ddgr_2.2-1_all.deb ...
Unpacking ddgr (2.2-1) ...
Setting up ddgr (2.2-1) ...
Processing triggers for man-db (2.12.0-4build2) ...
ddgrを使う
ddgr
(? for help)
と出てくるので、?
でヘルプを見てみる。
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
表形式にまとめると以下の通り。
キー | 説明 |
---|---|
n, p, f | 次、前、または最初の検索結果セットを取得する |
index | 指定したインデックスの検索結果をブラウザで開く |
o [index|range|a …] | スペース区切りのインデックス、範囲、またはすべての結果を開く |
O [index|range|a …] | ‘o’ と同様だが、GUIブラウザで開こうとする |
d キーワード | 元のオプションを保持したまま ‘キーワード’ で新規 DDG 検索を行う(omniprompt のキーやインデックスの検索に使用) |
x | URL 展開の切り替え |
c index | 指定したインデックスの URL をクリップボードにコピー |
q, ^D, Enter 2回 | ddgr を終了する |
? | omniprompt のヘルプを表示する |
* | その他の入力は新しい検索キーワードとして扱う |
というわけで検索をしてみる。
キーワード検索
ddgr
ddgr (? for help) かつおぶし
1. 鰹節 - Wikipedia [ja.wikipedia.org]
鰹節(かつおぶし)は、カツオの魚肉を煮熟してから乾燥させた日本の保存食品。「かつぶし」とも言う。
「かつぶし」とも言う。 なお、 おかか は鰹節または 削り節 のことを指す [ 3 ] 。
2. 日本の伝統食「鰹節」とは?種類、栄養、削り方、だし取りの総まとめ [www.kobayashi-foods.co.jp]
鰹節は日本の伝統食で、鰹の身をボイルして水分を26%以下まで燻製にしたものです。本記事では、鰹節の種類や栄養、削り方
やだし取りの方法などを詳しく解説しています。
3. Katsuobushi - Wikipedia [en.wikipedia.org]
Steam animates katsuobushi A bag of katsuobushi flakes. Katsuobushi (Japanese: 鰹節) is simmered, smoked and
fermented skipjack tuna (Katsuwonus pelamis, sometimes referred to as bonito).It is also known as bonito flakes
or broadly as okaka (おかか).. Shaved katsuobushi and dried kelp—kombu—are the main ingredients of dashi, a broth
... (中略) ...
検索した結果をURLで開く
※URLで開く前に環境変数のBROWSER
を設定しておく。
今回は下記のように設定した。
export BROWSER="/mnt/c/Program Files/Google/Chrome/Application/chrome.exe"
ddgr かつおぶし
オムニプロンプトで下記を実行 (1番目の検索結果がchromeブラウザで開かれる)
1
特定のサイトで検索をする
ddgr -w amazon.co.jp かつおぶし
1. Amazon.co.jp: かつおぶし - アマゾン [www.amazon.co.jp]
ホクイリ 本枯本節 鰹節 鹿児島県産 農林水産大臣賞受賞歴有り 本節 かつお節 かつおぶし 出汁 だし 和食 乾物
(背節1本(230g)) 5つ星のうち4.7 4 過去1か月で100点以上購入されました
2. Amazon.co.jp: 鰹節 - アマゾン [www.amazon.co.jp]
ホクイリ 本枯節 破砕 削り節 100g 鰹節 鹿児島県産 農林水産大臣賞受賞歴有り かつお節 かつおぶし 出汁 だし 和食 乾物
(100g(1袋)) 5つ星のうち3.0 1 ¥1,220 ¥ 1,220 ( ¥12 ¥12 /グラム)
3. かつおぶしの中野(東京鰹節類卸商業協同組合 組合員の「有限会社 中野」が運営しております。) @ Amazon.co.jp: [www.amazon.co.jp]
かつおぶしの中野(東京鰹節類卸商業協同組合 組合員の「有限会社 中野」が運営しております。)
... (中略) ...
参考
jarun / ddgr
https://github.com/jarun/ddgrWSL の Linux から Windows のブラウザで URL を開く
https://blog.1q77.com/2024/01/open-browser-in-wsl/
おわりに
DuckDuckGo
を今後使っていきたいなと思ったので、まずはddgr
コマンドから使ってみた。
ターミナルで検索できるのはかなり楽なので今後も使っていきたいなぁ。