Linux command
ipfs 命令
网络
复制后可按需替换文件名、目录或参数。
常用示例
Initialize IPFS repository
ipfs init
Start IPFS daemon
ipfs daemon
Add file to IPFS
ipfs add [file]
Add directory recursively
ipfs add -r [directory]
Get file by CID
ipfs get [CID]
View file contents
ipfs cat [CID]
Pin a file
ipfs pin add [CID]
List pinned files
ipfs pin ls
Show node info
ipfs id
说明
ipfs is the command-line interface for the Kubo implementation of the InterPlanetary File System, a peer-to-peer content-addressed storage and distribution network. Each file or block is identified by a CID (Content Identifier) derived from the cryptographic hash of its contents, so the same data is reachable from any node that holds it without requiring a fixed host or URL. A local ipfs daemon acts as a gateway between the user and the global IPFS swarm: it dials peers, fetches blocks, pins content for long-term retention, and exposes both an HTTP gateway and a JSON-RPC API. The add subcommand stores files in the local datastore and prints the resulting CID; cat and get retrieve content; pin add keeps content from being garbage-collected; and files offers a POSIX-like mutable filesystem (MFS) layered on top of immutable IPLD objects.
参数
- -r, --recursive
- Add directories recursively.
- -q, --quiet
- Minimal output.
- -w, --wrap-with-directory
- Wrap files in directory.
FAQ
What is the ipfs command used for?
ipfs is the command-line interface for the Kubo implementation of the InterPlanetary File System, a peer-to-peer content-addressed storage and distribution network. Each file or block is identified by a CID (Content Identifier) derived from the cryptographic hash of its contents, so the same data is reachable from any node that holds it without requiring a fixed host or URL. A local ipfs daemon acts as a gateway between the user and the global IPFS swarm: it dials peers, fetches blocks, pins content for long-term retention, and exposes both an HTTP gateway and a JSON-RPC API. The add subcommand stores files in the local datastore and prints the resulting CID; cat and get retrieve content; pin add keeps content from being garbage-collected; and files offers a POSIX-like mutable filesystem (MFS) layered on top of immutable IPLD objects.
How do I run a basic ipfs example?
Run `ipfs init` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -r, --recursive do in ipfs?
Add directories recursively.