GNUNET-SEARCH(1) | General Commands Manual | GNUNET-SEARCH(1) |
gnunet-search
— a
command line interface to search for content on GNUnet
gnunet-search |
[-a LEVEL |
--anonymity= LEVEL]
[-b | --bookmark-only ]
[-c FILENAME |
--config= FILENAME]
[-F FORMAT |
--dir-printf= FORMAT]
[-f FORMAT |
--printf= FORMAT]
[-h | --help ]
[-i FORMAT |
--iter-printf= FORMAT]
[-L LOGLEVEL |
--loglevel= LOGLEVEL]
[-l FILENAME |
--logfile= FILENAME]
[-o FILENAME |
--output= FILENAME]
[-n | --no-network ]
[-N VALUE |
--results= VALUE]
[-s | --silent ]
[-t DELAY |
--timeout= DELAY]
[-v | --version ]
[-V | --verbose ]
⟨KEYWORD⟩ ⟨+KEYWORD⟩ |
⟨URI⟩
⟨+URI⟩ |
Search for content on GNUnet. The keywords are case-sensitive.
gnunet-search
can be used both for a search in the
global namespace as well as for searching a private subspace. The options
are as follows:
-a
LEVEL |
--anonymity=
LEVEL-b
|
--bookmark-only
-c
FILENAME |
--config=
FILENAME-F
FORMAT |
--dir-printf=
FORMAT--printf
argument
(please refer to it for more information). If missing,
--dir-printf
defaults to
--printf
. If --printf
is
missing too --dir-printf
defaults to
‘#%n:\ngnunet-download -o "%f" -R
%u\n\n
’.-f
FORMAT |
--printf=
FORMAT\
’ and
‘%
’ directives are interpreted as
follows:
\\
\
’)\a
\b
\e
\f
\n
\r
\t
\v
\0
\N...
\xX...
Note: The
‘\
’ character followed by any
other character not listed above is treated as an ordinary character, so
both characters are printed.
%%
%a
--iter-printf
argument; this specifier optionally supports metatype filtering via
hash sign (e.g.
‘%2#a
’ prints all embedded file
names, if present - see libextractor's metatypes for the complete list
of numerical identifiers)%f
%j
--iter-printf
argument; this specifier
optionally supports metatype filtering via hash sign
(e.g.
‘%5#j
’ prints a book title, if
present); see libextractor's metatypes for the complete list of
numerical identifiers)%l
%m
%n
%s
%u
Note: The
‘%
’ character followed by any
other character not listed above is treated as an ordinary character, so
both characters are printed.
If missing, --printf
defaults to
‘#%n:\ngnunet-download -o "%f"
%u\n\n
’.
-h
|
--help
-i
FORMAT |
--iter-printf=
FORMAT%a
’ or
‘%j
’ format specifiers appear in
--printf
or --dir-printf
,
list each metadata property according to FORMAT, in
which the ‘\
’ directives are
interpreted as in --printf
and
--dir-printf
, while the
‘%
’ directives are interpreted as
follows:
%%
%p
%l
%i
%n
%t
%w
Note: The
‘%
’ character followed by any
other character not listed above is treated as an ordinary character, so
both characters are printed.
If missing, --iter-printf
defaults to
‘ %t: %p\n
’ or
‘ MetaType #%i: %p\n
’, depending
on whether the program was compiled with libextractor or not.
-L
LOGLEVEL |
--loglevel=
LOGLEVEL-l
FILENAME |
--logfile=
FILENAME-o
FILENAME |
--output=
FILENAMEgnunet-search --output=commons.gnd
commons
’).-n
|
--no-network
-N
VALUE |
--results=
VALUE-s
|
--silent
--output
argument is required).-t
DELAY |
--timeout=
DELAY-v
|
--version
-V
|
--verbose
%a\n
’ to the default
--printf
and --dir-printf
arguments – ignored when these are provided by the userIt is possible to run gnunet-search
with
an URI instead of a keyword. The URI can have the format for a namespace
search or for a keyword search. For a namespace search, the format is
gnunet://fs/sks/NAMESPACE/IDENTIFIER
For a keyword search, use
gnunet://fs/ksk/KEYWORD[+KEYWORD]*
If the format does not correspond to a GNUnet URI, GNUnet will automatically assume that keywords are supplied directly.
If multiple keywords are passed,
gnunet-search
will look for content matching any of
the keywords. The ‘+
’ prefix makes a
keyword mandatory.
~/.config/gnunet.conf GNUnet configuration file; specifies the default value for the timeout
Example 1:
$ gnunet-search 'Das
Kapital'
searches for content matching the keyword “Das Kapital”
Example 2:
$ gnunet-search Das
Kapital
searches for content matching either keyword “Das” or keyword “Kapital”
Example 3:
$ gnunet-search +Das
+Kapital
searches for content matching both mandatory keywords “Das” and “Kapital”
Search results are printed by
gnunet-search
like this:
gnunet-download -o "COPYING" gnunet://fs/chk/HASH1.HASH2.SIZE
Description: The GNU General Public License
Mime-type: text/plain
...
The first line contains the command to run to download the file.
The suggested filename in the example is
‘COPYING
’. The GNUnet URI consists of
the key and query hash of the file and finally the size of the file. If the
--verbose
option was provided, after the command to
download the file, GNUnet will print metadata about the file as advertised
in the search result. The metadata here is the description (“The GNU
General Public License”) and the mime-type
(“text-plain”). See the options for
gnunet-publish(1) on how to supply metadata by hand.
The --printf
(-f
),
--dir-printf
(-F
) and
--iter-printf
(-i
) arguments
offer powerful tools for manipulating the output printed. For instance,
Example 4:
$ gnunet-search -f '%f (%s bytes)\n' commons
will print a simple list of the results that match the “commons” keyword, with only the file name and the size printed, without any URI. Or, for instance,
Example 5:
#!/bin/sh
{
printf '<list>'
gnunet-search -f '
<file uri="%u">
<filename len="%l">%f</filename>
<size>%s</size>
<mimetype>%m</mimetype>
<result_id>%n</result_id>
<metadata>%a
</metadata>
</file>' \
-i '
<property tid="%i" type="%t">
<content len="%l">%p</content>
<property_id>%n</property_id>
<provided_by>%w</provided_by>
</property>' \
-t '2 s' commons
printf '\n</list>\n'
} > commons.xml
will run for two seconds and then create a file named commons.xml, containing the search results that match the “commons” keyword in XML format.
gnunet-download(1), gnunet-fs-gtk(1), gnunet-publish(1), gnunet.conf(5)
The full documentation for GNUnet is maintained as a Texinfo manual. If the info(1) and gnunet packages are properly installed at your site, the command
info gnunet
should give you access to the complete handbook,
info gnunet-c-tutorial
will give you access to a tutorial for developers.
Depending on your installation, this information is also available in gnunet(7) and gnunet-c-tutorial(7).
Report bugs by using https://bugs.gnunet.org or by sending electronic mail to <gnunet-developers@gnu.org>.
February 12, 2022 | Debian |