From 9239443fc0b12eab2b8d2b3b9887de8ea741a205 Mon Sep 17 00:00:00 2001 From: darksun Date: Mon, 26 Nov 2018 22:55:35 +0800 Subject: [PATCH 1/6] =?UTF-8?q?=E6=96=B0=E6=A0=BC=E5=BC=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...open source and free software maintainers.md | 16 ++++++++-------- ... A Closer Look at Voice-Assisted Speakers.md | 17 +++++++++-------- .../20181122 Getting started with Jenkins X.md | 16 ++++++++-------- ...123 How to Build a Netboot Server, Part 1.md | 5 ----- 4 files changed, 25 insertions(+), 29 deletions(-) diff --git a/sources/talk/20181121 10 ways to give thanks to open source and free software maintainers.md b/sources/talk/20181121 10 ways to give thanks to open source and free software maintainers.md index 15e6e5d229..b1ad8d8e38 100644 --- a/sources/talk/20181121 10 ways to give thanks to open source and free software maintainers.md +++ b/sources/talk/20181121 10 ways to give thanks to open source and free software maintainers.md @@ -1,11 +1,11 @@ -[^#]: collector: lujun9972 -[^#]: translator: -[^#]: reviewer: -[^#]: publisher: -[^#]: subject: 10 ways to give thanks to open source and free software maintainers -[^#]: via: https://opensource.com/article/18/11/ways-give-thanks-open-source -[^#]: author: [Moshe Zadka]( https://opensource.com/users/moshez) -[^#]: url: +[^#]: collector: (lujun9972) +[^#]: translator: ( ) +[^#]: reviewer: ( ) +[^#]: publisher: ( ) +[^#]: subject: (10 ways to give thanks to open source and free software maintainers) +[^#]: via: (https://opensource.com/article/18/11/ways-give-thanks-open-source) +[^#]: author: (Moshe Zadka https://opensource.com/users/moshez) +[^#]: url: ( ) 10 ways to give thanks to open source and free software maintainers ====== diff --git a/sources/talk/20181121 A Closer Look at Voice-Assisted Speakers.md b/sources/talk/20181121 A Closer Look at Voice-Assisted Speakers.md index 963d99511a..f00259ee61 100644 --- a/sources/talk/20181121 A Closer Look at Voice-Assisted Speakers.md +++ b/sources/talk/20181121 A Closer Look at Voice-Assisted Speakers.md @@ -1,14 +1,15 @@ -[^#]: collector: lujun9972 -[^#]: translator: -[^#]: reviewer: -[^#]: publisher: -[^#]: subject: A Closer Look at Voice-Assisted Speakers -[^#]: via: https://www.linux.com/blog/2018/11/closer-look-voice-assisted-speakers -[^#]: author: [Eric Brown](https://www.linux.com/users/ericstephenbrown) -[^#]: url: +[^#]: collector: (lujun9972) +[^#]: translator: ( ) +[^#]: reviewer: ( ) +[^#]: publisher: ( ) +[^#]: subject: (A Closer Look at Voice-Assisted Speakers) +[^#]: via: (https://www.linux.com/blog/2018/11/closer-look-voice-assisted-speakers) +[^#]: author: (Eric Brown https://www.linux.com/users/ericstephenbrown) +[^#]: url: ( ) A Closer Look at Voice-Assisted Speakers ====== + ![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/anavi-elc.png?itok=vN-QXvJf) U.S. consumers are expected to drop a bundle this Black Friday on smart speakers and home hubs. A Nov. 15 [Canalys report][1] estimates that shipments of voice-assisted speakers grew 137 percent in Q3 2018 year-to-year and are on the way to 75 million-unit sales in 2018. At the recent [Embedded Linux Conference and Open IoT Summit][2] in Edinburgh, embedded Linux developer and [Raspberry Pi HAT][3] creator Leon Anavi of the Konsulko Group reported on the latest smart speaker trends. diff --git a/sources/tech/20181122 Getting started with Jenkins X.md b/sources/tech/20181122 Getting started with Jenkins X.md index bd9591af44..70cb27b956 100644 --- a/sources/tech/20181122 Getting started with Jenkins X.md +++ b/sources/tech/20181122 Getting started with Jenkins X.md @@ -1,11 +1,11 @@ -[^#]: collector: lujun9972 -[^#]: translator: -[^#]: reviewer: -[^#]: publisher: -[^#]: subject: Getting started with Jenkins X -[^#]: via: https://opensource.com/article/18/11/getting-started-jenkins-x -[^#]: author: [Dave Johnson](https://opensource.com/users/snoopdave) -[^#]: url: +[^#]: collector: (lujun9972) +[^#]: translator: ( ) +[^#]: reviewer: ( ) +[^#]: publisher: ( ) +[^#]: subject: (Getting started with Jenkins X) +[^#]: via: (https://opensource.com/article/18/11/getting-started-jenkins-x) +[^#]: author: (Dave Johnson https://opensource.com/users/snoopdave) +[^#]: url: ( ) Getting started with Jenkins X ====== diff --git a/sources/tech/20181123 How to Build a Netboot Server, Part 1.md b/sources/tech/20181123 How to Build a Netboot Server, Part 1.md index 443b89e615..01bc4a49dd 100644 --- a/sources/tech/20181123 How to Build a Netboot Server, Part 1.md +++ b/sources/tech/20181123 How to Build a Netboot Server, Part 1.md @@ -435,11 +435,6 @@ $ sed -i '/daemon/a AutomaticLoginEnable=true' /fc28/etc/gdm/custom.conf $ sed -i '/daemon/a AutomaticLogin=liveuser' /fc28/etc/gdm/custom.conf ``` -#### Like this: - -Like - -Loading... -------------------------------------------------------------------------------- From 4a0586871875f4a09d12c1e41e96b2424a1ddb24 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 26 Nov 2018 23:20:45 +0800 Subject: [PATCH 2/6] PRF:20181119 How To Customize Bash Prompt In Linux.md @HankChow --- ...9 How To Customize Bash Prompt In Linux.md | 79 ++++++++++++------- 1 file changed, 51 insertions(+), 28 deletions(-) diff --git a/translated/tech/20181119 How To Customize Bash Prompt In Linux.md b/translated/tech/20181119 How To Customize Bash Prompt In Linux.md index a1f63304f3..190fdb914b 100644 --- a/translated/tech/20181119 How To Customize Bash Prompt In Linux.md +++ b/translated/tech/20181119 How To Customize Bash Prompt In Linux.md @@ -1,5 +1,6 @@ 在 Linux 上自定义 bash 命令提示符 ====== + ![](https://www.ostechnix.com/wp-content/uploads/2017/10/BASH-720x340.jpg) 众所周知,**bash**(the **B**ourne-**A**gain **Sh**ell)是目前绝大多数 Linux 发行版使用的默认 shell。本文将会介绍如何通过添加颜色和样式来自定义 bash 命令提示符的显示。尽管很多插件或工具都可以很轻易地满足这一需求,但我们也可以不使用插件和工具,自己手动自定义一些基本的显示方式,例如添加或者修改某些元素、更改前景色、更改背景色等等。 @@ -9,9 +10,10 @@ 在 bash 中,我们可以通过更改 `$PS1` 环境变量的值来自定义 bash 命令提示符。 一般情况下,bash 命令提示符会是以下这样的形式: + ![](https://www.ostechnix.com/wp-content/uploads/2017/10/Linux-Terminal.png) -在上图这种默认显示形式当中,sk 是我的用户名,而 ubuntuserver 是我的主机名。 +在上图这种默认显示形式当中,“sk” 是我的用户名,而 “ubuntuserver” 是我的主机名。 只要插入一些以反斜杠开头的特殊转义字符串,就可以按照你的喜好修改命令提示符了。下面我来举几个例子。 @@ -23,7 +25,7 @@ $ cp ~/.bashrc ~/.bashrc.bak #### 更改 bash 命令提示符中的 username@hostname 部分 -如上所示,bash 命令提示符一般都带有 username@hostname 部分,这个部分是可以修改的。 +如上所示,bash 命令提示符一般都带有 “username@hostname” 部分,这个部分是可以修改的。 只需要编辑 `~/.bashrc` 文件: @@ -37,7 +39,7 @@ $ vi ~/.bashrc PS1="ostechnix> " ``` -将上面的“ostechnix”替换为任意一个你想使用的单词,然后按 `ESC` 并输入 `:wq` 保存、退出文件。 +将上面的 “ostechnix” 替换为任意一个你想使用的单词,然后按 `ESC` 并输入 `:wq` 保存、退出文件。 执行以下命令使刚才的修改生效: @@ -45,15 +47,22 @@ PS1="ostechnix> " $ source ~/.bashrc ``` -你就可以看见 bash 命令提示符中出现刚才添加的“ostechnix”了。 +你就可以看见 bash 命令提示符中出现刚才添加的 “ostechnix” 了。 ![][3] -再来看看另一个例子,比如将 username@hostname 替换为 Hello@welcome>。 +再来看看另一个例子,比如将 “username@hostname” 替换为 “Hello@welcome>”。 -同样是像刚才那样修改 `~/.bashrc` 文件,然后执行 `source ~/.bashrc` 让修改结果立即生效。 +同样是像刚才那样修改 `~/.bashrc` 文件。 + +``` +export PS1="Hello@welcome> " +``` + +然后执行 `source ~/.bashrc` 让修改结果立即生效。 以下是我在 Ubuntu 18.04 LTS 上修改后的效果。 + ![](https://www.ostechnix.com/wp-content/uploads/2017/10/bash-prompt-1.png) #### 仅显示用户名 @@ -68,7 +77,7 @@ export PS1="\u " 下面提供了一些可以添加到 `$PS1` 环境变量中的用以改变 bash 命令提示符样式的转义字符串。每次修改之后,都需要执行 `source ~/.bashrc` 命令才能立即生效。 -**显示用户名和主机名:** +#### 显示用户名和主机名 ``` export PS1="\u\h " @@ -80,13 +89,13 @@ export PS1="\u\h " skubuntuserver ``` -**显示用户名和完全限定域名Fully Qualified Domain Name(FQDN)** +#### 显示用户名和完全限定域名 ``` export PS1="\u\H " ``` -**在用户名和主机名之间显示其它字符** +#### 在用户名和主机名之间显示其它字符 如果你还需要在用户名和主机名之间显示其它字符(例如 `@`),可以使用以下格式: @@ -95,33 +104,39 @@ export PS1="\u@\h " ``` 命令提示符会这样显示: + ``` sk@ubuntuserver ``` -**显示用户名、主机名,并在末尾添加符号** +#### 显示用户名、主机名,并在末尾添加 $ 符号 + ``` export PS1="\u@\h\\$ " ``` -**综合以上两种显示方式** +#### 综合以上两种显示方式 + ``` export PS1="\u@\h> " ``` 命令提示符最终会这样显示: + ``` sk@ubuntuserver> ``` 相似地,还可以添加其它特殊字符,例如冒号、分号、星号、下划线、空格等等。 -**显示用户名、主机名、shell 名称** +#### 显示用户名、主机名、shell 名称 + ``` export PS1="\u@\h>\s " ``` -**显示用户名、主机名、shell 名称以及 shell 版本** +#### 显示用户名、主机名、shell 名称以及 shell 版本 + ``` export PS1="\u@\h>\s\v " ``` @@ -130,7 +145,7 @@ bash 命令提示符显示样式: ![][4] -**显示用户名、主机名、当前目录** +#### 显示用户名、主机名、当前目录 ``` export PS1="\u@\h\w " @@ -138,30 +153,36 @@ export PS1="\u@\h\w " 如果当前目录是 `$HOME` ,会以一个波浪线(`~`)显示。 -**在 bash 命令提示符中显示日期** +#### 在 bash 命令提示符中显示日期 除了用户名和主机名,如果还想在 bash 命令提示符中显示日期,可以在 `~/.bashrc` 文件中添加以下内容: + ``` export PS1="\u@\h>\d " ``` + ![][5] -**在 bash 命令提示符中显示日期及 12 小时制时间** +#### 在 bash 命令提示符中显示日期及 12 小时制时间 + ``` export PS1="\u@\h>\d\@ " ``` -**显示日期及 hh:mm:ss 格式时间** +#### 显示日期及 hh:mm:ss 格式时间 + ``` export PS1="\u@\h>\d\T " ``` -**显示日期及 24 小时制时间** +#### 显示日期及 24 小时制时间 + ``` export PS1="\u@\h>\d\A " ``` -**显示日期及 24 小时制 hh:mm:ss 格式时间** +#### 显示日期及 24 小时制 hh:mm:ss 格式时间 + ``` export PS1="\u@\h>\d\t " ``` @@ -178,7 +199,7 @@ $ echo $PS1 如果我不想做任何调整,直接把 username@hostname 部分整个去掉可以吗?答案是肯定的。 -如果你是一个技术方面的博主,你有可能会需要在网站或者博客中上传自己的 Linux 终端截图。或许你的用户名和主机名太拉风、太另类,不想让别人看到,在这种情况下,你就需要隐藏命令提示符中的 username@hostname 部分。 +如果你是一个技术方面的博主,你有可能会需要在网站或者博客中上传自己的 Linux 终端截图。或许你的用户名和主机名太拉风、太另类,不想让别人看到,在这种情况下,你就需要隐藏命令提示符中的 “username@hostname” 部分。 如果你不想暴露自己的用户名和主机名,只需要按照以下步骤操作。 @@ -202,13 +223,13 @@ PS1="\W> " $ source ~/.bashrc ``` -现在看一下你的终端,username@hostname 部分已经消失了,只保留了一个 `~>` 标记。 +现在看一下你的终端,“username@hostname” 部分已经消失了,只保留了一个 `~>` 标记。 ![][6] -如果你想要尽可能简单的操作,又不想弄乱你的 `~/.bashrc` 文件,最好的办法就是在系统中创建另一个用户(例如 user@example、admin@demo)。用带有这样的命令提示符的用户去截图或者录屏,就不需要顾虑自己的用户名或主机名被别人看见了。 +如果你想要尽可能简单的操作,又不想弄乱你的 `~/.bashrc` 文件,最好的办法就是在系统中创建另一个用户(例如 “user@example”、“admin@demo”)。用带有这样的命令提示符的用户去截图或者录屏,就不需要顾虑自己的用户名或主机名被别人看见了。 -**警告:**在某些情况下,这种做法并不推荐。例如像 zsh 这种 shell 会继承当前 shell 的设置,这个时候可能会出现一些意想不到的问题。这个技巧只用于隐藏命令提示符中的 username@hostname 部分,仅此而已,如果把这个技巧挪作他用,也可能会出现异常。 +**警告:**在某些情况下,这种做法并不推荐。例如像 zsh 这种 shell 会继承当前 shell 的设置,这个时候可能会出现一些意想不到的问题。这个技巧只用于隐藏命令提示符中的 “username@hostname” 部分,仅此而已,如果把这个技巧挪作他用,也可能会出现异常。 ### 为 bash 命令提示符着色 @@ -217,6 +238,7 @@ $ source ~/.bashrc 通过向 `~/.bashrc` 文件写入一些配置,可以修改 bash 命令提示符的前景色(也就是文本的颜色)和背景色。 例如,下面这一行配置可以令某些文本的颜色变成红色: + ``` export PS1="\u@\[\e[31m\]\h\[\e[m\] " ``` @@ -224,9 +246,11 @@ export PS1="\u@\[\e[31m\]\h\[\e[m\] " 添加配置后,执行 `source ~/.bashrc` 立即生效。 你的 bash 命令提示符就会变成这样: + ![][7] 类似地,可以用这样的配置来改变背景色: + ``` export PS1="\u@\[\e[31;46m\]\h\[\e[m\] " ``` @@ -247,18 +271,17 @@ PS1="\W 🔥 >" 如果你是一个新手,编辑 `$PS1` 环境变量的过程可能会有些困难,因为命令提示符中的大量转义字符串可能会让你有点晕头转向。但不要担心,有一个在线的 bash `$PS1` 生成器可以帮助你轻松生成各种 `$PS1` 环境变量值。 -就是这个网站: +就是这个[网站][9]: [![EzPrompt](https://www.ostechnix.com/wp-content/uploads/2017/10/EzPrompt.png)][9] 只需要直接选择你想要的 bash 命令提示符样式,添加颜色、设计排序,然后就完成了。你可以预览输出,并将配置代码复制粘贴到 `~/.bashrc` 文件中。就这么简单。顺便一提,本文中大部分的示例都是通过这个网站制作的。 - -### 我把我的 `~/.bashrc` 文件弄乱了,该如何恢复? +### 我把我的 ~/.bashrc 文件弄乱了,该如何恢复? 正如我在上面提到的,强烈建议在更改 `~/.bashrc` 文件前做好备份(在更改其它重要的配置文件之前也一定要记得备份)。这样一旦出现任何问题,你都可以很方便地恢复到更改之前的配置状态。当然,如果你忘记了备份,还可以按照下面这篇文章中介绍的方法恢复为默认配置。 -[如何将 `~/.bashrc` 文件恢复到默认配置][10] +- [如何将 `~/.bashrc` 文件恢复到默认配置][10] 这篇文章是基于 ubuntu 的,但也适用于其它的 Linux 发行版。不过事先声明,这篇文章的方法会将 `~/.bashrc` 文件恢复到系统最初时的状态,你对这个文件做过的任何修改都将丢失。 @@ -271,7 +294,7 @@ via: https://www.ostechnix.com/hide-modify-usernamelocalhost-part-terminal/ 作者:[SK][a] 选题:[lujun9972][b] 译者:[HankChow](https://github.com/HankChow) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 0b157f72a44eab10d417f4e6a402fd84a1b039fe Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 26 Nov 2018 23:21:12 +0800 Subject: [PATCH 3/6] PUB:20181119 How To Customize Bash Prompt In Linux.md @HankChow https://linux.cn/article-10280-1.html --- .../20181119 How To Customize Bash Prompt In Linux.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20181119 How To Customize Bash Prompt In Linux.md (100%) diff --git a/translated/tech/20181119 How To Customize Bash Prompt In Linux.md b/published/20181119 How To Customize Bash Prompt In Linux.md similarity index 100% rename from translated/tech/20181119 How To Customize Bash Prompt In Linux.md rename to published/20181119 How To Customize Bash Prompt In Linux.md From 817bff427efa518d0092f6efee3c4899cc5e600e Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 26 Nov 2018 23:28:13 +0800 Subject: [PATCH 4/6] Update 20181122 Getting started with Jenkins X.md --- .../20181122 Getting started with Jenkins X.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/sources/tech/20181122 Getting started with Jenkins X.md b/sources/tech/20181122 Getting started with Jenkins X.md index 70cb27b956..1c2aab6903 100644 --- a/sources/tech/20181122 Getting started with Jenkins X.md +++ b/sources/tech/20181122 Getting started with Jenkins X.md @@ -1,11 +1,11 @@ -[^#]: collector: (lujun9972) -[^#]: translator: ( ) -[^#]: reviewer: ( ) -[^#]: publisher: ( ) -[^#]: subject: (Getting started with Jenkins X) -[^#]: via: (https://opensource.com/article/18/11/getting-started-jenkins-x) -[^#]: author: (Dave Johnson https://opensource.com/users/snoopdave) -[^#]: url: ( ) +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: subject: (Getting started with Jenkins X) +[#]: via: (https://opensource.com/article/18/11/getting-started-jenkins-x) +[#]: author: (Dave Johnson https://opensource.com/users/snoopdave) +[#]: url: ( ) Getting started with Jenkins X ====== From d45e7e97ec88e200d08bd0c2e501e8db5439bf1d Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 26 Nov 2018 23:28:39 +0800 Subject: [PATCH 5/6] Update 20181121 A Closer Look at Voice-Assisted Speakers.md --- ...1 A Closer Look at Voice-Assisted Speakers.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/sources/talk/20181121 A Closer Look at Voice-Assisted Speakers.md b/sources/talk/20181121 A Closer Look at Voice-Assisted Speakers.md index f00259ee61..c3f477c0c3 100644 --- a/sources/talk/20181121 A Closer Look at Voice-Assisted Speakers.md +++ b/sources/talk/20181121 A Closer Look at Voice-Assisted Speakers.md @@ -1,11 +1,11 @@ -[^#]: collector: (lujun9972) -[^#]: translator: ( ) -[^#]: reviewer: ( ) -[^#]: publisher: ( ) -[^#]: subject: (A Closer Look at Voice-Assisted Speakers) -[^#]: via: (https://www.linux.com/blog/2018/11/closer-look-voice-assisted-speakers) -[^#]: author: (Eric Brown https://www.linux.com/users/ericstephenbrown) -[^#]: url: ( ) +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: subject: (A Closer Look at Voice-Assisted Speakers) +[#]: via: (https://www.linux.com/blog/2018/11/closer-look-voice-assisted-speakers) +[#]: author: (Eric Brown https://www.linux.com/users/ericstephenbrown) +[#]: url: ( ) A Closer Look at Voice-Assisted Speakers ====== From ff85e76d645eede3aad0722ee32d81e461aafd1a Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Mon, 26 Nov 2018 23:29:03 +0800 Subject: [PATCH 6/6] Update 20181121 10 ways to give thanks to open source and free software maintainers.md --- ... open source and free software maintainers.md | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/sources/talk/20181121 10 ways to give thanks to open source and free software maintainers.md b/sources/talk/20181121 10 ways to give thanks to open source and free software maintainers.md index b1ad8d8e38..67951fce7c 100644 --- a/sources/talk/20181121 10 ways to give thanks to open source and free software maintainers.md +++ b/sources/talk/20181121 10 ways to give thanks to open source and free software maintainers.md @@ -1,11 +1,11 @@ -[^#]: collector: (lujun9972) -[^#]: translator: ( ) -[^#]: reviewer: ( ) -[^#]: publisher: ( ) -[^#]: subject: (10 ways to give thanks to open source and free software maintainers) -[^#]: via: (https://opensource.com/article/18/11/ways-give-thanks-open-source) -[^#]: author: (Moshe Zadka https://opensource.com/users/moshez) -[^#]: url: ( ) +[#]: collector: (lujun9972) +[#]: translator: ( ) +[#]: reviewer: ( ) +[#]: publisher: ( ) +[#]: subject: (10 ways to give thanks to open source and free software maintainers) +[#]: via: (https://opensource.com/article/18/11/ways-give-thanks-open-source) +[#]: author: (Moshe Zadka https://opensource.com/users/moshez) +[#]: url: ( ) 10 ways to give thanks to open source and free software maintainers ======