--- title: "Kubo CLI" description: API documentation for the Kubo command-line executable. --- # Kubo command-line ::: tip Generated on 2023-05-09 12:45:57, from kubo 0.20.0 This document was autogenerated from CLI help text in [kubo 0.20.0](https://github.com/ipfs/kubo/releases/tag/v0.20.0) For issues and support, check out the [generate-cli-docs.sh](https://github.com/ipfs/ipfs-docs/blob/main/docs/reference/kubo/generate-cli-docs.sh) script on GitHub. ::: IPFS can run in either _online_ or _offline_ mode. Online mode is when you have IPFS running separately as a daemon process. If you do not have an IPFS daemon running, you are in offline mode. Some commands, like `ipfs swarm peers`, are only supported when online. The [command-line quickstart guide](/how-to/command-line-quick-start/#take-your-node-online) explains how to start the IPFS daemon and take your node online. ### Alignment with Kubo RPC API Every command usable from the CLI is also available through the [RPC API v0](/reference/kubo/rpc). For example: ```sh > ipfs swarm peers /ip4/104.131.131.82/tcp/4001/p2p/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ /ip4/104.236.151.122/tcp/4001/p2p/QmSoLju6m7xTh3DuokvT3886QRYqxAzb1kShaanJgW36yx /ip4/104.236.176.52/tcp/4001/p2p/QmSoLnSGccFuZQJzRadHn95W2CrSFmZuTdDWP8HXaHca9z > curl -X POST http://127.0.0.1:5001/api/v0/swarm/peers { "Strings": [ "/ip4/104.131.131.82/tcp/4001/p2p/QmaCpDMGvV2BGHeYERUEnRQAwe3N8SzbUtfsmvsqQLuvuJ", "/ip4/104.236.151.122/tcp/4001/p2p/QmSoLju6m7xTh3DuokvT3886QRYqxAzb1kShaanJgW36yx", "/ip4/104.236.176.52/tcp/4001/p2p/QmSoLnSGccFuZQJzRadHn95W2CrSFmZuTdDWP8HXaHca9z", ] } ``` ## ipfs ``` USAGE ipfs - Global p2p merkle-dag filesystem. SYNOPSIS ipfs [--config= | -c] [--debug | -D] [--help] [-h] [--api=] [--offline] [--cid-base=] [--upgrade-cidv0-in-output] [--encoding= | --enc] [--timeout=] ... OPTIONS --repo-dir string - Path to the repository directory to use. --config-file string - Path to the configuration file to use. -c, --config string - [DEPRECATED] Path to the configuration file to use. -D, --debug bool - Operate in debug mode. --help bool - Show the full command help text. -h bool - Show a short version of the command help text. -L, --local bool - Run the command locally, instead of using the daemon. DEPRECATED: use --offline. --offline bool - Run the command offline. --api string - Use a specific API instance (defaults to /ip4/127.0.0.1/tcp/5001). --cid-base string - Multibase encoding used for version 1 CIDs in output. --upgrade-cidv0-in-output bool - Upgrade version 0 to version 1 CIDs in output. --enc, --encoding string - The encoding type the output should be encoded with (json, xml, or text). Default: text. --stream-channels bool - Stream channel output. --timeout string - Set a global timeout on the command. SUBCOMMANDS BASIC COMMANDS init Initialize local IPFS configuration add Add a file to IPFS cat Show IPFS object data get Download IPFS objects ls List links from an object refs List hashes of links from an object DATA STRUCTURE COMMANDS dag Interact with IPLD DAG nodes files Interact with files as if they were a unix filesystem block Interact with raw blocks in the datastore TEXT ENCODING COMMANDS cid Convert and discover properties of CIDs multibase Encode and decode data with Multibase format ADVANCED COMMANDS daemon Start a long-running daemon process shutdown Shut down the daemon process resolve Resolve any type of content path name Publish and resolve IPNS names key Create and list IPNS name keypairs pin Pin objects to local storage repo Manipulate the IPFS repository stats Various operational stats p2p Libp2p stream mounting (experimental) filestore Manage the filestore (experimental) mount Mount an IPFS read-only mount point (experimental) NETWORK COMMANDS id Show info about IPFS peers bootstrap Add or remove bootstrap peers swarm Manage connections to the p2p network dht Query the DHT for values or peers routing Issue routing commands ping Measure the latency of a connection bitswap Inspect bitswap state pubsub Send and receive messages via pubsub TOOL COMMANDS config Manage configuration version Show IPFS version information diag Generate diagnostic reports update Download and apply go-ipfs updates commands List all available commands log Manage and show logs of running daemon Use 'ipfs --help' to learn more about each command. ipfs uses a repository in the local file system. By default, the repo is located at ~/.ipfs. To change the repo location, set the $IPFS_PATH environment variable: export IPFS_PATH=/path/to/ipfsrepo EXIT STATUS The CLI will exit with one of the following values: 0 Successful execution. 1 Failed executions. For more information about each command, use: 'ipfs --help' ``` ## ipfs add ``` USAGE ipfs add ... - Add a file or directory to IPFS. SYNOPSIS ipfs add [--recursive | -r] [--dereference-args] [--stdin-name=] [--hidden | -H] [--ignore=]... [--ignore-rules-path=] [--quiet | -q] [--quieter | -Q] [--silent] [--progress | -p] [--trickle | -t] [--only-hash | -n] [--wrap-with-directory | -w] [--chunker= | -s] [--raw-leaves] [--nocopy] [--fscache] [--cid-version=] [--hash=] [--inline] [--inline-limit=] [--pin=false] [--to-files=] [--] ... ARGUMENTS ... - The path to a file to be added to IPFS. OPTIONS -r, --recursive bool - Add directory paths recursively. --dereference-args bool - Symlinks supplied in arguments are dereferenced. --stdin-name string - Assign a name if the file source is stdin. -H, --hidden bool - Include files that are hidden. Only takes effect on recursive add. --ignore array - A rule (.gitignore-stype) defining which file(s) should be ignored (variadic, experimental). --ignore-rules-path string - A path to a file with .gitignore-style ignore rules (experimental). -q, --quiet bool - Write minimal output. -Q, --quieter bool - Write only final hash. --silent bool - Write no output. -p, --progress bool - Stream progress data. -t, --trickle bool - Use trickle-dag format for dag generation. -n, --only-hash bool - Only chunk and hash - do not write to disk. -w, --wrap-with-directory bool - Wrap files with a directory object. -s, --chunker string - Chunking algorithm, size-[bytes], rabin-[min]-[avg]-[max] or buzhash. Default: size-262144. --raw-leaves bool - Use raw blocks for leaf nodes. --nocopy bool - Add the file using filestore. Implies raw-leaves. (experimental). --fscache bool - Check the filestore for pre-existing blocks. (experimental). --cid-version int - CID version. Defaults to 0 unless an option that depends on CIDv1 is passed. Passing version 1 will cause the raw-leaves option to default to true. --hash string - Hash function to use. Implies CIDv1 if not sha2-256. (experimental). Default: sha2-256. --inline bool - Inline small blocks into CIDs. (experimental). --inline-limit int - Maximum block size to inline. (experimental). Default: 32. --pin bool - Pin locally to protect added files from garbage collection. Default: true. --to-files string - Add reference to Files API (MFS) at the provided path. DESCRIPTION Adds the content of to IPFS. Use -r to add directories. Note that directories are added recursively, to form the IPFS MerkleDAG. If the daemon is not running, it will just add locally. If the daemon is started later, it will be advertised after a few seconds when the reprovider runs. The wrap option, '-w', wraps the file (or files, if using the recursive option) in a directory. This directory contains only the files which have been added, and means that the file retains its filename. For example: > ipfs add example.jpg added QmbFMke1KXqnYyBBWxB74N4c5SBnJMVAiMNRcGu6x1AwQH example.jpg > ipfs add example.jpg -w added QmbFMke1KXqnYyBBWxB74N4c5SBnJMVAiMNRcGu6x1AwQH example.jpg added QmaG4FuMqEBnQNn3C8XJ5bpW8kLs7zq2ZXgHptJHbKDDVx You can now refer to the added file in a gateway, like so: /ipfs/QmaG4FuMqEBnQNn3C8XJ5bpW8kLs7zq2ZXgHptJHbKDDVx/example.jpg Files imported with 'ipfs add' are protected from GC (implicit '--pin=true'), but it is up to you to remember the returned CID to get the data back later. Passing '--to-files' creates a reference in Files API (MFS), making it easier to find it in the future: > ipfs files mkdir -p /myfs/dir > ipfs add example.jpg --to-files /myfs/dir/ > ipfs files ls /myfs/dir/ example.jpg See 'ipfs files --help' to learn more about using MFS for keeping track of added files and directories. The chunker option, '-s', specifies the chunking strategy that dictates how to break files into blocks. Blocks with same content can be deduplicated. Different chunking strategies will produce different hashes for the same file. The default is a fixed block size of 256 * 1024 bytes, 'size-262144'. Alternatively, you can use the Buzhash or Rabin fingerprint chunker for content defined chunking by specifying buzhash or rabin-[min]-[avg]-[max] (where min/avg/max refer to the desired chunk sizes in bytes), e.g. 'rabin-262144-524288-1048576'. The following examples use very small byte sizes to demonstrate the properties of the different chunkers on a small file. You'll likely want to use a 1024 times larger chunk sizes for most files. > ipfs add --chunker=size-2048 ipfs-logo.svg added QmafrLBfzRLV4XSH1XcaMMeaXEUhDJjmtDfsYU95TrWG87 ipfs-logo.svg > ipfs add --chunker=rabin-512-1024-2048 ipfs-logo.svg added Qmf1hDN65tR55Ubh2RN1FPxr69xq3giVBz1KApsresY8Gn ipfs-logo.svg You can now check what blocks have been created by: > ipfs object links QmafrLBfzRLV4XSH1XcaMMeaXEUhDJjmtDfsYU95TrWG87 QmY6yj1GsermExDXoosVE3aSPxdMNYr6aKuw3nA8LoWPRS 2059 Qmf7ZQeSxq2fJVJbCmgTrLLVN9tDR9Wy5k75DxQKuz5Gyt 1195 > ipfs object links Qmf1hDN65tR55Ubh2RN1FPxr69xq3giVBz1KApsresY8Gn QmY6yj1GsermExDXoosVE3aSPxdMNYr6aKuw3nA8LoWPRS 2059 QmerURi9k4XzKCaaPbsK6BL5pMEjF7PGphjDvkkjDtsVf3 868 QmQB28iwSriSUSMqG2nXDTLtdPHgWb4rebBrU7Q1j4vxPv 338 Finally, a note on hash (CID) determinism and 'ipfs add' command. Almost all the flags provided by this command will change the final CID, and new flags may be added in the future. It is not guaranteed for the implicit defaults of 'ipfs add' to remain the same in future Kubo releases, or for other IPFS software to use the same import parameters as Kubo. If you need to back up or transport content-addressed data using a non-IPFS medium, CID can be preserved with CAR files. See 'dag export' and 'dag import' for more information. ``` ## ipfs bitswap ``` USAGE ipfs bitswap - Interact with the bitswap agent. SYNOPSIS ipfs bitswap SUBCOMMANDS ipfs bitswap ledger - Show the current ledger for a peer. ipfs bitswap reprovide - Trigger reprovider. ipfs bitswap stat - Show some diagnostic information on the bitswap agent. ipfs bitswap wantlist - Show blocks currently on the wantlist. For more information about each command, use: 'ipfs bitswap --help' ``` ## ipfs bitswap ledger ``` USAGE ipfs bitswap ledger - Show the current ledger for a peer. SYNOPSIS ipfs bitswap ledger [--] ARGUMENTS - The PeerID (B58) of the ledger to inspect. DESCRIPTION The Bitswap decision engine tracks the number of bytes exchanged between IPFS nodes, and stores this information as a collection of ledgers. This command prints the ledger associated with a given peer. ``` ## ipfs bitswap reprovide ``` USAGE ipfs bitswap reprovide - Trigger reprovider. SYNOPSIS ipfs bitswap reprovide DESCRIPTION Trigger reprovider to announce our data to network. ``` ## ipfs bitswap stat ``` USAGE ipfs bitswap stat - Show some diagnostic information on the bitswap agent. SYNOPSIS ipfs bitswap stat [--verbose | -v] [--human] OPTIONS -v, --verbose bool - Print extra information. --human bool - Print sizes in human readable format (e.g., 1K 234M 2G). ``` ## ipfs bitswap wantlist ``` USAGE ipfs bitswap wantlist - Show blocks currently on the wantlist. SYNOPSIS ipfs bitswap wantlist [--peer= | -p] OPTIONS -p, --peer string - Specify which peer to show wantlist for. Default: self. DESCRIPTION Print out all blocks currently on the bitswap wantlist for the local peer. ``` ## ipfs block ``` USAGE ipfs block - Interact with raw IPFS blocks. SYNOPSIS ipfs block DESCRIPTION 'ipfs block' is a plumbing command used to manipulate raw IPFS blocks. Reads from stdin or writes to stdout. A block is identified by a Multihash passed with a valid CID. SUBCOMMANDS ipfs block get - Get a raw IPFS block. ipfs block put ... - Store input as an IPFS block. ipfs block rm ... - Remove IPFS block(s) from the local datastore. ipfs block stat - Print information of a raw IPFS block. For more information about each command, use: 'ipfs block --help' ``` ## ipfs block get ``` USAGE ipfs block get - Get a raw IPFS block. SYNOPSIS ipfs block get [--] ARGUMENTS - The CID of an existing block to get. DESCRIPTION 'ipfs block get' is a plumbing command for retrieving raw IPFS blocks. It takes a , and outputs the block to stdout. ``` ## ipfs block put ``` USAGE ipfs block put ... - Store input as an IPFS block. SYNOPSIS ipfs block put [--cid-codec=] [--mhtype=] [--mhlen=] [--pin] [--allow-big-block] [--format= | -f] [--] ... ARGUMENTS ... - The data to be stored as an IPFS block. OPTIONS --cid-codec string - Multicodec to use in returned CID. Default: raw. --mhtype string - Multihash hash function. Default: sha2-256. --mhlen int - Multihash hash length. Default: -1. --pin bool - Pin added blocks recursively. Default: false. --allow-big-block bool - Disable block size check and allow creation of blocks bigger than 1MiB. WARNING: such blocks won't be transferable over the standard bitswap. Default: false. -f, --format string - Use legacy format for returned CID (DEPRECATED). DESCRIPTION 'ipfs block put' is a plumbing command for storing raw IPFS blocks. It reads data from stdin, and outputs the block's CID to stdout. Unless cid-codec is specified, this command returns raw (0x55) CIDv1 CIDs. Passing alternative --cid-codec does not modify imported data, nor run any validation. It is provided solely for convenience for users who create blocks in userland. NOTE: Do not use --format for any new code. It got superseded by --cid-codec and left only for backward compatibility when a legacy CIDv0 is required (--format=v0). ``` ## ipfs block rm ``` USAGE ipfs block rm ... - Remove IPFS block(s) from the local datastore. SYNOPSIS ipfs block rm [--force | -f] [--quiet | -q] [--] ... ARGUMENTS ... - CIDs of block(s) to remove. OPTIONS -f, --force bool - Ignore nonexistent blocks. -q, --quiet bool - Write minimal output. DESCRIPTION 'ipfs block rm' is a plumbing command for removing raw ipfs blocks. It takes a list of CIDs to remove from the local datastore.. ``` ## ipfs block stat ``` USAGE ipfs block stat - Print information of a raw IPFS block. SYNOPSIS ipfs block stat [--] ARGUMENTS - The CID of an existing block to stat. DESCRIPTION 'ipfs block stat' is a plumbing command for retrieving information on raw IPFS blocks. It outputs the following to stdout: Key - the CID of the block Size - the size of the block in bytes ``` ## ipfs bootstrap ``` USAGE ipfs bootstrap - Show or edit the list of bootstrap peers. SYNOPSIS ipfs bootstrap DESCRIPTION Running 'ipfs bootstrap' with no arguments will run 'ipfs bootstrap list'. SECURITY WARNING: The bootstrap command manipulates the "bootstrap list", which contains the addresses of bootstrap nodes. These are the *trusted peers* from which to learn about other peers in the network. Only edit this list if you understand the risks of adding or removing nodes from this list. SUBCOMMANDS ipfs bootstrap add []... - Add peers to the bootstrap list. ipfs bootstrap list - Show peers in the bootstrap list. ipfs bootstrap rm []... - Remove peers from the bootstrap list. For more information about each command, use: 'ipfs bootstrap --help' ``` ## ipfs bootstrap add ``` USAGE ipfs bootstrap add []... - Add peers to the bootstrap list. SYNOPSIS ipfs bootstrap add [--default] [--] [...] ARGUMENTS []... - A peer to add to the bootstrap list (in the format '/') OPTIONS --default bool - Add default bootstrap nodes. (Deprecated, use 'default' subcommand instead). DESCRIPTION Outputs a list of peers that were added (that weren't already in the bootstrap list). SECURITY WARNING: The bootstrap command manipulates the "bootstrap list", which contains the addresses of bootstrap nodes. These are the *trusted peers* from which to learn about other peers in the network. Only edit this list if you understand the risks of adding or removing nodes from this list. SUBCOMMANDS ipfs bootstrap add default - Add default peers to the bootstrap list. For more information about each command, use: 'ipfs bootstrap add --help' ``` ## ipfs bootstrap add default ``` USAGE ipfs bootstrap add default - Add default peers to the bootstrap list. SYNOPSIS ipfs bootstrap add default DESCRIPTION Outputs a list of peers that were added (that weren't already in the bootstrap list). ``` ## ipfs bootstrap list ``` USAGE ipfs bootstrap list - Show peers in the bootstrap list. SYNOPSIS ipfs bootstrap list DESCRIPTION Peers are output in the format '/'. ``` ## ipfs bootstrap rm ``` USAGE ipfs bootstrap rm []... - Remove peers from the bootstrap list. SYNOPSIS ipfs bootstrap rm [--all] [--] [...] ARGUMENTS []... - A peer to add to the bootstrap list (in the format '/') OPTIONS --all bool - Remove all bootstrap peers. (Deprecated, use 'all' subcommand). DESCRIPTION Outputs the list of peers that were removed. SECURITY WARNING: The bootstrap command manipulates the "bootstrap list", which contains the addresses of bootstrap nodes. These are the *trusted peers* from which to learn about other peers in the network. Only edit this list if you understand the risks of adding or removing nodes from this list. SUBCOMMANDS ipfs bootstrap rm all - Remove all peers from the bootstrap list. For more information about each command, use: 'ipfs bootstrap rm --help' ``` ## ipfs bootstrap rm all ``` USAGE ipfs bootstrap rm all - Remove all peers from the bootstrap list. SYNOPSIS ipfs bootstrap rm all DESCRIPTION Outputs the list of peers that were removed. ``` ## ipfs cat ``` USAGE ipfs cat ... - Show IPFS object data. SYNOPSIS ipfs cat [--offset= | -o] [--length= | -l] [--progress=false] [--] ... ARGUMENTS ... - The path to the IPFS object(s) to be outputted. OPTIONS -o, --offset int64 - Byte offset to begin reading from. -l, --length int64 - Maximum number of bytes to read. -p, --progress bool - Stream progress data. Default: true. DESCRIPTION Displays the data contained by an IPFS or IPNS object(s) at the given path. ``` ## ipfs cid ``` USAGE ipfs cid - Convert and discover properties of CIDs SYNOPSIS ipfs cid SUBCOMMANDS ipfs cid base32 ... - Convert CIDs to Base32 CID version 1. ipfs cid bases - List available multibase encodings. ipfs cid codecs - List available CID multicodecs. ipfs cid format ... - Format and convert a CID in various useful ways. ipfs cid hashes - List available multihashes. For more information about each command, use: 'ipfs cid --help' ``` ## ipfs cid base32 ``` USAGE ipfs cid base32 ... - Convert CIDs to Base32 CID version 1. SYNOPSIS ipfs cid base32 [--] ... ARGUMENTS ... - CIDs to convert. DESCRIPTION 'ipfs cid base32' normalizes passed CIDs to their canonical case-insensitive encoding. Useful when processing third-party CIDs which could come with arbitrary formats. ``` ## ipfs cid bases ``` USAGE ipfs cid bases - List available multibase encodings. SYNOPSIS ipfs cid bases [--prefix] [--numeric] OPTIONS --prefix bool - also include the single letter prefixes in addition to the code. --numeric bool - also include numeric codes. DESCRIPTION 'ipfs cid bases' relies on https://github.com/multiformats/go-multibase ``` ## ipfs cid codecs ``` USAGE ipfs cid codecs - List available CID multicodecs. SYNOPSIS ipfs cid codecs [--numeric | -n] [--supported | -s] OPTIONS -n, --numeric bool - also include numeric codes. -s, --supported bool - list only codecs supported by go-ipfs commands. DESCRIPTION 'ipfs cid codecs' relies on https://github.com/multiformats/go-multicodec ``` ## ipfs cid format ``` USAGE ipfs cid format ... - Format and convert a CID in various useful ways. SYNOPSIS ipfs cid format [-f=] [-v=] [--mc=] [-b=] [--] ... ARGUMENTS ... - CIDs to format. OPTIONS -f string - Printf style format string. Default: %s. -v string - CID version to convert to. --mc string - CID multicodec to convert to. -b string - Multibase to display CID in. DESCRIPTION Format and converts 's in various useful ways. The optional format string is a printf style format string: %% literal % %b multibase name %B multibase code %v version string %V version number %c codec name %C codec code %h multihash name %H multihash code %L hash digest length %m multihash encoded in base %b (with multibase prefix) %M multihash encoded in base %b without multibase prefix %d hash digest encoded in base %b (with multibase prefix) %D hash digest encoded in base %b without multibase prefix %s cid string encoded in base %b (1) %S cid string encoded in base %b without multibase prefix %P cid prefix: %v-%c-%h-%L (1) For CID version 0 the multibase must be base58btc and no prefix is used. For Cid version 1 the multibase prefix is included. ``` ## ipfs cid hashes ``` USAGE ipfs cid hashes - List available multihashes. SYNOPSIS ipfs cid hashes [--numeric | -n] [--supported | -s] OPTIONS -n, --numeric bool - also include numeric codes. -s, --supported bool - list only codecs supported by go-ipfs commands. DESCRIPTION 'ipfs cid hashes' relies on https://github.com/multiformats/go-multihash ``` ## ipfs commands ``` USAGE ipfs commands - List all available commands. SYNOPSIS ipfs commands [--flags | -f] OPTIONS -f, --flags bool - Show command flags. DESCRIPTION Lists all available commands (and subcommands) and exits. SUBCOMMANDS ipfs commands completion - Generate shell completions. For more information about each command, use: 'ipfs commands --help' ``` ## ipfs commands completion ``` USAGE ipfs commands completion - Generate shell completions. SYNOPSIS ipfs commands completion SUBCOMMANDS ipfs commands completion bash - Generate bash shell completions. ipfs commands completion fish - Generate fish shell completions. For more information about each command, use: 'ipfs commands completion --help' ``` ## ipfs commands completion bash ``` USAGE ipfs commands completion bash - Generate bash shell completions. SYNOPSIS ipfs commands completion bash DESCRIPTION Generates command completions for the bash shell. The simplest way to see it working is write the completions to a file and then source it: > ipfs commands completion bash > ipfs-completion.bash > source ./ipfs-completion.bash To install the completions permanently, they can be moved to /etc/bash_completion.d or sourced from your ~/.bashrc file. ``` ## ipfs commands completion fish ``` USAGE ipfs commands completion fish - Generate fish shell completions. SYNOPSIS ipfs commands completion fish DESCRIPTION Generates command completions for the fish shell. The simplest way to see it working is write the completions to a file and then source it: > ipfs commands completion fish > ipfs-completion.fish > source ./ipfs-completion.fish To install the completions permanently, they can be moved to /etc/fish/completions or ~/.config/fish/completions or sourced from your ~/.config/fish/config.fish file. ``` ## ipfs config ``` USAGE ipfs config [] - Get and set IPFS config values. SYNOPSIS ipfs config [--bool] [--json] [--] [] ARGUMENTS - The key of the config entry (e.g. "Addresses.API"). [] - The value to set the config entry to. OPTIONS --bool bool - Set a boolean value. --json bool - Parse stringified JSON. DESCRIPTION 'ipfs config' controls configuration variables. It works much like 'git config'. The configuration values are stored in a config file inside your IPFS repository (IPFS_PATH). Examples: Get the value of the 'Datastore.Path' key: $ ipfs config Datastore.Path Set the value of the 'Datastore.Path' key: $ ipfs config Datastore.Path ~/.ipfs/datastore SUBCOMMANDS ipfs config edit - Open the config file for editing in $EDITOR. ipfs config profile - Apply profiles to config. ipfs config replace - Replace the config with . ipfs config show - Output config file contents. For more information about each command, use: 'ipfs config --help' ``` ## ipfs config edit ``` USAGE ipfs config edit - Open the config file for editing in $EDITOR. SYNOPSIS ipfs config edit DESCRIPTION To use 'ipfs config edit', you must have the $EDITOR environment variable set to your preferred text editor. ``` ## ipfs config profile ``` USAGE ipfs config profile - Apply profiles to config. SYNOPSIS ipfs config profile DESCRIPTION Available profiles: 'server': Disables local host discovery, recommended when running IPFS on machines with public IPv4 addresses. 'local-discovery': Sets default values to fields affected by the server profile, enables discovery in local networks. 'default-networking': Restores default network settings. Inverse profile of the test profile. 'badgerds': Configures the node to use the experimental badger datastore. Use this datastore if some aspects of performance, especially the speed of adding many gigabytes of files, are critical. However, be aware that: * This datastore will not properly reclaim space when your datastore is smaller than several gigabytes. If you run IPFS with --enable-gc, you plan on storing very little data in your IPFS node, and disk usage is more critical than performance, consider using flatfs. * This datastore uses up to several gigabytes of memory. * Good for medium-size datastores, but may run into performance issues if your dataset is bigger than a terabyte. * The current implementation is based on old badger 1.x which is no longer supported by the upstream team. This profile may only be applied when first initializing the node. 'lowpower': Reduces daemon overhead on the system. May affect node functionality - performance of content discovery and data fetching may be degraded. 'test': Reduces external interference of IPFS daemon, this is useful when using the daemon in test environments. 'default-datastore': Configures the node to use the default datastore (flatfs). Read the "flatfs" profile description for more information on this datastore. This profile may only be applied when first initializing the node. 'flatfs': Configures the node to use the flatfs datastore. This is the most battle-tested and reliable datastore. You should use this datastore if: * You need a very simple and very reliable datastore, and you trust your filesystem. This datastore stores each block as a separate file in the underlying filesystem so it's unlikely to loose data unless there's an issue with the underlying file system. * You need to run garbage collection in a way that reclaims free space as soon as possible. * You want to minimize memory usage. * You are ok with the default speed of data import, or prefer to use --nocopy. This profile may only be applied when first initializing the node. 'randomports': Use a random port number for swarm. SUBCOMMANDS ipfs config profile apply - Apply profile to config. For more information about each command, use: 'ipfs config profile --help' ``` ## ipfs config profile apply ``` USAGE ipfs config profile apply - Apply profile to config. SYNOPSIS ipfs config profile apply [--dry-run] [--] ARGUMENTS - The profile to apply to the config. OPTIONS --dry-run bool - print difference between the current config and the config that would be generated. ``` ## ipfs config replace ``` USAGE ipfs config replace - Replace the config with . SYNOPSIS ipfs config replace [--] ARGUMENTS - The file to use as the new config. DESCRIPTION Make sure to back up the config file first if necessary, as this operation can't be undone. ``` ## ipfs config show ``` USAGE ipfs config show - Output config file contents. SYNOPSIS ipfs config show DESCRIPTION NOTE: For security reasons, this command will omit your private key and remote services. If you would like to make a full backup of your config (private key included), you must copy the config file from your repo. ``` ## ipfs daemon ``` USAGE ipfs daemon - Run a network-connected IPFS node. SYNOPSIS ipfs daemon [--init] [--init-config=] [--init-profile=] [--routing=] [--mount] [--writable] [--mount-ipfs=] [--mount-ipns=] [--unrestricted-api] [--disable-transport-encryption] [--enable-gc] [--manage-fdlimit=false] [--migrate] [--enable-pubsub-experiment] [--enable-namesys-pubsub] [--enable-mplex-experiment] [--agent-version-suffix=] OPTIONS --init bool - Initialize ipfs with default settings if not already initialized. --init-config string - Path to existing configuration file to be loaded during --init. --init-profile string - Configuration profiles to apply for --init. See ipfs init --help for more. --routing string - Overrides the routing option. Default: default. --mount bool - Mounts IPFS to the filesystem using FUSE (experimental). --writable bool - Enable legacy Gateway.Writable (REMOVED). --mount-ipfs string - Path to the mountpoint for IPFS (if using --mount). Defaults to config setting. --mount-ipns string - Path to the mountpoint for IPNS (if using --mount). Defaults to config setting. --unrestricted-api bool - Allow API access to unlisted hashes. --disable-transport-encryption bool - Disable transport encryption (for debugging protocols). --enable-gc bool - Enable automatic periodic repo garbage collection. --manage-fdlimit bool - Check and raise file descriptor limits if needed. Default: true. --migrate bool - If true, assume yes at the migrate prompt. If false, assume no. --enable-pubsub-experiment bool - DEPRECATED. --enable-namesys-pubsub bool - Enable IPNS over pubsub. Implicitly enables pubsub, overrides Ipns.UsePubsub config. --enable-mplex-experiment bool - DEPRECATED. --agent-version-suffix string - Optional suffix to the AgentVersion presented by `ipfs id` and also advertised through BitSwap. DESCRIPTION The daemon will start listening on ports on the network, which are documented in (and can be modified through) 'ipfs config Addresses'. For example, to change the 'Gateway' port: ipfs config Addresses.Gateway /ip4/127.0.0.1/tcp/8082 The RPC API address can be changed the same way: ipfs config Addresses.API /ip4/127.0.0.1/tcp/5002 Make sure to restart the daemon after changing addresses. By default, the gateway is only accessible locally. To expose it to other computers in the network, use 0.0.0.0 as the ip address: ipfs config Addresses.Gateway /ip4/0.0.0.0/tcp/8080 Be careful if you expose the RPC API. It is a security risk, as anyone could control your node remotely. If you need to control the node remotely, make sure to protect the port as you would other services or database (firewall, authenticated proxy, etc). HTTP Headers ipfs supports passing arbitrary headers to the RPC API and Gateway. You can do this by setting headers on the API.HTTPHeaders and Gateway.HTTPHeaders keys: ipfs config --json API.HTTPHeaders.X-Special-Header "[\"so special :)\"]" ipfs config --json Gateway.HTTPHeaders.X-Special-Header "[\"so special :)\"]" Note that the value of the keys is an _array_ of strings. This is because headers can have more than one value, and it is convenient to pass through to other libraries. CORS Headers (for API) You can setup CORS headers the same way: ipfs config --json API.HTTPHeaders.Access-Control-Allow-Origin "[\"example.com\"]" ipfs config --json API.HTTPHeaders.Access-Control-Allow-Methods "[\"PUT\", \"GET\", \"POST\"]" ipfs config --json API.HTTPHeaders.Access-Control-Allow-Credentials "[\"true\"]" Shutdown To shut down the daemon, send a SIGINT signal to it (e.g. by pressing 'Ctrl-C') or send a SIGTERM signal to it (e.g. with 'kill'). It may take a while for the daemon to shutdown gracefully, but it can be killed forcibly by sending a second signal. IPFS_PATH environment variable ipfs uses a repository in the local file system. By default, the repo is located at ~/.ipfs. To change the repo location, set the $IPFS_PATH environment variable: export IPFS_PATH=/path/to/ipfsrepo DEPRECATION NOTICE Previously, ipfs used an environment variable as seen below: export API_ORIGIN="http://localhost:8888/" This is deprecated. It is still honored in this version, but will be removed in a future version, along with this notice. Please move to setting the HTTP Headers. ``` ## ipfs dag ``` USAGE ipfs dag - Interact with IPLD DAG objects. SYNOPSIS ipfs dag DESCRIPTION 'ipfs dag' is used for creating and manipulating DAG objects/hierarchies. This subcommand is intended to deprecate and replace the existing 'ipfs object' command moving forward. SUBCOMMANDS ipfs dag export - Streams the selected DAG as a .car stream on stdout. ipfs dag get - Get a DAG node from IPFS. ipfs dag import ... - Import the contents of .car files ipfs dag put ... - Add a DAG node to IPFS. ipfs dag resolve - Resolve IPLD block. ipfs dag stat - Gets stats for a DAG. For more information about each command, use: 'ipfs dag --help' ``` ## ipfs dag export ``` USAGE ipfs dag export - Streams the selected DAG as a .car stream on stdout. SYNOPSIS ipfs dag export [--progress | -p] [--] ARGUMENTS - CID of a root to recursively export OPTIONS -p, --progress bool - Display progress on CLI. Defaults to true when STDERR is a TTY. DESCRIPTION 'ipfs dag export' fetches a DAG and streams it out as a well-formed .car file. Note that at present only single root selections / .car files are supported. The output of blocks happens in strict DAG-traversal, first-seen, order. CAR file follows the CARv1 format: https://ipld.io/specs/transport/car/carv1/ ``` ## ipfs dag get ``` USAGE ipfs dag get - Get a DAG node from IPFS. SYNOPSIS ipfs dag get [--output-codec=] [--] ARGUMENTS - The object to get OPTIONS --output-codec string - Format that the object will be encoded as. Default: dag-json. DESCRIPTION 'ipfs dag get' fetches a DAG node from IPFS and prints it out in the specified format. ``` ## ipfs dag import ``` USAGE ipfs dag import ... - Import the contents of .car files SYNOPSIS ipfs dag import [--pin-roots=false] [--silent] [--stats] [--allow-big-block] [--] ... ARGUMENTS ... - The path of a .car file. OPTIONS --pin-roots bool - Pin optional roots listed in the .car headers after importing. Default: true. --silent bool - No output. --stats bool - Output stats. --allow-big-block bool - Disable block size check and allow creation of blocks bigger than 1MiB. WARNING: such blocks won't be transferable over the standard bitswap. Default: false. DESCRIPTION 'ipfs dag import' imports all blocks present in supplied .car ( Content Address aRchive ) files, recursively pinning any roots specified in the CAR file headers, unless --pin-roots is set to false. Note: This command will import all blocks in the CAR file, not just those reachable from the specified roots. However, these other blocks will not be pinned and may be garbage collected later. The pinning of the roots happens after all car files are processed, permitting import of DAGs spanning multiple files. Pinning takes place in offline-mode exclusively, one root at a time. If the combination of blocks from the imported CAR files and what is currently present in the blockstore does not represent a complete DAG, pinning of that individual root will fail. Maximum supported CAR version: 2 Specification of CAR formats: https://ipld.io/specs/transport/car/ ``` ## ipfs dag put ``` USAGE ipfs dag put ... - Add a DAG node to IPFS. SYNOPSIS ipfs dag put [--store-codec=] [--input-codec=] [--pin] [--hash=] [--allow-big-block] [--] ... ARGUMENTS ... - The object to put OPTIONS --store-codec string - Codec that the stored object will be encoded with. Default: dag-cbor. --input-codec string - Codec that the input object is encoded in. Default: dag-json. --pin bool - Pin this object when adding. --hash string - Hash function to use. Default: sha2-256. --allow-big-block bool - Disable block size check and allow creation of blocks bigger than 1MiB. WARNING: such blocks won't be transferable over the standard bitswap. Default: false. DESCRIPTION 'ipfs dag put' accepts input from a file or stdin and parses it into an object of the specified format. ``` ## ipfs dag resolve ``` USAGE ipfs dag resolve - Resolve IPLD block. SYNOPSIS ipfs dag resolve [--] ARGUMENTS - The path to resolve DESCRIPTION 'ipfs dag resolve' fetches a DAG node from IPFS, prints its address and remaining path. ``` ## ipfs dag stat ``` USAGE ipfs dag stat - Gets stats for a DAG. SYNOPSIS ipfs dag stat [--progress=false] [--] ARGUMENTS - CID of a DAG root to get statistics for OPTIONS -p, --progress bool - Return progressive data while reading through the DAG. Default: true. DESCRIPTION 'ipfs dag stat' fetches a DAG and returns various statistics about it. Statistics include size and number of blocks. Note: This command skips duplicate blocks in reporting both size and the number of blocks ``` ## ipfs dht ``` USAGE ipfs dht - Issue commands directly through the DHT. SYNOPSIS ipfs dht SUBCOMMANDS ipfs dht query ... - Find the closest Peer IDs to a given Peer ID by querying the DHT. For more information about each command, use: 'ipfs dht --help' DEPRECATED SUBCOMMANDS ipfs dht findpeer ... - Find the multiaddresses associated with a Peer ID. ipfs dht findprovs ... - Find peers that can provide a specific value, given a key. ipfs dht get ... - Given a key, query the routing system for its best value. ipfs dht provide ... - Announce to the network that you are providing given values. ipfs dht put - Write a key/value pair to the routing system. ``` ## ipfs dht findpeer ``` WARNING: DEPRECATED, command will be removed in the future USAGE ipfs dht findpeer ... - Find the multiaddresses associated with a Peer ID. SYNOPSIS ipfs dht findpeer [--verbose | -v] [--] ... ARGUMENTS ... - The ID of the peer to search for. OPTIONS -v, --verbose bool - Print extra information. DESCRIPTION Outputs a list of newline-delimited multiaddresses. ``` ## ipfs dht findprovs ``` WARNING: DEPRECATED, command will be removed in the future USAGE ipfs dht findprovs ... - Find peers that can provide a specific value, given a key. SYNOPSIS ipfs dht findprovs [--verbose | -v] [--num-providers= | -n] [--] ... ARGUMENTS ... - The key to find providers for. OPTIONS -v, --verbose bool - Print extra information. -n, --num-providers int - The number of providers to find. Default: 20. DESCRIPTION Outputs a list of newline-delimited provider Peer IDs. ``` ## ipfs dht get ``` WARNING: DEPRECATED, command will be removed in the future USAGE ipfs dht get ... - Given a key, query the routing system for its best value. SYNOPSIS ipfs dht get [--] ... ARGUMENTS ... - The key to find a value for. DESCRIPTION Outputs the best value for the given key. There may be several different values for a given key stored in the routing system; in this context 'best' means the record that is most desirable. There is no one metric for 'best': it depends entirely on the key type. For IPNS, 'best' is the record that is both valid and has the highest sequence number (freshest). Different key types can specify other 'best' rules. ``` ## ipfs dht provide ``` WARNING: DEPRECATED, command will be removed in the future USAGE ipfs dht provide ... - Announce to the network that you are providing given values. SYNOPSIS ipfs dht provide [--verbose | -v] [--recursive | -r] [--] ... ARGUMENTS ... - The key[s] to send provide records for. OPTIONS -v, --verbose bool - Print extra information. -r, --recursive bool - Recursively provide entire graph. ``` ## ipfs dht put ``` WARNING: DEPRECATED, command will be removed in the future USAGE ipfs dht put - Write a key/value pair to the routing system. SYNOPSIS ipfs dht put [--] ARGUMENTS - The key to store the value at. - A path to a file containing the value to store. DESCRIPTION Given a key of the form /foo/bar and a valid value for that key, this will write that value to the routing system with that key. Keys have two parts: a keytype (foo) and the key name (bar). IPNS uses the /ipns keytype, and expects the key name to be a Peer ID. IPNS entries are specifically formatted (protocol buffer). You may only use keytypes that are supported in your ipfs binary: currently this is only /ipns. Unless you have a relatively deep understanding of the go-ipfs routing internals, you likely want to be using 'ipfs name publish' instead of this. The value must be a valid value for the given key type. For example, if the key is /ipns/QmFoo, the value must be IPNS record (protobuf) signed with the key identified by QmFoo. ``` ## ipfs dht query ``` USAGE ipfs dht query ... - Find the closest Peer IDs to a given Peer ID by querying the DHT. SYNOPSIS ipfs dht query [--verbose | -v] [--] ... ARGUMENTS ... - The peerID to run the query against. OPTIONS -v, --verbose bool - Print extra information. DESCRIPTION Outputs a list of newline-delimited Peer IDs. ``` ## ipfs diag ``` USAGE ipfs diag - Generate diagnostic reports. SYNOPSIS ipfs diag SUBCOMMANDS ipfs diag cmds - List commands run on this IPFS node. ipfs diag profile - Collect a performance profile for debugging. ipfs diag sys - Print system diagnostic information. For more information about each command, use: 'ipfs diag --help' ``` ## ipfs diag cmds ``` USAGE ipfs diag cmds - List commands run on this IPFS node. SYNOPSIS ipfs diag cmds [--verbose | -v] OPTIONS -v, --verbose bool - Print extra information. DESCRIPTION Lists running and recently run commands. SUBCOMMANDS ipfs diag cmds clear - Clear inactive requests from the log. ipfs diag cmds set-time