mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-03-27 02:30:10 +08:00
Merge remote-tracking branch 'LCTT/master'
This commit is contained in:
commit
50884fbae3
@ -1,83 +1,86 @@
|
||||
如何在 Linux 和 Windows 之间共享文件?
|
||||
如何在 Linux 和 Windows 之间共享文件?
|
||||
=====
|
||||
|
||||
> 用一些来自 Linux 社区的工具,在 Linux 和 Windows 之间共享文件是超容易的。让我们看看可以做这件事的两种不同方法。
|
||||
|
||||

|
||||
|
||||
现代很多人都在混合网络上工作,Linux 和 Windows 系统都扮演着重要的结束。在两者之间共享文件有时是非常关键的,并且使用正确的工具非常容易。只需很少的功夫,你就可以将文件从 Windows 复制到 Linux 或从 Linux 到 Windows。在这篇文章中,我们将讨论配置 Linux 和 Windows 系统所需的东西,以允许你轻松地将文件从一个操作系统转移到另一个。
|
||||
|
||||
### 在 Linux 和 Windows 之间复制文件
|
||||
|
||||
在 Windows 和 Linux 之间移动文件的第一步是下载并安装诸如 PuTTY 的 pscp 之类的工具。你可以从 [putty.org][1] 获得它,并轻松将其设置在 Windows 系统上。PuTTY 带有一个终端仿真器(putty)以及像 **pscp** 这样的工具,用于在 Linux 和 Windows 系统之间安全地复制文件。当你进入 PuTTY 站点时,你可以选择安装所有工具,或选择安装你想要的工具,也可以选择单个 .exe 文件。
|
||||
在 Windows 和 Linux 之间移动文件的第一步是下载并安装诸如 PuTTY 的 `pscp` 之类的工具。你可以从 [putty.org][1] 获得它(LCTT 译注:切记从官方网站下载,并最好对比其 md5/sha1 指纹),并轻松将其设置在 Windows 系统上。PuTTY 带有一个终端仿真器(`putty`)以及像 `pscp` 这样的工具,用于在 Linux 和 Windows 系统之间安全地复制文件。当你进入 PuTTY 站点时,你可以选择安装所有工具,或选择安装你想要的工具,也可以选择单个 .exe 文件。
|
||||
|
||||
你还需要在你的 Linux 系统上设置并运行 ssh 服务器。这允许它支持客户端(Windows 端)连接请求。如果你还没有安装 ssh 服务器,那么以下步骤可以在 Debian 系统上运行(包括 Ubuntu 等):
|
||||
|
||||
你还需要在你的 Linux 系统上设置并运行 ssh-server。这允许它支持客户端(Windows 端)连接请求。如果你还没有安装 ssh 服务器,那么以下步骤可以在 Debian 系统上运行(包括 Ubuntu 等):
|
||||
```
|
||||
sudo apt update
|
||||
sudo apt install ssh-server
|
||||
sudo service ssh start
|
||||
|
||||
```
|
||||
|
||||
对于 Red Hat 及其相关的 Linux 系统,使用类似的命令:
|
||||
|
||||
```
|
||||
sudo yum install openssh-server
|
||||
sudo systemctl start sshd
|
||||
|
||||
```
|
||||
注意,如果你正在运行防火墙(例如 ufw),则可能需要打开 22 端口以允许连接。
|
||||
|
||||
使用 **pscp** 命令,你可以将文件从 Windows 移到 Linux,反之亦然。它的 “copy from to” 命令的语法非常简单。
|
||||
使用 `pscp` 命令,你可以将文件从 Windows 移到 Linux,反之亦然。它的 “copy from to” 命令的语法非常简单。
|
||||
|
||||
#### 从 Windows 到 Linux
|
||||
|
||||
在下面显示的命令中,我们将 Windows 系统上用户账户中的文件复制到 Linux 系统下的 /tmp 目录。
|
||||
|
||||
```
|
||||
C:\Program Files\PuTTY>pscp \Users\shs\copy_me.txt shs@192.168.0.18:/tmp
|
||||
shs@192.168.0.18's password:
|
||||
copy_me.txt | 0 kB | 0.1 kB/s | ETA: 00:00:00 | 100%
|
||||
|
||||
```
|
||||
|
||||
#### 从 Linux 到 Windows
|
||||
|
||||
将文件从 Linux 转移到 Windows 也同样简单。只要反向参数即可。
|
||||
将文件从 Linux 转移到 Windows 也同样简单。只要颠倒参数即可。
|
||||
|
||||
```
|
||||
C:\Program Files\PuTTY>pscp shs@192.168.0.18:/tmp/copy_me.txt \Users\shs
|
||||
shs@192.168.0.18's password:
|
||||
copy_me.txt | 0 kB | 0.1 kB/s | ETA: 00:00:00 | 100%
|
||||
|
||||
```
|
||||
|
||||
如果 1) pscp 位于 Windows 搜索路径中,并且 2) 你的 Linux 系统在 Windows hosts 文件中,则该过程可以变得更加顺畅和轻松。(to 校正者:这句话不怎么明白)
|
||||
如果 1) `pscp` 位于 Windows 搜索路径中,并且 2) 你的 Linux 系统在 Windows 的 hosts 文件中,则该过程可以变得更加顺畅和轻松。
|
||||
|
||||
#### Windows 搜索路径
|
||||
|
||||
如果你使用 PuTTY 安装程序安装 PuTTY 工具,你可能会发现 **C:\Program files\PuTTY** 位于 Windows 搜索路径中。你可以通过在 Windows 命令提示符下键入 **echo %path%** 来检查是否属于这种情况(在搜索栏中键入 “cmd” 来打开命令提示符)。如果是这样,你不需要关心文件系统中相对于 pscp 可执行文件的位置。进入到包含你想要移动文件的文件夹可能会更容易。
|
||||
如果你使用 PuTTY 安装程序安装 PuTTY 工具,你可能会发现 `C:\Program files\PuTTY` 位于 Windows 搜索路径中。你可以通过在 Windows 命令提示符下键入 `echo %path%` 来检查是否属于这种情况(在搜索栏中键入 `cmd` 来打开命令提示符)。如果是这样,你不需要关心文件系统中相对于 `pscp` 可执行文件的位置。进入到包含你想要移动文件的文件夹可能会更容易。
|
||||
|
||||
```
|
||||
C:\Users\shs>pscp copy_me.txt shs@192.168.0.18:/tmp
|
||||
shs@192.168.0.18's password:
|
||||
copy_me.txt | 0 kB | 0.1 kB/s | ETA: 00:00:00 | 100%
|
||||
|
||||
```
|
||||
|
||||
#### 更新你的 Windows hosts 文件
|
||||
#### 更新你的 Windows 的 hosts 文件
|
||||
|
||||
这是另一个小修补。使用管理员权限,你可以将 Linux 系统添加到 Windows 的 hosts 文件中(`C:\Windows\System32\drivers\etc\hosts`),然后使用其主机名代替其 IP 地址。请记住,如果你的 Linux 系统的 IP 地址是动态分配的,那么它不会一直发挥作用。
|
||||
|
||||
这是另一个小修补。使用管理员权限,你可以将 Linux 系统添加到 Windows hosts 文件(C:\Windows\System32\drivers\etc\hosts),然后使用其主机名代替其 IP 地址。请记住,如果你的 Linux 系统的 IP 地址是动态分配的,那么它不会一直发挥作用。
|
||||
```
|
||||
C:\Users\shs>pscp copy_me.txt shs@stinkbug:/tmp
|
||||
shs@192.168.0.18's password:
|
||||
hosts | 0 kB | 0.8 kB/s | ETA: 00:00:00 | 100%
|
||||
|
||||
```
|
||||
|
||||
请注意,Windows hosts 文件与 Linux 系统上的 /etc/hosts 文件格式相同 -- IP 地址,空格,主机名。注释以 pound(to 校正者:这个符号是英镑符??) 符号来表示的。
|
||||
请注意,Windows 的 hosts 文件与 Linux 系统上的 `/etc/hosts` 文件格式相同 -- IP 地址、空格、主机名。注释以 `#` 符号来表示的。
|
||||
|
||||
```
|
||||
# Linux systems
|
||||
192.168.0.18 stinkbug
|
||||
|
||||
```
|
||||
|
||||
#### 讨厌的行结尾符
|
||||
|
||||
请记住,Windows 上文本文件中的行以回车符和换行符结束。pscp 工具不会删除回车符,使文件看起来像 Linux 文本文件。相反,它只是完整地复制文件。你可以考虑安装 **tofrodos** 包,这使你能够在 Linux 系统上使用 **fromdos** 和 **todos** 命令来调整在平台之间移动的文件。
|
||||
请记住,Windows 上文本文件中的行以回车符和换行符结束。`pscp` 工具不会删除回车符,以使文件看起来像 Linux 文本文件。相反,它只是完整地复制文件。你可以考虑安装 `tofrodos` 包,这使你能够在 Linux 系统上使用 `fromdos` 和 `todos` 命令来调整在平台之间移动的文件。
|
||||
|
||||
### 在 Windows 和 Linux 之间共享文件夹
|
||||
|
||||
@ -96,7 +99,7 @@ via: https://www.networkworld.com/article/3269189/linux/sharing-files-between-li
|
||||
作者:[Sandra Henry-Stocker][a]
|
||||
选题:[lujun9972](https://github.com/lujun9972)
|
||||
译者:[MjSeven](https://github.com/MjSeven)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
@ -1,88 +1,63 @@
|
||||
如何在 Linux 中使用 history 命令
|
||||
======
|
||||
|
||||
> 用强大的 history 命令使你的命令行提示符更有效率。
|
||||
|
||||

|
||||
|
||||
随着我在终端中花费越来越多的时间,我感觉就像不断地寻找新的命令,使我的日常任务更加高效。GNU 的 `history` 命令是一个真正改变我日常工作的命令。
|
||||
随着我在终端中花费越来越多的时间,我感觉就像在不断地寻找新的命令,以使我的日常任务更加高效。GNU 的 `history` 命令是一个真正改变我日常工作的命令。
|
||||
|
||||
GNU `history` 命令保存了从该终端会话运行的所有其他命令的列表,然后允许你重放或者重用这些命令,而不用重新输入它们。如果你是一个老玩家,你知道 `history` 的力量,但对于我们这些半吊子或新手系统管理员来说, `history` 是一个立竿见影的生产力增益。
|
||||
|
||||
### History 101
|
||||
### 历史 101
|
||||
|
||||
要查看命令历史,请在 Linux 中打开终端程序,然后输入:
|
||||
|
||||
要查看 `history`,请在 Linux 中打开终端程序,然后输入:
|
||||
```
|
||||
$ history
|
||||
|
||||
```
|
||||
|
||||
这是我得到的响应:
|
||||
|
||||
```
|
||||
1 clear
|
||||
|
||||
|
||||
|
||||
2 ls -al
|
||||
|
||||
|
||||
|
||||
3 sudo dnf update -y
|
||||
|
||||
|
||||
|
||||
4 history
|
||||
|
||||
```
|
||||
|
||||
`history` 命令显示自开始会话后输入的命令列表。 `history` 有趣的地方是你可以使用以下命令重放任意一个命令:
|
||||
|
||||
```
|
||||
$ !3
|
||||
|
||||
```
|
||||
|
||||
提示符中的 `!3` 告诉 shell 重新运行历史列表中第 3 个命令。我还可以输入以下命令来使用:
|
||||
|
||||
```
|
||||
linuser@my_linux_box: !sudo dnf
|
||||
|
||||
```
|
||||
|
||||
`history` 将搜索与你提供的模式相匹配的最后一个命令并运行它。
|
||||
`history` 将搜索与你提供的模式相匹配的最后一个命令,并运行它。
|
||||
|
||||
### 搜索历史
|
||||
|
||||
你还可以输入 `!!` 重新运行 `history` 的最后一条命令。而且,通过与` grep` 配对,你可以搜索与文本模式相匹配的命令,或者通过与 `tail` 一起使用,你可以找到你最后几条执行的命令。例如:
|
||||
你还可以输入 `!!` 重新运行命令历史中的最后一条命令。而且,通过与` grep` 配对,你可以搜索与文本模式相匹配的命令,或者通过与 `tail` 一起使用,你可以找到你最后几条执行的命令。例如:
|
||||
|
||||
```
|
||||
$ history | grep dnf
|
||||
|
||||
|
||||
|
||||
3 sudo dnf update -y
|
||||
|
||||
|
||||
|
||||
5 history | grep dnf
|
||||
|
||||
|
||||
|
||||
$ history | tail -n 3
|
||||
|
||||
|
||||
|
||||
4 history
|
||||
|
||||
|
||||
|
||||
5 history | grep dnf
|
||||
|
||||
|
||||
|
||||
6 history | tail -n 3
|
||||
|
||||
```
|
||||
|
||||
另一种实现这个功能的方法是输入 `Ctrl-R` 来调用你的命令历史记录的递归搜索。输入后,提示变为:
|
||||
|
||||
```
|
||||
(reverse-i-search)`':
|
||||
|
||||
```
|
||||
|
||||
现在你可以开始输入一个命令,并且会显示匹配的命令,按回车键执行。
|
||||
@ -90,9 +65,9 @@ $ history | tail -n 3
|
||||
### 更改已执行的命令
|
||||
|
||||
`history` 还允许你使用不同的语法重新运行命令。例如,如果我想改变我以前的命令 `history | grep dnf` 成 `history | grep ssh`,我可以在提示符下执行以下命令:
|
||||
|
||||
```
|
||||
$ ^dnf^ssh^
|
||||
|
||||
```
|
||||
|
||||
`history` 将重新运行该命令,但用 `ssh` 替换 `dnf`,并执行它。
|
||||
@ -111,8 +86,6 @@ $ ^dnf^ssh^
|
||||
* 记录历史中每行的日期和时间
|
||||
* 防止某些命令被记录在历史记录中
|
||||
|
||||
|
||||
|
||||
有关 `history` 命令的更多信息和其他有趣的事情,请参考[ GNU Bash 手册][1]。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
@ -122,7 +95,7 @@ via: https://opensource.com/article/18/6/history-command
|
||||
作者:[Steve Morris][a]
|
||||
选题:[lujun9972](https://github.com/lujun9972)
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
@ -1,3 +1,4 @@
|
||||
(translating by runningwater)
|
||||
A year as Android Engineer
|
||||
============================================================
|
||||
|
||||
@ -121,7 +122,7 @@ The engineer role isn't just coding, but rather a broad range of skills. I am s
|
||||
via: https://proandroiddev.com/a-year-as-android-engineer-55e2a428dfc8
|
||||
|
||||
作者:[Lara Martín][a]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
译者:[runningwater](https://github.com/runningwater)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
@ -1,3 +1,5 @@
|
||||
translating---geekpi
|
||||
|
||||
How To Record Everything You Do In Terminal
|
||||
======
|
||||

|
||||
|
@ -1,58 +0,0 @@
|
||||
translating----geekpi
|
||||
|
||||
How to Mount and Use an exFAT Drive on Ubuntu Linux
|
||||
======
|
||||
**Brief: This quick tutorial shows you how to enable exFAT file system support on Ubuntu and other Ubuntu-based Linux distributions. This way you won’t see any error while mounting exFAT drives on your system.**
|
||||
|
||||
### Problem mounting exFAT disk on Ubuntu
|
||||
|
||||
The other day, I tried to use an external USB key formatted in exFAT format that contained a file of around 10 GB in size. As soon as I plugged the USB key, my Ubuntu 16.04 throw an error complaining that it **cannot mount unknown filesystem type ‘exfat’**.
|
||||
|
||||
![Fix exfat drive mount error on Ubuntu Linux][1]
|
||||
|
||||
The exact error message was this:
|
||||
**Error mounting /dev/sdb1 at /media/abhishek/SHADI DATA: Command-line `mount -t “exfat” -o “uhelper=udisks2,nodev,nosuid,uid=1001,gid=1001,iocharset=utf8,namecase=0,errors=remount-ro,umask=0077” “/dev/sdb1” “/media/abhishek/SHADI DATA”‘ exited with non-zero exit status 32: mount: unknown filesystem type ‘exfat’**
|
||||
|
||||
### The reason behind this exFAT mount error
|
||||
|
||||
Microsoft’s favorite [FAT file system][2] is limited to files up to 4GB in size. You cannot transfer a file bigger than 4 GB in size to a FAT drive. To overcome the limitations of the FAT filesystem, Microsoft introduced [exFAT][3] file system in 2006.
|
||||
|
||||
As most of the Microsoft related stuff are proprietary, exFAT file format is no exception to that. Ubuntu and many other Linux distributions don’t provide the proprietary exFAT file support by default. This is the reason why you see the mount error with exFAT files.
|
||||
|
||||
### How to mount exFAT drive on Ubuntu Linux
|
||||
|
||||
![Fix exFAT mount error on Ubuntu Linux][4]
|
||||
|
||||
The solution to this problem is simple. All you need to do is to enable exFAT support.
|
||||
|
||||
I am going to show the commands for Ubuntu but this should be applicable to other Ubuntu-based distributions such as [Linux Mint][5], elementary OS etc.
|
||||
|
||||
Open a terminal (Ctrl+Alt+T shortcut in Ubuntu) and use the following command:
|
||||
```
|
||||
sudo apt install exfat-fuse exfat-utils
|
||||
|
||||
```
|
||||
|
||||
Once you have installed these packages, go to file manager and click on the USB disk again to mount it. There is no need to replug the USB. It should be mounted straightaway.
|
||||
|
||||
#### Did it help you?
|
||||
|
||||
I hope this quick tip helped you to fix the exFAT mount error for your Linux distribution. If you have any further questions, suggestions or a simple thanks, please use the comment box below.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/mount-exfat/
|
||||
|
||||
作者:[Abhishek Prakash][a]
|
||||
选题:[lujun9972](https://github.com/lujun9972)
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://itsfoss.com/author/abhishek/
|
||||
[1]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/06/exfat-mount-error-linux.jpeg
|
||||
[2]:http://www.ntfs.com/fat-systems.htm
|
||||
[3]:https://en.wikipedia.org/wiki/ExFAT
|
||||
[4]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/06/exfat-mount-error-featured-800x450.jpeg
|
||||
[5]:https://linuxmint.com/
|
@ -0,0 +1,56 @@
|
||||
如何在 Ubuntu Linux 上挂载和使用 exFAT 驱动器
|
||||
======
|
||||
**简介:本教程将向你展示如何在 Ubuntu 和其他基于 Ubuntu 的 Linux 发行版上启用 exFAT 文件系统支持。用此种方法在系统上挂载 exFAT 驱动器时,你将看不到任何错误。**
|
||||
|
||||
### 在 Ubuntu 上挂载 exFAT 磁盘时出现问题
|
||||
|
||||
有一天,我试图使用用 exFAT 格式化 的 U 盘,其中包含大小约为 10GB 的文件。只要我插入 U 盘,我的 Ubuntu 16.04 就会抛出一个错误说**无法挂载未知的文件系统类型 ‘exfat’**。
|
||||
|
||||
![Fix exfat drive mount error on Ubuntu Linux][1]
|
||||
|
||||
确切的错误信息是这样的:
|
||||
**Error mounting /dev/sdb1 at /media/abhishek/SHADI DATA: Command-line `mount -t “exfat” -o “uhelper=udisks2,nodev,nosuid,uid=1001,gid=1001,iocharset=utf8,namecase=0,errors=remount-ro,umask=0077” “/dev/sdb1” “/media/abhishek/SHADI DATA”‘ exited with non-zero exit status 32: mount: unknown filesystem type ‘exfat’**
|
||||
|
||||
### exFAT挂载错误的原因
|
||||
|
||||
微软最喜欢的[ FAT 文件系统][2]仅限于最大 4GB 的文件。你不能将大于 4GB 的文件传输到 FAT 驱动器。为了克服 FAT 文件系统的限制,微软在 2006 年推出了 [exFAT][3] 文件系统。
|
||||
|
||||
由于大多数微软相关的东西都是专有的,exFAT 文件格式也不例外。Ubuntu 和许多其他 Linux 发行版默认不提供专有的 exFAT 文件支持。这就是你看到 exFAT 文件出现挂载错误的原因。
|
||||
|
||||
### 如何在 Ubuntu Linux 上挂载 exFAT 驱动器
|
||||
|
||||
![Fix exFAT mount error on Ubuntu Linux][4]
|
||||
|
||||
解决这个问题很简单。你只需启用 exFAT 支持即可。
|
||||
|
||||
我将展示在 Ubuntu 中的命令,但这应该适用于其他基于 Ubuntu 的发行版,例如 [Linux Mint][5]、elementary OS 等。
|
||||
|
||||
打开终端(Ubuntu 中 Ctrl+Alt+T 快捷键)并使用以下命令:
|
||||
```
|
||||
sudo apt install exfat-fuse exfat-utils
|
||||
|
||||
```
|
||||
|
||||
安装完这些软件包后,进入文件管理器并再次点击 U 盘来挂载它。无需重新插入 USB。它应该能直接挂载。
|
||||
|
||||
#### 这对你有帮助么
|
||||
|
||||
我希望这个提示可以帮助你修复 Linux 发行版的 exFAT 的挂载错误。如果你有任何其他问题、建议或感谢,请在评论中留言。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/mount-exfat/
|
||||
|
||||
作者:[Abhishek Prakash][a]
|
||||
选题:[lujun9972](https://github.com/lujun9972)
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://itsfoss.com/author/abhishek/
|
||||
[1]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/06/exfat-mount-error-linux.jpeg
|
||||
[2]:http://www.ntfs.com/fat-systems.htm
|
||||
[3]:https://en.wikipedia.org/wiki/ExFAT
|
||||
[4]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/06/exfat-mount-error-featured-800x450.jpeg
|
||||
[5]:https://linuxmint.com/
|
Loading…
Reference in New Issue
Block a user