使用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)


目录
打赏
0
0
0
0
1937
分享
相关文章
Linux系统中的cd命令:目录切换技巧
踏过千山,越过万水,人生就是一场不断前行的旅程,总充满了未知与挑战。然而,“cd”命令如同你的旅伴,会带你穿梭在如棋盘一般的文件系统中,探索每一处未知。希望你能从“cd”命令中找到乐趣,像是掌控了一种络新妙的魔法,去向未知进发,开始你的探索之旅。
91 24
|
6天前
|
Linux命令的基本格式解析
总的来说,Linux命令的基本格式就像一个食谱,它可以指导你如何使用你的计算机。通过学习和实践,你可以成为一个真正的“计算机厨师”,创造出各种“美味”的命令。
45 15
Linux系统之su命令的基本使用
Linux系统之su命令的基本使用
67 2
Linux系统之su命令的基本使用
安装【银河麒麟V10】linux系统--并挂载镜像
安装【银河麒麟V10】linux系统--并挂载镜像
3437 0
卸载、下载、安装mysql(Linux系统centos7)
卸载、下载、安装mysql(Linux系统centos7)
304 0
|
6月前
|
手把手教会你安装Linux系统
手把手教会你安装Linux系统
147 0
部署05-VMwareWorkstation中安装CentOS7 Linux操作系统, VMware部署CentOS系统第一步,下载Linux系统,/不要忘, CentOS -7-x86_64-DVD
部署05-VMwareWorkstation中安装CentOS7 Linux操作系统, VMware部署CentOS系统第一步,下载Linux系统,/不要忘, CentOS -7-x86_64-DVD
从头安装Arch Linux系统
本文记录了作者安装Arch Linux系统的过程,包括安装成果展示和遇到的疑难点及其解决方法,如硬盘不足、下载失败、设置时区、安装微码和配置无密码登录等。
190 1
从头安装Arch Linux系统
使用redis进行手机验证码的验证、每天只能发送三次验证码 (redis安装在虚拟机linux系统中)
该博客文章展示了如何在Linux虚拟机上使用Redis和Jedis客户端实现手机验证码的验证功能,包括验证码的生成、存储、验证以及限制每天发送次数的逻辑,并提供了测试结果截图。
使用redis进行手机验证码的验证、每天只能发送三次验证码 (redis安装在虚拟机linux系统中)
虚拟机安装Linux系统的网络配置
该博客文章提供了解决虚拟机中Linux系统网络问题的多种方法,包括重置网络服务、修改网络配置文件、使用不同网络模式等,以确保虚拟机能够成功连接到网络。
虚拟机安装Linux系统的网络配置