mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-02-03 23:40:14 +08:00
Merge remote-tracking branch 'LCTT/master'
This commit is contained in:
commit
a1b3a938fd
@ -0,0 +1,240 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (robsean)
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-12361-1.html)
|
||||
[#]: subject: (How to Make Ubuntu Look Like macOS in 5 Easy Steps)
|
||||
[#]: via: (https://itsfoss.com/make-ubuntu-look-like-macos/)
|
||||
[#]: author: (Community https://itsfoss.com/author/itsfoss/)
|
||||
|
||||
5 个简单步骤使你的 Ubuntu 看起来像 macOS
|
||||
======
|
||||
|
||||
定制是 [我为什么使用 Linux][1] 的一个主要原因。定制桌面 Linux 的道路是永无止境的。你可以更改图标、主题、字体、终端、添加屏幕小工具、[指示器小程序][2]、扩展等诸如此类的东西。
|
||||
|
||||
我们已经介绍了很多桌面环境定制的建议和技巧。在这篇文章中,我将向你展示如何使 Ubuntu 看起来像 macOS。
|
||||
|
||||
很多人使用 macOS,是因为它的简单和优雅的外观。你可能不同意这一点,但这仍然是一个流行的观点。甚至有的 Linux 发行版也有类似 macOS 外观和感觉。
|
||||
|
||||
一位读者要求我们展示如何使 Ubuntu 看起来像 macOS,因此我们写了这篇教程。事实上,这是一个用来展示桌面 Linux 定制能力的很好的示例。
|
||||
|
||||
不过,你没有必要为定制外观而安装一个新的发行版。你可以在你自己的系统上做一些调整来给予你一个类似 macOS 的外观。
|
||||
|
||||
### 如何给你的 Ubuntu Linux 进行 macOS 改造
|
||||
|
||||
![][3]
|
||||
|
||||
尽管这篇文章是对 Ubuntu 的建议,但是你也可以在其它使用 GNOME 桌面环境的发行版中使用这些建议,几乎可以不做任何改动。请确保[检查一下你的桌面环境][4]。
|
||||
|
||||
说实话,即使你使用的是其它的桌面环境,你仍然可以得到一些关于要做哪些更改的提示。但是你必须确保使用你的桌面环境的工具按照步骤进行。
|
||||
|
||||
#### 必要条件: GNOME Tweaks 和 GNOME 扩展
|
||||
|
||||
请确保 [安装 GNOME Tweaks 工具][5]。你需要它来更改主题和图标。
|
||||
|
||||
你也需要 [启用 GNOME 扩展][6] 来更改 GNOME Shell 和添加重要的要点。
|
||||
|
||||
在你启用 GNOME 扩展后,你需要从 [GNOME 扩展][7] 网站安装“用户主题” 扩展,或者只需要转到 [这个超链接][8] ,并单击开关来将其打开。
|
||||
|
||||
我也希望你对 [在 Ubuntu 上安装主题][9] 有一定的了解。不过,我还是简单的谈了一下这个主题。
|
||||
|
||||
让我们依次看看每个步骤。
|
||||
|
||||
#### 步骤 1: 安装一个 macOS 风格的 GTK 主题
|
||||
|
||||
因为重点是使 GNOME 看起来像 macOS,所以你应该选择一个像 macOS 一样的主题。有很多主题都是像 macOS 一样的。
|
||||
|
||||
##### 下载一个你选择的主题
|
||||
|
||||
你可以转到 [Gnome-look][10] 站点,并搜索关于 GTK3 的主题。如果你在 Gnome-look 网站上看到 “Pling” 字样,不用担心,它们都是来自同一个供应商。
|
||||
|
||||
你可以选择任何你想要的主题。下面是一些我认为你应该看看的macOS主题:
|
||||
|
||||
- [mcOS 11][11]
|
||||
- [McHigh Sierra][12]
|
||||
- [Catalina][13]
|
||||
- [McMojave][14]
|
||||
|
||||
在这篇文章中,我将使用 “[McMojave][14]”。你可以选择任何你想要的主题。你将在网站的右侧找到下拉式的下载按钮,单击它。
|
||||
|
||||
![McMojave 暗黑主题][15]
|
||||
|
||||
在这里你可以找到各种 “.tar.xz” 文件。这些不同的文件包含了相同的主题,但有一些小的差异。像在 “McMojave” 中,我们有像暗黑主题和明亮主题的变体。你可以尝试所有的主题,或者从之间随意选择一个你喜欢的。
|
||||
|
||||
##### 设置下载的主题
|
||||
|
||||
提取下载的主题,并复制这些提取的主题文件夹到 `.local/share/themes` 文件夹下。
|
||||
|
||||
打开 GNOME Tweak 工具,并更改应用程序和 Shell 的主题。在你更改主题的同时,你可以看到黄色、绿色和红色三个按钮,以及左上角的苹果标志。你也可以看到在面板项上的一些更改。
|
||||
|
||||
![McMojave GTK 和 Shell 主题][16]
|
||||
|
||||
#### 步骤 2: 安装像 macOS 一样的图标
|
||||
|
||||
macOS 外观改造的下一步骤是使用像 macOS 一样的图标。
|
||||
|
||||
##### 下载图标集合
|
||||
|
||||
这里有一些我建议使用的图标集合,你可以从 Gnome-look 网站下载:
|
||||
|
||||
- [McMojave-circle][17]
|
||||
- [Mojave CT-icons][18]
|
||||
- [Cupertino icons][19]
|
||||
|
||||
在这篇文章中,我将使用 “[McMojave-circle][17]” ,你可以随意使用任何你喜欢的图标。
|
||||
|
||||
就像主题一样,你可以从右侧的下拉式的 “下载” 按钮下载图标集合。在这里你也可以找到同一种图标的不同版本。
|
||||
|
||||
![Mcmojave Circle][20]
|
||||
|
||||
##### 设置图标
|
||||
|
||||
现在设置下载的图标。为此,提取下载文件中的文件夹并复制它到你的家目录下的 `.icons` 文件夹。 查看这篇关于 [在 Ubuntu 中安装图标主题][9] 的文章。
|
||||
|
||||
这是这种图标看起来的样子:
|
||||
|
||||
![McMojave Circle 图标外观][21]
|
||||
|
||||
#### 步骤 3: 添加类似 macOS 样子的坞站
|
||||
|
||||
没有类似 macOS 样子的<ruby>坞站<rt>dock</rt></ruby>,你的 Ubuntu 就看起来不像 macOS。在 Linux 上有很多可用的坞站。我喜欢 “[Dash to Dock][22]”,我会在这里使用它。
|
||||
|
||||
“Dash to Dock” 是一个 GNOME 扩展。到现在为止,你已经熟悉 GNOME 扩展。只需要转到 [这个超链接][23] ,并单击切换按钮来安装它。你的原本的坞站将自动被 “Dash to Dock” 所替换。
|
||||
|
||||
你可以通过右键单击 “show applications” 按钮(最右边的菜单按钮)并选择 “Dash to dock settings” 来更改设置。
|
||||
|
||||
![Dash To Dock][24]
|
||||
|
||||
#### 步骤 4: 使用 macOS 壁纸
|
||||
|
||||
大多数复杂的东西已经完成。现在是时候设置 macOS 壁纸了。你可以从下面的超链接下载 macOS 默认壁纸:
|
||||
|
||||
- [下载 macOS 壁纸][25]
|
||||
|
||||
##### 更改桌面背景
|
||||
|
||||
我将使用 “Mojave Day” 壁纸。右键单击已下载的的图像,并选择 “设置为壁纸” 选项来更改壁纸。
|
||||
|
||||
在设置这个壁纸后,这是我系统外观的样子:
|
||||
|
||||
![][26]
|
||||
|
||||
##### 更改锁屏壁纸
|
||||
|
||||
锁屏壁纸选项已经从 [Ubuntu 20.04][27] 的设置中移除。现在它使用一个模糊的桌面壁纸作为锁屏壁纸。
|
||||
|
||||
要设置一个自定义锁屏壁纸,你可以使用 “[Lock screen background][28]” 扩展。
|
||||
|
||||
打开 “Lock screen background” 扩展设置,并设置锁屏壁纸。
|
||||
|
||||
![锁屏背景设置][29]
|
||||
|
||||
这是锁屏现在的样子。如果你感到好奇话,这里是 [如何在 Ubuntu 中截图锁屏][30]。
|
||||
|
||||
![锁屏][31]
|
||||
|
||||
![登录屏幕][32]
|
||||
|
||||
#### 步骤 5: 更改系统字体
|
||||
|
||||
这几年,macOS 的主要系统字体是 “San Francisco” 。但是,这个字体并不是公共领域的,而是像苹果生态系统中的许多其他东西一样,是专有字体。基于这个原因,你不能使用这种字体。
|
||||
|
||||
你能做的就是使用一种看起来像 San Francisc 字体一样的开源字体。我建议使用 Google 的 [Roboto][33] 字体,或 Adobe 的 [Source Sans Pro][34] 。
|
||||
|
||||
[在 Ubuntu 中安装字体是很简单的][35] 。下载 字体的 zip 文件,只需要在提取出来的文件夹中双击 ttf 文件。它会给你一个选项来逐一安装字体。
|
||||
|
||||
如果你想节省时间并一次安装所有的字体,提取其中所有的字体到你的家目录(`~/.fonts`)下的 `.fonts` 目录中。
|
||||
|
||||
![安装字体][36]
|
||||
|
||||
在你安装字体后,你可以使用 GNOME Tweaks 工具来更改系统字体。
|
||||
|
||||
![设置字体][37]
|
||||
|
||||
#### 额外提示:Spotlight 式的应用程序启动器(如果你像更进一步的话)
|
||||
|
||||
如果你是 macOS Spotlight 启动器的粉丝,那么你在 Linux 上也能找到类似的东西。我最喜欢的这类启动器的软件包是 “[Albert][38]”。
|
||||
|
||||
你可以 [在 Albert 网站上找到它的安装说明][39] 。
|
||||
|
||||
安装完成后,打开 Albert 并设置快捷键(你想打开该启动器的组合键)就可以了。我想,在 macOS 中 `Command + Space` 键是来启动 Spotlight;在 Ubuntu 中,你可以设置 `Super+Space` [快捷键][40]。
|
||||
|
||||
你会会得到很多内置的主题,在下面的图片中,我使用 “Spotlight dark” 主题。
|
||||
|
||||
Albert 不能直接启动应用程序,你必须授予它在哪里可以进行搜索的权限。
|
||||
|
||||
![Albert 设置][41]
|
||||
|
||||
在设置后,这是它看起来的样子:
|
||||
|
||||
![Albert 暗黑主题][42]
|
||||
|
||||
这是我的 Ubuntu 20.04 在完成所有定制后的样子。它看起来像 macOS 吗? 仁者见仁,智者见智。
|
||||
|
||||
![macOS 主题][43]
|
||||
|
||||
![Ubuntu 使用 macOS 外观改造][44]
|
||||
|
||||
如此,这就是你如何使你的 GNOME 桌面看起来像 macOS 一样的步骤。正如我在开始时所说的,这是一个很好的 Linux 桌面定制功能的示例。
|
||||
|
||||
如果你有新的注意或有任何疑问;评论区全是你的地盘。
|
||||
|
||||
本文由 Sumeet 编写,并由 Abhishek Prakash 提供补充输入信息。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/make-ubuntu-look-like-macos/
|
||||
|
||||
作者:[Sumeet][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://itsfoss.com/author/itsfoss/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://itsfoss.com/why-use-linux/
|
||||
[2]: https://itsfoss.com/best-indicator-applets-ubuntu/
|
||||
[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/Make-Ubuntu-Look-like-MacOS.png?ssl=1
|
||||
[4]: https://linux.cn/article-12124-1.html
|
||||
[5]: https://itsfoss.com/gnome-tweak-tool/
|
||||
[6]: https://linux.cn/article-9447-1.html
|
||||
[7]: https://extensions.gnome.org/
|
||||
[8]: https://extensions.gnome.org/extension/19/user-themes/
|
||||
[9]: https://itsfoss.com/install-themes-ubuntu/
|
||||
[10]: https://www.gnome-look.org/
|
||||
[11]: https://www.pling.com/p/1220826
|
||||
[12]: https://www.pling.com/p/1013714
|
||||
[13]: https://www.pling.com/p/1226871
|
||||
[14]: https://www.pling.com/p/1275087
|
||||
[15]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/McMojave-dark-theme.png?ssl=1
|
||||
[16]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/McMojave-Desktop.png?ssl=1
|
||||
[17]: https://www.gnome-look.org/p/1305429/
|
||||
[18]: https://www.gnome-look.org/p/1210856/
|
||||
[19]: https://www.gnome-look.org/p/1102582/
|
||||
[20]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/McMojave-circle-.png?ssl=1
|
||||
[21]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/McMojave-circle-icons-look.png?fit=800%2C494&ssl=1
|
||||
[22]: https://github.com/micheleg/dash-to-dock
|
||||
[23]: https://extensions.gnome.org/extension/307/dash-to-dock/
|
||||
[24]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/Dash-to-dock-1.png?ssl=1
|
||||
[25]: https://oswallpapers.com/category/mac-os/
|
||||
[26]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/Wallpaper.png?fit=800%2C450&ssl=1
|
||||
[27]: https://itsfoss.com/ubuntu-20-04-release-features/
|
||||
[28]: https://extensions.gnome.org/extension/1476/unlock-dialog-background/
|
||||
[29]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/Lock-screen-background-setting.png?ssl=1
|
||||
[30]: https://itsfoss.com/screenshot-login-screen-ubuntu-linux/
|
||||
[31]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/Lock-screen-1.png?ssl=1
|
||||
[32]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/Login-screen-1.png?ssl=1
|
||||
[33]: https://fonts.google.com/specimen/Roboto?query=robot
|
||||
[34]: https://adobe-fonts.github.io/source-sans-pro/
|
||||
[35]: https://itsfoss.com/install-fonts-ubuntu/
|
||||
[36]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/Fonts.png?ssl=1
|
||||
[37]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/Set-fonts.png?ssl=1
|
||||
[38]: https://albertlauncher.github.io/
|
||||
[39]: https://albertlauncher.github.io/docs/installing/
|
||||
[40]: https://itsfoss.com/ubuntu-shortcuts/
|
||||
[41]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/Albert-settings.png?ssl=1
|
||||
[42]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/Albert-look.png?ssl=1
|
||||
[43]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/macOS-theme.png?fit=800%2C450&ssl=1
|
||||
[44]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/macOS-theme-2.png?fit=800%2C450&ssl=1
|
@ -1,105 +0,0 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (4 essential tools to set up your Python environment for success)
|
||||
[#]: via: (https://opensource.com/article/20/6/python-tools)
|
||||
[#]: author: (Moshe Zadka https://opensource.com/users/moshez)
|
||||
|
||||
4 essential tools to set up your Python environment for success
|
||||
======
|
||||
This selection of tools will streamline your Python environment for
|
||||
smooth and consistent development practices.
|
||||
![Python programming language logo with question marks][1]
|
||||
|
||||
Python is a wonderful general-purpose programming language, often taught as a first programming language. Twenty years in, multiple books written, and it remains [my language of choice][2]. While the language is often said to be straight-forward, configuring Python for development has not been described as such (as documented by [xkcd][3]).
|
||||
|
||||
![xkcd python illustration][4]
|
||||
|
||||
A complex Python environment: [xkcd][3]
|
||||
|
||||
There are many ways to use Python in your day-to-day life. I will explain how I use the Python ecosystem tools, and I will be honest where I am still looking for alternatives.
|
||||
|
||||
### Use pyenv to manage Python versions
|
||||
|
||||
The best way I have found to get a Python version working on your machine is `pyenv`. This software will work on Linux, Mac OS X, and WSL2: the three "UNIX-like" environments that I usually care about.
|
||||
|
||||
Installing `pyenv` itself can be a little tricky at times. One way is to use the dedicated [pyenv installer][5], which uses a `curl | bash` method to bootstrap (see the instructions for more details).
|
||||
|
||||
If you're on a Mac (or another system where you run Homebrew), you can follow instructions on how to install and use pyenv [here][6].
|
||||
|
||||
Once you install and set up `pyenv` per the directions, you can use `pyenv global` to set a "default Python" version. In general, you will want to select your "favorite" version. This will usually be the latest stable, but other considerations can change that.
|
||||
|
||||
### Make virtual environments simpler with virtualenvwrapper
|
||||
|
||||
One advantage of using `pyenv` to install Python is that all subsequent Python interpreter installations you care about are owned by you instead of the operating system you use.
|
||||
|
||||
Though installing things inside Python itself is usually not the best option, there is one exception: in your "favorite" Python chosen above, install and configure `virtualenvwrapper`. This gives you the ability to create and switch to virtual environments at a moment's notice.
|
||||
|
||||
I walk through exactly how to install and use `virtualenvwrapper` [in this article][7].
|
||||
|
||||
Here is where I recommend a unique workflow. There is one virtual environment that you will want to make so that you can reuse it a lot—`runner`. In this environment, install your favorite `runner`; that is, software that you will regularly use to run other software. As of today, my preference is `tox`.
|
||||
|
||||
### Use tox as a Python runner
|
||||
|
||||
[tox][8] is a great tool to automate your test runs of Python. In each Python environment, I create a `tox.ini` file. Whatever system I use for continuous integration will run it, and I can run the same locally with `virtualenvwrapper`'s workon syntax described in the article above:
|
||||
|
||||
|
||||
```
|
||||
$ workon runner
|
||||
$ tox
|
||||
```
|
||||
|
||||
The reason this workflow is important is that I test my code against multiple versions of Python and multiple versions of the library dependencies. That means there are going to be multiple environments in the tox runner. Some will try running against the latest dependencies. Some will try running against frozen dependencies (more on that next), and I might also generate those locally with `pip-compile`.
|
||||
|
||||
Side note: I am currently [looking at `nox`][9] as a replacement for `tox`. The reasons are beyond the scope of this article, but it's worth taking a look at.
|
||||
|
||||
### Use pip-compile for Python dependency management
|
||||
|
||||
Python is a dynamic programming language, which means it loads its dependencies on every execution of the code. Understanding exactly what version of each dependency is running could mean the difference between smoothly running code and an unexpected crash. That means we have to think about dependency management tooling.
|
||||
|
||||
For each new project, I include a `requirements.in` file that is (usually) only the following:
|
||||
|
||||
|
||||
```
|
||||
`.`
|
||||
```
|
||||
|
||||
Yes, that's right. A single line with a single dot. I document "loose" dependencies, such as `Twisted>=17.5` in the `setup.py`file. That is in contrast to exact dependencies like `Twisted==18.1`, which make it harder to upgrade to new versions of the library when you need a feature or a bug fix.
|
||||
|
||||
The `.` means "current directory," which uses the current directory's `setup.py` as the source for dependencies.
|
||||
|
||||
This means that using `pip-compile requirements.in > requirements.txt` will create a frozen dependencies file. You can use this dependencies file either in a virtual environment created by `virtualenvwrapper` or in `tox.ini`.
|
||||
|
||||
Sometimes it is useful to have `requirements-dev.txt`, generated from `requirements-dev.in` (contents: `.[dev]`) or `requirements-test.txt`, generated from `requirements-test.in` (contents: `.[test]`).
|
||||
|
||||
I am looking to see if `pip-compile` should be replaced in this flow by [`dephell`][10]. The `dephell` tool has a bunch of interesting things about it, like the use of asynchronous HTTP requests to speak dependency downloads.
|
||||
|
||||
### Conclusion
|
||||
|
||||
Python is as powerful as it is pleasing on the eyes. In order to write that code, I lean on a particular toolchain that has worked well for me. The tools `pyenv`, `virtualenvwrapper`, `tox`, and `pip-compile` are all separate. However, they each have their own role, with no overlaps, and together, they deliver a powerful Python workflow.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/20/6/python-tools
|
||||
|
||||
作者:[Moshe Zadka][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/moshez
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/python_programming_question.png?itok=cOeJW-8r (Python programming language logo with question marks)
|
||||
[2]: https://opensource.com/article/19/10/why-love-python
|
||||
[3]: https://xkcd.com/1987/
|
||||
[4]: https://opensource.com/sites/default/files/uploads/python_environment_xkcd_1.png (xkcd python illustration)
|
||||
[5]: https://github.com/pyenv/pyenv-installer
|
||||
[6]: https://opensource.com/article/20/4/pyenv
|
||||
[7]: https://opensource.com/article/19/6/python-virtual-environments-mac
|
||||
[8]: https://opensource.com/article/19/5/python-tox
|
||||
[9]: https://nox.thea.codes/en/stable/
|
||||
[10]: https://github.com/dephell/dephell
|
@ -1,5 +1,5 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: translator: (nophDog)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
@ -1,125 +0,0 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Linux tools for improving your time management)
|
||||
[#]: via: (https://opensource.com/article/20/6/linux-time-management)
|
||||
[#]: author: (Sudeshna Sur https://opensource.com/users/sudeshna-sur)
|
||||
|
||||
Linux tools for improving your time management
|
||||
======
|
||||
Whether you need help to stay focused, maintain timeliness, or find
|
||||
shortcuts to avoid repetition, these Linux tools have you covered.
|
||||
![Business woman on laptop sitting in front of window][1]
|
||||
|
||||
Productivity is a subjective term, but essentially, it's a measurement of how efficiently a particular task is completed. Everyone has different things that keep them productive—some people need help staying on task, some people need a particular kind of work environment, some people need alerts and reminders to avoid missed deadlines, and some need assistance with repetitive, manual chores. Luckily, there are myriad tools and technologies available to provide you the specific support you need. In particular, if you are a Linux user, there are some tweaks that can help you increase your productivity; here are two that I use on a regular basis.
|
||||
|
||||
### Clipboard Indicator
|
||||
|
||||
Are you someone who uses a lot of copy and paste functions between several documents in your day to day usage? If so, then [Clipboard Indicator][2] should become one of your go-to solutions. Install Clipboard Indicator as a GNOME extension to your Linux distribution. In my experience, it has a minimum performance impact on GNOME Shell—at least, less than other solutions I have tried.
|
||||
|
||||
This tool adds an indicator menu to the top panel and caches your clipboard history. You can set the history size, preview the number of characters you want to view. It shows notifications on copy and acts as a temporary space to store whatever you copy.
|
||||
|
||||
![Clipboard indicator menu on GNOME desktop][3]
|
||||
|
||||
The easiest way to install the extension and connector is to use your distro's package manager.
|
||||
|
||||
For Fedora, CentOs, or RHEL, use:
|
||||
|
||||
|
||||
```
|
||||
`$ sudo dnf install chrome-gnome-shell`
|
||||
```
|
||||
|
||||
On Ubuntu or Debian, use `apt install` instead.
|
||||
|
||||
Once it's installed, go to <https://extensions.gnome.org/> and check your installed extensions.
|
||||
|
||||
If you use Firefox, use the Firefox browser add-on and install the `GNOME Shell integration`**.** You will see a small footprint icon in your Firefox toolbar, which will take you to the Extensions page. On that page, search for the Clipboard Indicator extension and toggle to enable it.
|
||||
|
||||
Now, follow the prompts to download the GNOME extension and activate it. You can check your `~/.local/share/gnome-shell/extensions` location to view the extension.
|
||||
|
||||
Voila! You'll see a new icon in the top-right corner of your GNOME desktop. Copy anything and experiment with its settings.
|
||||
|
||||
A quick installation via Git can also be performed by cloning the repo into your local `gnome-shell extensions` directory using the command:
|
||||
|
||||
|
||||
```
|
||||
`$ git clone https://github.com/Tudmotu/gnome-shell-extension-clipboard-indicator.git ~/.local/share/gnome-shell/extensions/clipboard-indicator@tudmotu.com`
|
||||
```
|
||||
|
||||
Go to the GNOME Tweak tool and activate it from the Extensions screen.
|
||||
|
||||
### Pomodoro
|
||||
|
||||
![Using the pomodoro timer on GNOME][4]
|
||||
|
||||
The Pomodoro Technique is a time management philosophy that aims to provide the user with maximum focus. Each 25-minute work period is called a "pomodoro," (Italian for tomato); after each pomodoro, you take a five-minute break. Every four pomodoros, or 100 minutes, you then take a 15 to 20-minute break. If you have a large and varied to-do list, using the Pomodoro Technique can help you crank through projects faster by forcing you to adhere to strict timing.
|
||||
|
||||
The installation procedure can be managed through the GNOME Tweaks webpage (extensions.gnome.org) or through the command line. For the latter, choose your distribution of Linux along with the release version and install using the following command:
|
||||
|
||||
|
||||
```
|
||||
`$ sudo dnf install gnome-shell-extension-pomodoro`
|
||||
```
|
||||
|
||||
or if you wish to build from source:
|
||||
|
||||
|
||||
```
|
||||
$ git clone -b gnome-3.34 <https://github.com/codito/gnome-pomodoro.git>
|
||||
$ cd gnome-pomodoro
|
||||
```
|
||||
|
||||
The source code has a number of dependencies, many of which are likely already installed. To make sure of it, install of the following.
|
||||
|
||||
|
||||
```
|
||||
`$ sudo dnf install autoconf-archive gettext vala vala-tools pkg-config desktop-file-utils glib2-devel gtk3-devel libappstream-glib-devel libappindicator-gtk3-devel libcanberra-devel libpeas-devel sqlite-devel gom-devel gobject-introspection-devel gsettings-desktop-schemas-devel gstreamer1-devel`
|
||||
```
|
||||
|
||||
Inside unpacked directory of the source code, complete the build.
|
||||
|
||||
|
||||
```
|
||||
$ ./autogen.sh --prefix=/usr --datadir=/usr/share
|
||||
$ make
|
||||
$ sudo make install
|
||||
```
|
||||
|
||||
No matter how we install, go to GNOME Tweaks and turn on the pomodoro timer. If you don't already have GNOME Tweaks, installing it through your package manager or in your software installer of choice. For example, on Fedora:
|
||||
|
||||
|
||||
```
|
||||
`$ sudo dnf install gnome-tweaks`
|
||||
```
|
||||
|
||||
On Ubuntu or Debian, use `apt install` instead.
|
||||
|
||||
Pomodoro desktop integration is currently available for GNOME Shell, and they plan to support more desktops in the future. Check out <https://gnomepomodoro.org/> for the latest on the project. For KDE users in the meantime, there is an alternative called [Fokus][5].
|
||||
|
||||
### Productivity on Linux
|
||||
|
||||
Productivity is personal, but it's something we all are after in one way or another. Each of these tools has either saved me time or made my working time more productive, and they're a quick integration with Linux.
|
||||
|
||||
Do you have a favorite productivity tool? Share it in the comments!
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/20/6/linux-time-management
|
||||
|
||||
作者:[Sudeshna Sur][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/sudeshna-sur
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/lenovo-thinkpad-laptop-concentration-focus-windows-office.png?itok=-8E2ihcF (Woman using laptop concentrating)
|
||||
[2]: https://extensions.gnome.org/extension/779/clipboard-indicator/
|
||||
[3]: https://opensource.com/sites/default/files/uploads/gnome-tweaks-productivity_0.png (Clipboard indicator menu on GNOME desktop)
|
||||
[4]: https://opensource.com/sites/default/files/uploads/pomodoro-timer-fedora-opensourcecom.png (Using the pomodoro timer on GNOME)
|
||||
[5]: https://store.kde.org/p/1308861/
|
@ -1,156 +0,0 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Make Bash history more useful with these tips)
|
||||
[#]: via: (https://opensource.com/article/20/6/bash-history-control)
|
||||
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
|
||||
|
||||
Make Bash history more useful with these tips
|
||||
======
|
||||
Tell Bash what you want it to remember—or even rewrite history by
|
||||
deleting entries you don't want or need.
|
||||
![A person programming][1]
|
||||
|
||||
A Linux terminal running [Bash][2] has a built-in history that you can use to track what you've been doing lately. To view a history of your Bash session, use the built-in command `history`:
|
||||
|
||||
|
||||
```
|
||||
$ echo "foo"
|
||||
foo
|
||||
$ echo "bar"
|
||||
bar
|
||||
$ history
|
||||
1 echo "foo"
|
||||
2 echo "bar"
|
||||
3 history
|
||||
```
|
||||
|
||||
The `history` command isn't an executable file on your filesystem, like most commands, but a function of Bash. You can verify this by using the `type` command:
|
||||
|
||||
|
||||
```
|
||||
$ type history
|
||||
history is a shell builtin
|
||||
```
|
||||
|
||||
### History control
|
||||
|
||||
The upper limit of lines in your shell history is defined by the `HISTSIZE` variable. You can set this variable in your `.bashrc` file. The following sets your history to 3,000 lines, after which the oldest line is removed to make room for the newest command, placed at the bottom of the list:
|
||||
|
||||
|
||||
```
|
||||
`export HISTSIZE=3000`
|
||||
```
|
||||
|
||||
There are other history-related variables, too. The `HISTCONTROL` variable controls what history is stored. You can force Bash to exclude commands starting with empty space by placing this in your `.bashrc` file:
|
||||
|
||||
|
||||
```
|
||||
`export HISTCONTROL=$HISTCONTROL:ignorespace`
|
||||
```
|
||||
|
||||
Now, if you type a command starting with a space, that command won't get recorded in history:
|
||||
|
||||
|
||||
```
|
||||
$ echo "hello"
|
||||
$ mysql -u bogus -h badpassword123 mydatabase
|
||||
$ echo "world"
|
||||
$ history
|
||||
1 echo "hello"
|
||||
2 echo "world"
|
||||
3 history
|
||||
```
|
||||
|
||||
You can avoid duplicate entries, too:
|
||||
|
||||
|
||||
```
|
||||
`export HISTCONTROL=$HISTCONTROL:ignoredups`
|
||||
```
|
||||
|
||||
Now, if you type two commands, one after another, only one appears in history:
|
||||
|
||||
|
||||
```
|
||||
$ ls
|
||||
$ ls
|
||||
$ ls
|
||||
$ history
|
||||
1 ls
|
||||
2 history
|
||||
```
|
||||
|
||||
If you like both of these ignores, you can just use `ignoreboth`:
|
||||
|
||||
|
||||
```
|
||||
`export HISTCONTROL=$HISTCONTROL:ignoreboth`
|
||||
```
|
||||
|
||||
### Remove a command from history
|
||||
|
||||
Sometimes you make a mistake and type something sensitive into your shell, or maybe you just want to clean up your history so that it more accurately represents the steps you took to get something working correctly. If you want to delete a command from your history in Bash, use the `-d` option with the line number of the item you want to remove:
|
||||
|
||||
|
||||
```
|
||||
$ echo "foo"
|
||||
foo
|
||||
$ echo "bar"
|
||||
bar
|
||||
$ history | tail
|
||||
535 echo "foo"
|
||||
536 echo "bar"
|
||||
537 history | tail
|
||||
$ history -d 536
|
||||
$ history | tail
|
||||
535 echo "foo"
|
||||
536 history | tail
|
||||
537 history -d 536
|
||||
538 history | tail
|
||||
```
|
||||
|
||||
To stop adding `history` entries, you can place a `space` before the command, as long as you have `ignorespace` in your `HISTCONTROL` environment variable:
|
||||
|
||||
|
||||
```
|
||||
$ history | tail
|
||||
535 echo "foo"
|
||||
536 echo "bar"
|
||||
$ history -d 536
|
||||
$ history | tail
|
||||
535 echo "foo"
|
||||
```
|
||||
|
||||
You can clear your entire session history with the `-c` option:
|
||||
|
||||
|
||||
```
|
||||
$ history -c
|
||||
$ history
|
||||
$
|
||||
```
|
||||
|
||||
### History lessons
|
||||
|
||||
Manipulating history is usually less dangerous than it sounds, especially when you're curating it with a purpose in mind. For instance, if you're documenting a complex problem, it's often best to use your session history to record your commands because, by slotting them into your history, you're running them and thereby testing the process. Very often, documenting without doing leads to overlooking small steps or writing minor details wrong.
|
||||
|
||||
Use your history sessions as needed, and exercise your power over history wisely. Happy history hacking!
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/20/6/bash-history-control
|
||||
|
||||
作者:[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/computer_keyboard_laptop_development_code_woman.png?itok=vbYz6jjb (A person programming)
|
||||
[2]: https://opensource.com/resources/what-bash
|
@ -1,5 +1,5 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
@ -1,5 +1,5 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
416
sources/tech/20200629 LaTeX typesetting part 2 (tables).md
Normal file
416
sources/tech/20200629 LaTeX typesetting part 2 (tables).md
Normal file
@ -0,0 +1,416 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (LaTeX typesetting part 2 (tables))
|
||||
[#]: via: (https://fedoramagazine.org/latex-typesetting-part-2-tables/)
|
||||
[#]: author: (Earl Ramirez https://fedoramagazine.org/author/earlramirez/)
|
||||
|
||||
LaTeX typesetting part 2 (tables)
|
||||
======
|
||||
|
||||
![][1]
|
||||
|
||||
LaTeX offers a number of tools to create and customise tables, in this series we will be using the tabular and tabularx environment to create and customise tables.
|
||||
|
||||
### Basic table
|
||||
|
||||
To create a table you simply specify the environment \begin{tabular}{columns}
|
||||
```
|
||||
|
||||
```
|
||||
|
||||
\begin{tabular}{c|c}
|
||||
Release &amp;amp;Codename \\\ \hline
|
||||
Fedora Core 1 &amp;amp;Yarrow \\\
|
||||
Fedora Core 2 &amp;amp;Tettnang \\\
|
||||
Fedora Core 3 &amp;amp;Heidelberg \\\
|
||||
Fedora Core 4 &amp;amp;Stentz \\\
|
||||
\end{tabular}
|
||||
```
|
||||
|
||||
```
|
||||
|
||||
![Basic Table][2]
|
||||
|
||||
In the above example "{c|c}" in the curly bracket refers to the position of the text in the column. The below table summarises the positional argument together with the description.
|
||||
|
||||
Position | Argument
|
||||
---|---
|
||||
c | Position text in the centre
|
||||
l | Position text left-justified
|
||||
r | Position text right-justified
|
||||
p{width} | Align the text at the top of the cell
|
||||
m{width} | Align the text in the middle of the cell
|
||||
b{width} | Align the text at the bottom of the cell
|
||||
|
||||
>Both m{width} and b{width} requires the array package to be specified in the preamble.
|
||||
|
||||
Using the example above, let us breakdown the important points used and describe a few more options that you will see in this series
|
||||
|
||||
Option | Description
|
||||
---|---
|
||||
& | Defines each cell, the ampersand is only used from the second column
|
||||
\ | This terminates the row and start a new row
|
||||
|
|
||||
\hline | Specifies the horizontal line (optional)
|
||||
*{num}{form} | This is handy when you have many columns and is an efficient way of limiting the repetition
|
||||
|
|
||||
|
||||
### Customising our table
|
||||
|
||||
Now that some of the options available let create a table using the options described in the previous section.
|
||||
```
|
||||
|
||||
```
|
||||
|
||||
\begin{tabular}{*{3}{|l|}}
|
||||
\hline
|
||||
\textbf{Version} &amp;amp;\textbf{Code name} &amp;amp;\textbf{Year released} \\\
|
||||
\hline
|
||||
Fedora 6 &amp;amp;Zod &amp;amp;2006 \\\ \hline
|
||||
Fedora 7 &amp;amp;Moonshine &amp;amp;2007 \\\ \hline
|
||||
Fedora 8 &amp;amp;Werewolf &amp;amp;2007 \\\
|
||||
\hline
|
||||
\end{tabular}
|
||||
```
|
||||
|
||||
```
|
||||
|
||||
![Customise Table][3]
|
||||
|
||||
### Managing long text
|
||||
|
||||
With LaTeX if there are many texts in a column it will not be formatted well and does not look presentable.
|
||||
|
||||
The below example shows how long text is formatted, we will use "blindtext" in the preamble so that we can produce sample text.
|
||||
```
|
||||
|
||||
```
|
||||
|
||||
\begin{tabular}{|l|l|}\hline
|
||||
Summary &amp;amp;Description \\\ \hline
|
||||
Test &amp;amp;\blindtext \\\
|
||||
\end{tabular}
|
||||
```
|
||||
|
||||
```
|
||||
|
||||
![Default Formatting][4]
|
||||
|
||||
As you can see the text exceed the page width; however, there are a couple of options to overcome this challenge.
|
||||
|
||||
* Specify the column width, for example, m{5cm}
|
||||
* Utilise the tabularx environment, this requires tabularx package in the preamble.
|
||||
|
||||
|
||||
|
||||
### Managing long text with column width
|
||||
|
||||
By specifying the column width the text will be wrapped into the width as shown in the example below.
|
||||
```
|
||||
|
||||
```
|
||||
|
||||
\begin{tabular}{|l|m{14cm}|} \hline
|
||||
Summary &amp;amp;Description \\\ \hline
|
||||
Test &amp;amp;\blindtext \\\ \hline
|
||||
\end{tabular}\vspace{3mm}
|
||||
```
|
||||
|
||||
```
|
||||
|
||||
![Column width][5]
|
||||
|
||||
### Managing long text with tabularx
|
||||
|
||||
Before we can leverage tabularx we need to add it in the preamble. Tabularx takes the following example
|
||||
|
||||
**\begin{tabularx}{width}{columns}**
|
||||
```
|
||||
|
||||
```
|
||||
|
||||
\begin{tabularx}{\textwidth}{|l|X|} \hline
|
||||
Summary &amp;amp; Tabularx Description\\\ \hline
|
||||
Text &amp;amp;\blindtext \\\ \hline
|
||||
\end{tabularx}
|
||||
```
|
||||
|
||||
```
|
||||
|
||||
![Tabularx][6]
|
||||
|
||||
Notice that the column that we want the long text to be wrapped has a capital "X" specified.
|
||||
|
||||
### Multirow and multicolumn
|
||||
|
||||
There are times when you will need to merge rows and/or column. This section describes how it is accomplished. To use multirow and multicolumn add multirow to the preamble.
|
||||
|
||||
### Multirow
|
||||
|
||||
Multirow takes the following argument _\multirow{number_of_rows}{width}{text}_, let us look at the below example.
|
||||
```
|
||||
|
||||
```
|
||||
|
||||
\begin{tabular}{|l|l|}\hline
|
||||
Release &amp;amp;Codename \\\ \hline
|
||||
Fedora Core 4 &amp;amp;Stentz \\\ \hline
|
||||
\multirow{2}{*}{MultiRow} &amp;amp;Fedora 8 \\\
|
||||
&amp;amp;Werewolf \\\ \hline
|
||||
\end{tabular}
|
||||
```
|
||||
|
||||
```
|
||||
|
||||
![MultiRow][7]
|
||||
|
||||
In the above example, two rows were specified, the ‘*’ tells LaTeX to automatically manage the size of the cell.
|
||||
|
||||
### Multicolumn
|
||||
|
||||
Multicolumn argument is _\multicolumn{number_of_columns}{cell_position}{text}_, below example demonstrates multicolumn.
|
||||
```
|
||||
|
||||
```
|
||||
|
||||
\begin{tabular}{|l|l|l|}\hline
|
||||
Release &amp;amp;Codename &amp;amp;Date \\\ \hline
|
||||
Fedora Core 4 &amp;amp;Stentz &amp;amp;2005 \\\ \hline
|
||||
\multicolumn{3}{|c|}{Mulit-Column} \\\ \hline
|
||||
\end{tabular}
|
||||
```
|
||||
|
||||
```
|
||||
|
||||
![Multi-Column][8]
|
||||
|
||||
### Working with colours
|
||||
|
||||
Colours can be assigned to the text, an individual cell or the entire row. Additionally, we can configure alternating colours for each row.
|
||||
|
||||
Before we can add colour to our tables we need to include _\usepackage[table]{xcolor}_ into the preamble. We can also define colours using the following colour reference [LaTeX Colour][9] or by adding an exclamation after the colour prefixed by the shade from 0 to 100. For example, _gray!30_
|
||||
```
|
||||
|
||||
```
|
||||
|
||||
\definecolor{darkblue}{rgb}{0.0, 0.0, 0.55}
|
||||
\definecolor{darkgray}{rgb}{0.66, 0.66, 0.66}
|
||||
```
|
||||
|
||||
```
|
||||
|
||||
Below example demonstrate this a table with alternate colours, \rowcolors take the following options _\rowcolors{row_start_colour}{even_row_colour}{odd_row_colour}_.
|
||||
```
|
||||
|
||||
```
|
||||
|
||||
\rowcolors{2}{darkgray}{gray!20}
|
||||
\begin{tabular}{c|c}
|
||||
Release &amp;amp;Codename \\\ \hline
|
||||
Fedora Core 1 &amp;amp;Yarrow \\\
|
||||
Fedora Core 2 &amp;amp;Tettnang \\\
|
||||
Fedora Core 3 &amp;amp;Heidelberg \\\
|
||||
Fedora Core 4 &amp;amp;Stentz \\\
|
||||
\end{tabular}
|
||||
```
|
||||
|
||||
```
|
||||
|
||||
![Alt colour table][10]
|
||||
|
||||
In addition to the above example, \rowcolor can be used to specify the colour of each row, this method works best when there are multi-rows. The following examples show the impact of using the \rowcolours with multi-row and how to work around it.
|
||||
|
||||
![Impact on multi-row][11]
|
||||
|
||||
As you can see the _multi-row_ is visible in the first row, to fix this we have to do the following.
|
||||
```
|
||||
|
||||
```
|
||||
|
||||
\begin{tabular}{|l|l|}\hline
|
||||
\rowcolor{darkblue}\textsc{\color{white}Release} &amp;amp;\textsc{\color{white}Codename} \\\ \hline
|
||||
\rowcolor{gray!10}Fedora Core 4 &amp;amp;Stentz \\\ \hline
|
||||
\rowcolor{gray!40}&amp;amp;Fedora 8 \\\
|
||||
\rowcolor{gray!40}\multirow{-2}{*}{Multi-Row} &amp;amp;Werewolf \\\ \hline
|
||||
\end{tabular}
|
||||
```
|
||||
|
||||
```
|
||||
|
||||
![Multi-row][12]
|
||||
|
||||
Let us discuss the changes that were implemented to resolve the multi-row with the alternate colour issue.
|
||||
|
||||
* The first row started above the multi-row
|
||||
* The number of rows was changed from 2 to -2, which means to read from the line above
|
||||
* \rowcolor was specified for each row, more importantly, the multi-rows must have the same colour so that you can have the desired results.
|
||||
|
||||
|
||||
|
||||
One last note on colour, to change the colour of a column you need to create a new column type and define the colour. The example below illustrates how to define the new column colour.
|
||||
```
|
||||
|
||||
```
|
||||
|
||||
\newcolumntype{g}{&amp;gt;{\columncolor{darkblue}}l}
|
||||
```
|
||||
|
||||
```
|
||||
|
||||
Let’s break it down
|
||||
|
||||
* \newcolumntype{g}: defines the letter _g_ as the new column
|
||||
* {>{\columncolor{darkblue}}l}: here we select our desired colour, and _l_ tells the column to be left-justified, this can be subsitued with _c_ or _r_
|
||||
|
||||
|
||||
```
|
||||
|
||||
```
|
||||
|
||||
\begin{tabular}{g|l}
|
||||
\textsc{Release} &amp;amp;\textsc{Codename} \\\ \hline
|
||||
Fedora Core 4 &amp;amp;Stentz \\\
|
||||
&amp;amp;Fedora 8 \\\
|
||||
\multirow{-2}{*}{Multi-Row} &amp;amp;Werewolf \\\
|
||||
\end{tabular}\
|
||||
```
|
||||
|
||||
```
|
||||
|
||||
![Column Colour][13]
|
||||
|
||||
### Landscape table
|
||||
|
||||
There may be times when your table has many columns and will not fit elegantly in portrait. With the _rotating_ package in preamble you will be able to create a sideways table. The below example demonstrates this.
|
||||
|
||||
For the landscape table, we will use the _sidewaystable_ environment and add the tabular environment within it, we also specified additional options.
|
||||
|
||||
* \centering to position the table in the centre of the page
|
||||
* \caption{} to give our table a name
|
||||
* \label{} this enables us to reference the table in our document
|
||||
|
||||
|
||||
```
|
||||
|
||||
```
|
||||
|
||||
\begin{sidewaystable}
|
||||
\centering
|
||||
\caption{Sideways Table}
|
||||
\label{sidetable}
|
||||
\begin{tabular}{ll}
|
||||
\rowcolor{darkblue}\textsc{\color{white}Release} &amp;amp;\textsc{\color{white}Codename} \\\
|
||||
\rowcolor{gray!10}Fedora Core 4 &amp;amp;Stentz \\\
|
||||
\rowcolor{gray!40} &amp;amp;Fedora 8 \\\
|
||||
\rowcolor{gray!40}\multirow{-2}{*}{Multi-Row} &amp;amp;Werewolf \\\
|
||||
\end{tabular}\vspace{3mm}
|
||||
\end{sidewaystable}
|
||||
```
|
||||
|
||||
```
|
||||
|
||||
![Sideways Table][14]
|
||||
|
||||
### List and tables
|
||||
|
||||
To include a list into a table you can use tabularx and include the list in the column where the _X_ is specified. Another option will be to use tabular but you must specify the column width.
|
||||
|
||||
### List in tabularx
|
||||
```
|
||||
|
||||
```
|
||||
|
||||
\begin{tabularx}{\textwidth}{|l|X|} \hline
|
||||
Fedora Version &amp;amp;Editions \\\ \hline
|
||||
Fedora 32 &amp;amp;\begin{itemize}[noitemsep]
|
||||
\item CoreOS
|
||||
\item Silverblue
|
||||
\item IoT
|
||||
\end{itemize} \\\ \hline
|
||||
\end{tabularx}\vspace{3mm}
|
||||
```
|
||||
|
||||
```
|
||||
|
||||
![List in tabularx][15]
|
||||
|
||||
### List in tabular
|
||||
```
|
||||
|
||||
```
|
||||
|
||||
\begin{tabular}{|l|m{6cm}|}\hline
|
||||
Fedora Version &amp;amp;Editions \\\ \hline
|
||||
Fedora 32 &amp;amp;\begin{itemize}[noitemsep]
|
||||
\item CoreOS
|
||||
\item Silverblue
|
||||
\item IoT
|
||||
\end{itemize} \\\ \hline
|
||||
\end{tabular}
|
||||
```
|
||||
|
||||
```
|
||||
|
||||
![List in tabular][16]
|
||||
|
||||
### Conclusion
|
||||
|
||||
LaTeX offers many ways to customise your table with tabular and tabularx, you can also add both tabular and tabularx within the table environment (\begin\table) to add the table name and to position the table.
|
||||
|
||||
### LaTeX packages
|
||||
|
||||
The packages used in this series are.
|
||||
```
|
||||
|
||||
```
|
||||
|
||||
\usepackage{fullpage}
|
||||
\usepackage{blindtext} % add demo text
|
||||
\usepackage{array} % used for column positions
|
||||
\usepackage{tabularx} % adds tabularx which is used for text wrapping
|
||||
\usepackage{multirow} % multi-row and multi-colour support
|
||||
\usepackage[table]{xcolor} % add colour to the columns
|
||||
\usepackage{rotating} % for landscape/sideways tables
|
||||
```
|
||||
|
||||
```
|
||||
|
||||
### Additional Reading
|
||||
|
||||
This was an intermediate lesson on tables; for more advanced information about tables and LaTex in general, you can go to [LaTeX Wiki][17]
|
||||
|
||||
![][13]
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://fedoramagazine.org/latex-typesetting-part-2-tables/
|
||||
|
||||
作者:[Earl Ramirez][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://fedoramagazine.org/author/earlramirez/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://fedoramagazine.org/wp-content/uploads/2020/06/latex-series-816x345.png
|
||||
[2]: https://fedoramagazine.org/wp-content/uploads/2020/06/image-13.png
|
||||
[3]: https://fedoramagazine.org/wp-content/uploads/2020/06/image-23.png
|
||||
[4]: https://fedoramagazine.org/wp-content/uploads/2020/06/image-10.png
|
||||
[5]: https://fedoramagazine.org/wp-content/uploads/2020/06/image-11.png
|
||||
[6]: https://fedoramagazine.org/wp-content/uploads/2020/06/image-12.png
|
||||
[7]: https://fedoramagazine.org/wp-content/uploads/2020/06/image-15.png
|
||||
[8]: https://fedoramagazine.org/wp-content/uploads/2020/06/image-16.png
|
||||
[9]: https://latexcolor.com
|
||||
[10]: https://fedoramagazine.org/wp-content/uploads/2020/06/image-17.png
|
||||
[11]: https://fedoramagazine.org/wp-content/uploads/2020/06/image-18.png
|
||||
[12]: https://fedoramagazine.org/wp-content/uploads/2020/06/image-19.png
|
||||
[13]: https://fedoramagazine.org/wp-content/uploads/2020/06/image-24.png
|
||||
[14]: https://fedoramagazine.org/wp-content/uploads/2020/06/image-20.png
|
||||
[15]: https://fedoramagazine.org/wp-content/uploads/2020/06/image-21.png
|
||||
[16]: https://fedoramagazine.org/wp-content/uploads/2020/06/image-22.png
|
||||
[17]: https://en.wikibooks.org/wiki/LaTeX/Tables
|
@ -0,0 +1,182 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (What is End of Life in Ubuntu? Everything You Should Know About it)
|
||||
[#]: via: (https://itsfoss.com/end-of-life-ubuntu/)
|
||||
[#]: author: (Abhishek Prakash https://itsfoss.com/author/abhishek/)
|
||||
|
||||
What is End of Life in Ubuntu? Everything You Should Know About it
|
||||
======
|
||||
|
||||
If you have been following It’s FOSS for some time, you might have noticed that I publish news articles like Ubuntu XYZ version has reached end of life (EoL).
|
||||
|
||||
This end of life is one of those essential concepts that every Ubuntu user should be aware of.
|
||||
|
||||
This is why I decided to write this detailed guide to explain what does an Ubuntu release reaching end of life means, why it matters to you and how to check when your Ubuntu install has reaches end of life.
|
||||
|
||||
### What is end of life in Ubuntu?
|
||||
|
||||
![][1]
|
||||
|
||||
First thing first, end of life is not really an Ubuntu-specific concept. It is a generic term widely used in the software industry.
|
||||
|
||||
The end of life of a software means the software has reached the end of its predefined support period. Beyond this date, the software won’t get any feature, maintenance or security updates.
|
||||
|
||||
You may continue using the software past its end of life date but at your own risk. If there are security vulnerability, your system and data will be at risk.
|
||||
|
||||
Compare it to the use by date or the expiry date on a food item. You may consume the yogurt one day after its use by date but can you eat it after a week or a month?
|
||||
|
||||
#### Why end of life?
|
||||
|
||||
Software is not a living being then why they have an end of life? Why doesn’t Ubuntu just keep on supporting one version forever?
|
||||
|
||||
It is to maintain a balance between stability and features. You want new features in your system but you don’t want it to break your system. Software compatibility is complex and testing takes time.
|
||||
|
||||
So what Ubuntu does is to give you a release and takes the responsibility of maintaining it by providing security and other updates for a certain time period.
|
||||
|
||||
Ubuntu team and volunteers also work on the new release in parallel to add new features to the future release.
|
||||
|
||||
#### Support life cycle of Ubuntu releases
|
||||
|
||||
Ubuntu has two new version releases every year. These releases can be categorized into:
|
||||
|
||||
* Regular release with 9 months of support period
|
||||
* Long-term support (LTS) release with 5 years of support period
|
||||
|
||||
|
||||
|
||||
A new LTS version is released every two years while the regular releases come every six months.
|
||||
|
||||
This table should give you a better understanding:
|
||||
|
||||
Ubuntu Version | Release | End of Life
|
||||
---|---|---
|
||||
Ubuntu 18.04 (LTS) | April, 2018 | April, 2023 (5 years)
|
||||
Ubuntu 18.10 | October, 2018 | July, 2019 (9 months)
|
||||
Ubuntu 19.04 | April, 2019 | January, 2020 (9 months)
|
||||
Ubuntu 19.10 | October, 2019 | July, 2020 (9 months)
|
||||
Ubuntu 20.04 (LTS) | April, 2020 | April, 2025 (5 years)
|
||||
Ubuntu 20.10 | October, 2020 | July, 2021 (9 months)
|
||||
|
||||
The long-term support release focus on providing stability for a longer period. You probably know that Linux distributions like Ubuntu are also responsible for providing applications to you. These distributions have thousands of applications/packages in their repositories.
|
||||
|
||||
The LTS versions often hold on to software versions as they cannot test every new version of so many software in the five years of support period.
|
||||
|
||||
When Ubuntu releases a new LTS version, it also updates a number of software to a newer version. For example, Ubuntu 18.04 LTS has PHP 7.2 whereas Ubuntu 20.04 LTS has PHP 7.4 available.
|
||||
|
||||
The regular release are short-live, but they bring new features (like newer versions of software like file managers, desktop environments, newer kernels etc).
|
||||
|
||||
Personally, I think of these regular releases as a stepping platform for the next LTS releases. For examples, the features introduced in Ubuntu 18.10, 19.04, 19.10 will eventually be added in Ubuntu 20.04 (but not in 18.04).
|
||||
|
||||
#### How to check how long your Ubuntu system will be supported?
|
||||
|
||||
The simplest way to check the end of life support in Ubuntu is using this command in the terminal:
|
||||
|
||||
```
|
||||
hwe-support-status --verbose
|
||||
```
|
||||
|
||||
It will show an output that mentions the support period of your Ubuntu version.
|
||||
|
||||
```
|
||||
You are not running a system with a Hardware Enablement Stack. Your system is supported until April 2025.
|
||||
```
|
||||
|
||||
The [Hardware Enablement Stack in Ubuntu][2] allows you to receive the latest generic Linux kernel supported by Ubuntu. The important part is the support status date.
|
||||
|
||||
If you want a detailed overview of how many software packages you have got and how long those packages will be supported, you can use the ubuntu-security-status command:
|
||||
|
||||
```
|
||||
ubuntu-security-status
|
||||
```
|
||||
|
||||
**In older versions of Ubuntu, the same command is known as ubuntu-support-status.** For both commands, the output is nearly identical:
|
||||
|
||||
```
|
||||
[email protected]:~$ ubuntu-security-status
|
||||
2242 packages installed, of which:
|
||||
1695 receive package updates with LTS until 4/2025
|
||||
510 could receive security updates with ESM Apps until 4/2030
|
||||
30 packages are from third parties
|
||||
7 packages are no longer available for download
|
||||
|
||||
Packages from third parties are not provided by the official Ubuntu
|
||||
archive, for example packages from Personal Package Archives in
|
||||
Launchpad.
|
||||
For more information on the packages, run 'ubuntu-security-status
|
||||
--thirdparty'.
|
||||
|
||||
Packages that are not available for download may be left over from a
|
||||
previous release of Ubuntu, may have been installed directly from a
|
||||
.deb file, or are from a source which has been disabled.
|
||||
For more information on the packages, run 'ubuntu-security-status
|
||||
--unavailable'.
|
||||
|
||||
Enable Extended Security Maintenance (ESM Apps) to get 0 security
|
||||
updates (so far) and enable coverage of 510 packages.
|
||||
|
||||
This machine is not attached to an Ubuntu Advantage subscription.
|
||||
See https://ubuntu.com/advantage
|
||||
```
|
||||
|
||||
As you can see in the above output, my system will majorly get supported till April 2025. Ubuntu can provide maintenance support for 510 packages till April 2030 but you’ll have to purchase the ESM.
|
||||
|
||||
The ESM is more useful to mission-critical business infrastructure where upgrading to a newer version of the OS will impact the business. For desktop users, upgrading to a newer version is easier and more sensible thing to do.
|
||||
|
||||
#### What happens when your Ubuntu install reaches end of life? What if you continue using Ubuntu even after its end of life?
|
||||
|
||||
When your Ubuntu install reaches end of life, it stops getting system updates including any security updates. There won’t be updates for installed software as well.
|
||||
|
||||
Without the security updates your system will become vulnerable to hacking attacks (if you connect to internet). Suppose a vulnerability gets discovered in one of the software you use or even in Linux kernel. You don’t get the update so this vulnerability is not patched and some malicious hackers take advantage of it to steal your data.
|
||||
|
||||
Eventually, you’ll not be able to use the Ubuntu repositories. If you try to install a new application, you’ll see ‘[unable to locate package error][3]‘.
|
||||
|
||||
So, basically, you won’t be able to install new software and your system will be at risk. Not a pretty scenario.
|
||||
|
||||
The worst part is that if you wait way too long, you won’t be able to upgrade to the newer version. For example, a system running 17.04 can no longer update to 17.10 because even 17.10 is not supported anymore. A [fresh new Ubuntu installation][4] is the only suggested option in such case.
|
||||
|
||||
#### What should you do when your Ubuntu install reaches end of life?
|
||||
|
||||
Ubuntu doesn’t just abandon you after your system reaches end of life. It notifies you either in terminal or on the desktop that your system is no longer supported.
|
||||
|
||||
![Ubuntu No Longer Supported][5]
|
||||
|
||||
It even provides a mechanism to [upgrade your current Ubuntu version to the newer version][6]. Most of the software you have currently installed and your pictures, videos and other documents remain as it is. Making a backup of your important data on an external disk is still recommended.
|
||||
|
||||
![Upgrade to Ubuntu 20.04 From 18.04][7]
|
||||
|
||||
The rule of thumb is:
|
||||
|
||||
* if you are using an LTS release, you should upgrade when the next LTS version is available.
|
||||
* if you are using a regular release, you should upgrade whenever the next version is available.
|
||||
|
||||
|
||||
|
||||
#### Still confused?
|
||||
|
||||
I wrote this article because this is one of the most common confusion for It’s FOSS readers. I hope it clears the air and you have a better understanding of Ubuntu release cycle.
|
||||
|
||||
If you still have doubts, please feel free to ask your question in the comment section. I’ll be happy to answer your queries.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/end-of-life-ubuntu/
|
||||
|
||||
作者:[Abhishek Prakash][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://itsfoss.com/author/abhishek/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/end-of-life-ubuntu.png?ssl=1
|
||||
[2]: https://itsfoss.com/ubuntu-hwe-kernel/
|
||||
[3]: https://itsfoss.com/unable-to-locate-package-error-ubuntu/
|
||||
[4]: https://itsfoss.com/install-ubuntu/
|
||||
[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/ubuntu-no-longer-supported.png?ssl=1
|
||||
[6]: https://itsfoss.com/upgrade-ubuntu-version/
|
||||
[7]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/03/upgrade-ubuntu-20-04-from-18-04.jpg?ssl=1
|
@ -0,0 +1,104 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (wxy)
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (4 essential tools to set up your Python environment for success)
|
||||
[#]: via: (https://opensource.com/article/20/6/python-tools)
|
||||
[#]: author: (Moshe Zadka https://opensource.com/users/moshez)
|
||||
|
||||
建立成功的 Python 环境的 4 个基本工具
|
||||
======
|
||||
|
||||
> 选择的这些工具将简化你的 Python 环境,以实现顺畅和一致的开发实践。
|
||||
|
||||
![Python programming language logo with question marks][1]
|
||||
|
||||
Python 是一门出色的通用编程语言,经常作为第一门编程语言来教授。二十年来,我为它撰写了很多本书,而它仍然是[我的首选语言][2]。虽然通常来说这门语言是简洁明了的,但是(正如 [xkcd][3] 所说的),从来没有人说过配置 Python 环境也是一样的简单。
|
||||
|
||||
![xkcd python illustration][4]
|
||||
|
||||
*一个复杂的Python环境。 [xkcd][3]*
|
||||
|
||||
在日常生活中有很多使用 Python 的方法。我将解释我是如何使用这些 Python 生态系统工具的,坦诚的说,我仍在寻找更多替代品。
|
||||
|
||||
### 使用 pyenv 来管理 Python 版本
|
||||
|
||||
我发现在你的机器上运行一个特定版本的 Python 的最好方法是使用 `pyenv`。这个软件可以在 Linux、Mac OS X 和 WSL2 上工作:这是我通常关心的三个 “类 UNIX” 环境。
|
||||
|
||||
安装 `pyenv` 本身有时会有点棘手。一种方法是使用专用的 [pyenv 安装程序][5],它使用 `curl | bash` 的方法来进行(详见说明)。
|
||||
|
||||
如果你是在 Mac 上(或者你运行 Homebrew 的其他系统),你可以按照[这里][6]的说明来安装和使用 `pyenv`。
|
||||
|
||||
按照说明安装和设置了 `pyenv` 之后,你可以使用 `pyenv global` 来设置一个 “默认的” Python 版本。一般来说,你会选择你 “最喜欢的” 版本。这通常是最新的稳定版本,但如果有其他考虑因素也可能做不同的选择。
|
||||
|
||||
### 使用 virtualenvwrapper 让虚拟环境更简单
|
||||
|
||||
使用 `pyenv` 安装 Python 的一个好处是,你后继安装的所有后续 Python 解释器环境都是你自己的,而不属于你的操作系统。
|
||||
|
||||
虽然在 Python 本身内部安装东西通常不是最好的选择,但有一个例外:在上面选择的 “最喜欢的” Python 中,安装并配置 `virtualenvwrapper`。这样你就可以在瞬间创建和切换到虚拟环境。
|
||||
|
||||
我在[这篇文章中][7]具体介绍了如何安装和使用 `virtualenvwrapper`。
|
||||
|
||||
这里我推荐一个独特的工作流程。你可以制作一个虚拟环境,这样你就可以大量重复使用它来运行许多<ruby>运行器<rt>runner</rt></ruby>。在这个环境中,安装你最喜欢的运行器 —— 也就是你会经常用来运行其他软件的软件。就目前而言,我的首选是 `tox`。
|
||||
|
||||
### 使用 tox 作为 Python 运行器
|
||||
|
||||
[tox][8] 是一个很好的工具,可以让你的 Python 测试自动化。在每个 Python 环境中,我都会创建一个 `tox.ini` 文件。无论我使用什么系统做持续集成,都可以运行它,我可以用上面文章中描述的 `virtualenvwrapper` 的 `workon` 语法在本地运行同样的东西:
|
||||
|
||||
```
|
||||
$ workon runner
|
||||
$ tox
|
||||
```
|
||||
|
||||
这个工作流程之所以重要,是因为我要在多个版本的 Python 和多个版本的库依赖中测试我的代码。这意味着在 `tox` 运行器中会有多个环境。有些人会尝试在最新的依赖关系中运行,有些人会尝试在冻结的依赖关系中运行(接下来会有更多的介绍),我也可能会用 `pip-compile` 在本地生成这些环境。
|
||||
|
||||
附注:我目前正在[研究使用 nox][9] 作为 `tox` 的替代品。原因超出了本文的范围,但值得一试。
|
||||
|
||||
### 使用 pip-compile 进行 Python 依赖性管理
|
||||
|
||||
Python 是一种动态编程语言,这意味着它在每次执行代码时都会加载其依赖关系。确切了解每个依赖项的具体运行版本可能意味着是平稳运行代码还是意外崩溃。这意味着我们必须考虑依赖管理工具。
|
||||
|
||||
对于每个新项目,我都会包含一个 `requirements.in` 文件,(通常)只有以下内容:
|
||||
|
||||
```
|
||||
.
|
||||
```
|
||||
|
||||
是的,没错。只有一个点的单行。我在 `setup.py` 文件中记录了 “松散” 的依赖关系,比如 `Twisted>=17.5`。这与 `Twisted==18.1` 这样的确切依赖关系形成了鲜明对比,后者在需要一个特性或错误修复时升级到新版本的库变得更加困难。
|
||||
|
||||
`.` 的意思是 “当前目录”,它使用当前目录下的 `setup.py` 作为依赖关系的来源。
|
||||
|
||||
这意味着使用 `pip-compile requirements.in > requirements.txt` 将创建一个冻结的依赖文件。你可以在 `virtualenvwrapper` 创建的虚拟环境中或者 `tox.ini` 中使用这个依赖文件。
|
||||
|
||||
有时,从 `requirements-dev.in`(内容:`.[dev]`)生成的 `requirements-dev.txt` 或从 `requirements-test.in`(内容:`.[test]`)生成的 `requirements-test.txt` 很有用。
|
||||
|
||||
我正在研究在这个流程中是否应该用 [dephell][10] 代替 `pip-compile`。`dephell` 工具具有许多有趣的功能,比如使用异步 HTTP 请求来下载依赖项。
|
||||
|
||||
### 结论
|
||||
|
||||
Python 的功能既强大又赏心悦目。为了编写这些代码,我依靠了一个对我来说很有效的特定工具链。工具 `pyenv`、`virtualenvwrapper`、`tox` 和 `pip-compile` 都是独立的。但是,它们各有各的作用,没有重叠,它们一起打造了一个强大的 Python 工作流。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/20/6/python-tools
|
||||
|
||||
作者:[Moshe Zadka][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[wxy](https://github.com/wxy)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/moshez
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/python_programming_question.png?itok=cOeJW-8r (Python programming language logo with question marks)
|
||||
[2]: https://opensource.com/article/19/10/why-love-python
|
||||
[3]: https://xkcd.com/1987/
|
||||
[4]: https://opensource.com/sites/default/files/uploads/python_environment_xkcd_1.png (xkcd python illustration)
|
||||
[5]: https://github.com/pyenv/pyenv-installer
|
||||
[6]: https://opensource.com/article/20/4/pyenv
|
||||
[7]: https://opensource.com/article/19/6/python-virtual-environments-mac
|
||||
[8]: https://opensource.com/article/19/5/python-tox
|
||||
[9]: https://nox.thea.codes/en/stable/
|
||||
[10]: https://github.com/dephell/dephell
|
@ -1,245 +0,0 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (robsean)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (How to Make Ubuntu Look Like macOS in 5 Easy Steps)
|
||||
[#]: via: (https://itsfoss.com/make-ubuntu-look-like-macos/)
|
||||
[#]: author: (Community https://itsfoss.com/author/itsfoss/)
|
||||
|
||||
如何使用 5 个简单的步骤来使 Ubuntu 看起来像 macOS
|
||||
======
|
||||
|
||||
定制系统是 [我为什么使用 Linux][1] 的一个主要原因。定制桌面 Linux 的道路是永无止境的.你可以更改图标,主题,字体,终端,添加屏幕小工具,[指示器小程序][2], 扩展小程序等诸如此类的东西。
|
||||
|
||||
我们已经在 FOSS 上介绍了很多桌面环境定制的建议和技巧。在这篇文章中,我将向你展示如何使 Ubuntu 看起来像 macOS 。
|
||||
|
||||
很多人使用 macOS ,是因为它的简单和唯美的外观。你可能不同意这一点,但是这仍然是一个流行的观点。甚至可以说这里有些类似 macOS 外观和感觉的 Linux 发行版。
|
||||
|
||||
**一位读者要求我们展示如何使 Ubuntu 看起来像 macOS** ,因此我们创建了这篇教程。事实上,这是一个 **很好的用来展示桌面 Linux 定制能力的示例** 。
|
||||
|
||||
不,你没有必要为定制外观而安装一个新的发行版。你可以在你自己的系统上做一些调整来给予你一个类似 macOS 的外观。
|
||||
|
||||
### 如何给予你的 Ubuntu Linux 一个 macOS 外观改造
|
||||
|
||||
![][3]
|
||||
|
||||
尽管这篇文章是对 Ubuntu 的建议,但是你也可以在 **其它使用 GNOME desktop** 的发行版中使用这些建议,只需要做很少或不做任何更改。请确保 [检查你的桌面环境][4] 。
|
||||
|
||||
平心而论,即使你使用一些其它的桌面环境,你仍然可以获得一些关于要做哪些更改的提示。但是你必需确保使用你所用桌面环境的工具来遵循这些步骤。
|
||||
|
||||
#### 必要条件: GNOME Tweaks 和 GNOME 扩展
|
||||
|
||||
请确保 [安装 GNOME Tweaks 工具][5] 。你将需要它来更改主题和图标。
|
||||
|
||||
你也将需要 [启用 GNOME 扩展][6] 来更改 GNOME Shell 和添加重要的要点。
|
||||
|
||||
在你启用 GNOME 扩展后,你需要从 [Gnome 扩展][7] 来安装“用户主题”扩展,或者只需要转到 [这个超链接][8] ,并单击开关来将其打开。
|
||||
|
||||
我也要求你有一些 [在 Ubuntu 上安装主题][9] 的知识。不过,我将简单得涉及这个主题。
|
||||
|
||||
让我们依次看看每个步骤。
|
||||
|
||||
#### 步骤 1: 安装一个受 macOS 影响的 GTK 主题
|
||||
|
||||
因为重点是使 GNOME 看起来像 macOS ,所以你应该选择一个像 macOS 一样的主题。在这里有很多像 macOS 一样的主题。
|
||||
|
||||
**下载一个你选择的主题**
|
||||
|
||||
你可以转到 [Gnome-look][10] 站点,并搜索关于 GTK3 的主题。如果你看到 “Pling” 写在 Gnome-look 网站上,不用担心。因为它们都来自同一个提供商。
|
||||
|
||||
你可以选择任何你像要的主题。这里有一些 macOS 主题,我认为你应该看一看:
|
||||
|
||||
[**mcOS 11**][11]
|
||||
|
||||
[McHigh Sierra][12]
|
||||
|
||||
[Catalina][13]
|
||||
|
||||
[McMojave][14]
|
||||
|
||||
在这篇文章中,我将使用 “[McMojave][14]”。你可以选择任何你想要的主题。你将在网站的右侧找到下拉式的下载按钮,单击它。
|
||||
|
||||
![McMojave 暗黑主题][15]
|
||||
|
||||
在这里你可以找到各种各样的 “.tar.xz” 文件。这些不同是文件包含略有区别的相同主题。像在 “McMojave” 中,我们有像暗黑主题和明亮主题的变体。你可以全试,或者从转盘中间选择你喜欢的任意一个。
|
||||
|
||||
**设置下载的主题**
|
||||
|
||||
提取下载的主题,并复制这些提取的主题文件夹到 .local/share/themes 文件夹下。
|
||||
|
||||
打开 GNOME Tweak 工具,并更改应用程序和 Shell 主题。在你更改主题的同时,你可以看到黄色,绿色和红色三个按钮, and that Apple logo on upper left corner. 你也可以注意到在面板项目上的一些更改。
|
||||
|
||||
![McMojave GTK 和 Shell 主题][16]
|
||||
|
||||
#### 步骤 2: 安装像 macOS 一样的图标
|
||||
|
||||
macOS 外观改造的下一步骤是使用像 macOS 一样的图标。
|
||||
|
||||
**下载图标集合**
|
||||
|
||||
这里有一些我建议使用的图标集合,你可以从 Gnome-look 网站下载:
|
||||
|
||||
[McMojave-circle][17]
|
||||
|
||||
[Mojave CT-icons][18]
|
||||
|
||||
[Cupertino icons][19]
|
||||
|
||||
在这篇文章中,我将使用“[McMojave-circle][17]” ,你可以随意使用任何你喜欢的图标。
|
||||
|
||||
就像主题一样,你可以从右侧的下拉式的“下载”按钮下载图标集合。在这里你也可以找到同一种图标的不同版本。
|
||||
|
||||
![Mcmojave Circle][20]
|
||||
|
||||
**设置图标**
|
||||
|
||||
现在设置下载的图标。为此,提取下载文件中的文件夹并复制它到你的 home 目录下的 .icons 文件夹。 查看这篇关于 [在 Ubuntu 中安装图标][9] [][9][主题][9] 的文章。
|
||||
|
||||
这是这种图标看起来的样子:
|
||||
|
||||
![McMojave Circle 图标外观][21]
|
||||
|
||||
#### 步骤 3: 添加类似 macOS 样子的 dock
|
||||
|
||||
没有类似 macOS 样子的 dock ,你的 Ubuntu 将不会看起来像 macOS 。在 Linus 上有很多可用的 dock 。我喜欢 [Dash to Dock][22] ,并且将在这里使用它。
|
||||
|
||||
Dash to Dock 是一个 GNOME 扩展。到现在为止,你已经熟悉 GNOME 扩展。只需要转到 [这个超链接][23] ,并单击切换按钮来安装它。你的原本的 dock 将自动被 dash-to-dock 所替换。
|
||||
|
||||
你可以通过右键单击 “显示应用程序” 按钮(最右边的菜单按钮)来更改设置,并选择 “Dash to dock 设置”。
|
||||
|
||||
![Dash To Dock][24]
|
||||
|
||||
#### 步骤 4: 使用 macOS 壁纸
|
||||
|
||||
大多数复杂的东西已经完成。现在是时候设置 macOS 壁纸了。你可以从下面的超链接下载 macOS 默认壁纸:
|
||||
|
||||
[下载 macOS 壁纸][25]
|
||||
|
||||
**更改桌面背景**
|
||||
|
||||
我将使用 “Mojave Day” 壁纸。右键单击已下载的的图像,并选择 ‘设置为壁纸’ 选项来更改壁纸。
|
||||
|
||||
在设置这个壁纸后,这是我系统外观的样子:
|
||||
|
||||
![][26]
|
||||
|
||||
**更改锁屏壁纸**
|
||||
|
||||
锁屏壁纸选项已经从 [Ubuntu 20.04][27] 的设置中移除。现在它使用模棱两可的桌面壁纸作为锁屏壁纸。
|
||||
|
||||
为设置一个自定义锁屏壁纸,你可以使用 “[锁屏壁纸][28]” 扩展。
|
||||
|
||||
打开 “锁屏壁纸” 扩展设置,并设置锁屏壁纸。
|
||||
|
||||
![锁屏背景设置][29]
|
||||
|
||||
这是锁屏现在的样子。如果你想弄明白的话,这里是 [如何在 Ubuntu 中锁屏截图][30]。
|
||||
|
||||
![锁屏][31]
|
||||
|
||||
![登录屏幕][32]
|
||||
|
||||
#### 步骤 5: 更改系统字体
|
||||
|
||||
这几年以来,macOS 的主要字体是 ‘San Francisco’ 。但是,这个 San Francisco 字体不在公共领域中,而是专有的,就像在苹果生态系统中的很多其它东西一样。因此,你不能使用这种字体。
|
||||
|
||||
你能做的就是使用一种看起来像 San Francisc 字体一样的开源字体。我建议使用来自 Google 的 [Roboto][33] 字体,或来自 Adobe 的 [Source Sans Pro][34] 。
|
||||
|
||||
[在 Ubuntu 中安装字体是很简单的][35] 。下载 字体的 zip 文件,只需要在提取出来的文件夹中双击 ttf 文件。它将给予你逐个安装字体的选项。
|
||||
|
||||
如果你想节省时间并一次安装所有的字体,提取其中所有的字体到你的 home 文件夹 (~/.fonts) 下的 “.fonts” 目录中。
|
||||
|
||||
![安装字体][36]
|
||||
|
||||
在你安装字体后,你可以使用 GNOME Tweaks 工具来更改系统字体。
|
||||
|
||||
![设置字体][37]
|
||||
|
||||
#### 额外提示: Spotlight 就像应用程序启动器一样(如果你像多跑1英里的话)
|
||||
|
||||
如果你是 macOS Spotlight 启动器的一名粉丝,那么你在 Linux 上也能够有一些类似的东西。我最喜欢获取的这类启动器的软件包是 “[Albert][38]“ 。
|
||||
|
||||
你可以找到 [Albert 在其网站上的安装说明][39] 。
|
||||
|
||||
在安装后,打开 “Albert” 并设置快捷键 (你想打开启动器的组合键),接下来你就可以去尝试一下。我认为在 macOS 中,Command 按键 + 空格按键是来启动 Spotlight 的。你可以设置 Super 按键 + 空格按键 [为 Ubuntu 中的键盘快捷键][40] 。
|
||||
|
||||
你将会获得很多内置的主题,在下面的图片中,我使用 “Spotlight 暗黑” 主题。
|
||||
|
||||
Albert 不能直接启动应用程序,你必需给予它能够查看搜索结果是权限。
|
||||
|
||||
![Albert 设置][41]
|
||||
|
||||
在设置后,这是它看起来的样子:
|
||||
|
||||
![Albert 暗黑主题][42]
|
||||
|
||||
这是我的 Ubuntu 20.04 在完成所有定制后的样子。它看起来像 macOS 吗? 仁者见仁,智者见智。
|
||||
|
||||
![macOS 主题][43]
|
||||
|
||||
![Ubuntu 使用 macOS 外观改造][44]
|
||||
|
||||
如此,这就是你如何使你的 GNOME desktop 看起来像 macOS 一样的步骤。正如我在开始时所说的,这是一个很好的 Linux 桌面定制功能的示例。
|
||||
|
||||
如果你有新的注意或有任何疑问;评论区全是你的地盘。
|
||||
|
||||
_由 Sumeet 编写,并由 Abhishek Prakash 提供补充输入信息。_
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/make-ubuntu-look-like-macos/
|
||||
|
||||
作者:[Community][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://itsfoss.com/author/itsfoss/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://itsfoss.com/why-use-linux/
|
||||
[2]: https://itsfoss.com/best-indicator-applets-ubuntu/
|
||||
[3]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/Make-Ubuntu-Look-like-MacOS.png?ssl=1
|
||||
[4]: https://itsfoss.com/find-desktop-environment/
|
||||
[5]: https://itsfoss.com/gnome-tweak-tool/
|
||||
[6]: https://itsfoss.com/gnome-shell-extensions/
|
||||
[7]: https://extensions.gnome.org/
|
||||
[8]: https://extensions.gnome.org/extension/19/user-themes/
|
||||
[9]: https://itsfoss.com/install-themes-ubuntu/
|
||||
[10]: https://www.gnome-look.org/
|
||||
[11]: https://www.pling.com/p/1220826
|
||||
[12]: https://www.pling.com/p/1013714
|
||||
[13]: https://www.pling.com/p/1226871
|
||||
[14]: https://www.pling.com/p/1275087
|
||||
[15]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/McMojave-dark-theme.png?ssl=1
|
||||
[16]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/McMojave-Desktop.png?ssl=1
|
||||
[17]: https://www.gnome-look.org/p/1305429/
|
||||
[18]: https://www.gnome-look.org/p/1210856/
|
||||
[19]: https://www.gnome-look.org/p/1102582/
|
||||
[20]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/McMojave-circle-.png?ssl=1
|
||||
[21]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/McMojave-circle-icons-look.png?fit=800%2C494&ssl=1
|
||||
[22]: https://github.com/micheleg/dash-to-dock
|
||||
[23]: https://extensions.gnome.org/extension/307/dash-to-dock/
|
||||
[24]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/Dash-to-dock-1.png?ssl=1
|
||||
[25]: https://oswallpapers.com/category/mac-os/
|
||||
[26]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/Wallpaper.png?fit=800%2C450&ssl=1
|
||||
[27]: https://itsfoss.com/ubuntu-20-04-release-features/
|
||||
[28]: https://extensions.gnome.org/extension/1476/unlock-dialog-background/
|
||||
[29]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/Lock-screen-background-setting.png?ssl=1
|
||||
[30]: https://itsfoss.com/screenshot-login-screen-ubuntu-linux/
|
||||
[31]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/Lock-screen-1.png?ssl=1
|
||||
[32]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/Login-screen-1.png?ssl=1
|
||||
[33]: https://fonts.google.com/specimen/Roboto?query=robot
|
||||
[34]: https://adobe-fonts.github.io/source-sans-pro/
|
||||
[35]: https://itsfoss.com/install-fonts-ubuntu/
|
||||
[36]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/Fonts.png?ssl=1
|
||||
[37]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/Set-fonts.png?ssl=1
|
||||
[38]: https://albertlauncher.github.io/
|
||||
[39]: https://albertlauncher.github.io/docs/installing/
|
||||
[40]: https://itsfoss.com/ubuntu-shortcuts/
|
||||
[41]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/Albert-settings.png?ssl=1
|
||||
[42]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/06/Albert-look.png?ssl=1
|
||||
[43]: https://i2.wp.com/itsfoss.com/wp-content/uploads/2020/06/macOS-theme.png?fit=800%2C450&ssl=1
|
||||
[44]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/06/macOS-theme-2.png?fit=800%2C450&ssl=1
|
@ -0,0 +1,125 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Linux tools for improving your time management)
|
||||
[#]: via: (https://opensource.com/article/20/6/linux-time-management)
|
||||
[#]: author: (Sudeshna Sur https://opensource.com/users/sudeshna-sur)
|
||||
|
||||
用于改善时间管理的 Linux 工具
|
||||
======
|
||||
无论你是需要帮助来保持专注、保持及时性,还是发现为了避免重复的快捷方式,这些 Linux 工具能够帮助你。
|
||||
![Business woman on laptop sitting in front of window][1]
|
||||
|
||||
|
||||
生产率是一个主观术语,但从本质上讲,它是衡量特定任务完成效率的标准。每个人都有不同的方式来提高他们的生产力:有些人需要帮助完成任务、有些人需要特殊的工作环境、有些人需要警报和提醒以避免错过截止日期,还有些人需要帮助重复的,手工杂务。幸运的是,有多种工具和技术可为你提供所需的特定支持。特别地,如果你是 Linux 用户,有一些调整可以帮助你提高生产力。这是我经常使用的两个。
|
||||
|
||||
### Clipboard Indicator
|
||||
|
||||
你是日常在多个文档之间的大量使用复制和粘贴的人吗?如果是这样,那么 [Clipboard Indicator][2] 应该成为你的首选方案之一。将 Clipboard Indicator 作为 GNOME 扩展安装到 Linux 发行版中。以我的经验,它对 GNOME Shell 的性能影响最小,至少比我尝试过的其他方案要小。
|
||||
|
||||
该工具添加了一个指示器菜单到顶部面板,并缓存剪贴板历史。你可以设置历史记录大小,预览要查看的字符数。它显示有关复制的通知,并充当保存任意复制内容的临时空间。
|
||||
|
||||
![Clipboard indicator menu on GNOME desktop][3]
|
||||
|
||||
安装扩展程序和连接器的最简单方法是使用发行版的包管理器。
|
||||
|
||||
对于 Fedora、CentOS 或 RHEL,请使用:
|
||||
|
||||
|
||||
```
|
||||
`$ sudo dnf install chrome-gnome-shell`
|
||||
```
|
||||
|
||||
在 Ubuntu 或 Debian 上,请改用 `apt install`。
|
||||
|
||||
安装完成后,进入<https://extensions.gnome.org/> 并查看已安装的扩展。
|
||||
|
||||
如果你使用的是 Firefox,请使用 Firefox 浏览器附加组件并安装 `GNOME Shell integration`。你将在 Firefox 工具栏中看到一个很小的图标,它将带你进入“扩展”页面。在该页面上,搜索 Clipboard Indicator 扩展并启用它
|
||||
|
||||
现在,按照提示下载 GNOME 扩展并激活它。你可以查看你的 `~/.local/share/gnome-shell/extensions` 来浏览扩展。
|
||||
|
||||
好了!你将在 GNOME 桌面的右上角看到一个新图标。复制任意内容并尝试其设置。
|
||||
|
||||
也可以使用以下命令通过 Git 进行快速安装:将仓库克隆到本地 `gnome-shell extensions` 目录中:
|
||||
|
||||
|
||||
```
|
||||
`$ git clone https://github.com/Tudmotu/gnome-shell-extension-clipboard-indicator.git ~/.local/share/gnome-shell/extensions/clipboard-indicator@tudmotu.com`
|
||||
```
|
||||
|
||||
进入 GNOME Tweaks 工具,然后从“扩展”页面激活它。
|
||||
|
||||
### Pomodoro
|
||||
|
||||
![Using the pomodoro timer on GNOME][4]
|
||||
|
||||
Pomodoro 技术是一种时间管理理念,旨在为用户提供最大注意力。每个 25 分钟的工作时间称为“番茄时间 (pomodoro)”(意大利语的番茄);每个番茄之后,你需要休息五分钟。每四个番茄时间,即每 100 分钟,你就要休息 15 至 20 分钟。如果你有大量的待办事项,那么使用 Pomodoro 技术可以通过强迫你遵守严格的时间安排来帮助你更快地完成项目。
|
||||
|
||||
可以通过 GNOME Tweaks 网页 (extensions.gnome.org) 或通过命令行来管理安装过程。对于后者,请选择 Linux 发行版和版本,并使用以下命令进行安装:
|
||||
|
||||
|
||||
```
|
||||
`$ sudo dnf install gnome-shell-extension-pomodoro`
|
||||
```
|
||||
|
||||
或者,如果你希望从源代码构建:
|
||||
|
||||
|
||||
```
|
||||
$ git clone -b gnome-3.34 <https://github.com/codito/gnome-pomodoro.git>
|
||||
$ cd gnome-pomodoro
|
||||
```
|
||||
|
||||
源码有许多依赖关系,其中许多可能已经安装。为了确保这点,请安装以下内容。
|
||||
|
||||
|
||||
```
|
||||
`$ sudo dnf install autoconf-archive gettext vala vala-tools pkg-config desktop-file-utils glib2-devel gtk3-devel libappstream-glib-devel libappindicator-gtk3-devel libcanberra-devel libpeas-devel sqlite-devel gom-devel gobject-introspection-devel gsettings-desktop-schemas-devel gstreamer1-devel`
|
||||
```
|
||||
|
||||
在源代码的解压目录中,完成构建。
|
||||
|
||||
|
||||
```
|
||||
$ ./autogen.sh --prefix=/usr --datadir=/usr/share
|
||||
$ make
|
||||
$ sudo make install
|
||||
```
|
||||
|
||||
无论我们如何安装,请进入 GNOME Tweaks 并打开番茄计时器。如果你还没有 GNOME Tweaks,请通过包管理器或所选的软件安装程序进行安装。例如,在 Fedora 上:
|
||||
|
||||
|
||||
```
|
||||
`$ sudo dnf install gnome-tweaks`
|
||||
```
|
||||
|
||||
在 Ubuntu 或 Debian上,请改用 `apt install`。
|
||||
|
||||
Pomodoro 桌面集成当前可在 GNOME Shell 中使用,并且它们计划在将来支持更多桌面。 查看 <https://gnomepomodoro.org/> 获取有关该项目的最新信息。同时,对于 KDE 用户,还有一个名为 [Fokus][5] 的替代品。
|
||||
|
||||
### Linux 上的生产力
|
||||
|
||||
生产力是个人的,但这是我们所有人都在以某种方式追求的东西。 任何一个工具要么节省了我的时间,要么使我的工作效率提高了,它们可以与 Linux 快速集成。
|
||||
|
||||
你是否有喜欢的生产力工具?请在评论中分享!
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/20/6/linux-time-management
|
||||
|
||||
作者:[Sudeshna Sur][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/sudeshna-sur
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/lenovo-thinkpad-laptop-concentration-focus-windows-office.png?itok=-8E2ihcF (Woman using laptop concentrating)
|
||||
[2]: https://extensions.gnome.org/extension/779/clipboard-indicator/
|
||||
[3]: https://opensource.com/sites/default/files/uploads/gnome-tweaks-productivity_0.png (Clipboard indicator menu on GNOME desktop)
|
||||
[4]: https://opensource.com/sites/default/files/uploads/pomodoro-timer-fedora-opensourcecom.png (Using the pomodoro timer on GNOME)
|
||||
[5]: https://store.kde.org/p/1308861/
|
@ -0,0 +1,155 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Make Bash history more useful with these tips)
|
||||
[#]: via: (https://opensource.com/article/20/6/bash-history-control)
|
||||
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
|
||||
|
||||
这些技巧让 Bash history 更加有用
|
||||
======
|
||||
告诉 Bash 你想要它记住什么,甚至删除不需要的记录重写历史。
|
||||
![A person programming][1]
|
||||
|
||||
运行 [Bash][2] 的 Linux 终端有内置的历史记录,你可以用来跟踪最近的操作。要查看你的 Bash 会话的历史记录,请使用内置命令 `history`:
|
||||
|
||||
|
||||
```
|
||||
$ echo "foo"
|
||||
foo
|
||||
$ echo "bar"
|
||||
bar
|
||||
$ history
|
||||
1 echo "foo"
|
||||
2 echo "bar"
|
||||
3 history
|
||||
```
|
||||
|
||||
与大多数命令不一样,`history` 命令不是文件系统上的可执行文件,而是 Bash 的功能。你可以使用 `type` 命令来验证:
|
||||
|
||||
|
||||
```
|
||||
$ type history
|
||||
history is a shell builtin
|
||||
```
|
||||
|
||||
### 历史控制
|
||||
|
||||
shell 历史记录的行数上限由 `HISTSIZE` 变量定义。你可以在 .bashrc 文件中设置此变量。以下将你的历史记录设置为 3,000 行,之后将最早的行删除以为最新命令腾出空间,该命令位于列表的底部:
|
||||
|
||||
|
||||
```
|
||||
`export HISTSIZE=3000`
|
||||
```
|
||||
|
||||
还有其他与历史相关的变量。 `HISTCONTROL` 变量控制哪些历史被记录。你可以在 `.bashrc` 中写入下面的行来强制 Bash 排除以空格开头的命令:
|
||||
|
||||
|
||||
```
|
||||
`export HISTCONTROL=$HISTCONTROL:ignorespace`
|
||||
```
|
||||
|
||||
现在,如果你输入以空格开头的命令,那么它将不会记录在历史记录中:
|
||||
|
||||
|
||||
```
|
||||
$ echo "hello"
|
||||
$ mysql -u bogus -h badpassword123 mydatabase
|
||||
$ echo "world"
|
||||
$ history
|
||||
1 echo "hello"
|
||||
2 echo "world"
|
||||
3 history
|
||||
```
|
||||
|
||||
你也可以避免重复的条目:
|
||||
|
||||
|
||||
```
|
||||
`export HISTCONTROL=$HISTCONTROL:ignoredups`
|
||||
```
|
||||
|
||||
现在,如果你一个接着一个输入两个命令,历史记录中只会显示一个:
|
||||
|
||||
|
||||
```
|
||||
$ ls
|
||||
$ ls
|
||||
$ ls
|
||||
$ history
|
||||
1 ls
|
||||
2 history
|
||||
```
|
||||
|
||||
如果你喜欢这两个忽略,那么可以使用 `ignoreboth`:
|
||||
|
||||
|
||||
```
|
||||
`export HISTCONTROL=$HISTCONTROL:ignoreboth`
|
||||
```
|
||||
|
||||
### 从历史记录中删除命令
|
||||
|
||||
有时你会犯一个错误,在 shell 中输入了一些敏感内容,或者你只是想清理历史记录,以便它更准确地表示让某件事正常工作所采取的步骤。如果要从 Bash 的历史记录中删除命令,请在要删除的项目的行号上使用 `-d` 选项:
|
||||
|
||||
|
||||
```
|
||||
$ echo "foo"
|
||||
foo
|
||||
$ echo "bar"
|
||||
bar
|
||||
$ history | tail
|
||||
535 echo "foo"
|
||||
536 echo "bar"
|
||||
537 history | tail
|
||||
$ history -d 536
|
||||
$ history | tail
|
||||
535 echo "foo"
|
||||
536 history | tail
|
||||
537 history -d 536
|
||||
538 history | tail
|
||||
```
|
||||
|
||||
要停止添加 `history` 条目,只要在 `HISTCONTROL` 环境变量中有 `ignorespace`,就可以在命令前添加`空格`:
|
||||
|
||||
|
||||
```
|
||||
$ history | tail
|
||||
535 echo "foo"
|
||||
536 echo "bar"
|
||||
$ history -d 536
|
||||
$ history | tail
|
||||
535 echo "foo"
|
||||
```
|
||||
|
||||
你可以使用 -c 选项清除所有会话历史记录:
|
||||
|
||||
|
||||
```
|
||||
$ history -c
|
||||
$ history
|
||||
$
|
||||
```
|
||||
|
||||
### history 命令教训
|
||||
|
||||
操纵历史通常没有听起来那么危险,尤其是当你有目标地管理它时。例如,如果你要记录一个复杂的问题,通常最好使用会话历史来记录命令,因为通过将命令插入历史记录,你能运行它们并从而测试过程。很多时候,不执行历史命令会导致忽略小的步骤或写错小细节。。
|
||||
|
||||
按需使用历史会话,并明智地控制历史记录。享受历史修改吧!
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/20/6/bash-history-control
|
||||
|
||||
作者:[Seth Kenlon][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/seth
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/computer_keyboard_laptop_development_code_woman.png?itok=vbYz6jjb (A person programming)
|
||||
[2]: https://opensource.com/resources/what-bash
|
Loading…
Reference in New Issue
Block a user