This commit is contained in:
toyijiu 2017-07-21 13:18:45 +09:00
commit c0729d31c6
6 changed files with 218 additions and 284 deletions

View File

@ -0,0 +1,124 @@
Linux Bash 提示符的一些骚操作
=======================================================
> 一些能让你自定义 Bash 提示符的黑科技
![Bash prompt tips and tricks](https://opensource.com/sites/default/files/styles/image-full-size/public/images/business/osdc_terminals.png?itok=QmkPW7P1 "Bash prompt tips and tricks")
当你在 Linux 环境下打开一个 Shell 终端时,会看到命令行中出现了类似下面的一个 Bash 提示符:
```
[user@$host ~]$
```
你知道命令行提示符其实是可以自己设置添加许多非常有用的信息的吗?在这篇文章中我就会教你如何自定义自己的 Bash 命令行提示符,想看的话就接着看吧~
### 如何设置 Bash 提示符
Bash 提示符是通过环境变量 `PS1` <ruby>提示符字符串 1<rt>Prompt String 1</rt></ruby> 来设置的,它用于交互式 shell 提示符。当然如果你需要更多的输入才能完成一个 Bash 命令时,`PS2` 环境变量就是用来设置多行提示符的:
```
[dneary@dhcp-41-137 ~]$ export PS1="[Linux Rulez]$ "
[Linux Rulez] export PS2="... "
[Linux Rulez] if true; then
... echo "Success!"
... fi
Success!
```
### 在哪里设置 PS1 的值?
`PS1` 就是一个普通的环境变量,系统默认值设置在 `/etc/bashrc` 中,在我的系统中,默认提示符通过以下命令来设置的:
```
[ "$PS1" = "\\s-\\v\\\$ " ] && PS1="[\u@\h \W]\\$ "
```
它判断 `PS1` 是否是系统的默认值 `\s-\v$` ,如果是的话则将值设置为 `[\u@\h \W]\$`LCTT 译注:注意命令中用 `\` 做了转义。)
但如果你想要自定义提示符,不应该修改 `/etc/bashrc` ,而是应该在你的主目录下将自定义命令加到 `.bashrc` 文件中。
### 上面提到的 `\u`、`\h`、`\W`、`\s` 和 `\v` 是什么意思?
`man bash` 中的 PROMPTING 章节中,你能够找到所有 `PS1``PS2` 相关的特殊字符的描述,以下是一些比较常用的:
- `\u`:用户名
- `\h`:短主机名
- `\W`当前你所在的目录的名称basename`~` 表示你的主目录
- `\s`Shell 名字bash 或者 sh取决于你的 Shell 的名字是什么)
- `\v`Shell 的版本号
### 还有哪些特殊的字符串可以用在提示符当中
除了上面这些,还有很多有用的字符串可以用在提示符当中:
- `\d`:将日期扩展成 “Tue Jun 27” 这种格式
- `\D{fmt}`:允许自定义日期格式——可通过 `man strftime` 来获得更多信息
- `\D{%c}`:获得本地化的日期和时间
- `\n`:换行(参考下面的多行提示符)
- `\w`:显示当前工作目录的完整路径
- `\H`:当前工作机器的完整主机名
除了以上这些,你还可以在 Bash 的 man 页面的 PROMPTING 部分找到更多的特殊字符和它的用处。
### 多行提示符
如果你的提示符过长(比如说你想包括 `\H` 、`\w` 或完整的日期时间时 ),想将提示符切成两行,可以使用 `\n` 将提示符切断成两行显示,比如下面的多行的例子会在第一行显示日期、时间和当前工作目录,第二行显示用户名和主机名:
```
PS1="\D{%c} \w\n[\u@\H]$ "
```
### 还能再好玩点吗?
人们偶尔也想将提示符变成彩色的。虽然我觉得彩色提示符让人分心、易怒,但是也许你很喜欢。如果我们想将日期变成红色的,目录变成青蓝色,用户名搞一个黄色背景,你可以这样做:
```
PS1="\[\e[31m\]\D{%c}\[\e[0m\]
    \[\e[36m\]\w\[\e[0m\]\n[\[\e[1;43m\]\u\[\e[0m\]@\H]$ "
```
- `\[..\]` :表示一些非打印字符
- `\e[..` :转义字符,后面的跟着的特定的转义字符串在终端中表示颜色或者其他意思
- `31m` :表示红色字体(`41m` 表示是红色背景)
- `36m` :表示是青蓝色字体
- `1;43m` :表示黄色字体(`1;33m` 表示黄色字体)
- `[\e[0m]]` :它在最后将颜色恢复成系统终端默认颜色
你可以在 [Bash prompt HOWTO][11] 这里找到更多的颜色代码,甚至可以让字符反相和闪烁!我不知道为什么地球人会有这种想法,但是你可以这么干!
所以你最喜欢的自定义提示符是什么样子的呢?有没有让你抓狂的自定义提示符呢?请在评论里告诉我吧~
(照片来源:[ajmexico][8]. 修改自 [Jason Baker][9]. [CC BY-SA 2.0][10].
---
作者简介:
Dave Neary - Dave Neary 是红帽开源和标准化团队成员,帮助开源项目对红帽的成功至关重要。自从在 1999 年为 GIMP 提交了第一个补丁以来,他一直带着各种不同的帽子,在开源的世界徜徉。
---
via: https://opensource.com/article/17/7/bash-prompt-tips-and-tricks
作者:[Dave Neary][a]
译者:[吴霄/toyijiu](https://github.com/toyijiu)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:https://opensource.com/users/dneary
[1]:https://opensource.com/resources/what-is-linux?intcmp=70160000000h1jYAAQ&utm_source=intcallout&utm_campaign=linuxcontent
[2]:https://opensource.com/resources/what-are-linux-containers?intcmp=70160000000h1jYAAQ&utm_source=intcallout&utm_campaign=linuxcontent
[3]:https://developers.redhat.com/promotions/linux-cheatsheet/?intcmp=70160000000h1jYAAQ&utm_source=intcallout&utm_campaign=linuxcontent
[4]:https://developers.redhat.com/cheat-sheet/advanced-linux-commands-cheatsheet?intcmp=70160000000h1jYAAQ&utm_source=intcallout&utm_campaign=linuxcontent
[5]:https://opensource.com/tags/linux?intcmp=70160000000h1jYAAQ&utm_source=intcallout&utm_campaign=linuxcontent
[6]:https://opensource.com/article/17/7/bash-prompt-tips-and-tricks?rate=7o5TkSbm_tDUEANDpxTZJU3LgEg0EK-j4xPuNL79m3M
[7]:https://opensource.com/user/16681/feed
[8]:https://www.flickr.com/photos/15587432@N02/3281139507/
[9]:https://opensource.com/users/jason-baker
[10]:https://creativecommons.org/licenses/by/2.0/
[11]:http://tldp.org/HOWTO/Bash-Prompt-HOWTO/x329.html
[12]:https://opensource.com/users/dneary
[13]:https://opensource.com/users/dneary
[14]:https://opensource.com/article/17/7/bash-prompt-tips-and-tricks#comments

View File

@ -1,89 +1,36 @@
安卓编年史
安卓编年史31安卓 6.0 棉花糖
==============
### 安卓 6.0 棉花糖
2015 年 10 月,谷歌给世界带来了安卓 6.0 棉花糖。配合这个版本的发布,谷歌委托生产了两部新的 Nexus 设备:[华为 Nexus 6P 和 LG Nexus 5X][39]。除了常规的性能升级,新手机还带有一套关键硬件:为棉花糖的新指纹 API 准备的指纹识别器。棉花糖还引入了一个疯狂的全新搜索特性被称作“Google Now on Tap”用户控制的应用权限一个全新的数据备份系统以及许多其它的改良。
![](https://cdn.arstechnica.net/wp-content/uploads/2016/10/32-1-1440x1466.jpg)
#### 新谷歌应用
* [
![](https://cdn.arstechnica.net/wp-content/uploads/2016/10/32-1-150x150.jpg)
][3]
* [
![](https://cdn.arstechnica.net/wp-content/uploads/2015/10/app-drawer-150x150.jpg)
][4]
* [
![](https://cdn.arstechnica.net/wp-content/uploads/2015/10/2015-10-01-19.01.201-150x150.png)
][5]
* [
![](https://cdn.arstechnica.net/wp-content/uploads/2015/09/Untitled-3-150x150.gif)
][6]
* [
![](https://cdn.arstechnica.net/wp-content/uploads/2015/09/google-now-home-150x150.jpg)
][7]
* [
![](https://cdn.arstechnica.net/wp-content/uploads/2015/09/typing-150x150.jpg)
][8]
* [
![](https://cdn.arstechnica.net/wp-content/uploads/2015/09/serp-150x150.jpg)
][9]
* [
![](https://cdn.arstechnica.net/wp-content/uploads/2015/09/voice-150x150.jpg)
][10]
* [
![](https://cdn.arstechnica.net/wp-content/uploads/2015/09/icons-150x150.jpg)
][11]
棉花糖是[谷歌大标志重新设计][40]后的第一个安卓版本。系统也随之升级,主要是一个新的谷歌应用,给搜索小部件,搜索页面以及应用图标添加了一个多彩的标志。
![](https://cdn.arstechnica.net/wp-content/uploads/2015/10/app-drawer.jpg)
谷歌将应用抽屉从页面导航的横向布局还原回了单页竖直滚动表的形式。早期版本的安卓用的都是竖直滚动表的形式,直到谷歌在蜂巢中改成了横向页面系统。滚动单页面让人更容易从很多应用中找到目标。一项“快速滚动”的特性同样好用,它可以让你拖动滚动条来激活字母索引。新的应用抽屉布局也用到了小部件抽屉上。考虑到旧系统中小部件轻松就超过了 15 页,这是个大改进。
![](https://cdn.arstechnica.net/wp-content/uploads/2015/10/2015-10-01-19.01.201.png)
棉花糖应用抽屉顶部的“建议应用”栏也让查找应用变得更快。该栏显示的内容一直在变化,试图在你需要的时候为你提供你需要的应用。它使用了算法来统计应用使用,经常一起打开的应用以及每天的打开次数。
#### Google Now on Tap——一个没有完美实现的特性
* [
![](https://cdn.arstechnica.net/wp-content/uploads/2015/10/ontap-150x150.jpg)
][12]
* [
![](https://cdn.arstechnica.net/wp-content/uploads/2015/10/onta3p-150x150.jpg)
][13]
* [
![](https://cdn.arstechnica.net/wp-content/uploads/2015/10/now-on-tap-150x150.jpg)
][14]
* [
![](https://cdn.arstechnica.net/wp-content/uploads/2015/10/fail1-150x150.jpg)
][15]
* [
![](https://cdn.arstechnica.net/wp-content/uploads/2015/10/youtube-150x150.jpg)
][16]
* [
![](https://cdn.arstechnica.net/wp-content/uploads/2015/10/apps-150x150.jpg)
][17]
* [
![](https://cdn.arstechnica.net/wp-content/uploads/2015/10/fail2-150x150.jpg)
][18]
* [
![](https://cdn.arstechnica.net/wp-content/uploads/2015/10/hangouts-150x150.jpg)
][19]
* [
![](https://cdn.arstechnica.net/wp-content/uploads/2015/10/voice-context-150x150.jpg)
][20]
* [
![](https://cdn.arstechnica.net/wp-content/uploads/2015/10/wrongstephen-150x150.jpg)
][21]
* [
![](https://cdn.arstechnica.net/wp-content/uploads/2016/10/assist-api-980x576-150x150.jpg)
][22]
![](https://cdn.arstechnica.net/wp-content/uploads/2015/10/ontap.jpg)
棉花糖的头等新特性之一就是“Google Now on Tap”。有了 Now on Tap你可以在安卓的任意界面长按 home 键,安卓会将整个屏幕发送给谷歌进行处理。谷歌会试着分析页面上的内容,并从屏幕底部弹出显示一个特殊的搜索结果列表。
![](https://cdn.arstechnica.net/wp-content/uploads/2015/10/onta3p.jpg)
Now on Tap 产生的结果不是通常的 10 个蓝色链接——即便那必定有一个通往谷歌搜索的链接。Now on Tap 还可以深度连接到其它使用了谷歌的应用索引功能的应用。他们的想法是你可以在 Youtube 音乐视频那里唤出 Now on tap然后获得一个到谷歌 Play 或亚马逊“购买”页面的链接。在演员新闻文章处唤出 Now on Tap 可以链接到 IMDb 应用中该演员的页面上。
![](https://cdn.arstechnica.net/wp-content/uploads/2016/10/assist-api-980x576.jpg)
谷歌没有让这成为私有特性而是给安卓创建了一个全新的“Assistant API助理 API”。用户可以挑选一个“助理应用”它可以在长按 home 键的时候获取很多信息。助理应用会获取所有由当前应用加载的数据——不仅是直接从屏幕获取到的——连同所有这些图片还有任何开发者想要包含的元数据。这个 API 驱动了谷歌 Now on Tap如果愿意的话它还允许第三方打造 Now on Tap 的竞争对手。
谷歌在棉花糖的发布会上炒作了 Now on Tap但实际上这项特性不是很实用。谷歌搜索的价值在于你可以问它准确的问题——你输入你想要的内容它搜索整个互联网寻找答案或网页。Now on Tap 让事情变得无限困难,因为它甚至不知道你要问的是什么。你带着特定意图打开了 Now on Tap但你发送给谷歌的查询是很不准确的“屏幕上的所有内容”。谷歌需要猜测你查询的内容然后试着基于它给出有用的结果或操作。
@ -96,75 +43,44 @@ Now on Tap 产生的结果不是通常的 10 个蓝色链接——即便那必
#### 权限
* [
![](https://cdn.arstechnica.net/wp-content/uploads/2016/10/33-1-150x150.jpg)
][23]
* [
![](https://cdn.arstechnica.net/wp-content/uploads/2016/10/34-1-150x150.jpg)
][24]
* [
![](https://cdn.arstechnica.net/wp-content/uploads/2015/09/perm-150x150.jpg)
][25]
* [
![](https://cdn.arstechnica.net/wp-content/uploads/2015/09/denied-1-150x150.jpg)
][26]
* [
![](https://cdn.arstechnica.net/wp-content/uploads/2015/09/denied-2-150x150.jpg)
][27]
* [
![](https://cdn.arstechnica.net/wp-content/uploads/2015/09/apps-150x150.jpg)
][28]
* [
![](https://cdn.arstechnica.net/wp-content/uploads/2015/09/overlay-150x150.jpg)
][29]
* [
![](https://cdn.arstechnica.net/wp-content/uploads/2015/09/system-permisions-150x150.jpg)
][30]
* [
![](https://cdn.arstechnica.net/wp-content/uploads/2015/09/warning-150x150.jpg)
][31]
* [
![](https://cdn.arstechnica.net/wp-content/uploads/2015/09/Google_IO_2015_-_Android_M_Permissions_-_YouTube_-_Google_Chrome_2015-09-04_12-31-49-150x150.jpg)
][32]
![](https://cdn.arstechnica.net/wp-content/uploads/2016/10/33-1-1440x1454.jpg)
安卓 6.0 终于引入了应用权限系统,让用户可以细粒度地控制应用可以访问的数据。
![](https://cdn.arstechnica.net/wp-content/uploads/2015/09/perm.jpg)
![](https://cdn.arstechnica.net/wp-content/uploads/2015/09/denied-1.jpg)
应用在安装的时候不再给你一份长长的权限列表。在棉花糖中,应用安装根本不询问任何权限。当应用需要一个权限的时候——比如访问你的位置、摄像头、麦克风,或联系人列表的时候——它们会在需要用到的时候询问。在你使用应用的时候,如果需要新权限时会弹出一个“允许或拒绝”的对话框。一些应用的设置流程这么处理:在启动的时候询问获取一些关键权限,其它的等到需要用到的时候再弹出提示。这样更好地与用户沟通了需要权限是为了做什么——应用需要摄像头权限,因为你刚刚点击了摄像头按钮。
![](https://cdn.arstechnica.net/wp-content/uploads/2015/09/apps.jpg)
![](https://cdn.arstechnica.net/wp-content/uploads/2015/09/system-permisions.jpg)
除了及时的“允许或拒绝”对话框,棉花糖还添加了一个权限设置界面。这个复选框大列表让数据敏感用户可以浏览应用拥有的权限。他们不仅可以通过应用来查询,也可以通过权限来查询。举个例子,你可以查看所有拥有访问麦克风权限的应用。
![](https://cdn.arstechnica.net/wp-content/uploads/2015/09/warning.jpg)
谷歌试验应用权限已经有一段时间了,这些设置界面基本就是隐藏的“[App Ops][42]”系统的重生,它是在安卓 4.3 中不小心引入并很快被移除的权限管理系统。
![](https://cdn.arstechnica.net/wp-content/uploads/2015/09/Google_IO_2015_-_Android_M_Permissions_-_YouTube_-_Google_Chrome_2015-09-04_12-31-49.jpg)
尽管谷歌在之前版本就试验过了,棉花糖的权限系统最大的不同是它代表了一个向权限系统的有序过渡。安卓 4.3 的 App Ops 从没有计划暴露给用户,所以开发者不了解它。在 4.3 中拒绝一个应用需要的一个权限经常导致奇怪的错误信息或一个彻底的崩溃。棉花糖的系统对开发者是缺省的——新的权限系统只适用于针对棉花糖 SDK 开发的应用,谷歌将它作为开发者已经为权限处理做好准备的信号。权限系统还允许在一项功能由于权限被拒绝无法正常工作时与用户进行沟通。应用会被告知它们的权限请求被拒绝,它们可以指导用户在需要该功能的时候去打开该权限访问。
#### 指纹 API
![](https://cdn.arstechnica.net/wp-content/uploads/2015/10/finger1.jpg)
* [
![](https://cdn.arstechnica.net/wp-content/uploads/2015/10/finger1-150x150.jpg)
][33]
* [
![](https://cdn.arstechnica.net/wp-content/uploads/2015/10/fingerlock-150x150.jpg)
][34]
* [
![](https://cdn.arstechnica.net/wp-content/uploads/2015/10/2015-10-16-17.19.36-150x150.png)
][35]
* [
![](https://cdn.arstechnica.net/wp-content/uploads/2015/10/fingerprintplaystore-150x150.jpg)
][36]
* [
![](https://cdn.arstechnica.net/wp-content/uploads/2015/10/confirm-150x150.jpg)
][37]
* [
![](https://cdn.arstechnica.net/wp-content/uploads/2015/09/2015-09-04_16-38-31-150x150.png)
][38]
![](https://cdn.arstechnica.net/wp-content/uploads/2015/10/fingerlock.jpg)
在棉花糖出现之前,少数厂商推出了他们自己的指纹解决方案以作为对[苹果的 Touch ID][43] 的回应。但在棉花糖中,谷歌终于带来了生态级别的指纹识别 API。新系统包含了指纹注册界面指纹验证锁屏以及允许应用将内容保护在一个指纹扫描或锁屏验证之后的 API。
![](https://cdn.arstechnica.net/wp-content/uploads/2015/10/fingerprintplaystore.jpg)
Play 商店是最先支持该 API 的应用之一。你可以使用你的指纹来购买应用而不用输入你的密码。Nexus 5X 和 6P 是最先支持指纹 API 的手机,手机背面带有指纹读取硬件。
![](https://cdn.arstechnica.net/wp-content/uploads/2015/09/2015-09-04_16-38-31.png)
指纹 API 推出不久后时间,是罕见的安卓生态合作例子之一。所有带有指纹识别的手机都使用谷歌的 API并且大多数银行和购物应用都很好地支持了它。
--------------------------------------------------------------------------------
@ -179,7 +95,7 @@ via: http://arstechnica.com/gadgets/2016/10/building-android-a-40000-word-histor
作者:[RON AMADEO][a]
译者:[alim0x](https://github.com/alim0x)
校对:[校对者ID](https://github.com/校对者ID)
校对:[wxy](https://github.com/wxy)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出

View File

@ -1,3 +1,5 @@
translating----geekpi
This is how you OpenStack: 6 new guides and tutorials
============================================================

View File

@ -1,45 +0,0 @@
translating----geekpi
# [Nylas Mail A Free Email Client For Linux][7]
[![Nylas Mail An Amazing Free Email Client For Linux](http://www.linuxandubuntu.com/uploads/2/1/1/5/21152474/nylas-mail-review_orig.jpg)][1] So questions are being asked whether Ubuntu should still ship with a default email client. Personally, I have not used [Thunderbird][9] in a really long time. I wanna believe this is not the first time the question has been asked but this time I believe there is a really good chance that it is gonna get cut. This is because everyday users tend to resort to web-based clients such as Gmail or Outlook for their email needs. And for the power user on Linux, there are quite a few options available to choose from. [Geary][10], Empathy, Evolution, and Thunderbird itself have served many users quite well for sometime now, but I found something worth checking out: it is called Nylas Mail.Previously known as [Nylas N1][11] client, [Nylas Mail][12] was introduced early this year in January and along with it came a free version; **Nylas Mail** Basic along with the previously available paid version. Also, back in January, the client was available for only Mac but it is now available for Linux and Windows users.
### Why Nylas?
A lot of people have chosen Nylas Mail for a variety of reasons. Let us take a look at some of the common themes that run around.
**Simplicity**- Nylas Mail client manages elegance and simplicity. Built in electron, the app is very pretty and easy going. The design also ensures setting up your emails in Nylas is pretty easy and straightforward. [![Nylas mail an awesome email client for linux](http://www.linuxandubuntu.com/uploads/2/1/1/5/21152474/published/nylas-mail-an-awesome-email-client-for-linux.jpg?1499814843)][2] **Compatibility** - Nylas Mail is compatible with all email providers. It is compatible with Gmail, Yahoo, Exchange and IMAP accounts so you are covered wherever you get your mail. [![nylas compatible with gmail facebook imap](http://www.linuxandubuntu.com/uploads/2/1/1/5/21152474/published/nylas-compatible-with-gmail-facebook-imap.jpg?1499814928)][3] **Powerful features** - Nylas ships with a ton of features. There is a full-screen mode, offline support, multiple layout formats, multiple accounts, unified inboxes, reminders, snoozing, signatures and send later. Some of these features come with the Nylas Mail Basic. [![nylas email client powerful features](http://www.linuxandubuntu.com/uploads/2/1/1/5/21152474/published/nylas-email-client-powerful-features.jpg?1499814992)][4] **Hybrid backend** - Previously, Nylas sort of synced a copy of your mail into a server using the Nylas cloud and this was like mehn for many people. Fortunately, with the latest version, Nylas now employs a hybrid backend that connects directly to your email providers such as Gmail or Outlook. The cloud sync, although is still available, is only used when you use advanced subscription tools such as snoozing and tracking. The downside is that it is one or the other. Want some pro features, you require cloud sync, you dont want cloud sync, you miss out on those features. [![nylas email hybrid backend](http://www.linuxandubuntu.com/uploads/2/1/1/5/21152474/editor/nylas-email-hybrid-backend.jpg?1499815041)][5] **Open-source and a free edition** - Nylas mail is available as an open source project. This means you can take the code and build it up yourself. You can even setup your own server to sidestep the issue. [![nylas open source and free email client](http://www.linuxandubuntu.com/uploads/2/1/1/5/21152474/published/nylas-open-source-and-free-email-client.jpg?1499815091)][6] **Cross-platform** - Nylas is a cross-platform app available on Linux, Windows and Mac OS X. So regardless of which desktop operating system you prefer, you can rest assured that Nylas has you covered. And the experience is the same all across.
### What needs some work?
So far so good with Nylas email clients but there are a few gripes. First is the paid option which was introduced back in 2016\. The introduction of the free version kind of deals with this issue but the fact that some of the features are only available for the costly price of about $9/month is off-putting for most people including me. Also, not many people like to keep copies of their mail on a server somewhere. Of course, you can set up your own server but who needs the hassle. Lastly, for an app that runs in the background, it can be quite the memory hog. I hope it is not due to the fact that it is written mainly in electron and I want to believe this is going to get better with updates and improvements
### Conclusion
**Nylas Mail** hits a very sweet spot for me in terms of features and function and I believe you definitely should check it out. As an email client, it is pretty effective and I'm really liking Nylas Mail and will definitely keep it around. Maybe you should too. Kudos to the developers for the good work being done. Do you have another app you want us to take a look at? Point it out in the comments below and share your thoughts and comments as well. |
--------------------------------------------------------------------------------
via: http://www.linuxandubuntu.com/home/nylas-mail-an-amazing-free-email-client-for-linux
作者:[http://www.linuxandubuntu.com ][a]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:http://www.linuxandubuntu.com/home/nylas-mail-an-amazing-free-email-client-for-linux
[1]:http://www.linuxandubuntu.com/home/nylas-mail-an-amazing-free-email-client-for-linux
[2]:http://www.linuxandubuntu.com/uploads/2/1/1/5/21152474/nylas-mail-an-awesome-email-client-for-linux_orig.jpg
[3]:http://www.linuxandubuntu.com/uploads/2/1/1/5/21152474/nylas-compatible-with-gmail-facebook-imap_orig.jpg
[4]:http://www.linuxandubuntu.com/uploads/2/1/1/5/21152474/nylas-email-client-powerful-features_orig.jpg
[5]:http://www.linuxandubuntu.com/uploads/2/1/1/5/21152474/nylas-email-hybrid-backend_orig.jpg
[6]:http://www.linuxandubuntu.com/uploads/2/1/1/5/21152474/nylas-open-source-and-free-email-client_orig.jpg
[7]:http://www.linuxandubuntu.com/home/nylas-mail-an-amazing-free-email-client-for-linux
[8]:http://www.linuxandubuntu.com/home/nylas-mail-an-amazing-free-email-client-for-linux#comments
[9]:http://www.linuxandubuntu.com/home/thunderbird-release-with-several-bug-fixes
[10]:http://www.linuxandubuntu.com/home/geany-a-lightweight-ide-or-code-editor-for-programmers
[11]:http://www.linuxandubuntu.com/home/nylas-n1-a-premium-email-client-for-linux
[12]:https://www.nylas.com/nylas-mail/

View File

@ -1,122 +0,0 @@
Linux Bash 提示符的一些骚操作
=======================================================
###一些能让你自定义 Bash 提示符的黑科技
![Bash prompt tips and tricks](https://opensource.com/sites/default/files/styles/image-full-size/public/images/business/osdc_terminals.png?itok=QmkPW7P1 "Bash prompt tips and tricks")
照片来源 : 
[ajmexico][8]. 修改自 [Jason Baker][9]. [CC BY-SA 2.0][10].
当你在 Linux 环境下打开一个 Shell 终端时,会看到命令行中出现了类似下面的一个提示符:
```git
[user@$host ~]$
```
你知道命令行提示符其实是可以自己设置添加许多非常有用的信息的吗?在这篇文章中我就会教你如何自定义自己的 Bash 命令行提示符,想看的话就接着看吧~
###如何设置 Bash 提示符
Bash 提示符是通过环境变量 PS1(提示符字符串1) 来设置的。当然如果你想一次输入多行的数据,可以尝试通过 PS2 环境变量来设置提示符:
```git
[dneary@dhcp-41-137 ~]$ export PS1="[Linux Rulez]$ "
[Linux Rulez] export PS2="... "
[Linux Rulez] if true; then
... echo "Success!"
... fi
Success!
```
###在哪里设置 PS1 的值?
PS1 就是一个普通的环境变量,系统默认值设置在 /etc/bashrc 目录中,在我的系统中,默认提示符通过以下命令来设置:
```git
[ "$PS1" = "\\s-\\v\\\$ " ] && PS1="[\u@\h \W]\\$ "
```
它判断 PS1 是否是系统的默认值 \s-\v$ ,如果是的话则将值设置为 [\u@\h \W]\$。
如果你想要自定义提示符,就不应该修改 /etc/bashrc ,而是应该在你的用户目录下将自定义命令加到.bashrc文件中。
###上面提到的 \u,\h,\W,\s 和 \v 是什么意思?
这里有一些参考链接:
- [Linux 是什么](1)
- [Linux 容器是什么](2)
- [快下载吧这里有Linux 命令小抄](3)
- [比楼上更高级的 Linux 命令小抄](4)
- [我们最新的 Linux 相关文章](5)
在 man bash 中的 PROMPTING 章节,你能够找到所有 PS1 和 PS2 相关描述符的功能,以下是一些比较常用的:
- \u: 用户名
- \h: 短主机名
- \W: 当前你所在的目录名,只显示你的当前父目录
- \sShell 名字bash 或者 sh取决于你的 Shell 尊姓大名)
- \vShell 的版本号
###还有其他的一些特殊的字符串可以用在提示符当中吗
除了上面这些,还有很多有用的字符串可以用在提示符当中:
- \d将日期扩展成 "Tue Jun 27" 这种格式
- \D{fmt}:允许自定义日期格式-可通过 man strftime 来获得更多信息
- \D{%c}:获得当地的日期和时间
- \n换行参考下面的多行提示符
- \w显示当前工作目录的绝对路径
- \H党建工作机器的全名
除了以上这些,你还可以在 Bash man page 的 PROMPTING 部分找到更多的特殊字符和它的用处。
###多行提示符
如果你的提示符过长,想将提示符切成两行,可以使用 "\n" 将提示符切断成两行显示,比如下面的例子会在第一行显示日期,时间和当前工作目录,第二行显示用户名和主机名:
```git
PS1="\D{%c} \w\n[\u@\H]$ "
```
人们偶尔也想将提示符变成彩色的。虽然我觉得彩色提示符让人分心/易怒,但是也许你很喜欢。如果我们想将日期变成红色的,目录变成青蓝色,用户名搞一个黄色背景,你可以这样做:
```git
PS1="\[\e[31m\]\D{%c}\[\e[0m\]
    \[\e[36m\]\w\[\e[0m\]\n[\[\e[1;43m\]\u\[\e[0m\]@\H]$ "
```
- [..] :表示不需要打印的字符
- \e[.. :转义字符,后面的字符串表示颜色或者其他意思
- 31m 表示红色字体41m 表示是红色背景)
- 36m :表示是青蓝色字体
- 1;43m 表示黄色字体1;33m 表示黄色字体)
- [\e[0m]] :将颜色恢复成系统终端默认颜色
你可以在[Bash prompt HOWTO](11)这个网站找到更多的颜色代码,甚至可以让字符翻转和闪烁!我可不想这个干,但是你可以!
所以你最喜欢的自定义提示符是什么样子的呢?有没有让你抓狂的自定义提示符呢?请在评论里告诉我吧~
作者简介:
Dave Neary - Dave Neary is a member of the Open Source and Standards team at Red Hat, helping make Open Source projects important to Red Hat be successful. Dave has been around the free and open source software world, wearing many different hats, since sending his first patch to the GIMP in 1999.
via: https://opensource.com/article/17/7/bash-prompt-tips-and-tricks
作者:[Dave Neary ][a]
译者:[吴霄/toyijiu](https://github.com/toyijiu)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:https://opensource.com/users/dneary
[1]:https://opensource.com/resources/what-is-linux?intcmp=70160000000h1jYAAQ&utm_source=intcallout&utm_campaign=linuxcontent
[2]:https://opensource.com/resources/what-are-linux-containers?intcmp=70160000000h1jYAAQ&utm_source=intcallout&utm_campaign=linuxcontent
[3]:https://developers.redhat.com/promotions/linux-cheatsheet/?intcmp=70160000000h1jYAAQ&utm_source=intcallout&utm_campaign=linuxcontent
[4]:https://developers.redhat.com/cheat-sheet/advanced-linux-commands-cheatsheet?intcmp=70160000000h1jYAAQ&utm_source=intcallout&utm_campaign=linuxcontent
[5]:https://opensource.com/tags/linux?intcmp=70160000000h1jYAAQ&utm_source=intcallout&utm_campaign=linuxcontent
[6]:https://opensource.com/article/17/7/bash-prompt-tips-and-tricks?rate=7o5TkSbm_tDUEANDpxTZJU3LgEg0EK-j4xPuNL79m3M
[7]:https://opensource.com/user/16681/feed
[8]:https://www.flickr.com/photos/15587432@N02/3281139507/
[9]:https://opensource.com/users/jason-baker
[10]:https://creativecommons.org/licenses/by/2.0/
[11]:http://tldp.org/HOWTO/Bash-Prompt-HOWTO/x329.html
[12]:https://opensource.com/users/dneary
[13]:https://opensource.com/users/dneary
[14]:https://opensource.com/article/17/7/bash-prompt-tips-and-tricks#comments

View File

@ -0,0 +1,59 @@
# [Nylas Mail 一个 Linux 中免费的邮件客户端][7]
[![Nylas Mail An Amazing Free Email Client For Linux](http://www.linuxandubuntu.com/uploads/2/1/1/5/21152474/nylas-mail-review_orig.jpg)][1]
有一个被提及的问题是 Ubuntu 是否还应该附有默认的电子邮件客户端。就个人而言,我已经很长时间没有使用 [Thunderbird][9] 了。我相信这不是一个第一次被问到的问题,但我相信这是一个很好的机会把它裁剪掉。这是因为日常用户倾向于使用基于网络的客户端,例如 Gmail 或 Outlook 来满足其邮件需求。而对于 Linux 上的经验丰富的用户而言,还有很多可供选择的选项。[Geary][10]、Empathy、Evolution 和 Thunderbird 本身已经为很多用户提供了很好的服务,但是我发现了值得一试的东西:它被称为 Nylas Mail。
它以前被称为 [Nylas N1][11]Nylas Mail 于今年初在 1 月份推出,接着是一个免费版本; **Nylas Mail** Basic 以及以前提供的付费版本。此外,在 1 月份,客户端仅适用于 Mac但现在可用于 Linux 和 Windows 用户。
### 为什么使用 Nylas
​很多人因为种种原因选择了 Nylas Mail。让我们来看看一些常见的原因。
**简单** - Nylas Mail 客户端管理优雅简单。用 electron 构建,应用非常漂亮,容易使用。该设计还确保在 Nylas 中设置电子邮件非常简单直接。
[![Nylas mail an awesome email client for linux](http://www.linuxandubuntu.com/uploads/2/1/1/5/21152474/published/nylas-mail-an-awesome-email-client-for-linux.jpg?1499814843)][2]
**兼容性** - Nylas Mail 与所有电子邮件提供商兼容。它与 Gmail、Yahoo、Exchange 和 IMAP 帐户兼容,因此你可以在任何地方收到邮件。
[![nylas compatible with gmail facebook imap](http://www.linuxandubuntu.com/uploads/2/1/1/5/21152474/published/nylas-compatible-with-gmail-facebook-imap.jpg?1499814928)][3]
**​强大的功能** - Nylas 拥有大量功能。它有一个全屏模式、离线支持、多布局格式、多帐户、统一的收件箱、提醒、打盹、签名和稍后发送功能。其中一些功能随 Nylas Mail Basic 一起提供。
[![nylas email client powerful features](http://www.linuxandubuntu.com/uploads/2/1/1/5/21152474/published/nylas-email-client-powerful-features.jpg?1499814992)][4]
**​混合后端 ** - 以前Nylas 将邮件的一个副本同步到使用 Nylas 云的服务器中,这对许多人来说就像 mehn 一样。幸运的是在最新版本中Nylas 采用了一个混合后端,可直接连接到 Gmail 或 Outlook 等电子邮件提供商。云同步虽然仍然可用,但仅在使用高级订阅工具(如打盹和跟踪)时使用。缺点是它是一个或另一个后端。想要一些专业功能,你需要云同步,你不想要云同步,那你错过了这些功能。
[![nylas email hybrid backend](http://www.linuxandubuntu.com/uploads/2/1/1/5/21152474/editor/nylas-email-hybrid-backend.jpg?1499815041)][5]
**​开源和免费版 ** - Nylas 作为开源项目。这意味着你可以自己编写代码并自行构建。你甚至可以设置自己的服务器以回避问题。
[![nylas open source and free email client](http://www.linuxandubuntu.com/uploads/2/1/1/5/21152474/published/nylas-open-source-and-free-email-client.jpg?1499815091)][6]
**跨平台** - Nylas 是在 Linux、Windows 和 Mac OS X 上提供的跨平台应用程序。因此,无论你喜欢哪种桌面操作系统,你都可以放心,因为 Nylas 都已经覆盖了。而且用法是相同的。
### 还要做些什么?
到目前为止Nylas 邮件客户端很好,但有一些抱怨。首先是在 2016 年推出的付费选项。引入免费版本有点像是这个问题的方案,但事实上,一些功能只能用每月 $9 的价格使用让包括我在内的大部分人不快。此外,没有多少人喜欢将邮件的副本保存在某台服务器上。当然,你可以设置自己的服务器,但有些麻烦。最后,对于在后台运行的应用程序,它需要当当多的内存。我希望这不是因为它主要是用 electron 写的,我相信随着它的更新和改进,它会变得更好。
### 总结
**Nylas Mail** 在特性和功能方面对我来说非常棒,我相信你一定要用一下。作为一个电子邮件客户端,它是非常有效的,我真的很喜欢 Nylas Mail并且一定会一直使用它。也许你应该也会。向开发人员的所做的工作致谢。你有其他的程序想让我们看下么在下面的评论中指出并分享你的想法和意见。
--------------------------------------------------------------------------------
via: http://www.linuxandubuntu.com/home/nylas-mail-an-amazing-free-email-client-for-linux
作者:[http://www.linuxandubuntu.com ][a]
译者:[geekpi](https://github.com/geekpi)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
[a]:http://www.linuxandubuntu.com/home/nylas-mail-an-amazing-free-email-client-for-linux
[1]:http://www.linuxandubuntu.com/home/nylas-mail-an-amazing-free-email-client-for-linux
[2]:http://www.linuxandubuntu.com/uploads/2/1/1/5/21152474/nylas-mail-an-awesome-email-client-for-linux_orig.jpg
[3]:http://www.linuxandubuntu.com/uploads/2/1/1/5/21152474/nylas-compatible-with-gmail-facebook-imap_orig.jpg
[4]:http://www.linuxandubuntu.com/uploads/2/1/1/5/21152474/nylas-email-client-powerful-features_orig.jpg
[5]:http://www.linuxandubuntu.com/uploads/2/1/1/5/21152474/nylas-email-hybrid-backend_orig.jpg
[6]:http://www.linuxandubuntu.com/uploads/2/1/1/5/21152474/nylas-open-source-and-free-email-client_orig.jpg
[7]:http://www.linuxandubuntu.com/home/nylas-mail-an-amazing-free-email-client-for-linux
[8]:http://www.linuxandubuntu.com/home/nylas-mail-an-amazing-free-email-client-for-linux#comments
[9]:http://www.linuxandubuntu.com/home/thunderbird-release-with-several-bug-fixes
[10]:http://www.linuxandubuntu.com/home/geany-a-lightweight-ide-or-code-editor-for-programmers
[11]:http://www.linuxandubuntu.com/home/nylas-n1-a-premium-email-client-for-linux
[12]:https://www.nylas.com/nylas-mail/