mirror of
https://github.com/LCTT/TranslateProject.git
synced 2024-12-26 21:30:55 +08:00
Merge remote-tracking branch 'LCTT/master'
This commit is contained in:
commit
b2d733d55a
103
published/20190524 Dual booting Windows and Linux using UEFI.md
Normal file
103
published/20190524 Dual booting Windows and Linux using UEFI.md
Normal file
@ -0,0 +1,103 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (robsean)
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-12891-1.html)
|
||||
[#]: subject: (Dual booting Windows and Linux using UEFI)
|
||||
[#]: via: (https://opensource.com/article/19/5/dual-booting-windows-linux-uefi)
|
||||
[#]: author: (Alan Formy-Duval https://opensource.com/users/alanfdoss/users/ckrzen)
|
||||
|
||||
使用 UEFI 双启动 Windows 和 Linux
|
||||
======
|
||||
|
||||
> 这是一份在同一台机器上设置 Linux 和 Windows 双重启动的速成解释,使用统一可扩展固件接口(UEFI)。
|
||||
|
||||
![](https://img.linux.net.cn/data/attachment/album/202012/06/101431eb02wvkk0nzkk5sw.jpg)
|
||||
|
||||
我将强调一些重要点,而不是一步一步地指导你来如何配置你的系统以实现双重启动。作为一个示例,我将提到我在几个月之前新买的笔记本计算机。我先是安装 [Ubuntu Linux][2] 到整个硬盘中,这就摧毁了预装的 [Windows 10][3] 环境。几个月后,我决定安装一个不同的 Linux 发行版 [Fedora Linux][4],也决定在双重启动配置中与它一起再次安装 Windows 10 。我将强调一些极其重要的实际情况。让我们开始吧!
|
||||
|
||||
### 固件
|
||||
|
||||
双重启动不仅仅是软件问题。或者说它算是软件的问题,因为它需要更改你的固件,以告诉你的机器如何开始启动程序。这里有一些和固件相关的重要事项要铭记于心。
|
||||
|
||||
#### UEFI vs BIOS
|
||||
|
||||
在尝试安装前,确保你的固件配置是最佳的。现在出售的大多数计算机有一个名为 <ruby>[统一可扩展固件接口][5]<rt>Unified Extensible Firmware Interface</rt></ruby> (UEFI)的新类型固件,UEFI 差不多取代了另一个名为 <ruby>[基本输入输出系统][6]<rt>Basic Input Output System</rt></ruby>(BIOS)的固件类型,(包括很多固件供应商在内的很多人)通常称 BIOS 为<ruby>传统启动模式<rt>Legacy Boot</rt></ruby>。
|
||||
|
||||
我不需要 BIOS,所以我选择了 UEFI 模式。
|
||||
|
||||
#### 安全启动
|
||||
|
||||
另一个重要的设置是<ruby>安全启动<rt>Secure Boot</rt></ruby>。这个功能将检测启动路径是否被篡改,并阻止未经批准的操作系统的启动。现在,我禁用这个选项来确保我能够安装 Fedora Linux 。依据 Fedora 项目维基“[功能/安全启动][7]”部分的介绍可知:Fedora Linux 在安全启动选项启用的时候也可以工作。这对其它的 Linux 发行版来说可能有所不同 — 我打算今后重新研究这项设置。
|
||||
|
||||
简而言之,如果你发现在这项设置启用时你不能安装你的 Linux 操作系统,那么禁用安全启动并再次重新尝试安装。
|
||||
|
||||
### 对启动驱动器进行分区
|
||||
|
||||
如果你选择双重启动并且两个操作系统都在同一个驱动器上,那么你必须将它分成多个分区。即使你使用两个不同的驱动器进行双重启动,出于各种各样的原因,大多数 Linux 环境也最好分成几个基本的分区。这里有一些选项值得考虑。
|
||||
|
||||
#### GPT vs MBR
|
||||
|
||||
如果你决定手动分区你的启动驱动器,在动手前,我建议使用<ruby>[GUID 分区表][8]<rt>GUID Partition Table</rt></ruby>(GPT),而不是使用旧的<ruby>[主启动记录][9]<rt>Master Boot Record</rt></ruby>(MBR) 。这种更改的原因之一是:MBR 有两个特定的限制,而 GPT 却没有:
|
||||
|
||||
* MBR 可以最多拥有 15 个分区,而 GPT 可以最多拥有 128 个分区。
|
||||
* MBR 最多仅支持 2 TB 磁盘,而 GPT 使用 64 位地址,这使得它最多支持 800 万 TB 的磁盘。
|
||||
|
||||
如果你最近购买过硬盘,那么你可能会知道现代的很多硬盘都超过了 2 TB 的限制。
|
||||
|
||||
#### EFI 系统分区
|
||||
|
||||
如果你正在进行一次全新的安装或使用一块新的驱动器,那么这里可能没有可以开始的分区。在这种情况下,操作系统安装程序将先创建一个分区,即<ruby>[EFI 系统分区][10]<rt>EFI System Partition</rt></ruby>(ESP)。如果你选择使用一个诸如 [gdisk][11] 之类的工具来手动分区你的驱动器,你将需要使用一些参数来创建这个分区。基于现有的 ESP ,我设置它为约 500 MB 的大小,并分配它为 `ef00`( EFI 系统 )分区类型。UEFI 规范要求格式化为 FAT32/msdos ,很可能是因为这种格式被大量的操作系统所支持。
|
||||
|
||||
![分区][12]
|
||||
|
||||
### 操作系统安装
|
||||
|
||||
在你完成先前的两个任务后,你就可以安装你的操作系统了。虽然我在这里关注的是 Windows 10 和 Fedora Linux ,当安装其它组合时的过程也是非常相似。
|
||||
|
||||
#### Windows 10
|
||||
|
||||
我开始 Windows 10 的安装,并创建了一个 20 GB 的 Windows 分区。因为我先前在我的笔记本计算机上安装了 Linux ,所以驱动器已经有了一个 ESP ,我选择保留它。我删除所有的现有 Linux 和交换分区来开始一次全新安装,然后开始我的 Windows 安装。Windows 安装程序自动创建另一个 16 MB 的小分区,称为 <ruby>[微软保留分区][13]<rt>Microsoft Reserved Partition</rt></ruby>(MSR)。在这完成后,在 512 GB 启动驱动器上仍然有大约 400 GB 的未分配空间。
|
||||
|
||||
接下来,我继续完成了 Windows 10 安装过程。随后我重新启动到 Windows 来确保它是工作的,在操作系统第一次启动时,创建我的用户账号,设置 Wi-Fi ,并完成其它必须的任务。
|
||||
|
||||
#### Fedora Linux
|
||||
|
||||
接下来,我将心思转移到安装 Linux 。我开始了安装过程,当安装进行到磁盘配置的步骤时,我确保不会更改 Windows NTFS 和 MSR 分区。我也不会更改 EPS ,但是我设置它的挂载点为 `/boot/efi`。然后我创建常用的 ext4 格式分区, `/`(根分区)、`/boot` 和 `/home`。我创建的最后一个分区是 Linux 的交换分区(swap)。
|
||||
|
||||
像安装 Windows 一样,我继续完成了 Linux 安装,随后重新启动。令我高兴的是,在启动时<ruby>[大一统启动加载程序][14]<rt>GRand Unified Boot Loader</rt></ruby>(GRUB)菜单提供选择 Windows 或 Linux 的选项,这意味着我不需要再做任何额外的配置。我选择 Linux 并完成了诸如创建我的用户账号等常规步骤。
|
||||
|
||||
### 总结
|
||||
|
||||
总体而言,这个过程是不难的,在过去的几年里,从 UEFI 过渡到 BIOS 有一些困难需要解决,加上诸如安全启动等功能的引入。我相信我们现在已经克服了这些障碍,可以可靠地设置多重启动系统。
|
||||
|
||||
我不再怀念 [Linux LOader][15](LILO)!
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/19/5/dual-booting-windows-linux-uefi
|
||||
|
||||
作者:[Alan Formy-Duval][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[robsean](https://github.com/robsean)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/alanfdoss/users/ckrzen
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/linux_keyboard_desktop.png?itok=I2nGw78_ (Linux keys on the keyboard for a desktop computer)
|
||||
[2]: https://www.ubuntu.com
|
||||
[3]: https://www.microsoft.com/en-us/windows
|
||||
[4]: https://getfedora.org
|
||||
[5]: https://en.wikipedia.org/wiki/Unified_Extensible_Firmware_Interface
|
||||
[6]: https://en.wikipedia.org/wiki/BIOS
|
||||
[7]: https://fedoraproject.org/wiki/Features/SecureBoot
|
||||
[8]: https://en.wikipedia.org/wiki/GUID_Partition_Table
|
||||
[9]: https://en.wikipedia.org/wiki/Master_boot_record
|
||||
[10]: https://en.wikipedia.org/wiki/EFI_system_partition
|
||||
[11]: https://sourceforge.net/projects/gptfdisk/
|
||||
[12]: /sites/default/files/u216961/gdisk_screenshot_s.png
|
||||
[13]: https://en.wikipedia.org/wiki/Microsoft_Reserved_Partition
|
||||
[14]: https://en.wikipedia.org/wiki/GNU_GRUB
|
||||
[15]: https://en.wikipedia.org/wiki/LILO_(boot_loader)
|
@ -1,203 +0,0 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (7 Git tricks that changed my life)
|
||||
[#]: via: (https://opensource.com/article/20/10/advanced-git-tips)
|
||||
[#]: author: (Rajeev Bera https://opensource.com/users/acompiler)
|
||||
|
||||
7 Git tricks that changed my life
|
||||
======
|
||||
These helpful tips will change the way you work with the popular version
|
||||
control system.
|
||||
![Computer screen with files or windows open][1]
|
||||
|
||||
Git is one of the most common version control systems available, and it's used on private systems and publicly hosted websites for all kinds of development work. Regardless of how proficient with Git I become, it seems there are always features left to discover. Here are seven tricks that have changed the way I work with Git.
|
||||
|
||||
### 1\. Autocorrection in Git
|
||||
|
||||
We all make typos sometimes, but if you have Git's auto-correct feature enabled, you can let Git automatically fix a mistyped subcommand.
|
||||
|
||||
Suppose you want to check the status with `git status` but you type `git stats` by accident. Under normal circumstances, Git tells you that 'stats' is not a valid command:
|
||||
|
||||
|
||||
```
|
||||
$ git stats
|
||||
git: ‘stats’ is not a git command. See ‘git --help’.
|
||||
|
||||
The most similar command is
|
||||
status
|
||||
```
|
||||
|
||||
To avoid similar scenarios, enable Git autocorrection in your Git configuration:
|
||||
|
||||
|
||||
```
|
||||
`$ git config --global help.autocorrect 1`
|
||||
```
|
||||
|
||||
If you want this to apply only to your current repository, omit the `--global` option.
|
||||
|
||||
This command enables the autocorrection feature. An in-depth tutorial is available at [Git Docs][2], but trying the same errant command as above gives you a good idea of what this configuration does:
|
||||
|
||||
|
||||
```
|
||||
$ git stats
|
||||
git: ‘stats’ is not a git command. See ‘git --help’.
|
||||
On branch master
|
||||
Your branch is up to date with ‘origin/master’.
|
||||
|
||||
nothing to commit, working tree clean
|
||||
```
|
||||
|
||||
Instead of suggesting an alternative subcommand, Git now just runs the top suggestion, which in this case was **git status**.
|
||||
|
||||
### 2\. Count your commits
|
||||
|
||||
There are many reasons you might need to count your commits. Many developers count the number of commits to judge when to increment the build number, for instance, or just to get a feel for how the project is progressing.
|
||||
|
||||
To count your commits is really easy and straightforward; here is the Git command:
|
||||
|
||||
|
||||
```
|
||||
`$ git rev-list --count`
|
||||
```
|
||||
|
||||
In the above command, the **branch-name** should be a valid branch name in your current repository.
|
||||
|
||||
|
||||
```
|
||||
$ git rev-list –count master
|
||||
32
|
||||
$ git rev-list –count dev
|
||||
34
|
||||
```
|
||||
|
||||
### 3\. Optimize your repo
|
||||
|
||||
Your code repository is valuable not only for you but also for your organization. You can keep your repository clean and up to date with a few simple practices. One of the best practices is to [use the .gitignore file][3]. By using this file, you are telling Git not to store many unwanted files like binaries, temporary files, and so on.
|
||||
|
||||
To optimize your repository further, you can use Git garbage collection.
|
||||
|
||||
|
||||
```
|
||||
`$ git gc --prune=now --aggressive`
|
||||
```
|
||||
|
||||
This command helps when you or your team heavily uses **pull** or **push** commands.
|
||||
|
||||
This command is an internal utility that cleans up unreachable or "orphaned" Git objects in your repository.
|
||||
|
||||
### 4\. Take a backup of untracked files
|
||||
|
||||
Most of the time, it's safe to delete all the untracked files. But many times, there is a situation wherein you want to delete, but also to create a backup of your untracked files just in case you need them later.
|
||||
|
||||
Git, along with some Bash command piping, makes it easy to create a zip archive for your untracked files.
|
||||
|
||||
|
||||
```
|
||||
$ git ls-files --others --exclude-standard -z |\
|
||||
xargs -0 tar rvf ~/backup-untracked.zip
|
||||
```
|
||||
|
||||
The above command makes an archive (and excludes files listed in .gitignore) with the name backup-untracked.zip
|
||||
|
||||
### 5\. Know your .git folder
|
||||
|
||||
Every repository has a .git folder. It is a special hidden folder.
|
||||
|
||||
|
||||
```
|
||||
$ ls -a
|
||||
. … .git
|
||||
```
|
||||
|
||||
Git mainly works with two things:
|
||||
|
||||
1. The working tree (the state of files in your current checkout)
|
||||
2. The path of your Git repository (specifically, the location of the .git folder, which contains the versioning information)
|
||||
|
||||
|
||||
|
||||
This folder stores all references and other important details like configurations, repository data, the state of HEAD, logs, and much more.
|
||||
|
||||
If you delete this folder, the current state of your source code is not deleted, but your remote information, such as your project history, is. Deleting this folder means your project (at least, the local copy) isn't under version control anymore. It means you cannot track your changes; you cannot pull or push from a remote.
|
||||
|
||||
Generally, there's not much you need to do, or should do, in your .git folder. It's managed by Git and is considered mostly off-limits. However, there are some interesting artifacts in this directory, including the current state of HEAD:
|
||||
|
||||
|
||||
```
|
||||
$ cat .git/HEAD
|
||||
ref: refs/heads/master
|
||||
```
|
||||
|
||||
It also contains, potentially, a description of your repository:
|
||||
|
||||
|
||||
```
|
||||
`$ cat .git/description`
|
||||
```
|
||||
|
||||
This is an unnamed repository; edit this file 'description' to name the repository.
|
||||
|
||||
The Git hooks folder is also here, complete with example hook files. You can read these samples to get an idea of what's possible through Git hooks, and you can also [read this Git hook introduction by Seth Kenlon][4].
|
||||
|
||||
### 6\. View a file of another branch
|
||||
|
||||
Sometimes you want to view the content of the file from another branch. It's possible with a simple Git command, and without actually switching your branch.
|
||||
|
||||
Suppose you have a file called [README.md][5], and it's in the **main** branch. You're working on a branch called **dev**.
|
||||
|
||||
With the following Git command, you can do it from the terminal.
|
||||
|
||||
|
||||
```
|
||||
`$ git show main:README.md`
|
||||
```
|
||||
|
||||
Once you execute this command, you can view the content of the file in your terminal.
|
||||
|
||||
### 7\. Search in Git
|
||||
|
||||
You can search in Git like a pro with one simple command. Better still, you can search in Git even if you aren't sure which commit—or even branch—you made your changes.
|
||||
|
||||
|
||||
```
|
||||
`$ git rev-list --all | xargs git grep -F ‘’`
|
||||
```
|
||||
|
||||
For example, suppose you want to search for the string "font-size: 52 px;" in your repository:
|
||||
|
||||
|
||||
```
|
||||
$ git rev-list –all | xargs git grep -F ‘font-size: 52 px;’
|
||||
F3022…9e12:HtmlTemplate/style.css: font-size: 52 px;
|
||||
E9211…8244:RR.Web/Content/style/style.css: font-size: 52 px;
|
||||
```
|
||||
|
||||
### Try these tips
|
||||
|
||||
I hope these advanced tips are useful and boost your productivity, saving you lots of time.
|
||||
|
||||
Do you have [Git tips][6] you love? Share them in the comments.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/20/10/advanced-git-tips
|
||||
|
||||
作者:[Rajeev Bera][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/acompiler
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/browser_screen_windows_files.png?itok=kLTeQUbY (Computer screen with files or windows open)
|
||||
[2]: https://git-scm.com/book/en/v2/Customizing-Git-Git-Configuration#_code_help_autocorrect_code
|
||||
[3]: https://opensource.com/article/20/8/dont-ignore-gitignore
|
||||
[4]: https://opensource.com/life/16/8/how-construct-your-own-git-server-part-6
|
||||
[5]: http://README.md
|
||||
[6]: https://acompiler.com/git-tips/
|
@ -1,5 +1,5 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: translator: (robsean)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
@ -0,0 +1,68 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Why 2020 is the best time to use the Kate text editor)
|
||||
[#]: via: (https://opensource.com/article/20/12/kate-text-editor)
|
||||
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
|
||||
|
||||
Why 2020 is the best time to use the Kate text editor
|
||||
======
|
||||
Learn more about the long-beloved text editor that offers something for
|
||||
every user.
|
||||
![Programming at a browser, orange hands][1]
|
||||
|
||||
The KDE Plasma Desktop has a lot to offer—a great desktop, a flexible file manager, and tightly integrated applications. However, it can be easy to overlook its default text editors, one of which is [Kate][2]. On December 14, 2020, [Kate turns 20 years old][3], and in its two decades of development, it has achieved a perfect balance between a straightforward editor and a modest Integrated Development Environment (IDE).
|
||||
|
||||
### Installing Kate
|
||||
|
||||
If you’re running the KDE Plasma Desktop, you probably already have Kate installed. In the event that it’s not installed yet, you can find it in your software repository, regardless of which desktop you’re running.
|
||||
|
||||
Alternatively, [you can install Kate from][4] [Flathub.org][5] using Flatpak on Linux or Chromebook.
|
||||
|
||||
On Windows, [you can obtain Kate][6] from the Windows store.
|
||||
|
||||
To install it on macOS, [download the macOS build from the KDE build site][7].
|
||||
|
||||
### All the right features
|
||||
|
||||
Kate seems, at first, unassuming. It looks like every other text editor—a big blank window ready to accept lots of typed input, a menu bar along the top, some metadata around the edges to indicate character encoding and line count. The moment you start using it, though, you realize that it has all the features you need, right where you want them.
|
||||
|
||||
For instance, along the left side of the Kate window are line numbers, which are enabled by default. Better still, code collapsing is activated when you type in a common coding language or markdown syntax. A document navigation panel on the right side of the window provides quick and visual access to different parts of your file. And the bottom of the window contains common mode settings, including insert or overwrite, character encoding (such as UTF-8), and syntax highlighting.
|
||||
|
||||
![Kate][8]
|
||||
|
||||
That’s not all, though. It might sound like a lot, but the layout is convenient and intuitive. There are even more features available in the menu and settings.
|
||||
|
||||
Kate features Git integration, a file browser, shell, open document or project panel, word completion, XML completion, a tabbed interface, split screens, and a plugin structure so you can extend its features even further.
|
||||
|
||||
### An editor for every user
|
||||
|
||||
Kate’s extreme flexibility allows it to be both a simple text editor and a robust IDE. By defaulting to a familiar interface, it appeals to a wide audience, but by offering the ability to integrate with debuggers, compilers, and code linters, it appeals to developers.
|
||||
|
||||
Because it allows the user to control its UI layout, Kate ensures every user can optimize their experience with it. This has been, traditionally, a difficult balance—an editor with too many features feels too much like a bloated IDE, while an editor with a simplistic interface and obfuscated features feels basic or inconvenient. Kate gets it right by placing the really useful features at the forefront of the UI for everyone to enjoy while keeping advanced features discoverable but out of the way.
|
||||
|
||||
Kate is, frankly, difficult to walk away from. It’s a pleasure to use, easy to configure, and fun to explore. Install Kate today, and give it a try. Being available on all major platforms, there’s little reason you shouldn’t choose Kate as your new favorite editor.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/20/12/kate-text-editor
|
||||
|
||||
作者:[Seth Kenlon][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/seth
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/programming_code_keyboard_orange_hands.png?itok=G6tJ_64Y (Programming at a browser, orange hands)
|
||||
[2]: http://kate-editor.org
|
||||
[3]: https://kate-editor.org/post/2020/2020-11-08-kate-is-soon-20-years-old/
|
||||
[4]: https://flathub.org/apps/details/org.kde.kate
|
||||
[5]: http://Flathub.org
|
||||
[6]: https://www.microsoft.com/en-nz/p/kate/9nwmw7bb59hw?rtc=1&activetab=pivot:overviewtab
|
||||
[7]: https://binary-factory.kde.org/view/MacOS/job/Kate_Release_macos/
|
||||
[8]: https://opensource.com/sites/default/files/kate.jpg (Kate)
|
@ -1,103 +0,0 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (robsean)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Dual booting Windows and Linux using UEFI)
|
||||
[#]: via: (https://opensource.com/article/19/5/dual-booting-windows-linux-uefi)
|
||||
[#]: author: (Alan Formy-Duval https://opensource.com/users/alanfdoss/users/ckrzen)
|
||||
|
||||
使用 UEFI 双启动 Windows 和 Linux
|
||||
======
|
||||
在同一台机器上设置 Linux 和 Windows 双重启动的一份速成解释,使用统一可扩展固件接口(UEFI)。
|
||||
![键盘上的 Linux 的按键字母][1]
|
||||
|
||||
我将强调一些重要点,而不是一步一步地指导你来如何配置你的系统以实现双重启动。作为一个示例,我将提到我在几个月之前新买的笔记本计算机。我首先安装 [Ubuntu Linux][2] 到整个硬盘中,这就摧毁了预装的 [Windows 10][3] 安装。几个月后,我决定安装一个不同的 Linux 发行版,也决定在双重启动配置中与 [Fedora Linux][4] 一起重新安装 Windows 10 。我将强调一些极其重要的实际情况。让我们开始吧!
|
||||
|
||||
### 固件
|
||||
|
||||
双重启动不仅仅是软件问题。或者说它算是软件的问题, 因为它需要更改你的固件,以告诉你的机器如何开始启动程序。这里有一些和固件相关的重要议题要铭记于心。
|
||||
|
||||
#### UEFI vs BIOS
|
||||
|
||||
在尝试安装前,确保你的固件配置是最佳的。现在出售的大多数计算机有一个名为 [统一可扩展固件接口 (UEFI)][5] 的新固件类型,UEFI 差不多取代了另一个名为 [基本输入输出系统 (BIOS)][6] 的固件类型,(包括很多固件供应商在内的很多人)通常称 BIOS 为传统启动模式。
|
||||
|
||||
我不需要 BIOS ,使用我选择了 UEFI 模式。
|
||||
|
||||
#### 安全启动
|
||||
|
||||
另一个重要的设置是安全启动。这个功能将检测启动路径是否被篡改,并阻止未经批准的操作系统的启动。现在,我禁用这个选项来确保我能够安装 Fedora Linux 。依据 Fedora 项目维基 [功能/安全启动][7] 的介绍可知:Fedora Linux 在安全启动选项启用的时候也可以工作。这对其它的 Linux 发行版来说可能有所不同 — 我打算今后重新研究这项设置。
|
||||
|
||||
简而言之,如果你发现在这项设置启用时你不能安装你的 Linux 操作系统,那么禁用安全启动并再次重新尝试安装。
|
||||
|
||||
### 分区启动驱动器
|
||||
|
||||
如果你选择双重启动并且两个操作相同都在同一个驱动器上,那么你必须将你分成多个分区。即使你使用两个不同的驱动器进行双重启动,出于各种各样的原因,大多数 Linux 安装也最好分成几个基本的分区。这里有一些选项值得考虑。
|
||||
|
||||
#### GPT vs MBR
|
||||
|
||||
如果你决定手动分区你的启动驱动器,在动手前,我建议使用 [GUID 分区表 (GPT)][8] ,而不是使用旧的 [主启动记录 (MBR)][9] 。这种更改的原因之一是:MBR 有两个特定的限制,而 GPT 却没有:
|
||||
|
||||
* MBR 可以最多拥有 15 个分区,而 GPT 可以最多拥有 128 个分区。
|
||||
* MBR 最多仅支持 2 TB ,而 GPT 使用 64 位地址,这使得它最多支持 800 万 TB 的磁盘。
|
||||
|
||||
|
||||
|
||||
如果你最近购买过硬盘,那么你可能会知道现代的很多硬盘都超过了 2 TB 的限制。
|
||||
|
||||
#### EFI 系统分区
|
||||
|
||||
I如果你正在进行一次全新的安装或使用一块新的驱动器,那么这里可能没有可以开始的分区。在这种情况下,操作系统安装程序将先创建一个分区,即 [EFI 系统分区 (ESP)][10] 。如果你选择使用一个诸如 [gdisk][11] 之类的工具来手动分区你的驱动器,你将需要使用一些参数来创建这个分区。基于现有的 ESP ,我设置它为约 500 MB 的大小,并分配它为 ef00( EFI 系统 )分区类型。UEFI 规范要求格式为 FAT32/msdos ,很可能是因为这种格式被大量的操作系统所支持。
|
||||
|
||||
![分区][12]
|
||||
|
||||
### 操作系统安装
|
||||
|
||||
在你完成先前的两个任务后,你就可以安装你的操作系统了。虽然我在这里关注的是 Windows 10 和 Fedora Linux ,当安装其它组合时的过程也是非常相似。
|
||||
|
||||
#### Windows 10
|
||||
|
||||
我开始 Windows 10 的安装,并创建了一个 20 GB的 Windows 分区。因为我先前在我的笔记本计算机上安装了 Linux ,所以驱动器已经有了一个 ESP ,我选择保留它。我删除所有的现有 Linux 和 swap 分区来开始 fresh ,然后开始我的 Windows 安装。Windows 安装程序自动创建另一个小分区—16 MB—称为 [Microsoft 保留分区 (MSR)][13] 。在这完成后,在 512 GB 启动分区上仍然有大约 400 GB 的b未分配空间。
|
||||
|
||||
接下来,我继续完成了 Windows 10 安装过程。随后我重新启动到 Windows 来确保它是工作的,在操作系统第一次启动时,创建我的用户账号,设置 wi-fi ,并完成其它必须的任务。
|
||||
|
||||
#### Fedora Linux
|
||||
|
||||
接下来,我将心思转移到安装 Linux 。当安装重新到到磁盘配置的步骤时,我开始了这个过程,我确保不更改 Windows 的 NTFS 和 MSR 分区。我也不更改 EPS ,但是我设置它的挂载点位 **/boot/efi** 。然后我创建常用的 ext4 格式分区, **/** (root) , **/boot** ,和 **/home** 。我创建的最后一个分区是 Linux 的 **swap** 。
|
||||
|
||||
像安装 Windows 一样,我继续完成了 Linux 安装,随后重新启动。令我高兴的是,在启动时 [GRand][14] [统一启动加载程序 (GRUB)][14] 菜单提供选择 Windows 或 Linux 的选项,这意味着我不需要再做任何额外的配置。我选择 Linux 并完成了诸如创建我的用户账号等常规步骤。
|
||||
|
||||
### 总结
|
||||
|
||||
总体而言,这个过程是不难的,在过去的几年里,从 UEFI 到 BIOS 有一些不同的成功克服困难的更改,加上诸如安全启动等功能的引入。我相信我们现在已经克服了这些障碍,可以可靠地设置多重启动系统。
|
||||
|
||||
我不再怀念 [Linux LOader (LILO)][15] !
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/19/5/dual-booting-windows-linux-uefi
|
||||
|
||||
作者:[Alan Formy-Duval][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[robsean](https://github.com/robsean)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/alanfdoss/users/ckrzen
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/linux_keyboard_desktop.png?itok=I2nGw78_ (Linux keys on the keyboard for a desktop computer)
|
||||
[2]: https://www.ubuntu.com
|
||||
[3]: https://www.microsoft.com/en-us/windows
|
||||
[4]: https://getfedora.org
|
||||
[5]: https://en.wikipedia.org/wiki/Unified_Extensible_Firmware_Interface
|
||||
[6]: https://en.wikipedia.org/wiki/BIOS
|
||||
[7]: https://fedoraproject.org/wiki/Features/SecureBoot
|
||||
[8]: https://en.wikipedia.org/wiki/GUID_Partition_Table
|
||||
[9]: https://en.wikipedia.org/wiki/Master_boot_record
|
||||
[10]: https://en.wikipedia.org/wiki/EFI_system_partition
|
||||
[11]: https://sourceforge.net/projects/gptfdisk/
|
||||
[12]: /sites/default/files/u216961/gdisk_screenshot_s.png
|
||||
[13]: https://en.wikipedia.org/wiki/Microsoft_Reserved_Partition
|
||||
[14]: https://en.wikipedia.org/wiki/GNU_GRUB
|
||||
[15]: https://en.wikipedia.org/wiki/LILO_(boot_loader)
|
189
translated/tech/20201026 7 Git tricks that changed my life.md
Normal file
189
translated/tech/20201026 7 Git tricks that changed my life.md
Normal file
@ -0,0 +1,189 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (wxy)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (7 Git tricks that changed my life)
|
||||
[#]: via: (https://opensource.com/article/20/10/advanced-git-tips)
|
||||
[#]: author: (Rajeev Bera https://opensource.com/users/acompiler)
|
||||
|
||||
改变我使用 Git 工作方式的七个技巧
|
||||
======
|
||||
|
||||
> 这些有用的技巧将改变你使用这个流行的版本控制系统的工作方式。
|
||||
|
||||
[打开文件或窗口的电脑屏幕][1]
|
||||
|
||||
Git 是目前最常见的版本控制系统之一,无论是私有系统还是公开托管的网站,都在使用它进行各种开发工作。无论我对 Git 的使用有多熟练,似乎总有一些功能还没有被发现,下面是改变我使用 Git 工作方式的七个技巧。
|
||||
|
||||
### 1、Git 中的自动更正
|
||||
|
||||
我们有时都会打错字,但如果启用了 Git 的自动更正功能,就可以让 Git 自动修正打错的子命令。
|
||||
|
||||
假设你想用 `git status` 检查状态,却不小心输入了 `git stats`。正常情况下,Git 会告诉你 `stats` 不是一条有效的命令:
|
||||
|
||||
```
|
||||
$ git stats
|
||||
git: ‘stats’ is not a git command. See ‘git --help’.
|
||||
|
||||
The most similar command is
|
||||
status
|
||||
```
|
||||
|
||||
为了避免类似的情况发生,请在 Git 配置中启用 Git 自动更正功能:
|
||||
|
||||
```
|
||||
$ git config --global help.autocorrect 1
|
||||
```
|
||||
|
||||
如果你希望这个命令只适用于你当前的版本库,请省略 `--global` 选项。
|
||||
|
||||
这条命令启用了自动更正功能。更深入的教程可以在 [Git Docs][2] 中找到,但尝试一下和上面一样的错误命令,就能很好地了解这个配置的作用:
|
||||
|
||||
```
|
||||
$ git stats
|
||||
git: ‘stats’ is not a git command. See ‘git --help’.
|
||||
On branch master
|
||||
Your branch is up to date with ‘origin/master’.
|
||||
|
||||
nothing to commit, working tree clean
|
||||
```
|
||||
|
||||
Git 现在不会建议使用其他子命令,而是直接运行最上面的建议,在本例中是 `git status`。
|
||||
|
||||
### 2、计算你的提交量
|
||||
|
||||
有很多原因让你需要计算提交次数。例如,许多开发者通过计算提交数量来判断何时增加构建版本号,或者只是为了了解项目的进展情况。
|
||||
|
||||
要计算提交次数其实很简单直接,下面是 Git 的命令:
|
||||
|
||||
```
|
||||
$ git rev-list --count branch-name
|
||||
```
|
||||
|
||||
在上面的命令中,`branch-name` 应该是当前版本库中有效的分支名称:
|
||||
|
||||
```
|
||||
$ git rev-list –count master
|
||||
32
|
||||
$ git rev-list –count dev
|
||||
34
|
||||
```
|
||||
|
||||
### 3、优化你的仓库
|
||||
|
||||
你的代码仓库不仅对你有价值,对你的组织也有价值。你可以通过一些简单的做法来保持你的版本库的清洁和更新。其中一个最好的做法是 [使用 .gitignore 文件][3]。使用这个文件,就是告诉 Git 不要存储许多不需要的文件,比如二进制文件、临时文件等等。
|
||||
|
||||
为了进一步优化你的版本库,你可以使用 Git 的垃圾收集功能:
|
||||
|
||||
```
|
||||
$ git gc --prune=now --aggressive
|
||||
```
|
||||
|
||||
当你或你的团队大量使用 `pull` 或 `push` 命令时,这条命令就会起到帮助作用。
|
||||
|
||||
这个命令是一个内部工具,可以清理仓库中无法访问或 “孤儿” Git 对象。
|
||||
|
||||
### 4、备份未被跟踪的文件
|
||||
|
||||
大多数时候,删除所有未被跟踪的文件是安全的。但很多时候,你不仅要删除,还要为你的未跟踪文件创建一个备份,以备以后需要。
|
||||
|
||||
通过 Git 和一些 Bash 命令管道,可以很容易地为你的未被跟踪的文件创建一个压缩包:
|
||||
|
||||
```
|
||||
$ git ls-files --others --exclude-standard -z |\
|
||||
xargs -0 tar rvf ~/backup-untracked.zip
|
||||
```
|
||||
|
||||
上面的命令制作了一个名为 `backup-untracked.zip` 的存档(并排除了 `.gitignore` 中列出的文件)。
|
||||
|
||||
### 5、了解你的 .git 文件夹
|
||||
|
||||
每个版本库都有一个 `.git` 文件夹。它是一个特殊的隐藏文件夹。
|
||||
|
||||
```
|
||||
$ ls -a
|
||||
. … .git
|
||||
```
|
||||
|
||||
Git 的工作主要依赖于两个部分:
|
||||
|
||||
1. 工作树(你当前签出的文件状态)。
|
||||
2. 你的 Git 仓库的路径(特别是 `.git` 文件夹的位置,其中包含版本信息)。
|
||||
|
||||
这个文件夹存储了所有的引用和其他重要的细节,比如配置、仓库数据、HEAD 状态、日志等等。
|
||||
|
||||
如果你删除这个文件夹,你的源代码的当前状态不会被删除,但你的远程信息,如你的项目历史记录,会被删除。删除这个文件夹意味着你的项目(至少是本地副本)不再处于版本控制之下。这意味着你不能跟踪你的变化;你不能从远程拉取或推送。
|
||||
|
||||
一般来说,没有什么需要在 `.git` 文件夹里做的,也没有什么应该做的。它是由 Git 管理的,被认为基本上是禁区。然而,这个目录里有一些有趣的工件,包括 HEAD 的当前状态。
|
||||
|
||||
```
|
||||
$ cat .git/HEAD
|
||||
ref: refs/heads/master
|
||||
```
|
||||
|
||||
它还可能包含对你的存储库的描述:
|
||||
|
||||
```
|
||||
$ cat .git/description
|
||||
```
|
||||
|
||||
这是一个未命名的仓库,编辑这个 `description` 文件来命名这个仓库。
|
||||
|
||||
Git 钩子文件夹也在这里,里面有一些钩子示例文件。你可以阅读这些示例来了解通过 Git 钩子可以实现什么,你也可以 [阅读 Seth Kenlon 的 Git 钩子介绍][4]。
|
||||
|
||||
### 6、查看另一个分支的文件
|
||||
|
||||
有时你想查看另一个分支的文件的内容。用一个简单的 Git 命令就可以实现,而且不需要切换分支。
|
||||
|
||||
假设你有一个名为 [README.md][5] 的文件,它在 `main` 分支中,而你正在 `dev` 分支上工作。
|
||||
|
||||
使用下面的 Git 命令,你可以在终端上完成:
|
||||
|
||||
```
|
||||
$ git show main:README.md
|
||||
```
|
||||
|
||||
一旦你执行了这个命令,你就可以在你的终端上查看文件的内容。
|
||||
|
||||
### 7、在 Git 中搜索
|
||||
|
||||
只需一个简单的命令,你就可以像专业人士一样在 Git 中搜索。更棒的是,即使你不确定是在哪个提交或分支上做的修改,也可以在 Git 中搜索。
|
||||
|
||||
```
|
||||
$ git rev-list --all | xargs git grep -F 'string'
|
||||
```
|
||||
|
||||
例如,假设你想在你的版本库中搜索 `font-size: 52 px;` 这个字符串:
|
||||
|
||||
```
|
||||
$ git rev-list –all | xargs git grep -F ‘font-size: 52 px;’
|
||||
F3022…9e12:HtmlTemplate/style.css: font-size: 52 px;
|
||||
E9211…8244:RR.Web/Content/style/style.css: font-size: 52 px;
|
||||
```
|
||||
|
||||
### 试试这些技巧
|
||||
|
||||
希望这些高级技巧对你有用,提高你的工作效率,为你节省很多时间。
|
||||
|
||||
你有喜欢的 [Git 小技巧][6] 吗?在评论中分享吧。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/20/10/advanced-git-tips
|
||||
|
||||
作者:[Rajeev Bera][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[wxy](https://github.com/wxy)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/acompiler
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/browser_screen_windows_files.png?itok=kLTeQUbY (Computer screen with files or windows open)
|
||||
[2]: https://git-scm.com/book/en/v2/Customizing-Git-Git-Configuration#_code_help_autocorrect_code
|
||||
[3]: https://opensource.com/article/20/8/dont-ignore-gitignore
|
||||
[4]: https://opensource.com/life/16/8/how-construct-your-own-git-server-part-6
|
||||
[5]: http://README.md
|
||||
[6]: https://acompiler.com/git-tips/
|
Loading…
Reference in New Issue
Block a user