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


目录
相关文章
|
8天前
|
Linux
Linux系统之whereis命令的基本使用
Linux系统之whereis命令的基本使用
50 23
Linux系统之whereis命令的基本使用
|
22天前
|
网络协议 Unix Linux
深入解析:Linux网络配置工具ifconfig与ip命令的全面对比
虽然 `ifconfig`作为一个经典的网络配置工具,简单易用,但其功能已经不能满足现代网络配置的需求。相比之下,`ip`命令不仅功能全面,而且提供了一致且简洁的语法,适用于各种网络配置场景。因此,在实际使用中,推荐逐步过渡到 `ip`命令,以更好地适应现代网络管理需求。
34 11
|
2月前
|
Linux
linux查看目录下的文件夹命令,find查找某个目录,但是不包括这个目录本身?
通过本文的介绍,您应该对如何在 Linux 系统中查看目录下的文件夹以及使用 `find` 命令查找特定目录内容并排除该目录本身有了清晰的理解。掌握这些命令和技巧,可以大大提高日常文件管理和查找操作的效率。 在实际应用中,灵活使用这些命令和参数,可以帮助您快速定位和管理文件和目录,满足各种复杂的文件系统操作需求。
143 8
|
Linux Windows 数据安全/隐私保护
linux挂载windows共享文件夹
MOUNT -t cifs -o username=域名/用户名,PASSWORD=密码 //IP/共享目录 /mnt
730 0
|
3月前
|
Linux 网络安全 数据安全/隐私保护
Linux 超级强大的十六进制 dump 工具:XXD 命令,我教你应该如何使用!
在 Linux 系统中,xxd 命令是一个强大的十六进制 dump 工具,可以将文件或数据以十六进制和 ASCII 字符形式显示,帮助用户深入了解和分析数据。本文详细介绍了 xxd 命令的基本用法、高级功能及实际应用案例,包括查看文件内容、指定输出格式、写入文件、数据比较、数据提取、数据转换和数据加密解密等。通过掌握这些技巧,用户可以更高效地处理各种数据问题。
345 8
|
3月前
|
监控 Linux
如何检查 Linux 内存使用量是否耗尽?这 5 个命令堪称绝了!
本文介绍了在Linux系统中检查内存使用情况的5个常用命令:`free`、`top`、`vmstat`、`pidstat` 和 `/proc/meminfo` 文件,帮助用户准确监控内存状态,确保系统稳定运行。
1131 6
|
3月前
|
Linux
在 Linux 系统中,“cd”命令用于切换当前工作目录
在 Linux 系统中,“cd”命令用于切换当前工作目录。本文详细介绍了“cd”命令的基本用法和常见技巧,包括使用“.”、“..”、“~”、绝对路径和相对路径,以及快速切换到上一次工作目录等。此外,还探讨了高级技巧,如使用通配符、结合其他命令、在脚本中使用,以及实际应用案例,帮助读者提高工作效率。
199 3