Linux command
cpx 命令
文本
复制后可按需替换文件名、目录或参数。
常用示例
Copy
cpx [source.txt] [dest.txt]
Copy
cpx -r [source_dir/] [dest_dir/]
Copy
cpx -r -e "node_modules" -e ".git" [project/] [/backup/]
Resume
cpx -r --resume [large_dataset/] [/backup/]
Preserve
cpx -r -p=all [photos/] [/backup/photos/]
Parallel
cpx -r -j 8 [source/] [dest/]
说明
cpx is a modern replacement for the traditional cp command, built in Rust for performance and safety. It provides parallel file copying (up to 5x faster than standard cp in benchmarks), visual progress bars, the ability to resume interrupted transfers with checksum verification, graceful Ctrl+C handling with resume hints, and gitignore-style exclude patterns.
参数
- -r, --recursive
- Copy directories recursively.
- -j _N_
- Number of parallel operations (default: 4).
- --resume
- Resume interrupted transfers with checksum verification.
- -f, --force
- Remove and retry if destination is unavailable.
- -i, --interactive
- Prompt before overwriting.
- -t, --target-directory _DIR_
- Copy all sources into the specified directory.
- -e, --exclude _PATTERN_
- Exclude matching files (glob patterns, comma-separated).
- -s, --symbolic-link _MODE_
- Create symlinks instead of copying (auto/absolute/relative).
- -l, --link
- Create hard links instead of copying.
- -P, --no-dereference
- Never follow source symlinks.
- -L, --dereference
- Always follow source symlinks.
- -p, --preserve _ATTRS_
- Preserve attributes (default/all/mode/timestamps/ownership/links/xattr).
- -b, --backup _MODE_
- Backup existing files (none/simple/numbered/existing).
- --reflink _WHEN_
- Copy-on-write if supported (auto/always/never).
- --parents
- Preserve full source path structure.
- --no-config
- Ignore all config files.
FAQ
What is the cpx command used for?
cpx is a modern replacement for the traditional cp command, built in Rust for performance and safety. It provides parallel file copying (up to 5x faster than standard cp in benchmarks), visual progress bars, the ability to resume interrupted transfers with checksum verification, graceful Ctrl+C handling with resume hints, and gitignore-style exclude patterns.
How do I run a basic cpx example?
Run `cpx [source.txt] [dest.txt]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.
What does -r, --recursive do in cpx?
Copy directories recursively.