使用croc命令在Linux系统电脑之间传输文件和文件夹(二)

简介: 使用croc命令在Linux系统电脑之间传输文件和文件夹

设置自定义代码短语

每次发送文件或文件夹时, croc 都会生成一个随机代码短语,但因为每次都不一样,使用起来还是不太方便。所以我们可以自定义一个代码短语,提高效率。可以使用 --code 参数来设置自定义代码短语来发送文件/文件夹。

$ croc send --code download-this file.txt

这里的download-this 就是我们自定义的代码短语。输出示例:

Sending 'file.txt' (116 B)

Code is: download-this

On the other computer run


croc download-this

收件人可以使用以下命令接收文件(使用自定义的代码短语):

$ croc download-this

微信图片_20220419171113.jpg

发送文本

就像文件和文件夹一样,我们也可以共享文本。当你要共享消息或者 URL 时可以用这种方式。如果要使用 croc 发送文本,可以运行以下命令:

$ croc send --text "Hello!!"

输出示例:

Sending 'text'

Code is: natural-roof-clock

On the other computer run


croc natural-roof-clock


Sending (->[fe80::a00:27ff:fe10:7cc1%wlp9s0]:39916)

收件方需要使用以下命令获取文本:

$ croc natural-roof-clock

Accept 'text' ? (y/n) y


Receiving (<-[fe80::d710:cf4:bb49:8b20%enp0s8]:9009)

Hello!!

微信图片_20220419171116.jpg

使用管道

你可以将文件的输出通过管道传输到 croc 作为它的输入,如下所示。

$ cat file.txt | croc send

输出示例:

Sending 'stdin' (116 B)

Code is: dexter-cowboy-soprano

On the other computer run


croc dexter-cowboy-soprano

croc 将自动使用 stdin 数据并发送文件,分配文件名,例如“ croc-stdin-728899651”。在接收端,用户可以使用以下命令接收文件:

$ croc dexter-cowboy-soprano

或者,使用:

$ croc --yes dexter-cowboy-soprano > out

在这里,--yes 选项不会要求任何确认,并自动同意所有提示。

设置输出文件夹

默认情况下, croc 会将数据下载到当前工作目录中。您可以使用 --out 选项使其使用不同的下载位置。

$ croc send file.txt

输出示例:

Sending 'file.txt' (116 B)

Code is: program-public-mystery

On the other computer run


croc program-public-mystery

在接收端,运行:

$ croc --out ~/Downloads

出现提示时输入代码短语。

获得帮助

要获取帮助,请运行以下命令:

$ croc --help

NAME:

  croc - easily and securely transfer stuff from one computer to another


USAGE:

  Send a file:

     croc send file.txt


  Send a file with a custom code:

     croc send --code secret-passphrase file.txt


VERSION:

  v8.3.2-7d155ad


COMMANDS:

  send     send a file (see options with croc send -h)

  relay    start your own relay (optional)

  help, h  Shows a list of commands or helpfor one command


GLOBAL OPTIONS:

  --remember      save these settings to reuse next time (default: false)

  --debug         toggle debug mode (default: false)

  --yes           automatically agree to all prompts (default: false)

  --stdout        redirect file to stdout (default: false)

  --no-compress   disable compression (default: false)

  --ask           make sure sender and recipient are prompted (default: false)

  --relay value   address of the relay (default: "142.93.177.120:9009") [$CROC_RELAY]

  --relay6 value  ipv6 address of the relay (default: "[2604:a880:800:c1::14c:1]:9009") [$CROC_RELAY6]

  --out value     specify an output folder to receive the file (default: ".")

  --pass value    password for the relay (default: "pass123") [$CROC_PASS]

  --help, -h      show help (default: false)

  --version, -v   print the version (default: false)


目录
相关文章
|
1天前
|
机器学习/深度学习 存储 Linux
linux中强大且常用命令:find、xargs、grep
linux中强大且常用命令:find、xargs、grep
23 9
|
1天前
|
SQL 移动开发 Linux
linux下find、grep命令详解
linux下find、grep命令详解
25 8
|
6天前
|
设计模式 Java Linux
Linux的20个常用命令
Linux的23个常用命令
Linux的20个常用命令
|
4月前
|
缓存 Linux 测试技术
安装【银河麒麟V10】linux系统--并挂载镜像
安装【银河麒麟V10】linux系统--并挂载镜像
1181 0
|
4月前
|
关系型数据库 MySQL Linux
卸载、下载、安装mysql(Linux系统centos7)
卸载、下载、安装mysql(Linux系统centos7)
196 0
|
2月前
|
Linux 虚拟化 数据安全/隐私保护
部署05-VMwareWorkstation中安装CentOS7 Linux操作系统, VMware部署CentOS系统第一步,下载Linux系统,/不要忘, CentOS -7-x86_64-DVD
部署05-VMwareWorkstation中安装CentOS7 Linux操作系统, VMware部署CentOS系统第一步,下载Linux系统,/不要忘, CentOS -7-x86_64-DVD
|
1月前
|
存储 NoSQL Java
使用redis进行手机验证码的验证、每天只能发送三次验证码 (redis安装在虚拟机linux系统中)
该博客文章展示了如何在Linux虚拟机上使用Redis和Jedis客户端实现手机验证码的验证功能,包括验证码的生成、存储、验证以及限制每天发送次数的逻辑,并提供了测试结果截图。
使用redis进行手机验证码的验证、每天只能发送三次验证码 (redis安装在虚拟机linux系统中)
|
1月前
|
Linux
虚拟机安装Linux系统的网络配置
该博客文章提供了解决虚拟机中Linux系统网络问题的多种方法,包括重置网络服务、修改网络配置文件、使用不同网络模式等,以确保虚拟机能够成功连接到网络。
虚拟机安装Linux系统的网络配置
|
2月前
|
安全 Linux 数据安全/隐私保护
入职必会-开发环境搭建33-VMWare虚拟机安装Linux系统
CentOS(Community ENTerprise Operating System)是一个基于Linux的开源操作系统,它是由社区志愿者团队从Red Hat Enterprise Linux(RHEL)源代码重新编译而成。CentOS致力于提供一个稳定、可靠且免费的企业级Linux发行版,适用于服务器和工作站环境。
|
2月前
|
缓存 Linux 测试技术
安装【银河麒麟V10】linux系统--并挂载镜像12
【7月更文挑战第12天】安装【银河麒麟V10】linux系统--并挂载镜像
549 0