mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-01-22 23:00:57 +08:00
translated
This commit is contained in:
parent
303c441f4c
commit
25f186965d
@ -1,188 +0,0 @@
|
||||
[#]: subject: "Transfer files between your phone and Linux with this open source tool"
|
||||
[#]: via: "https://opensource.com/article/21/11/transfer-files-phone-linux"
|
||||
[#]: author: "Don Watkins https://opensource.com/users/don-watkins"
|
||||
[#]: collector: "lujun9972"
|
||||
[#]: translator: "geekpi"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
Transfer files between your phone and Linux with this open source tool
|
||||
======
|
||||
The qrcp project offers a way to quickly copy files from your iPhone or
|
||||
Android device to your Linux computer and vice versa.
|
||||
![A person looking at a phone][1]
|
||||
|
||||
Are you looking for a way to quickly copy files from your iPhone or Android mobile device to your Linux computer or from your Linux computer to your devices? I recently discovered an open source application that's easy to install and makes transferring files as simple as a QR code.
|
||||
|
||||
The `qrcp` project provides a command that generates a QR code in your terminal that allows you to send or receive files to your computer over the network.
|
||||
|
||||
### Install qrcp on Linux, Windows, or Mac
|
||||
|
||||
The developer, Claudio d'Angelis, has released the `qrcp` application with an MIT license. I found it easy to install and easy to use. It's available for Linux, Windows, and macOS, and can be downloaded as an RPM, DEB, or tarball. There are builds for nearly every platform, including the Raspberry Pi.
|
||||
|
||||
If you want to install it on Linux, download either the RPM or DEB and use your package manager to perform a local install. For example, on Fedora, CentOS, or Mageia, or similar:
|
||||
|
||||
|
||||
```
|
||||
`$ sudo dnf install ./qrcp*rpm`
|
||||
```
|
||||
|
||||
If you just want to try it, you can download the tar.gz archive and run it locally:
|
||||
|
||||
|
||||
```
|
||||
|
||||
|
||||
$ tar --extract --file qrcp*tar.gz
|
||||
$ ./qrcp version
|
||||
qrcp 0.x.y
|
||||
|
||||
```
|
||||
|
||||
### Set up qrcp
|
||||
|
||||
You can view all of the available `qrcp` options by using the `--help` option:
|
||||
|
||||
|
||||
```
|
||||
|
||||
|
||||
$ qrcp --help
|
||||
$ ./qrcp --help
|
||||
Usage:
|
||||
qrcp [flags]
|
||||
qrcp [command]
|
||||
|
||||
Available Commands:
|
||||
completion Generate completion script
|
||||
config Configure qrcp
|
||||
help Help about any command
|
||||
receive Receive one or more files
|
||||
send Send a file(s) or directories from this host
|
||||
version Print version number and build information.
|
||||
[...]
|
||||
|
||||
```
|
||||
|
||||
You can configure the application by editing the default configuration file located at `~/.config/qrcp/config.json` using your favorite editor or invoking the configuration wizard from the command line:
|
||||
|
||||
|
||||
```
|
||||
`$ qrcp config`
|
||||
```
|
||||
|
||||
The first step is to create a configuration file. The `qrcp config` command takes you through this process, but there are a few tricky questions.
|
||||
|
||||
The first question asks you for a fully-qualified domain name. If you're using `qrcp` on a local network that doesn't use fully-qualified domain names (or if you don't know one way or the other), then leave this blank. The `qrcp` command will use your local IP address instead.
|
||||
|
||||
The next question prompts you for a port. Most firewalls block non-standard ports, but it's not uncommon to recognize port 8080 as Internet traffic. If your firewall blocks port 8080, then you'll still have to add an exception. Assuming your system uses `firewalld`, you can allow traffic on port 8080 with this command:
|
||||
|
||||
|
||||
```
|
||||
`$ sudo firewall-cmd --add-port 8080/tcp --permanent`
|
||||
```
|
||||
|
||||
Decline the option to keep the network connection alive after the transfer is complete and let `qrcp` generate a random path.
|
||||
|
||||
Assuming you're on a trusted network, use an HTTP (not HTTPS) connection, so you don't have to configure TLS.
|
||||
|
||||
The configuration is stored in `~/.config/qrcp/config.json` and is editable after the fact, so if you change your mind about any setting, it's easy to update.
|
||||
|
||||
The updated configuration looks like this:
|
||||
|
||||
|
||||
```
|
||||
|
||||
|
||||
{
|
||||
"fqdn": "",
|
||||
"interface": "wlp0s20f3",
|
||||
"port": 8080,
|
||||
"keepAlive": false,
|
||||
"path": "",
|
||||
"secure": false,
|
||||
"tls-key": "",
|
||||
"tls-cert": "",
|
||||
"output": "/home/don"
|
||||
|
||||
```
|
||||
|
||||
### Transfer files with qrcp
|
||||
|
||||
Now you're ready to send a file from your Linux computer to your mobile device. In this example, I used my iPhone, which infamously offers no support Linux at all. The process is exactly the same on an Android device.
|
||||
|
||||
Here's how I do it. First, I create an example file on my computer:
|
||||
|
||||
|
||||
```
|
||||
`$ echo "Hello world"> ~/example.txt`
|
||||
```
|
||||
|
||||
Next, I use the `send` subcommand to send the file from my Linux computer to my mobile:
|
||||
|
||||
|
||||
```
|
||||
`Linux~$ qrcp send example.txt`
|
||||
```
|
||||
|
||||
![example of sending a file][2]
|
||||
|
||||
Example of sending a file using qrcp send example.txt (CC BY-SA 4.0)
|
||||
|
||||
I open my camera application (on Android, I use a privacy-friendly dedicated QR scanner) and the iPhone scans the QR code and launches Safari on my phone. Finally, I click on the **Download** button.
|
||||
|
||||
![example download][3]
|
||||
|
||||
Download the example.txt file (CC BY-SA 4.0)
|
||||
|
||||
### Receiving files with qrcp
|
||||
|
||||
Receiving files is just as easy, except the command is slightly different:
|
||||
|
||||
|
||||
```
|
||||
`$ qrcp receive`
|
||||
```
|
||||
|
||||
![example of receiving a file][4]
|
||||
|
||||
Receive a file using the grcp receive command (CC BY-SA 4.0)
|
||||
|
||||
I scan the QR code, and it once again launches the Safari browser on my phone, but this time it appears a bit different because I'm sending files from my iPhone to the Linux computer.
|
||||
|
||||
![example of selecting a file][5]
|
||||
|
||||
Select a file to transfer (CC BY-SA 4.0)
|
||||
|
||||
I click on **Choose Files**, which allows me to choose the file I want to send.
|
||||
|
||||
![file appears in default location][6]
|
||||
|
||||
The file is downloaded to the default location (CC BY-SA 4.0)
|
||||
|
||||
After sending the file, it's found in the default location specified in my configuration.
|
||||
|
||||
### Try qrcp
|
||||
|
||||
The project documentation is brief but adequate, and it's supported by a community of developers in addition to Claudio d'Angelis, who originally came up with the idea. The community welcomes you to join them, and the application will change the way you look at file transfers to and from your mobile devices. Try it out!
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/21/11/transfer-files-phone-linux
|
||||
|
||||
作者:[Don Watkins][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/don-watkins
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/idea_innovation_mobile_phone.png?itok=RqVtvxkd (A person looking at a phone)
|
||||
[2]: https://opensource.com/sites/default/files/send-example.png
|
||||
[3]: https://opensource.com/sites/default/files/download-example.png
|
||||
[4]: https://opensource.com/sites/default/files/receive-file.png
|
||||
[5]: https://opensource.com/sites/default/files/select-file.jpg
|
||||
[6]: https://opensource.com/sites/default/files/default-location.png
|
@ -0,0 +1,188 @@
|
||||
[#]: subject: "Transfer files between your phone and Linux with this open source tool"
|
||||
[#]: via: "https://opensource.com/article/21/11/transfer-files-phone-linux"
|
||||
[#]: author: "Don Watkins https://opensource.com/users/don-watkins"
|
||||
[#]: collector: "lujun9972"
|
||||
[#]: translator: "geekpi"
|
||||
[#]: reviewer: " "
|
||||
[#]: publisher: " "
|
||||
[#]: url: " "
|
||||
|
||||
用这个开源工具在你的手机和 Linux 之间传输文件
|
||||
======
|
||||
qrcp 项目提供了一种快速地从你的 iPhone 或 Android 设备中复制文件到你的 Linux 电脑的方法,反之亦然。
|
||||
![A person looking at a phone][1]
|
||||
|
||||
你是否在寻找一种方法来快速复制文件,从你的 iPhone 或 Android 移动设备到你的 Linux 电脑,或者从你的 Linux 电脑到你的设备?我最近发现了一个开源的应用,它很容易安装,并使传输文件只需一个二维码。
|
||||
|
||||
`qrcp` 项目提供了一个命令,可以在你的终端生成一个二维码,让你通过网络向你的电脑发送或接收文件。
|
||||
|
||||
### 在 Linux、Windows 或 Mac 上安装 qrcp
|
||||
|
||||
开发者 Claudio d'Angelis 以 MIT 许可证发布了 `qrcp` 应用。我发现它很容易安装,也很容易使用。它适用于 Linux、Windows 和 macOS,可以作为 RPM、DEB 或 tarball 下载。它为几乎所有的平台构建,包括树莓派。
|
||||
|
||||
如果你想在 Linux 上安装它,下载 RPM 或 DEB,并使用你的包管理器进行本地安装。例如,在 Fedora、CentOS 或 Mageia,或类似的平台上:
|
||||
|
||||
|
||||
```
|
||||
`$ sudo dnf install ./qrcp*rpm`
|
||||
```
|
||||
|
||||
如果你只是想试试,你可以下载 tar.gz 压缩包并在本地运行它:
|
||||
|
||||
|
||||
```
|
||||
|
||||
|
||||
$ tar --extract --file qrcp*tar.gz
|
||||
$ ./qrcp version
|
||||
qrcp 0.x.y
|
||||
|
||||
```
|
||||
|
||||
### 设置 qrcp
|
||||
|
||||
你可以通过使用 `--help` 选项查看所有可用的 `qrcp` 选项:
|
||||
|
||||
|
||||
|
||||
```
|
||||
|
||||
|
||||
$ qrcp --help
|
||||
$ ./qrcp --help
|
||||
Usage:
|
||||
qrcp [flags]
|
||||
qrcp [command]
|
||||
|
||||
Available Commands:
|
||||
completion Generate completion script
|
||||
config Configure qrcp
|
||||
help Help about any command
|
||||
receive Receive one or more files
|
||||
send Send a file(s) or directories from this host
|
||||
version Print version number and build information.
|
||||
[...]
|
||||
|
||||
```
|
||||
|
||||
你可以使用你喜欢的编辑器编辑编辑位于 `~/.config/qrcp/config.json` 的默认配置文件或从命令行调用配置向导来配置应用。
|
||||
|
||||
|
||||
```
|
||||
`$ qrcp config`
|
||||
```
|
||||
|
||||
第一步是创建一个配置文件。`qrcp config` 命令带你完成这个过程,但有几个棘手的问题。
|
||||
|
||||
第一个问题是要求你提供一个完全限定域名。如果你在一个不使用完全限定域名的本地网络上使用 `qrcp`(或者你不知道哪种方式),那么就把这个留空。`qrcp` 命令将使用你的本地 IP 地址代替。
|
||||
|
||||
下一个问题是提示你选择端口。大多数防火墙会阻止非标准的端口,但识别 8080 端口作为互联网流量的情况并不少见。如果你的防火墙屏蔽了 8080 端口,那么你还是要添加一个例外。假设你的系统使用 `firewalld`,你可以用这个命令允许 8080 端口的流量:
|
||||
|
||||
|
||||
```
|
||||
`$ sudo firewall-cmd --add-port 8080/tcp --permanent`
|
||||
```
|
||||
|
||||
拒绝在传输完成后保持网络连接的选项,让 `qrcp` 生成一个随机路径。
|
||||
|
||||
假设你在一个可信的网络上,使用 HTTP(而不是 HTTPS)连接,所以你不必配置 TLS。
|
||||
|
||||
配置保存在 `~/.config/qrcp/config.json` 中,并且之后可以编辑,所以如果你想改变设置,它很容易更新。
|
||||
|
||||
更新后的配置看起来像这样:
|
||||
|
||||
|
||||
```
|
||||
|
||||
|
||||
{
|
||||
"fqdn": "",
|
||||
"interface": "wlp0s20f3",
|
||||
"port": 8080,
|
||||
"keepAlive": false,
|
||||
"path": "",
|
||||
"secure": false,
|
||||
"tls-key": "",
|
||||
"tls-cert": "",
|
||||
"output": "/home/don"
|
||||
|
||||
```
|
||||
|
||||
### 用 qrcp 传输文件
|
||||
|
||||
现在你已经准备好从你的 Linux 电脑向你的移动设备发送一个文件。在这个例子中,我使用了我的 iPhone,它完全不支持 Linux,这是臭名昭著的。这个过程在安卓设备上是完全一样的。
|
||||
|
||||
我是这样做的。首先,我在我的电脑上创建一个示例文件:
|
||||
|
||||
|
||||
```
|
||||
`$ echo "Hello world"> ~/example.txt`
|
||||
```
|
||||
|
||||
接下来,我使用 `send` 子命令将文件从我的 Linux 电脑发送到我的手机:
|
||||
|
||||
|
||||
```
|
||||
`Linux~$ qrcp send example.txt`
|
||||
```
|
||||
|
||||
![example of sending a file][2]
|
||||
|
||||
使用 qrcp send example.txt 发送文件的例子(CC BY-SA 4.0)
|
||||
|
||||
我打开我的相机应用(在 Android 上,我使用一个保护隐私的专用二维码扫描器),iPhone 扫描二维码并在我的手机上启动 Safari 浏览器。最后,我点击**下载**按钮。
|
||||
|
||||
![example download][3]
|
||||
|
||||
下载例子 .txt 文件(CC BY-SA 4.0)
|
||||
|
||||
### 用 qrcp 接收文件
|
||||
|
||||
接收文件也一样简单,只是命令略有不同:
|
||||
|
||||
|
||||
```
|
||||
`$ qrcp receive`
|
||||
```
|
||||
|
||||
![example of receiving a file][4]
|
||||
|
||||
使用 qrcp receive 命令接收一个文件(CC BY-SA 4.0)
|
||||
|
||||
我扫描了二维码,它再次启动了我手机上的 Safari 浏览器,但这次出现了一些不同,因为我正在将文件从我的 iPhone 发送到 Linux 电脑上。
|
||||
|
||||
![example of selecting a file][5]
|
||||
|
||||
选择一个要传输的文件(CC BY-SA 4.0)
|
||||
|
||||
我点击**选择文件**,它允许我选择我想发送的文件。
|
||||
|
||||
![file appears in default location][6]
|
||||
|
||||
文件被下载到默认位置(CC BY-SA 4.0)
|
||||
|
||||
发送文件后,在我的配置中指定的默认位置找到了文件。
|
||||
|
||||
### 尝试 qrcp
|
||||
|
||||
项目文档很简短但很充分,除了最初提出这个想法的 Claudio d'Angelis 之外,它还得到了一个开发者社区的支持。这个社区欢迎你加入他们,该应用将改变你对移动设备之间文件传输的看法。试试吧!
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/21/11/transfer-files-phone-linux
|
||||
|
||||
作者:[Don Watkins][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/don-watkins
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/idea_innovation_mobile_phone.png?itok=RqVtvxkd (A person looking at a phone)
|
||||
[2]: https://opensource.com/sites/default/files/send-example.png
|
||||
[3]: https://opensource.com/sites/default/files/download-example.png
|
||||
[4]: https://opensource.com/sites/default/files/receive-file.png
|
||||
[5]: https://opensource.com/sites/default/files/select-file.jpg
|
||||
[6]: https://opensource.com/sites/default/files/default-location.png
|
Loading…
Reference in New Issue
Block a user