neulab/tldr huggingface dataset:
-z, --time-cond <time> (HTTP FTP) Request a file that has been modified later than the given time and date, or one that has been modified before that time. The <date expression> can be all sorts of date strings or if it does not match any internal ones, it is taken as a filename and tries to get the modification date (mtime) from <file> instead. See the curl_getdate(3) man pages for date expression details.
Start the date expression with a dash (-) to make it request for a document that is older than the given date/time, default is a document that is newer than the specified date/time.
Examples: curl -z "Wed 01 Sep 2021 12:18:00" https://example.com curl -z "-Wed 01 Sep 2021 12:18:00" https://example.com curl -z file https://example.com
--tls-max <VERSION> (SSL) VERSION defines maximum supported TLS version. The minimum acceptable version is set by tlsv1.0, tlsv1.1, tlsv1.2 or tlsv1.3.
If the connection is done without TLS, this option has no effect. This includes QUIC-using (HTTP/3) transfers.
default Use up to recommended TLS version.
1.0    Use up to TLSv1.0.
1.1    Use up to TLSv1.1.
1.2    Use up to TLSv1.2.
1.3    Use up to TLSv1.3.
Examples: curl --tls-max 1.2 https://example.com curl --tls-max 1.3 --tlsv1.2 https://example.com
See also --tlsv1.0, --tlsv1.1, --tlsv1.2 and --tlsv1.3. --tls-max requires that the underlying libcurl was built to support TLS. Added in 7.54.0.
--tls13-ciphers <ciphersuite list> (TLS) Specifies which cipher suites to use in the connection if it negotiates TLS 1.3. The list of ciphers suites must specify valid ciphers. Read up on TLS 1.3 cipher suite details on this URL:
This option is currently used only when curl is built to use OpenSSL 1.1.1 or later. If you are using a different SSL backend you can try setting TLS 1.3 cipher suites by using the --ciphers option.
Example: curl --tls13-ciphers TLS_AES_128_GCM_SHA256 https://example.com
--tlsauthtype <type> Set TLS authentication type. Currently, the only supported option is "SRP", for TLS-SRP (RFC 5054). If --tlsuser and --tlspassword are specified but --tlsauthtype is not, then this option defaults to "SRP".  This option works only if the underlying libcurl is built with TLS-SRP support, which requires OpenSSL or GnuTLS with TLS-SRP support.
Example: curl --tlsauthtype SRP https://example.com
--tlspassword <string> Set password for use with the TLS authentication method specified with --tlsauthtype. Requires that --tlsuser also be set.
This option does not work with TLS 1.3.
Example: curl --tlspassword pwd --tlsuser user https://example.com
--tlsuser <name> Set username for use with the TLS authentication method specified with --tlsauthtype. Requires that --tlspassword also is set.
--tlsv1.0 (TLS) Forces curl to use TLS version 1.0 or later when connecting to a remote TLS server.
In old versions of curl this option was documented to allow _only_ TLS 1.0, but behavior was inconsistent depending on the TLS library. Use --tls-max if you want to set a maximum TLS version.
Example: curl --tlsv1.0 https://example.com
--tlsv1.1 (TLS) Forces curl to use TLS version 1.1 or later when connecting to a remote TLS server.
In old versions of curl this option was documented to allow _only_ TLS 1.1, but behavior was inconsistent depending on the TLS library. Use --tls-max if you want to set a maximum TLS version.
Example: curl --tlsv1.1 https://example.com
--tlsv1.2 (TLS) Forces curl to use TLS version 1.2 or later when connecting to a remote TLS server.
In old versions of curl this option was documented to allow _only_ TLS 1.2, but behavior was inconsistent depending on the TLS library. Use --tls-max if you want to set a maximum TLS version.
Example: curl --tlsv1.2 https://example.com
--tlsv1.3 (TLS) Forces curl to use TLS version 1.3 or later when connecting to a remote TLS server.
Note that TLS 1.3 is not supported by all TLS backends.
Example: curl --tlsv1.3 https://example.com
-1, --tlsv1 (SSL) Tells curl to use at least TLS version 1.x when negotiating with a remote TLS server. That means TLS version 1.0 or higher
Example: curl --tlsv1 https://example.com
See also --http1.1 and --http2. -1, --tlsv1 requires that the underlying libcurl was built to support TLS. This option overrides --tlsv1.1 and --tlsv1.2 and --tlsv1.3.
--tr-encoding (HTTP) Request a compressed Transfer-Encoding response using one of the algorithms curl supports, and uncompress the data while receiving it.
Example: curl --tr-encoding https://example.com
--trace-ascii <file> Enables a full trace dump of all incoming and outgoing data, including descriptive information, to the given output file. Use "-" as filename to have the output sent to stdout.
This is similar to --trace, but leaves out the hex part and only shows the ASCII part of the dump. It makes smaller output that might be easier to read for untrained humans.
Example: curl --trace-ascii log.txt https://example.com
This option overrides --trace and -v, --verbose.
--trace-time Prepends a time stamp to each trace or verbose line that curl displays.
Example: curl --trace-time --trace-ascii output https://example.com
--trace <file> Enables a full trace dump of all incoming and outgoing data, including descriptive information, to the given output file. Use "-" as filename to have the output sent to stdout. Use "%" as filename to have the output sent to stderr.
Example: curl --trace log.txt https://example.com
This option overrides -v, --verbose and --trace-ascii.
--unix-socket <path> (HTTP) Connect through this Unix domain socket, instead of using the network.
Example: curl --unix-socket socket-path https://example.com
Added in 7.40.0.
-T, --upload-file <file> This transfers the specified local file to the remote URL. If there is no file part in the specified URL, curl will append the local file name. NOTE that you must use a trailing / on the last directory to really prove to Curl that there is no file name or curl will think that your last directory name is the remote file name to use. That will most likely cause the upload operation to fail. If this is used on an HTTP(S) server, the PUT command will be used.
Use the file name "-" (a single dash) to use stdin instead of a given file.  Alternately, the file name "." (a single period) may be specified instead of "-" to use stdin in non-blocking mode to allow reading server output while stdin is being uploaded.
You can specify one -T, --upload-file for each URL on the command line. Each -T, --upload-file + URL pair specifies what to upload and to where. curl also supports "globbing" of the -T, --upload- file argument, meaning that you can upload multiple files to a single URL by using the same URL globbing style supported in the URL.
When uploading to an SMTP server: the uploaded data is assumed to be RFC 5322 formatted. It has to feature the necessary set of headers and mail body formatted correctly by the user as curl will not transcode nor encode it further in any way.
Examples: curl -T file https://example.com curl -T "img[1-1000].png" ftp://ftp.example.com/ curl --upload-file "{file1,file2}" https://example.com
--url <url> Specify a URL to fetch. This option is mostly handy when you want to specify URL(s) in a config file.
If the given URL is missing a scheme name (such as "http://" or "ftp://" etc) then curl will make a guess based on the host. If the outermost sub-domain name matches DICT, FTP, IMAP, LDAP, POP3 or SMTP then that protocol will be used, otherwise HTTP will be used. Since 7.45.0 guessing can be disabled by setting a default protocol, see --proto-default for details.
This option may be used any number of times. To control where this URL is written, use the -o, --output or the -O, --remote-name options.
WARNING: On Windows, particular file:// accesses can be converted to network accesses by the operating system. Beware!
Example: curl --url https://example.com
-B, --use-ascii (FTP LDAP) Enable ASCII transfer. For FTP, this can also be enforced by using a URL that ends with ";type=A". This option causes data sent to stdout to be in text mode for win32 systems.
Example: curl -B ftp://example.com/README
-A, --user-agent <name> (HTTP) Specify the User-Agent string to send to the HTTP server. To encode blanks in the string, surround the string with single quote marks. This header can also be set with the -H, --header or the --proxy-header options.
If you give an empty argument to -A, --user-agent (""), it will remove the header completely from the request. If you prefer a blank header, you can set it to a single space (" ").
Example: curl -A "Agent 007" https://example.com
-u, --user <user:password> Specify the user name and password to use for server authentication. Overrides -n, --netrc and --netrc-optional.
If you simply specify the user name, curl will prompt for a password.
The user name and passwords are split up on the first colon, which makes it impossible to use a colon in the user name with this option. The password can, still.
On systems where it works, curl will hide the given option argument from process listings. This is not enough to protect credentials from possibly getting seen by other users on the same system as they will still be visible for a moment before cleared. Such sensitive data should be retrieved from a file instead or similar and never used in clear text in a command line.
When using Kerberos V5 with a Windows based server you should include the Windows domain name in the user name, in order for the server to successfully obtain a Kerberos Ticket. If you do not, then the initial authentication handshake may fail.
When using NTLM, the user name can be specified simply as the user name, without the domain, if there is a single domain and forest in your setup for example.
To specify the domain name use either Down-Level Logon Name or UPN (User Principal Name) formats. For example, EXAMPLE\user and user@example.com respectively.
If you use a Windows SSPI-enabled curl binary and perform Kerberos V5, Negotiate, NTLM or Digest authentication then you can tell curl to select the user name and password from your environment by specifying a single colon with this option: "-u :".
Example: curl -u user:secret https://example.com
-v, --verbose Makes curl verbose during the operation. Useful for debugging and seeing what's going on "under the hood". A line starting with '>' means "header data" sent by curl, '<' means "header data" received by curl that is hidden in normal cases, and a line starting with '*' means additional info provided by curl.
If you only want HTTP headers in the output, -i, --include might be the option you are looking for.
If you think this option still does not give you enough details, consider using --trace or --trace-ascii instead.
Use -s, --silent to make curl really quiet.
Example: curl --verbose https://example.com
See also -i, --include. This option overrides --trace and --trace- ascii.
-V, --version Displays information about curl and the libcurl version it uses.
The first line includes the full version of curl, libcurl and other 3rd party libraries linked with the executable.
The second line (starts with "Protocols:") shows all protocols that libcurl reports to support.
The third line (starts with "Features:") shows specific features libcurl reports to offer. Available features include:
alt-svc Support for the Alt-Svc: header is provided.
AsynchDNS This curl uses asynchronous name resolves. Asynchronous name resolves can be done using either the c-ares or the threaded resolver backends.
brotli Support for automatic brotli compression over HTTP(S).
CharConv curl was built with support for character set conversions (like EBCDIC)
Debug  This curl uses a libcurl built with Debug. This enables more error-tracking and memory debugging etc. For curl- developers only!
gsasl  The built-in SASL authentication includes extensions to support SCRAM because libcurl was built with libgsasl.
GSS-API GSS-API is supported.
HSTS   HSTS support is present.
HTTP2  HTTP/2 support has been built-in.
HTTP3  HTTP/3 support has been built-in.
HTTPS-proxy This curl is built to support HTTPS proxy.
IDN    This curl supports IDN - international domain names.
IPv6   You can use IPv6 with this.
Kerberos Kerberos V5 authentication is supported.
Largefile This curl supports transfers of large files, files larger than 2GB.
libz   Automatic decompression (via gzip, deflate) of compressed files over HTTP is supported.
MultiSSL This curl supports multiple TLS backends.
NTLM   NTLM authentication is supported.
NTLM_WB NTLM delegation to winbind helper is supported.
PSL    PSL is short for Public Suffix List and means that this curl has been built with knowledge about "public suffixes".
SPNEGO SPNEGO authentication is supported.
SSL    SSL versions of various protocols are supported, such as HTTPS, FTPS, POP3S and so on.
SSPI   SSPI is supported.
TLS-SRP SRP (Secure Remote Password) authentication is supported for TLS.
TrackMemory Debug memory tracking is supported.
Unicode Unicode support on Windows.
UnixSockets Unix sockets support is provided.
zstd   Automatic decompression (via zstd) of compressed files over HTTP is supported.
Example: curl --version
-w, --write-out <format> Make curl display information on stdout after a completed transfer. The format is a string that may contain plain text mixed with any number of variables. The format can be specified as a literal "string", or you can have curl read the format from a file with "@filename" and to tell curl to read the format from stdin you write "@-".
The variables present in the output format will be substituted by the value or text that curl thinks fit, as described below. All variables are specified as %{variable_name} and to output a normal % you just write them as %%. You can output a newline by using \n, a carriage return with \r and a tab space with \t.
The output will be written to standard output, but this can be switched to standard error by using %{stderr}.
NOTE: The %-symbol is a special symbol in the win32-environment, where all occurrences of % must be doubled when using this option.
The variables available are:
content_type   The Content-Type of the requested document, if there was any.
errormsg       The error message. (Added in 7.75.0)
exitcode       The numerical exitcode of the transfer. (Added in 7.75.0)
filename_effective The ultimate filename that curl writes out to. This is only meaningful if curl is told to write to a file with the -O, --remote-name or -o, --output option. It's most useful in combination with the -J, --remote-header-name option.
ftp_entry_path The initial path curl ended up in when logging on to the remote FTP server.
http_code      The numerical response code that was found in the last retrieved HTTP(S) or FTP(s) transfer.
http_connect   The numerical code that was found in the last response (from a proxy) to a curl CONNECT request.
http_version   The http version that was effectively used. (Added in 7.50.0)
json           A JSON object with all available keys.
local_ip       The IP address of the local end of the most recently done connection - can be either IPv4 or IPv6.
local_port     The local port number of the most recently done connection.
method         The http method used in the most recent HTTP request. (Added in 7.72.0)
num_connects   Number of new connects made in the recent transfer.
num_headers    The number of response headers in the most recent request (restarted at each redirect). Note that the status line IS NOT a header. (Added in 7.73.0)
num_redirects  Number of redirects that were followed in the request.
onerror        The rest of the output is only shown if the transfer returned a non-zero error (Added in 7.75.0)
proxy_ssl_verify_result The result of the HTTPS proxy's SSL peer certificate verification that was requested. 0 means the verification was successful. (Added in 7.52.0)
redirect_url   When an HTTP request was made without -L, --location to follow redirects (or when --max- redirs is met), this variable will show the actual URL a redirect would have gone to.
referer        The Referer: header, if there was any. (Added in 7.76.0)
remote_ip      The remote IP address of the most recently done connection - can be either IPv4 or IPv6.
remote_port    The remote port number of the most recently done connection.
response_code  The numerical response code that was found in the last transfer (formerly known as "http_code").
scheme         The URL scheme (sometimes called protocol) that was effectively used. (Added in 7.52.0)
size_download  The total amount of bytes that were downloaded. This is the size of the body/data that was transferred, excluding headers.
size_header    The total amount of bytes of the downloaded headers.
size_request   The total amount of bytes that were sent in the HTTP request.
size_upload    The total amount of bytes that were uploaded. This is the size of the body/data that was transferred, excluding headers.
speed_download The average download speed that curl measured for the complete download. Bytes per second.
speed_upload   The average upload speed that curl measured for the complete upload. Bytes per second.
ssl_verify_result The result of the SSL peer certificate verification that was requested. 0 means the verification was successful.
stderr         From this point on, the -w, --write-out output will be written to standard error. (Added in 7.63.0)
stdout         From this point on, the -w, --write-out output will be written to standard output.  This is the default, but can be used to switch back after switching to stderr.  (Added in 7.63.0)
time_appconnect The time, in seconds, it took from the start until the SSL/SSH/etc connect/handshake to the remote host was completed.
time_connect   The time, in seconds, it took from the start until the TCP connect to the remote host (or proxy) was completed.
time_namelookup The time, in seconds, it took from the start until the name resolving was completed.
time_pretransfer The time, in seconds, it took from the start until the file transfer was just about to begin. This includes all pre-transfer commands and negotiations that are specific to the particular protocol(s) involved.
time_redirect  The time, in seconds, it took for all redirection steps including name lookup, connect, pretransfer and transfer before the final transaction was started. time_redirect shows the complete execution time for multiple redirections.
time_starttransfer The time, in seconds, it took from the start until the first byte was just about to be transferred. This includes time_pretransfer and also the time the server needed to calculate the result.
time_total     The total time, in seconds, that the full operation lasted.
url            The URL that was fetched. (Added in 7.75.0)
urlnum         The URL index number of this transfer, 0-indexed. De-globbed URLs share the same index number as the origin globbed URL. (Added in 7.75.0)
url_effective  The URL that was fetched last. This is most meaningful if you have told curl to follow location: headers.
Example: curl -w '%{http_code}\n' https://example.com
--xattr When saving output to a file, this option tells curl to store certain file metadata in extended file attributes. Currently, the URL is stored in the xdg.origin.url attribute and, for HTTP, the content type is stored in the mime_type attribute. If the file system does not support extended attributes, a warning is issued.
Example: curl --xattr -o storage https://example.com
~/.curlrc Default config file, see -K, --config for details.
The environment variables can be specified in lower case or upper case. The lower case version has precedence. http_proxy is an exception as it is only available in lower case.
Using an environment variable to set the proxy has the same effect as using the -x, --proxy option.
http_proxy [protocol://]<host>[:port] Sets the proxy server to use for HTTP.
HTTPS_PROXY [protocol://]<host>[:port] Sets the proxy server to use for HTTPS.
[url-protocol]_PROXY [protocol://]<host>[:port] Sets the proxy server to use for [url-protocol], where the protocol is a protocol that curl supports and as specified in a URL. FTP, FTPS, POP3, IMAP, SMTP, LDAP, etc.
ALL_PROXY [protocol://]<host>[:port] Sets the proxy server to use if no protocol-specific proxy is set.
NO_PROXY <comma-separated list of hosts/domains> list of host names that should not go through any proxy. If set to an asterisk '*' only, it matches all hosts. Each name in this list is matched as either a domain name which contains the hostname, or the hostname itself.
This environment variable disables use of the proxy even when specified with the -x, --proxy option. That is NO_PROXY=direct.example.com curl -x http://proxy.example.com http://direct.example.com accesses the target URL directly, and NO_PROXY=direct.example.com curl -x http://proxy.example.com http://somewhere.example.com accesses the target URL through the proxy.
The list of host names can also be include numerical IP addresses, and IPv6 versions should then be given without enclosing brackets.
IPv6 numerical addresses are compared as strings, so they will only match if the representations are the same: "::1" is the same as "::0:1" but they do not match.
CURL_SSL_BACKEND <TLS backend> If curl was built with support for "MultiSSL", meaning that it has built-in support for more than one TLS backend, this environment variable can be set to the case insensitive name of the particular backend to use when curl is invoked. Setting a name that is not a built-in alternative will make curl stay with the default.
SSL backend names (case-insensitive): bearssl, gnutls, gskit, mbedtls, mesalink, nss, openssl, rustls, schannel, secure- transport, wolfssl
QLOGDIR <directory name> If curl was built with HTTP/3 support, setting this environment variable to a local directory will make curl produce qlogs in that directory, using file names named after the destination connection id (in hex). Do note that these files can become rather large. Works with both QUIC backends.
SSLKEYLOGFILE <file name> If you set this environment variable to a file name, curl will store TLS secrets from its connections in that file when invoked to enable you to analyze the TLS traffic in real time using network analyzing tools such as Wireshark. This works with the following TLS backends: OpenSSL, libressl, BoringSSL, GnuTLS, NSS and wolfSSL.
The proxy string may be specified with a protocol:// prefix to specify alternative proxy protocols.
If no protocol is specified in the proxy string or if the string does not match a supported one, the proxy will be treated as an HTTP proxy.
The supported proxy protocol prefixes are as follows:
http:// Makes it use it as an HTTP proxy. The default if no scheme prefix is used.
https:// Makes it treated as an HTTPS proxy.
socks4:// Makes it the equivalent of --socks4
socks4a:// Makes it the equivalent of --socks4a
socks5:// Makes it the equivalent of --socks5
socks5h:// Makes it the equivalent of --socks5-hostname
There are a bunch of different error codes and their corresponding error messages that may appear under error conditions. At the time of this writing, the exit codes are:
1      Unsupported protocol. This build of curl has no support for this protocol.
2      Failed to initialize.
3      URL malformed. The syntax was not correct.
4      A feature or option that was needed to perform the desired request was not enabled or was explicitly disabled at build-time. To make curl able to do this, you probably need another build of libcurl!
5      Could not resolve proxy. The given proxy host could not be resolved.
6      Could not resolve host. The given remote host could not be resolved.
7      Failed to connect to host.
8      Weird server reply. The server sent data curl could not parse.
9      FTP access denied. The server denied login or denied access to the particular resource or directory you wanted to reach. Most often you tried to change to a directory that does not exist on the server.
10     FTP accept failed. While waiting for the server to connect back when an active FTP session is used, an error code was sent over the control connection or similar.
11     FTP weird PASS reply. Curl could not parse the reply sent to the PASS request.
12     During an active FTP session while waiting for the server to connect back to curl, the timeout expired.
13     FTP weird PASV reply, Curl could not parse the reply sent to the PASV request.
14     FTP weird 227 format. Curl could not parse the 227-line the server sent.
15     FTP cannot use host. Could not resolve the host IP we got in the 227-line.
16     HTTP/2 error. A problem was detected in the HTTP2 framing layer. This is somewhat generic and can be one out of several problems, see the error message for details.
17     FTP could not set binary. Could not change transfer method to binary.
18     Partial file. Only a part of the file was transferred.
19     FTP could not download/access the given file, the RETR (or similar) command failed.
21     FTP quote error. A quote command returned error from the server.
22     HTTP page not retrieved. The requested url was not found or returned another error with the HTTP error code being 400 or above. This return code only appears if -f, --fail is used.
23     Write error. Curl could not write data to a local filesystem or similar.
25     FTP could not STOR file. The server denied the STOR operation, used for FTP uploading.
26     Read error. Various reading problems.
27     Out of memory. A memory allocation request failed.
28     Operation timeout. The specified time-out period was reached according to the conditions.
30     FTP PORT failed. The PORT command failed. Not all FTP servers support the PORT command, try doing a transfer using PASV instead!
31     FTP could not use REST. The REST command failed. This command is used for resumed FTP transfers.
33     HTTP range error. The range "command" did not work.
34     HTTP post error. Internal post-request generation error.
35     SSL connect error. The SSL handshaking failed.
36     Bad download resume. Could not continue an earlier aborted download.
37     FILE could not read file. Failed to open the file. Permissions?
38     LDAP cannot bind. LDAP bind operation failed.
39     LDAP search failed.
41     Function not found. A required LDAP function was not found.
42     Aborted by callback. An application told curl to abort the operation.
43     Internal error. A function was called with a bad parameter.
45     Interface error. A specified outgoing interface could not be used.
47     Too many redirects. When following redirects, curl hit the maximum amount.
48     Unknown option specified to libcurl. This indicates that you passed a weird option to curl that was passed on to libcurl and rejected. Read up in the manual!
49     Malformed telnet option.
51     The peer's SSL certificate or SSH MD5 fingerprint was not OK.
52     The server did not reply anything, which here is considered an error.
53     SSL crypto engine not found.
54     Cannot set SSL crypto engine as default.
55     Failed sending network data.
56     Failure in receiving network data.
58     Problem with the local certificate.
59     Could not use specified SSL cipher.
60     Peer certificate cannot be authenticated with known CA certificates.
61     Unrecognized transfer encoding.
62     Invalid LDAP URL.
63     Maximum file size exceeded.
64     Requested FTP SSL level failed.
65     Sending the data requires a rewind that failed.
66     Failed to initialise SSL Engine.
67     The user name, password, or similar was not accepted and curl failed to log in.
68     File not found on TFTP server.
69     Permission problem on TFTP server.
70     Out of disk space on TFTP server.
71     Illegal TFTP operation.
72     Unknown TFTP transfer ID.
73     File already exists (TFTP).
74     No such user (TFTP).
75     Character conversion failed.
76     Character conversion functions required.
77     Problem reading the SSL CA cert (path? access rights?).
78     The resource referenced in the URL does not exist.
79     An unspecified error occurred during the SSH session.
80     Failed to shut down the SSL connection.
82     Could not load CRL file, missing or wrong format.
83     Issuer check failed.
84     The FTP PRET command failed.
85     Mismatch of RTSP CSeq numbers.
86     Mismatch of RTSP Session Identifiers.
87     Unable to parse FTP file list.
88     FTP chunk callback reported error.
89     No connection available, the session will be queued.
90     SSL public key does not matched pinned public key.
91     Invalid SSL certificate status.
92     Stream error in HTTP/2 framing layer.
93     An API function was called from inside a callback.
94     An authentication function returned an error.
95     A problem was detected in the HTTP/3 layer. This is somewhat generic and can be one out of several problems, see the error message for details.
96     QUIC connection error. This error may be caused by an SSL library error. QUIC is the protocol used for HTTP/3 transfers.
XX     More error codes will appear here in future releases. The existing ones are meant to never change.
AUTHORS / CONTRIBUTORS Daniel Stenberg is the main author, but the whole list of contributors is found in the separate THANKS file.
https://curl.se
ftp(1), wget(1)
MONGO(1)                         mongodb-manual                         MONGO(1)
mongo - MongoDB Shell
mongo is an interactive JavaScript shell interface to MongoDB, which provides a powerful interface for systems administrators as well as a way for developers to test queries and operations directly with the database. mongo also provides a fully functional JavaScript environment for use with a MongoDB. This document addresses the basic invocation of the mongo shell and an overview of its usage.
mongo [--shell] [--nodb] [--norc] [--quiet] [--port <port>] [--host <host>] [--eval <JavaScript>] [-u <username>] [--username <username>] [-p <password>] [--password <password>] [--help] [-h] [--version] [--verbose] [--ipv6] [database] [file.js]
Options --shell Enables the shell interface after evaluating a JavaScript file. If you invoke the mongo command and specify a JavaScript file as an argument, or use --eval to specify JavaScript on the command line, the --shell option provides the user with a shell prompt after the file finishes executing.
--nodb Prevents the shell from connecting to any database instances. Later, to connect to a database within the shell, see mongo-shell-new-connections.
--norc Prevents the shell from sourcing and evaluating ~/.mongorc.js on start up.
--quiet Silences output from the shell during the connection process.
--port <port> Specifies the port where the mongod or mongos instance is listening. Unless specified mongo connects to mongod instances on port 27017, which is the default mongod port.
--host <hostname> specifies the host where the mongod or mongos is running to connect to as <hostname>. By default mongo will attempt to connect to a MongoDB process running on the localhost.
--eval <javascript> Evaluates a JavaScript expression specified as an argument to this option. mongo does not load its own environment when evaluating code: as a result many options of the shell environment are not available.
--username <username>, -u <username> Specifies a username to authenticate to the MongoDB instance.  Use in conjunction with the --password option to supply a password. If you specify a username and password but the default database or the specified database do not require authentication, mongo will exit with an exception.
--password <password>, -p <password> Specifies a password to authenticate to the MongoDB instance.  Use in conjunction with the --username option to supply a username. If you specify a --username without the --password option, mongo will prompt for a password interactively, if the mongod or mongos requires authentication.
--authenticationDatabase <dbname> New in version 2.4.
Specifies the database that holds the user's (e.g --username) credentials.
By default, mongo assumes that the database name specified in the db address holds the user's credentials, unless you specify --authenticationDatabase.
See userSource, /reference/privilege-documents and /reference/user-privileges for more information about delegated authentication in MongoDB.
--authenticationMechanism <name> New in version 2.4.
Specifies the authentication mechanism. By default, the authentication mechanism is MONGODB-CR, which is the MongoDB challenge/response authentication mechanism. In the MongoDB Subscriber Edition, mongo also includes support for GSSAPI to handle Kerberos authentication.
See /tutorial/control-access-to-mongodb-with-kerberos-authentication for more information about Kerberos authentication.
--ssl  Enable connection to a mongod or mongos that has SSL encryption.
--sslPEMKeyFile <filename> New in version 2.4.
Required when using the --ssl option if the mongod or mongos has sslCAFile enabled without sslWeakCertificateValidation.
--sslPEMKeyPassword <value> New in version 2.4.
Specifies the password to decrypt the root certificate chain specified by --sslPEMKeyFile.
Only required if the certificate-key file is encrypted.
Specifies the .pem file that contains the certificate from the Certificate Authority. Specify the file name of the .pem file using relative or absolute paths
--version Returns the version of the shell.
--verbose Increases the verbosity of the output of the shell during the connection process.
--ipv6 Enables IPv6 support that allows mongo to connect to the MongoDB instance using an IPv6 network. All MongoDB programs and processes, including mongo, disable IPv6 support by default.
<db address> Specifies the "database address" of the database to connect to. For example:
The above command will connect the mongo shell to the admin database on the local machine. You may specify a remote database instance, with the resolvable hostname or IP address. Separate the database name from the hostname using a / character. See the following examples:
mongo mongodb1.example.net mongo mongodb1/admin mongo 10.8.8.10/test
<file.js> Specifies a JavaScript file to run and then exit.  Must be the last option specified.  Use the --shell option to return to a shell after the file finishes running.
Files ~/.dbshell mongo maintains a history of commands in the .dbshell file.
Note   mongo does not recorded interaction related to authentication in the history file, including authenticate and db.addUser().
Warning Versions of Windows mongo.exe earlier than 2.2.0 will save the .dbshell file in the mongo.exe working directory.
~/.mongorc.js mongo will read the .mongorc.js file from the home directory of the user invoking mongo. In the file, users can define variables, customize the mongo shell prompt, or update information that they would like updated every time they launch a shell. If you use the shell to evaluate a JavaScript file or expression either on the command line with --eval or by specifying a .js file to mongo, mongo will read the .mongorc.js file after the JavaScript has finished processing.
Specify the --norc option to disable reading .mongorc.js.
/tmp/mongo_edit<time_t>.js Created by mongo when editing a file.  If the file exists mongo will append an integer from 1 to 10 to the time value to attempt to create a unique file.
%TEMP%mongo_edit<time_t>.js Created by mongo.exe on Windows when editing a file.  If the file exists mongo will append an integer from 1 to 10 to the time value to attempt to create a unique file.
Environment EDITOR Specifies the path to an editor to use with the edit shell command.  A JavaScript variable EDITOR will override the value of EDITOR.
HOME   Specifies the path to the home directory where mongo will read the .mongorc.js file and write the .dbshell file.
HOMEDRIVE On Windows systems, HOMEDRIVE specifies the path the directory where mongo will read the .mongorc.js file and write the .dbshell file.
HOMEPATH Specifies the Windows path to the home directory where mongo will read the .mongorc.js file and write the .dbshell file.
The mongo shell supports the following keyboard shortcuts: [1]
┌───────────────────┬─────────────────────────────┐ │Keybinding         │ Function                    │ ├───────────────────┼─────────────────────────────┤ │Up arrow           │ Retrieve previous command   │ │                   │ from history                │ ├───────────────────┼─────────────────────────────┤ │Down-arrow         │ Retrieve next command from  │ │                   │ history                     │ ├───────────────────┼─────────────────────────────┤ │Home               │ Go to beginning of the line │ ├───────────────────┼─────────────────────────────┤ │End                │ Go to end of the line       │ ├───────────────────┼─────────────────────────────┤ │Tab                │ Autocomplete method/command │ ├───────────────────┼─────────────────────────────┤ │Left-arrow         │ Go backward one character   │ ├───────────────────┼─────────────────────────────┤ │Right-arrow        │ Go forward one character    │ ├───────────────────┼─────────────────────────────┤ │Ctrl-left-arrow    │ Go backward one word        │ ├───────────────────┼─────────────────────────────┤ │Ctrl-right-arrow   │ Go forward one word         │ ├───────────────────┼─────────────────────────────┤ │Meta-left-arrow    │ Go backward one word        │ ├───────────────────┼─────────────────────────────┤ │Meta-right-arrow   │ Go forward one word         │ ├───────────────────┼─────────────────────────────┤ │Ctrl-A             │ Go to the beginning of the  │ │                   │ line                        │ ├───────────────────┼─────────────────────────────┤ │Ctrl-B             │ Go backward one character   │ ├───────────────────┼─────────────────────────────┤ │Ctrl-C             │ Exit the mongo shell        │ ├───────────────────┼─────────────────────────────┤ │Ctrl-D             │ Delete a char (or exit the  │ │                   │ mongo shell)                │ └───────────────────┴─────────────────────────────┘
[1]  MongoDB accommodates multiple keybinding, Since 2.0, mongo includes support for basic emacs keybindings.
Typically users invoke the shell with the mongo command at the system prompt. Consider the following examples for other scenarios.
To connect to a database on a remote host using authentication and a non-standard port, use the following form:
mongo --username <user> --password <pass> --hostname <host> --port 28015
Alternatively, consider the following short form:
mongo -u <user> -p <pass> --host <host> --port 28015
Replace <user>, <pass>, and <host> with the appropriate values for your situation and substitute or omit the --port as needed.
To execute a JavaScript file without evaluating the ~/.mongorc.js file before starting a shell session, use the following form:
mongo --shell --norc alternate-environment.js
To print return a query as JSON, from the system prompt using the --eval option, use the following form:
mongo --eval 'db.collection.find().forEach(printjson)'
Use single quotes (e.g. ') to enclose the JavaScript, as well as the additional JavaScript required to generate this output.
FLEX(1)                            Programming                           FLEX(1)
flex - the fast lexical analyser generator
flex [OPTIONS] [FILE]...
Generates programs that perform pattern-matching on text.
Table Compression: -Ca, --align trade off larger tables for better memory alignment
-Ce, --ecs construct equivalence classes
-Cf    do not compress tables; use -f representation
-CF    do not compress tables; use -F representation
-Cm, --meta-ecs construct meta-equivalence classes
-Cr, --read use read() instead of stdio for scanner input
-f, --full generate fast, large scanner. Same as -Cfr
-F, --fast use alternate table representation. Same as -CFr
-Cem   default compression (same as --ecs --meta-ecs)
Debugging: -d, --debug enable debug mode in scanner
-b, --backup write backing-up information to lex.backup
-p, --perf-report write performance report to stderr
-s, --nodefault suppress default rule to ECHO unmatched text
-T, --trace flex should run in trace mode
-w, --nowarn do not generate warnings
-v, --verbose write summary of scanner statistics to stdout
--hex  use hexadecimal numbers instead of octal in debug outputs
-o, --outfile=FILE specify output filename
-S, --skel=FILE specify skeleton file
-t, --stdout write scanner on stdout instead of lex.yy.c
--yyclass=NAME name of C++ class
--header-file=FILE create a C header file in addition to the scanner
--tables-file[=FILE] write tables to FILE
Scanner behavior: -7, --7bit generate 7-bit scanner
-8, --8bit generate 8-bit scanner
-B, --batch generate batch scanner (opposite of -I)
-i, --case-insensitive ignore case in patterns
-l, --lex-compat maximal compatibility with original lex
-X, --posix-compat maximal compatibility with POSIX lex
-I, --interactive generate interactive scanner (opposite of -B)
--yylineno track line count in yylineno
Generated code: -+,  --c++ generate C++ scanner class
-Dmacro[=defn] #define macro defn  (default defn is '1')
-L,  --noline suppress #line directives in scanner
-P,  --prefix=STRING use STRING as prefix instead of "yy"
-R,  --reentrant generate a reentrant C scanner
--bison-bridge scanner for bison pure parser.
--bison-locations include yylloc support.
--stdinit initialize yyin/yyout to stdin/stdout
--nounistd do not include <unistd.h>
--noFUNCTION do not generate a particular FUNCTION
Miscellaneous: -c     do-nothing POSIX option
-n     do-nothing POSIX option
-h, --help produce this help message
-V, --version report flex version
The full documentation for flex is maintained as a Texinfo manual.  If the info and flex programs are properly installed at your site, the command
info flex
MMV(1)                       General Commands Manual                      MMV(1)
mmv - move/copy/append/link multiple files by wildcard patterns
mmv [-m|x|r|c|o|a|l|s] [-h] [-d|p] [-g|t] [-v|n] [--] [from to]
Rename all *.jpeg files in the current directory to *.jpg:
mmv '*.jpeg' '#1.jpg'
Replace the first occurrence of abc with xyz in all files in the current directory:
mmv '*abc*' '#1xyz#2'
Rename files ending in .html.en, .html.de, etc. to ending in .en.html, .de.html, etc. in the current directory:
mmv '*.html.??' '#1.#2#3.html'
Rename music files from <track no.> - <interpreter> - <song title>.ogg to <interpreter> - <track no.> - <song title>.ogg in the current directory:
mmv '* - * - *.ogg' '#2 - #1 - #3.ogg'
Mmv moves (or copies, appends, or links, as specified) each source file matching a from pattern to the target name specified by the to pattern. This multiple action is performed safely, i.e. without any unexpected deletion of files due to collisions of target names with existing filenames or with other target names.  Furthermore, before doing anything, mmv attempts to detect any errors that would result from the entire set of actions specified and gives the user the choice of either proceeding by avoiding the offending parts or aborting.  mmv does support large files (LFS) but it does *NOT* support sparse files (i.e. it explodes them).
The Task Options
Whether mmv moves, copies, appends, or links is governed by the first set of options given above.  If none of these are specified, the task is given by the command name under which mmv was invoked (argv[0]):
command name   default task
mmv            -x mcp            -c mad            -a mln            -l
The task option choices are:
-m :   move source file to target name.  Both must be on the same device. Will not move directories.  If the source file is a symbolic link, moves the link without checking if the link's target from the new directory is different than the old.
-x :   same as -m, except cross-device moves are done by copying, then deleting source.  When copying, sets the permission bits and file modification time of the target file to that of the source file.
-r :   rename source file or directory to target name.  The target name must not include a path: the file remains in the same directory in all cases.  This option is the only way of renaming directories under mmv.
-c :   copy source file to target name.  Sets the file modification time and permission bits of the target file to that of the source file, regardless of whether the target file already exists.  Chains and cycles (to be explained below) are not allowed.
-o :   overwrite target name with source file.  If target file exists, it is overwritten, keeping its original owner and permission bits. If it does not exist, it is created, with read-write permission bits set according to umask(1), and the execute permission bits copied from the source file.  In either case, the file modification time is set to the current time.
-a :   append contents of source file to target name.  Target file modification time is set to the current time.  If target file does not exist, it is created with permission bits set as under -o. Unlike all other options, -a allows multiple source files to have the same target name, e.g. "mmv -a \*.c big" will append all ".c" files to "big".  Chains and cycles are also allowed, so "mmv -a f f" will double up "f".
-l :   link target name to source file.  Both must be on the same device, and the source must not be a directory.  Chains and cycles are not allowed.
-s :   same as -l, but use symbolic links instead of hard links.  For the resulting link to aim back at the source, either the source name must begin with a '/', or the target must reside in either the current or the source directory.  If none of these conditions are met, the link is refused.  However, source and target can reside on different devices, and the source can be a directory.
Only one of these option may be given, and it applies to all matching files.  Remaining options need not be given separately, i.e. "mmv -mk" is allowed.
Multiple Pattern Pairs / Reading Patterns from STDIN
Multiple from -- to pattern pairs may be specified by omitting the pattern pair on the command line, and entering them on the standard input, one pair per line.  (If a pattern pair is given on the command line, the standard input is not read.)  Thus,
mmv a b c d
would rename "a" to "b" and "c" to "d".  If a file can be matched to several of the given from patterns, the to pattern of the first matching pair is used.  Thus,
mmv a b a c
would give the error message "a -> c : no match" because file "a" (even if it exists) was already matched by the first pattern pair.
WARNING: This operation mode does not work if the patterns itself contain spaces.  See http://bugs.debian.org/149873 for details.
The From Pattern
The from pattern is a filename with embedded wildcards: '*', '?', '['...']', and ';'.  The first three have their usual sh(1) meanings of, respectively, matching any string of characters, matching any single character, and matching any one of a set of characters.
Between the '[' and ']', a range from character 'a' through character 'z' is specified with "a-z".  The set of matching characters can be negated by inserting a '^' after the '['.  Thus, "[^b-e2-5_]" will match any character but 'b' through 'e', '2' through '5', and '_'.
Note that paths are allowed in the patterns, and wildcards may be intermingled with slashes arbitrarily.  The ';' wildcard is useful for matching files at any depth in the directory tree.  It matches the same as "*/" repeated any number of times, including zero, and can only occur either at the beginning of the pattern or following a '/'.  Thus ";*.c" will match all ".c" files in or below the current directory, while "/;*.c" will match them anywhere on the file system.
In addition, if the from pattern (or the to pattern) begins with "~/", the '~' is replaced with the home directory name.  (Note that the "~user" feature of csh(1) is not implemented.)  However, the '~' is not treated as a wildcard, in the sense that it is not assigned a wildcard index (see below).
Since matching a directory under a task option other than -r or -s would result in an error, tasks other than -r and -s match directories only against completely explicit from patterns (i.e. not containing wildcards).  Under -r and -s, this applies only to "." and "..".
Files beginning with '.' are only matched against from patterns that begin with an explicit '.'.  However, if -h is specified, they are matched normally.
Warning: since the shell normally expands wildcards before passing the command-line arguments to mmv, it is usually necessary to enclose the command-line from and to patterns in quotes.
The To Pattern