mirror of
https://github.com/LCTT/TranslateProject.git
synced 2024-12-26 21:30:55 +08:00
Merge branch 'master' of https://github.com/LCTT/TranslateProject into new
This commit is contained in:
commit
d9676f0e4c
@ -1,11 +1,13 @@
|
||||
尝试,学习,修改:新 IT 领导者的代码
|
||||
尝试、学习、修改:新 IT 领导者的代码
|
||||
=====
|
||||
|
||||
> 随着创新步伐的增加, 长期规划变得越来越困难。让我们重新思考一下我们对变化的反应方式。
|
||||
|
||||
![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/ship_wheel_gear_devops_kubernetes.png?itok=xm4a74Kv)
|
||||
|
||||
几乎每一天,新的技术发展都在威胁破坏,甚至是那些最复杂,最完善的商业计划。组织经常发现自己正在努力适应新的环境,这导致了他们对未来规划的转变。
|
||||
几乎每一天,新的技术发展都可能会动摇那些甚至最复杂、最完善的商业计划。组织经常发现自己需要不断努力适应新的环境,这导致了他们对未来规划的转变。
|
||||
|
||||
根据 CompTIA 2017 年的[研究][1],目前只有 34% 的公司正在制定超过 12 个月的 IT 架构计划。从长期计划转变的一个原因是:商业环境变化如此之快,以至于几乎不可能进一步规划未来。[CIO.com 说道][1]“如果你的公司正视图制定一项将持续五到十年的计划,那就忘了它。”
|
||||
根据 CompTIA 2017 年的[研究][1],目前只有 34% 的公司正在制定超过 12 个月的 IT 架构计划。从长期计划转变的一个原因是:商业环境变化如此之快,以至于几乎不可能进一步规划未来。[CIO.com 说道][1],“如果你的公司正视图制定一项将持续五到十年的计划,那就忘了它。”
|
||||
|
||||
我听过来自世界各地无数客户和合作伙伴的类似声明:技术创新正以一种前所未有的速度发生着。
|
||||
|
||||
@ -13,21 +15,21 @@
|
||||
|
||||
### 计划是怎么死的
|
||||
|
||||
正如我在 Open Organization(开源组织)中写的那样,传统经营组织针对工业经济进行了优化。他们采用等级结构和严格规定的流程,以实现地位竞争优势。要取得成功,他们必须确定他们想要实现的战略地位。然后,他们必须制定并规划实现目标的计划,并以最有效的方式执行这些计划,通过协调活动和推动合规性。
|
||||
正如我在《<ruby>开放式组织<rt>The Open Organization</rt></ruby>》中写的那样,传统经营组织针对工业经济进行了优化。他们采用等级结构和严格规定的流程,以实现地位竞争优势。要取得成功,他们必须确定他们想要实现的战略地位。然后,他们必须制定并规划实现目标的计划,并以最有效的方式执行这些计划,通过协调活动和推动合规性。
|
||||
|
||||
管理层的职责是优化这一过程:计划,规定,执行。包括:让我们想象一个有竞争力的优势地位;让我们来配置组织以最终到达那里;然后让我们通过确保组织的所有方面都遵守规定来推动执行。这就是我所说的“机械管理”,对于不同时期来说它都是一个出色的解决方案。
|
||||
管理层的职责是优化这一过程:计划、规定、执行。包括:让我们想象一个有竞争力的优势地位;让我们来配置组织以最终达成目标;然后让我们通过确保组织的所有方面都遵守规定来推动执行。这就是我所说的“机械管理”,对于不同时期来说它都是一个出色的解决方案。
|
||||
|
||||
在当今动荡不定的世界中,我们预测和定义战略位置的能力正在下降,因为变化的速度,新变量的引入速度正在加速。传统的,长期的,战略性规划和执行不像以前那么有效。
|
||||
在当今动荡不定的世界中,我们预测和定义战略位置的能力正在下降,因为变化的速度,新变量的引入速度正在加速。传统的、长期的、战略性规划和执行不像以前那么有效。
|
||||
|
||||
如果长期规划变得如此困难,那么规定必要的行为就更具有挑战性。并且衡量对计划的合规性几乎是不可能的。
|
||||
|
||||
这一切都极大地影响了人们的工作方式。与过去传统经营组织中的工人不同,他们为自己能够重复行动而感到自豪,几乎没有变化和舒适的确定性 -- 今天的工人在充满模糊性的环境中运作。他们的工作需要更大的创造力,直觉和批判性判断 -- 有更大的要求是背离过去的“正常”,适应当今的新情况。
|
||||
这一切都极大地影响了人们的工作方式。与过去传统经营组织中的工人不同,他们为自己能够重复行动而感到自豪,几乎没有变化和舒适的确定性 —— 今天的工人在充满模糊性的环境中运作。他们的工作需要更大的创造力、直觉和批判性判断 —— 更多的需要背离过去的“常规”,以适应当今的新情况。
|
||||
|
||||
以这种新方式工作对于价值创造变得更加重要。我们的管理系统必须专注于构建结构,系统和流程,以帮助创建积极主动的工人,他们能够以快速和敏捷的方式进行创新和行动。
|
||||
|
||||
我们需要提出一个不同的解决方案来优化组织,以适应不同的经济时代,从自下而上而不是自上而下开始。我们需要替换过去的三步骤 -- 计划,规定,执行,以一种更适应当今动荡天气的方法来取得成功 -- 尝试,学习,修改。
|
||||
我们需要提出一个不同的解决方案来优化组织,以适应不同的经济时代,从自下而上而不是自上而下开始。我们需要替换过去的三步骤 —— 计划、规定、执行,以一种更适应当今动荡天气的方法来取得成功 —— 尝试、学习、修改。
|
||||
|
||||
### 尝试,学习,修改
|
||||
### 尝试、学习、修改
|
||||
|
||||
因为环境变化如此之快,而且几乎没有任何预警,并且因为我们需要采取的步骤不再提前计划,我们需要培养鼓励创造性尝试和错误的环境,而不是坚持对五年计划的忠诚。以下是以这种方式开始工作的一些暗示:
|
||||
|
||||
@ -46,7 +48,7 @@ via: https://opensource.com/open-organization/18/3/try-learn-modify
|
||||
|
||||
作者:[Jim Whitehurst][a]
|
||||
译者:[MjSeven](https://github.com/MjSeven)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
@ -1,25 +1,27 @@
|
||||
开源网络工作: 创新与机遇的温床
|
||||
开源网络方面的职位:创新与机遇的温床
|
||||
======
|
||||
|
||||
> 诸如容器、边缘计算这样的技术焦点领域大红大紫,对在这一领域能够整合、协作、创新的开发者和系统管理员们的需求在日益增进。
|
||||
|
||||
![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/os-jobs-networking.jpg?itok=PgUzydn-)
|
||||
|
||||
随着全球经济更加靠近数字化未来,每个垂直行业的公司和组织都在紧抓如何进一步在业务与运营上整合与部署技术。虽然 IT 企业在很大程度上遥遥领先,但是他们的经验与教训已经应用在了各行各业。尽管全国失业率为 4.1%,但整个科技专业人员的整体的失业率在 4 月份为 1.9%,开源工作的未来看起来尤其光明。我在开源网络领域工作,并且目睹着创新和机遇正在改变世界交流的方式。
|
||||
|
||||
曾经是个发展缓慢的行业,现在由网络运营商、供应商、系统集成商和开发者所组成的网络生态系统正在采用开源软件,并且正在向商用硬件上运行的虚拟化和软件定义网络上转移。事实上,接近 70% 的全球移动用户由[低频网络][1]运营商成员所代表。该网络运营商成员致力于协调构成开放网络栈和相邻技术的项目。
|
||||
它曾经是个发展缓慢的行业,现在由网络运营商、供应商、系统集成商和开发者所组成的网络生态系统正在采用开源软件,并且正在向商用硬件上运行的虚拟化和软件定义网络上转移。事实上,接近 70% 的全球移动用户由[低频网络][1]运营商成员所占据。该网络运营商成员致力于协调构成开放网络栈和相邻技术的项目。
|
||||
|
||||
### 技能需求
|
||||
|
||||
这一领域的开发者和系统管理员采用云原生和 DevOps 的方法开发新的使用案例,应对最紧迫的行业挑战。诸如容器、边缘计算等焦点领域大红大紫,并且在这一领域能够整合、协作、创新的开发者和系统管理员们的需求在日益增进。
|
||||
|
||||
开源软件与 Linux 使这一切成为可能,根据最近出版的[ 2018开源软件工作报告][2],高达 80% 的招聘经理寻找会 Linux 技能的应聘者,**而 46% 希望在网络领域招聘人才,可以说“网络技术”在他们的招聘决策中起到了至关重要的作用。**
|
||||
开源软件与 Linux 使这一切成为可能,根据最近出版的 [2018开源软件工作报告][2],高达 80% 的招聘经理寻找会 Linux 技能的应聘者,**而 46% 希望在网络领域招聘人才,可以说“网络技术”在他们的招聘决策中起到了至关重要的作用。**
|
||||
|
||||
开发人员相当抢手,72% 的招聘经理都在找他们,其次是 DevOps 开发者(59%),工程师(57%)和系统管理员(49%)。报告同时指出,对容器技能需求的惊人的增长符合了我们在网络领域所见到的,即创建云本地虚拟功能(CNFs)和在[ XCI倡议 ][3]的 OPNFV 中持续集成/持续部署方法的增长。
|
||||
开发人员相当抢手,72% 的招聘经理都在找他们,其次是 DevOps 开发者(59%),工程师(57%)和系统管理员(49%)。报告同时指出,对容器技能需求的惊人的增长符合我们在网络领域所见到的,即云本地虚拟功能(CNF)的创建和持续集成/持续部署方式的激增,就如在 OPNFV 中的 [XCI 倡议][3] 一样。
|
||||
|
||||
### 开始吧
|
||||
|
||||
对于求职者来说,好消息是有着大量的关于开源软件的内容,包括免费的[Linux 入门课程][4]。好的工作需要有多项证书,因此我鼓励你探索更多领域,去寻求培训的机会。计算机网络方面,在[OPNFV][5]上查看最新的培训课程或者是[ONAP][6]项目,也可以选择这门[开源网络技术简介][7]课程。
|
||||
对于求职者来说,好消息是有着大量的关于开源软件的内容,包括免费的 [Linux 入门课程][4]。好的工作需要有多项证书,因此我鼓励你探索更多领域,去寻求培训的机会。计算机网络方面,在 [OPNFV][5] 上查看最新的培训课程或者是 [ONAP][6] 项目,也可以选择这门[开源网络技术简介][7]课程。
|
||||
|
||||
如果你还没有做好这些,下载 [2018开源软件工作报告][2] 以获得更多见解,在广阔的开放源码技术世界中规划你的课程,去寻找另一边等待你的令人兴奋的职业!
|
||||
如果你还没有做好这些,下载 [2018 开源软件工作报告][2] 以获得更多见解,在广阔的开放源码技术世界中规划你的课程,去寻找另一边等待你的令人兴奋的职业!
|
||||
|
||||
点击这里[下载完整的开源软件工作报告][8]并且[了解更多关于 Linux 的认证][9]。
|
||||
|
||||
@ -29,8 +31,8 @@ via: https://www.linux.com/blog/os-jobs-report/2018/7/open-source-networking-job
|
||||
|
||||
作者:[Brandon Wick][a]
|
||||
选题:[lujun9972](https://github.com/lujun9972)
|
||||
译者:[译者ID](https://github.com/LuuMing)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
译者:[LuuMing](https://github.com/LuuMing)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
@ -3,32 +3,32 @@ Fedora 下的图像创建程序
|
||||
|
||||
![](https://fedoramagazine.org/wp-content/uploads/2018/08/creatingimages-816x346.png)
|
||||
|
||||
感觉有创意吗?Fedora 有很多程序可以帮助你的创造力。从数字绘图、矢量到像素艺术,每个人都可以在这个周末得到创意。本文重点介绍了 Fedora 下创建很棒图像的程序。
|
||||
有了创意吗?Fedora 有很多程序可以帮助你的创造力。从数字绘图、矢量到像素艺术,每个人都可以在这个周末发挥创意。本文重点介绍了 Fedora 下创建很棒图像的程序。
|
||||
|
||||
### 矢量图形:Inkscape
|
||||
|
||||
[Inkscape][1] 是一个众所周知受人喜爱的开源矢量图形编辑器。SVG 是 Inkscape 的主要文件格式,因此你所有的图形都可以伸缩!Inkscape 已存在多年,所以有一个坚实的社区和[大量的教程和其他资源][2]用于入门。
|
||||
[Inkscape][1] 是一个众所周知的、受人喜爱的开源矢量图形编辑器。SVG 是 Inkscape 的主要文件格式,因此你所有的图形都可以任意伸缩!Inkscape 已存在多年,所以有一个坚实的社区和用于入门的[大量教程和其他资源][2]。
|
||||
|
||||
作为矢量图形编辑器,Inkscape 更适合于简单的插图(例如简单的漫画风格)。然而,使用矢量模糊,一些艺术家创造了一些[令人惊奇的矢量图][3]。
|
||||
|
||||
![][4]
|
||||
|
||||
从 Fedora Workstation 中的软件应用安装 Inkscape,或在终端中使用以下命令:
|
||||
|
||||
```
|
||||
sudo dnf install inkscape
|
||||
|
||||
```
|
||||
|
||||
### 数字绘图:Krita 和 Mypaint
|
||||
|
||||
[Krita][5] 是一个流行的图像创建程序,用于数字绘图、光栅插图和纹理。此外,Krita 是一个活跃的项目,拥有一个充满活力的社区 - 所以[有很多教程用于入门] [6]。Krita 有多个画笔引擎,带弹出调色板的 UI,用于创建无缝图案的环绕模式、滤镜、图层等等。
|
||||
[Krita][5] 是一个流行的图像创建程序,用于数字绘图、光栅插图和纹理。此外,Krita 是一个活跃的项目,拥有一个充满活力的社区 —— 所以[有用于入门的很多教程][6]。Krita 有多个画笔引擎、带有弹出调色板的 UI、用于创建无缝图案的环绕模式、滤镜、图层等等。
|
||||
|
||||
![][7]
|
||||
|
||||
从 Fedora Workstation 中的软件应用安装 Krita,或在终端中使用以下命令:
|
||||
|
||||
```
|
||||
sudo dnf install krita
|
||||
|
||||
```
|
||||
|
||||
[Mypaint][8] 是另一款适用于 Fedora 令人惊奇的数字绘图程序。像 Krita 一样,它有多个画笔和使用图层的能力。
|
||||
@ -36,14 +36,14 @@ sudo dnf install krita
|
||||
![][9]
|
||||
|
||||
从 Fedora Workstation 中的软件应用安装 Mypaint,或在终端中使用以下命令:
|
||||
|
||||
```
|
||||
sudo dnf install mypaint
|
||||
|
||||
```
|
||||
|
||||
### 像素艺术:Libresprite
|
||||
|
||||
[Libresprite][10] 是一个专为创建像素艺术和像素动画而设计的程序。它支持一系列颜色模式并可导出为多种格式(包括动画 GIF)。此外,Libresprite 还有用于创建像素艺术的绘图工具:多边形工具、轮廓和着色工具。
|
||||
[Libresprite][10] 是一个专为创建像素艺术和像素动画而设计的程序。它支持一系列颜色模式,并可导出为多种格式(包括动画 GIF)。此外,Libresprite 还有用于创建像素艺术的绘图工具:多边形工具、轮廓和着色工具。
|
||||
|
||||
![][11]
|
||||
|
||||
@ -57,7 +57,7 @@ via: https://fedoramagazine.org/image-creation-applications-fedora/
|
||||
作者:[Ryan Lerch][a]
|
||||
选题:[lujun9972](https://github.com/lujun9972)
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
@ -0,0 +1,69 @@
|
||||
L1 终端错误漏洞(L1TF)如何影响 Linux 系统
|
||||
======
|
||||
|
||||
> L1 终端错误(L1TF)影响英特尔处理器和 Linux 操作系统。让我们了解一下这个漏洞是什么,以及 Linux 用户需要为它做点什么。
|
||||
|
||||
![](https://images.idgesg.net/images/article/2018/08/l1tf-copy-100768129-large.jpg)
|
||||
|
||||
昨天(LCTT 译注:本文发表于 2018/8/15)在英特尔、微软和红帽的安全建议中宣布,一个新发现的漏洞英特尔处理器(还有 Linux)的漏洞称为 L1TF 或 “<ruby>L1 终端错误<rt>L1 Terminal Fault</rt></ruby>”,引起了 Linux 用户和管理员的注意。究竟什么是这个漏洞,谁应该担心它?
|
||||
|
||||
### L1TF、 L1 Terminal Fault 和 Foreshadow
|
||||
|
||||
处理器漏洞被称作 L1TF、L1 Terminal Fault 和 Foreshadow。研究人员在 1 月份发现了这个问题并向英特尔报告称其为 “Foreshadow”。它类似于过去发现的漏洞(例如 Spectre)。
|
||||
|
||||
此漏洞是特定于英特尔的。其他处理器不受影响。与其他一些漏洞一样,它之所以存在,是因为设计时为了优化内核处理速度,但允许其他进程访问数据。
|
||||
|
||||
**[另请阅读:[22 个必要的 Linux 安全命令][1]]**
|
||||
|
||||
已为此问题分配了三个 CVE:
|
||||
|
||||
* CVE-2018-3615:英特尔<ruby>软件保护扩展<rt>Software Guard Extension</rt></ruby>(英特尔 SGX)
|
||||
* CVE-2018-3620:操作系统和<ruby>系统管理模式<rt>ystem Management Mode</rt></ruby>(SMM)
|
||||
* CVE-2018-3646:虚拟化的影响
|
||||
|
||||
英特尔发言人就此问题发表了这一声明:
|
||||
|
||||
> “L1 Terminal Fault 通过今年早些时候发布的微代码更新得到解决,再加上从今天开始提供的操作系统和虚拟机管理程序软件的相应更新。我们在网上提供了更多信息,并继续鼓励每个人更新操作系统,因为这是得到保护的最佳方式之一。我们要感谢 imec-DistriNet、KU Leuven、以色列理工学院,密歇根大学,阿德莱德大学和 Data61 的研究人员以及我们的行业合作伙伴,他们帮助我们识别和解决了这个问题。“
|
||||
|
||||
### L1TF 会影响你的 Linux 系统吗?
|
||||
|
||||
简短的回答是“可能不会”。如果你因为在今年 1 月爆出的 [Spectre 和 Meltdown 漏洞][2]修补过系统,那你应该是安全的。与 Spectre 和 Meltdown 一样,英特尔声称真实世界中还没有系统受到影响的报告或者检测到。他们还表示,这些变化不太可能在单个系统上产生明显的性能影响,但它们可能对使用虚拟化操作系统的数据中心产生大的影响。
|
||||
|
||||
即使如此,仍然推荐频繁地打补丁。要检查你当前的内核版本,使用 `uname -r` 命令:
|
||||
|
||||
```
|
||||
$ uname -r
|
||||
4.18.0-041800-generic
|
||||
```
|
||||
|
||||
### 更多资源
|
||||
|
||||
请查看如下资源以了解 L1TF 的更多细节,以及为什么会出现这个漏洞:
|
||||
|
||||
- [L1TF explained in ~3 minutes (Red Hat)][5]
|
||||
- [L1TF explained in under 11 minutes (Red Hat)][6]
|
||||
- [Technical deep dive][7]
|
||||
- [Red Hat explanation of L1TF][8]
|
||||
- [Ubuntu updates for L1TF][9]
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.networkworld.com/article/3298157/linux/linux-and-l1tf.html
|
||||
|
||||
作者:[Sandra Henry-Stocker][a]
|
||||
选题:[lujun9972](https://github.com/lujun9972)
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://www.networkworld.com/author/Sandra-Henry_Stocker/
|
||||
[1]: https://www.networkworld.com/article/3272286/open-source-tools/22-essential-security-commands-for-linux.html
|
||||
[2]: https://www.networkworld.com/article/3245813/security/meltdown-and-spectre-exploits-cutting-through-the-fud.html
|
||||
[3]: https://www.facebook.com/NetworkWorld/
|
||||
[4]: https://www.linkedin.com/company/network-world
|
||||
[5]: https://www.youtube.com/watch?v=kBOsVt0iXE4&feature=youtu.be
|
||||
[6]: https://www.youtube.com/watch?v=kqg8_KH2OIQ
|
||||
[7]: https://www.redhat.com/en/blog/deeper-look-l1-terminal-fault-aka-foreshadow
|
||||
[8]: https://access.redhat.com/security/vulnerabilities/L1TF
|
||||
[9]: https://blog.ubuntu.com/2018/08/14/ubuntu-updates-for-l1-terminal-fault-vulnerabilities
|
@ -106,7 +106,7 @@ function func_return_value {
|
||||
}
|
||||
```
|
||||
|
||||
上面的函数向调用者返回 10。让我们执行这个函数:
|
||||
上面的函数向调用者返回 `10`。让我们执行这个函数:
|
||||
|
||||
```
|
||||
$ func_return_value
|
||||
@ -119,7 +119,7 @@ $ echo "Value returned by function is: $?"
|
||||
Value returned by function is: 10
|
||||
```
|
||||
|
||||
**提示**:在 Bash 中使用 `$?` 去获取函数的返回值
|
||||
**提示**:在 Bash 中使用 `$?` 去获取函数的返回值。
|
||||
|
||||
### 函数技巧
|
||||
|
@ -1,142 +0,0 @@
|
||||
Translating by DavidChenLiang
|
||||
|
||||
What I Learned from Programming Interviews
|
||||
============================================================
|
||||
|
||||
![](https://cdn-images-1.medium.com/max/1250/1*DXPdaGPM4oM6p5nSkup7IQ.jpeg)
|
||||
Whiteboard programming interviews
|
||||
|
||||
In 2017, I went to the [Grace Hopper Celebration][1] of women in computing. It’s the largest gathering of this kind, with 17,000 women attending last year.
|
||||
|
||||
This conference has a huge career fair where companies interview attendees. Some even get offers. Walking around the area, I noticed that some people looked stressed and worried. I overheard conversations, and some talked about how they didn’t do well in the interview.
|
||||
|
||||
I approached a group of people that I overheard and gave them advice. I considered some of the advice I gave to be basic, such as “it’s okay to think of the naive solution first.” But people were surprised by most of the advice I gave them.
|
||||
|
||||
I wanted to help more people with this. I gathered a list of tips that worked for me and published a [podcast episode][2] about them. They’re also the topic of this post.
|
||||
|
||||
I’ve had many programming interviews both for internships and full-time jobs. When I was in college studying Computer Science, there was a career fair every fall semester where the first round of interviews took place. I have failed at the first and final rounds of interviews. After each interview, I reflected on what I could’ve done better and had mock up interviews with friends who gave me feedback.
|
||||
|
||||
Whether we find a job through a job portal, networking, or university recruiting, part of the process involves doing a technical interview.
|
||||
|
||||
In recent years we’ve seen different interview formats emerge:
|
||||
|
||||
* Pair programming with an engineer
|
||||
|
||||
* Online quiz and online coding
|
||||
|
||||
* Whiteboard interviews
|
||||
|
||||
I’ll focus on the whiteboard interview because it’s the one that I have experienced. I’ve had many interviews. Some of them have gone well, while others haven’t.
|
||||
|
||||
### What I did wrong
|
||||
|
||||
First, I want to go over the things I did wrong in my interviews. This helps see the problems and what to improve.
|
||||
|
||||
When an interviewer gave me a technical problem, I immediately went to the whiteboard and started trying to solve it. _Without saying a word._
|
||||
|
||||
I made two mistakes here:
|
||||
|
||||
#### Not clarifying information that is crucial to solve a problem
|
||||
|
||||
For example, are we only working with numbers or also strings? Are we supporting multiple data types? If you don’t ask questions before you start working on a question, your interviewer can get the impression that you won’t ask questions before you start working on a project at their company. This is an important skill to have in the workplace. It is not like school anymore. You don’t get an assignment with all the steps detailed for you. You have to find out what those are and define them.
|
||||
|
||||
#### Thinking without writing or communicating
|
||||
|
||||
Often times I stood there thinking without writing. When I was doing a mock interview with a friend, he told me that he knew I was thinking because we had worked together. To a stranger, it can seem that I’m clueless, or that I’m thinking. It is also important not to rush on a solution right away. Take some time to brainstorm ideas. Sometimes the interviewer will gladly participate in this. After all, that’s how it is at work meetings.
|
||||
|
||||
### Coming up with a solution
|
||||
|
||||
Before you begin writing code, it helps if you come up with the algorithm first. Don’t start writing code and hope that you’ll solve the problem as you write.
|
||||
|
||||
This is what has worked for me:
|
||||
|
||||
1. Brainstorm
|
||||
|
||||
2. Coding
|
||||
|
||||
3. Error handling
|
||||
|
||||
4. Testing
|
||||
|
||||
#### 1\. Brainstorm
|
||||
|
||||
For me, it helps to visualize first what the problem is through a series of examples. If it’s a problem related to trees, I would start with the null case, one node, two nodes, three nodes. This can help you generalize a solution.
|
||||
|
||||
On the whiteboard, write down a list of the things the algorithm needs to do. This way, you can find bugs and issues before writing any code. Just keep track of the time. I made a mistake once where I spent too much time asking clarifying questions and brainstorming, and I barely had time to write the code. The downside of this is that your interviewer doesn’t get to see how you code. You can also come off as if you’re trying to avoid the coding portion. It helps to wear a wrist watch, or if there’s a clock in the room, look at it occasionally. Sometimes the interviewer will tell you, “I think we have the necessary information, let’s start coding it.”
|
||||
|
||||
#### 2\. Coding and code walkthrough
|
||||
|
||||
If you don’t have the solution right away, it always helps to point out the obvious naive solution. While you’re explaining this, you should be thinking of how to improve it. When you state the obvious, indicate why it is not the best solution. For this it helps to be familiar with big O notation. It is okay to go over 2–3 solutions first. The interviewer sometimes guides you by saying, “Can we do better?” This can sometimes mean they are looking for a more efficient solution.
|
||||
|
||||
#### 3\. Error handling
|
||||
|
||||
While you’re coding, point out that you’re leaving a code comment for error handling. Once an interviewer said, “That’s a good point. How would you handle it? Would you throw an exception? Or return a specific value?” This can make for a good short discussion about code quality. Mention a few error cases. Other times, the interviewer might say that you can assume that the parameters you’re getting already passed a validation. However, it is still important to bring this up to show that you are aware of error cases and quality.
|
||||
|
||||
#### 4\. Testing
|
||||
|
||||
After you have finished coding the solution, re-use the examples from brainstorming to walk through your code and make sure it works. For example you can say, “Let’s go over the example of a tree with one node, two nodes.”
|
||||
|
||||
After you finish this, the interviewer sometimes asks you how you would test your code, and what your test cases would be. I recommend that you organize your test cases in different categories.
|
||||
|
||||
Some examples are:
|
||||
|
||||
1. Performance
|
||||
|
||||
2. Error cases
|
||||
|
||||
3. Positive expected cases
|
||||
|
||||
For performance, think about extreme quantities. For example, if the problem is about lists, mention that you would have a case with a large list and a really small list. If it’s about numbers, you’ll test the maximum integer number and the smallest. I recommend reading about testing software to get more ideas. My favorite book on this is [How We Test Software at Microsoft][3].
|
||||
|
||||
For error cases, think about what is expected to fail and list those.
|
||||
|
||||
For positive expected cases, it helps to think of what the user requirements are. What are the cases that this solution is meant to solve? Those are the positive test cases.
|
||||
|
||||
### “Do you have any questions for me?”
|
||||
|
||||
Almost always there will be a few minutes dedicated at the end for you to ask questions. I recommend that you write down the questions you would ask your interviewer before the interview. Don’t say, “I don’t have any questions.” Even if you feel the interview didn’t go well, or you’re not super passionate about the company, there’s always something you can ask. It can be about what the person likes and hates most about his or her job. Or it can be something related to the person’s work, or technologies and practices used at the company. Don’t feel discouraged to ask something even if you feel you didn’t do well.
|
||||
|
||||
### Applying for a job
|
||||
|
||||
As for searching and applying for a job, I’ve been told that you should only apply to a place that you would be truly passionate to work for. They say pick a company that you love, or a product that you enjoy using, and see if you can work there.
|
||||
|
||||
I don’t recommend that you always do this. You can rule out many good options this way, especially if you’re looking for an internship or an entry-level job.
|
||||
|
||||
You can focus on other goals instead. What do I want to get more experience in? Is it cloud computing, web development, or artificial intelligence? When you talk to companies at the career fair, find out if their job openings are in this area. You might find a really good position at a company or a non-profit that wasn’t in your list.
|
||||
|
||||
#### Switching teams
|
||||
|
||||
After a year and a half at my first team, I decided that it was time to explore something different. I found a team I liked and had 4 rounds of interviews. I didn’t do well.
|
||||
|
||||
I didn’t practice anything, not even simply writing on a whiteboard. My logic had been, if I have been working at the company for almost 2 years, why would I need to practice? I was wrong about this. I struggled to write a solution on the whiteboard. Things like my writing being too small and running out of space by not starting at the top left all contributed to not passing.
|
||||
|
||||
I hadn’t brushed up on data structures and algorithms. If I had, I would’ve been more confident. Even if you’ve been working at a company as a Software Engineer, before you do a round of interviews with another team, I strongly recommend you go through practice problems on a whiteboard.
|
||||
|
||||
As for finding a team, if you are looking to switch teams at your company, it helps to talk informally with members of that team. For this, I found that almost everyone is willing to have lunch with you. People are mostly available at noon too, so there is low risk of lack of availability and meeting conflicts. This is an informal way to find out what the team is working on, and see what the personalities of your potential team members are like. You can learn many things from lunch meetings that can help you in the formal interviews.
|
||||
|
||||
It is important to know that at the end of the day, you are interviewing for a specific team. Even if you do really well, you might not get an offer because you are not a culture fit. That’s part of why I try to meet different people in the team first, but this is not always possible. Don’t get discouraged by a rejection, keep your options open, and practice.
|
||||
|
||||
This content is from the [“Programming interviews”][4] episode on [The Women in Tech Show: Technical Interviews with Prominent Women in Tech][5].
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
作者简介:
|
||||
|
||||
Software Engineer II at Microsoft Research, opinions are my own, host of www.thewomenintechshow.com
|
||||
|
||||
------------
|
||||
|
||||
via: https://medium.freecodecamp.org/what-i-learned-from-programming-interviews-29ba49c9b851
|
||||
|
||||
作者:[Edaena Salinas ][a]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:https://medium.freecodecamp.org/@edaenas
|
||||
[1]:https://anitab.org/event/2017-grace-hopper-celebration-women-computing/
|
||||
[2]:https://thewomenintechshow.com/2017/12/18/programming-interviews/
|
||||
[3]:https://www.amazon.com/How-We-Test-Software-Microsoft/dp/0735624259
|
||||
[4]:https://thewomenintechshow.com/2017/12/18/programming-interviews/
|
||||
[5]:https://thewomenintechshow.com/
|
@ -1,3 +1,6 @@
|
||||
Translating by MjSeven
|
||||
|
||||
|
||||
How To Add Additional IP (Secondary IP) In Ubuntu System
|
||||
======
|
||||
Linux admin should be aware of this because it’s a routine task. Many of you wondering why we need to add more than one IP address in server? why we need add this to single network card? am i right?
|
||||
|
@ -1,3 +1,5 @@
|
||||
idea2act translating
|
||||
|
||||
How to use VS Code for your Python projects
|
||||
======
|
||||
|
||||
|
@ -1,3 +1,5 @@
|
||||
translating----geekpi
|
||||
|
||||
10 Popular Windows Apps That Are Also Available on Linux
|
||||
======
|
||||
|
||||
|
@ -1,3 +1,4 @@
|
||||
LuuMing translating
|
||||
6 Reasons Why Linux Users Switch to BSD
|
||||
======
|
||||
Thus far I have written several articles about [BSD][1] for It’s FOSS. There is always at least one person in the comments asking “Why bother with BSD?” I figure that the best way to respond was to write an article on the topic.
|
||||
|
@ -1,323 +0,0 @@
|
||||
pinewall translating
|
||||
|
||||
A Collection Of More Useful Unix Utilities
|
||||
======
|
||||
|
||||
![](https://www.ostechnix.com/wp-content/uploads/2017/08/Moreutils-720x340.png)
|
||||
|
||||
We all know about **GNU core utilities** that comes pre-installed with all Unix-like operating systems. These are the basic file, shell and text manipulation utilities of the GNU operating system. The GNU core utilities contains the commands, such as cat, ls, rm, mkdir, rmdir, touch, tail, wc and many more, for performing the day-to-day operations. Among these utilities, there are also some other useful collection of Unix utilities which are not included by default in the Unix-like operating systems. Meet **moreutilis** , a growing collection of more useful Unix utilities. The moreutils can be installed on GNU/Linux, and various Unix flavours such as FreeBSD, openBSD and Mac OS.
|
||||
|
||||
|
||||
As of writing this guide, Moreutils provides the following utilities:
|
||||
|
||||
* **chronic** – Runs a command quietly unless it fails.
|
||||
* **combine** – Combine the lines in two files using boolean operations.
|
||||
* **errno** – Look up errno names and descriptions.
|
||||
* **ifdata** – Get network interface info without parsing ifconfig output.
|
||||
* **ifne** – Run a program if the standard input is not empty.
|
||||
* **isutf8** – Check if a file or standard input is utf-8.
|
||||
* **lckdo** – Execute a program with a lock held.
|
||||
* **mispipe** – Pipe two commands, returning the exit status of the first.
|
||||
* **parallel** – Run multiple jobs at once.
|
||||
* **pee** – tee standard input to pipes.
|
||||
* **sponge** – Soak up standard input and write to a file.
|
||||
* **ts** – timestamp standard input.
|
||||
* **vidir** – Edit a directory in your text editor.
|
||||
* **vipe** – Insert a text editor into a pipe.
|
||||
* **zrun** – Automatically uncompress arguments to command.
|
||||
|
||||
|
||||
|
||||
### Install moreutils on Linux
|
||||
|
||||
The moreutils is packaged to many Linux distributions, so you can install it using the distribution’s package manager.
|
||||
|
||||
On **Arch Linux** and derivatives such as **Antergos** , **Manjaro Linux** , run the following command to install moreutils.
|
||||
```
|
||||
$ sudo pacman -S moreutils
|
||||
|
||||
```
|
||||
|
||||
On **Fedora** :
|
||||
```
|
||||
$ sudo dnf install moreutils
|
||||
|
||||
```
|
||||
|
||||
On **RHEL** , **CentOS** , **Scientific Linux** :
|
||||
```
|
||||
$ sudo yum install epel-release
|
||||
|
||||
$ sudo yum install moreutils
|
||||
|
||||
```
|
||||
|
||||
On **Debian** , **Ubuntu** , **Linux Mint** :
|
||||
```
|
||||
$ sudo apt-get install moreutils
|
||||
|
||||
```
|
||||
|
||||
### Moreutils – A Collection Of More Useful Unix Utilities
|
||||
|
||||
Let us see the usage details of some moreutils tools.
|
||||
|
||||
##### The “Combine” utility
|
||||
|
||||
As the name implies, the **Combine** utility of moreutils package combines the sets of lines from two files using boolean operations such as “and”, “not”, “or”, “xor”.
|
||||
|
||||
* **and** – Outputs lines that are in file1 if they are also present in file2.
|
||||
* **not** – Outputs lines that are in file1 but not in file2.
|
||||
* **or** – Outputs lines that are in file1 or file2.
|
||||
* **xor** – Outputs lines that are in either file1 or file2, but not in both files.
|
||||
|
||||
|
||||
|
||||
Let me show you an example, so you can understand what exactly this utility will do . I have two files namely **file1** and **file2**. Here is the contents of the those two files.
|
||||
```
|
||||
$ cat file1
|
||||
is
|
||||
was
|
||||
were
|
||||
where
|
||||
there
|
||||
|
||||
$ cat file2
|
||||
is
|
||||
were
|
||||
there
|
||||
|
||||
```
|
||||
|
||||
Now, let me combine them using “and” boolean operation.
|
||||
```
|
||||
$ combine file1 and file2
|
||||
is
|
||||
were
|
||||
there
|
||||
|
||||
```
|
||||
|
||||
As you see in the above example, the “and” Boolean operator outputs lines that are in file1 if they are also present in file2. To put this more clearly, it displays the common lines(Ex. is, were, there) which are present in both files.
|
||||
|
||||
Let us now use “not” operator and see the result.
|
||||
```
|
||||
$ combine file1 not file2
|
||||
was
|
||||
where
|
||||
|
||||
```
|
||||
|
||||
As you see in the above output, the “not” operator displays the lines that are only in file1, but not in file2.
|
||||
|
||||
##### The “ifdata” utility
|
||||
|
||||
The “ifdata” utility can be used to check for the existence of a network interface, to get information about the network interface, such as its IP address. Unlike the built-in commands such as “ifconfig” or “ip”, ifdata has simple to parse output that is designed to be easily used by a shell script.
|
||||
|
||||
To display IP address details of a network interface, say wlp9s0, run:
|
||||
```
|
||||
$ ifdata -p wlp9s0
|
||||
192.168.43.192 255.255.255.0 192.168.43.255 1500
|
||||
|
||||
```
|
||||
|
||||
To display the netmask only, run:
|
||||
```
|
||||
$ ifdata -pn wlp9s0
|
||||
255.255.255.0
|
||||
|
||||
```
|
||||
|
||||
To check hardware address of a NIC:
|
||||
```
|
||||
$ ifdata -ph wlp9s0
|
||||
A0:15:46:90:12:3E
|
||||
|
||||
```
|
||||
|
||||
To check if a NIC exists or not, use “-pe” flag.
|
||||
```
|
||||
$ ifdata -pe wlp9s0
|
||||
yes
|
||||
|
||||
```
|
||||
|
||||
##### The “Pee” command
|
||||
|
||||
It is somewhat similar to “tee” command.
|
||||
|
||||
Let us see an example of “tee” command usage.
|
||||
```
|
||||
$ echo "Welcome to OSTechNIx" | tee file1 file2
|
||||
Welcome to OSTechNIx
|
||||
|
||||
```
|
||||
|
||||
The above command will create two files namely **file1** and **file2**. Then, append the line “Welcome to OSTechNix” on both files. And finally prints the message “Welcome to OSTechNix” in your Terminal.
|
||||
|
||||
The “Pee” command performs a similar function, but slightly differs from “tee” command. Look at the following command:
|
||||
```
|
||||
$ echo "Welcome to OSTechNIx" | pee cat cat
|
||||
Welcome to OSTechNIx
|
||||
Welcome to OSTechNIx
|
||||
|
||||
```
|
||||
|
||||
As you see in the above output, the two instances of “cat” command receives the output from “echo” command and displays them twice in the Terminal.
|
||||
|
||||
##### The “Sponge” utility
|
||||
|
||||
This is yet another useful utility from moreutils package. **Sponge** reads standard input and writes it out to the specified file. Unlike a shell redirect, sponge soaks up all its input before writing the output file.
|
||||
|
||||
Have a look at the contents of following text file.
|
||||
```
|
||||
$ cat file1
|
||||
I
|
||||
You
|
||||
Me
|
||||
We
|
||||
Us
|
||||
|
||||
```
|
||||
|
||||
As you see, the file contains some random lines, particularly “not” in alphabetical order. You want to sort the contents in alphabetical order. What would you do?
|
||||
```
|
||||
$ sort file1 > file1_sorted
|
||||
|
||||
```
|
||||
|
||||
Correct, isn’t it? Of course! As you see in the above command, I have sorted the contents of the **file1** in alphabetical order and saved them in a new file called **“file1_sorted”**. But, You can do the same without creating a new (i.e file1_sorted) using “sponge” command as shown below.
|
||||
```
|
||||
$ sort file1 | sponge file1
|
||||
|
||||
```
|
||||
|
||||
Now, check if the contents are sorted in alphabetical order.
|
||||
```
|
||||
$ cat file1
|
||||
I
|
||||
Me
|
||||
Us
|
||||
We
|
||||
You
|
||||
|
||||
```
|
||||
|
||||
See? we don’t need to create a new file. It’s very useful in scripting. And the good thing is sponge preserves the permissions of the output file if it already exists.
|
||||
|
||||
##### The “ts” utility
|
||||
|
||||
As the name says, “ts” command adds a timestamp to the beginning of each line of input.
|
||||
|
||||
Look at the following command’s output:
|
||||
```
|
||||
$ ping -c 2 localhost
|
||||
PING localhost(localhost.localdomain (::1)) 56 data bytes
|
||||
64 bytes from localhost.localdomain (::1): icmp_seq=1 ttl=64 time=0.055 ms
|
||||
64 bytes from localhost.localdomain (::1): icmp_seq=2 ttl=64 time=0.079 ms
|
||||
|
||||
--- localhost ping statistics ---
|
||||
2 packets transmitted, 2 received, 0% packet loss, time 1018ms
|
||||
rtt min/avg/max/mdev = 0.055/0.067/0.079/0.012 ms
|
||||
|
||||
```
|
||||
|
||||
Now, run the same command with “ts” utlity as shown below.
|
||||
```
|
||||
$ ping -c 2 localhost | ts
|
||||
Aug 21 13:32:28 PING localhost(localhost (::1)) 56 data bytes
|
||||
Aug 21 13:32:28 64 bytes from localhost (::1): icmp_seq=1 ttl=64 time=0.063 ms
|
||||
Aug 21 13:32:28 64 bytes from localhost (::1): icmp_seq=2 ttl=64 time=0.113 ms
|
||||
Aug 21 13:32:28
|
||||
Aug 21 13:32:28 --- localhost ping statistics ---
|
||||
Aug 21 13:32:28 2 packets transmitted, 2 received, 0% packet loss, time 4ms
|
||||
Aug 21 13:32:28 rtt min/avg/max/mdev = 0.063/0.088/0.113/0.025 ms
|
||||
|
||||
```
|
||||
|
||||
As you see in the above output, ts adds a timestamp at the beginning of each line. Here is another example.
|
||||
```
|
||||
$ ls -l | ts
|
||||
Aug 21 13:34:25 total 120
|
||||
Aug 21 13:34:25 drwxr-xr-x 2 sk users 12288 Aug 20 20:05 Desktop
|
||||
Aug 21 13:34:25 drwxr-xr-x 2 sk users 4096 Aug 10 18:44 Documents
|
||||
Aug 21 13:34:25 drwxr-xr-x 24 sk users 12288 Aug 21 13:06 Downloads
|
||||
[...]
|
||||
|
||||
```
|
||||
|
||||
##### The “Vidir” utility
|
||||
|
||||
The “Vidir” utility allows you to edit the contents of a specified directory in **vi** editor (Or, whatever you have in **$EDITOR** ). If no directory is specified, it will edit your current working directory.
|
||||
|
||||
The following command edits the contents of the directory called “Desktop”.
|
||||
```
|
||||
$ vidir Desktop/
|
||||
|
||||
```
|
||||
|
||||
![vidir][2]
|
||||
|
||||
The above command will open the specified directory in your **vi** editor. Each item in the editing directory will contain a number. You can now edit the files as the way you do in vi editor. Say for example, delete lines to remove files from the directory, or edit filenames to rename files.
|
||||
|
||||
You can edit the sub directories as well. The following command edits the current working directory along with its sub-directories.
|
||||
```
|
||||
$ find | vidir -
|
||||
|
||||
```
|
||||
|
||||
Please note the “-” at the end of the command. If “-” is specified as the directory to edit, it reads a list of filenames from stdin and displays those for editing.
|
||||
|
||||
If you want to edit only the files in the current working directory, you can use the following command:
|
||||
```
|
||||
$ find -type f | vidir -
|
||||
|
||||
```
|
||||
|
||||
Want to edit a specific file types, say .PNG files? then you would use:
|
||||
```
|
||||
$ vidir *.png
|
||||
|
||||
```
|
||||
|
||||
This command edits only the .png files in the current directory.
|
||||
|
||||
##### The “Vipe” Utility
|
||||
|
||||
The “vipe” command allows you to run your default editor in the middle of a Unix pipeline and edit the data that is being piped between programs.
|
||||
|
||||
The following command opens the vi editor (my default editor, of course) and allows you to edit the input of the “echo” command (i.e Welcome To OSTechNix) and displays the final result.
|
||||
```
|
||||
$ echo "Welcome to OSTechNIx" | vipe
|
||||
Hello World
|
||||
|
||||
```
|
||||
|
||||
As you see in the above output, I passed the input “Welcome to OSTechNix” to vi editor and edited them as “Hello World” and displayed the final output.
|
||||
|
||||
And, that’s all for now. I have covered only few utilities. The “moreutils” has more useful utilities. I already have mentioned the currently included utilities in moreutils package in the introductory section. You can read the man pages for greater detail on the above commands. Say for example, to know more about “vidir” command, run:
|
||||
```
|
||||
$ man vidir
|
||||
|
||||
```
|
||||
|
||||
Hope this helps. I will be soon here with another interesting and useful guide. If you find our articles helpful, please share them on your social, professional networks and support OSTechNix.
|
||||
|
||||
Cheers!
|
||||
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.ostechnix.com/moreutils-collection-useful-unix-utilities/
|
||||
|
||||
作者:[SK][a]
|
||||
选题:[lujun9972](https://github.com/lujun9972)
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:https://www.ostechnix.com/author/sk/
|
||||
[1]:data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7
|
||||
[2]:http://www.ostechnix.com/wp-content/uploads/2017/08/sk@sk_001-1.png
|
@ -0,0 +1,146 @@
|
||||
|
||||
我从编程面试中学到的
|
||||
============================================================
|
||||
|
||||
|
||||
![](https://cdn-images-1.medium.com/max/1250/1*DXPdaGPM4oM6p5nSkup7IQ.jpeg)
|
||||
聊聊白板编程面试
|
||||
|
||||
在2017年,我参加了[Grace Hopper Celebration][1]‘计算机行业中的女性’这一活动。这个活动是这类科技活动中最大的一个。共有17,000名女性IT工作者参加。
|
||||
|
||||
这个会议有个大型的配套招聘会,会上有招聘公司来面试会议参加者。有些人甚至现场拿到offer。我在现场晃荡了一下,注意到一些应聘者看上去非常紧张忧虑。我还隐隐听到应聘者之间的谈话,其中一些人谈到在面试中做的并不好。
|
||||
|
||||
我走近我听到谈话的那群人并和她们聊了起来并给了一些面试上的小建议。我想我的建议还是比较偏基本的,如“(在面试时)一开始给出个能工作的解决方案也还说的过去”之类的,但是当她们听到我的一些其他的建议时还是颇为吃惊。
|
||||
|
||||
为了能更多的帮到像她们一样的白面面试者,我收集了一些过去对我有用的小点子,这些小点子我已经发表在了[prodcast episode][2]上。它们也是这篇文章的主题。
|
||||
|
||||
为了实习生职位和全职工作,我做过很多次的面试。当我还在大学主修计算机科学时,学校每个秋季学期都有招聘会,第一轮招聘会在校园里举行。(我在第一和最后一轮都搞砸过。)不过,每次面试后,我都会反思哪些方面我能做的更好,我还会和朋友们做模拟面试,这样我就能从他们那儿得到更多的面试反馈。
|
||||
|
||||
不管我们怎么样找工作: 工作中介,网络,或者学校招聘,他们的招聘流程中都会涉及到技术面试:
|
||||
|
||||
近年来,我注意到了一些新的不同的面试形式出现了:
|
||||
|
||||
* 与招聘方的一位工程师结对编程
|
||||
* 网络在线测试及在线编码
|
||||
* 白板编程(LCTT译者注: 这种形式应该不新了)
|
||||
|
||||
|
||||
我将重点谈谈白板面试,这种形式我经历的最多。我有过很多次面试,有些挺不错的,有些被我搞砸了。
|
||||
|
||||
#### 我做错的地方
|
||||
|
||||
首先,我想回顾一下我做的不好的地方。知错能改,善莫大焉。
|
||||
|
||||
当面试者提出一个要我解决的问题时, 我立即马上立刻开始在白板上写代码,_什么都不问。_
|
||||
|
||||
这里我犯了两个错误:
|
||||
|
||||
#### 没有澄清对解决问题有关键作用的信息
|
||||
|
||||
比如,我们是否只用处理数字或者字符串?我们要支持多种数据类型吗?如果你在开始解题前不去问这些问题的话,你的面试官会有一种不好的印象:这个人在我们公司的话,他不会在开始项目工作之前不问清楚到底要做什么。而这恰恰是在工作场合很重要的一个工作习惯。公司可不像学校,你在开始工作前可不会得到写有所有详细步骤的作业说明。你得靠自己找到这些步骤并自己定义他们。
|
||||
|
||||
#### 只会默默思考,不去记录想法或和面试官沟通
|
||||
|
||||
在面试中,很多时候我也会傻傻站在那思考,什么都不写。我和一个朋友模拟面试的时候,他告诉我因为他曾经和我一起工作过所以他知道我在思考,但是如果他是个陌生的面试官的话,他会觉得要么我正站在那冥思苦想,毫无头绪。不要急匆匆的直奔解题而去是很重要的。花点时间多想想各种解题的可能性。有时候面试官会乐意和你一起探索解题的步骤。不管怎样,这就是在一家公司开工作会议的的普遍方式,大家各抒己见,一起讨论如何解决问题。
|
||||
|
||||
### 想到一个解题方法
|
||||
|
||||
在你开始写代码之前,如果你能总结一下要使用到的算法就太棒了。不要上来就写代码并认为你的代码肯定能解决问题。
|
||||
|
||||
这是对我管用的步骤:
|
||||
|
||||
1. 头脑风暴
|
||||
|
||||
2. 写代码
|
||||
|
||||
3. 处理错误路径
|
||||
|
||||
4. 测试
|
||||
|
||||
#### 1\. 头脑风暴
|
||||
|
||||
对我来说,我会首先通过一些例子来视觉化我要解决的问题。比如说如果这个问题和数据结构中的树有关,我就会从树底层的空节点开始思考,如何处理一个节点的情况呢?两个节点呢?三个节点呢?这能帮助你从具体例子里抽象出你的解决方案。
|
||||
|
||||
在白板上先写下你的算法要做的事情列表。这样做,你往往能在开始写代码前就发现bug和缺陷(不过你可得掌握好时间)。我犯过的一个错误是我花了过多的时间在澄清问题和头脑风暴上,最后几乎没有留下时间给我写代码。你的面试官可能没有机会看你在白板上写下代码,这可太糟了。你可以带块手表,或者房间有钟的话,你也可以抬头看看时间。有些时候面试者会提醒你你已经得到了所有的信息(这时你就不要再问别的了),'我想我们已经把所有需要的信息都澄清了,让我们写代码实现吧'
|
||||
|
||||
#### 2\. 开始写代码,一气呵成
|
||||
|
||||
如果你还没有得到问题的完美解决方法,从最原始的解法开始总的可以的。当你在向面试官解释最显而易见的解法时,你要想想怎么去完善它,并指明这种做法是最原始,未加优化的。(请熟悉算法中的O()的概念,这对面试非常有用。)在向面试者提交前请仔细检查你的解决方案两三遍。面试者有时会给你些提示, ‘还有更好的方法吗?’,这句话的意思是面试官提示你有更优化的解决方案。
|
||||
|
||||
#### 3\. 错误处理
|
||||
|
||||
当你在编码时,对你想做错误处理的代码行做个注释。当面试者说,'很好,这里你想到了错误处理。你想怎么处理呢?抛出异常还是返回错误码?',这将给你个机会去引出关于代码质量的一番讨论。当然,这种地方提出几个就够了。有时,面试者为了节省编码的时间,会告诉你可以假设外界输入的参数都已经通过了校验。不管怎样,你都要展现你对错误处理和编码质量的重要性的认识。
|
||||
|
||||
#### 4\. 测试
|
||||
|
||||
在编码完成后,用你在前面头脑风暴中写的用例来在你脑子里“跑”一下你的代码,确定万无一失。例如你可以说,‘让我用前面写下的树的例子来跑一下我的代码,如果是一个节点是什么结果,如果是两个节点是什么结果。。。’
|
||||
|
||||
在你结束之后,面试者有时会问你你将会怎么测试你的代码,你会涉及什么样的测试用例。我建议你用下面不同的分类来组织你的错误用例:
|
||||
|
||||
一些分类可以为:
|
||||
|
||||
1. 性能
|
||||
2. 错误用例
|
||||
3. 期望的正常用例
|
||||
|
||||
对于性能测试,要考虑极端数量下的情况。例如,如果问题是关于列表的,你可以说你将会使用一个非常大的列表以及的非常小的列表来测试。如果和数字有关,你将会测试系统中的最大整数和最小整数。我建议读一些有关软件测试的书来得到更多的知识。在这个领域我最喜欢的书是[How We Test Software at Microsoft][3]。
|
||||
|
||||
对于错误用例,想一下什么是期望的错误情况并一一写下。
|
||||
|
||||
对于正向期望用例,想想用户需求是什么?你的解决方案要解决什么问题?这些都可以成为正向期望用例。
|
||||
|
||||
### “你还有什么要问我的吗?”
|
||||
|
||||
面试最后总是会留几分钟给你问问题。我建议你在面试前写下你想问的问题。千万别说,‘我没什么问题了’,就算你觉得面试砸了或者你对这间公司不怎么感兴趣,你总有些东西可以问问。你甚至可以问面试者他最喜欢自己的工作什么,最讨厌自己的工作什么。或者你可以问问面试官的工作具体是什么,在用什么技术和实践。不要因为觉得自己在面试中做的不好而心灰意冷,不想问什么问题。
|
||||
|
||||
### 申请一份工作
|
||||
|
||||
|
||||
关于找工作申请工作,有人曾经告诉我,你应该去找你真正有激情工作的地方。去找一家你喜欢的公司,或者你喜欢使用的产品,看看你能不能去那儿工作。
|
||||
|
||||
我个人并不推荐你用上述的方法去找工作。你会排除很多很好的公司,特别是你是在找实习工作或者入门级的职位时。
|
||||
|
||||
你也可以集中在其他的一些目标上。如:我想从这个工作里得到哪方面的更多经验?这个工作是关于云计算?Web开发?或是人工智能?当在招聘会上与招聘公司沟通是,看看他们的工作单位有没有在这些领域的。你可能会在一家并非在你的想去公司列表上的公司(或非盈利机构)里找到你想找的职位。
|
||||
|
||||
#### 换组
|
||||
|
||||
在这家公司里的第一个组里呆了一年半以后,我觉得是时候去探索一下不同的东西了。我找到了一个我喜欢的组并进行了4轮面试。结果我搞砸了。
|
||||
|
||||
|
||||
我什么都没有准备,甚至都没在白板上练练手。我当时的逻辑是,如果我都已经在一家公司干了快2年了,我还需要练什么?我完全错了,我在接下去的白板面试中跌跌撞撞。我的板书写得太小,而且因为没有从最左上角开始写代码,我的代码大大超出了一个白板的空间,这些都导致了白板面试失败。
|
||||
|
||||
|
||||
我在面试前也没有刷过数据结构和算法题。如果我做了的话,我将会在面试中更有信心。就算你已经在一家公司担任了软件工程师,在你去另外一个组面试前,我强烈建议你在一块白板上演练一下如何写代码。
|
||||
|
||||
|
||||
对于换项目组这件事,如果你是在公司内部换组的话,事先能同那个组的人非正式聊聊会很有帮助。对于这一点,我发现几乎每个人都很乐于和你一起吃个午饭。人一般都会在中午有空,约不到人或者别人正好有会议冲突的风险会很低。这是一种非正式的途径来了解你想去的组正在干什么,以及这个组成员个性是怎么样的。相信我, 你能从一次午餐中得到很多信息,这可会对你的正式面试帮助不小。
|
||||
|
||||
|
||||
非常重要的一点是,你在面试一个特定的组时,就算你在面试中做的很好,因为文化不契合的原因,你也很可能拿不到offer。这也是为什么我一开始就想去见见组里不同的人的原因(有时这也不太可能),我希望你不要被一次拒绝所击倒,请保持开放的心态,选择新的机会,并多多练习。
|
||||
|
||||
|
||||
以上内容来自["Programming interviews"][4] 章节,选自 [The Women in Tech Show: Technical Interviews with Prominent Women in Tech][5]
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
作者简介:
|
||||
|
||||
|
||||
微软研究院Software Engineer II, www.thewomenintechshow.com站长,所有观点都只代表本人意见。
|
||||
|
||||
------------
|
||||
|
||||
via: https://medium.freecodecamp.org/what-i-learned-from-programming-interviews-29ba49c9b851
|
||||
|
||||
作者:[Edaena Salinas ][a]
|
||||
译者:DavidChenLiang (https://github.com/DavidChenLiang)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:https://medium.freecodecamp.org/@edaenas
|
||||
[1]:https://anitab.org/event/2017-grace-hopper-celebration-women-computing/
|
||||
[2]:https://thewomenintechshow.com/2017/12/18/programming-interviews/
|
||||
[3]:https://www.amazon.com/How-We-Test-Software-Microsoft/dp/0735624259
|
||||
[4]:https://thewomenintechshow.com/2017/12/18/programming-interviews/
|
||||
[5]:https://thewomenintechshow.com/
|
@ -1,53 +0,0 @@
|
||||
L1 终端错误漏洞如何影响 Linux 系统
|
||||
======
|
||||
|
||||
![](https://images.idgesg.net/images/article/2018/08/l1tf-copy-100768129-large.jpg)
|
||||
|
||||
昨天在英特尔、微软和红帽的安全建议中宣布,一个新发现的漏洞英特尔处理器(还有 Linux)的漏洞称为 L1TF 或 “L1 Terminal Fault”,引起了 Linux 用户和管理员的注意。究竟什么是这个漏洞,谁应该担心它?
|
||||
|
||||
### 1TF、 L1 Terminal Fault 和 Foreshadow
|
||||
|
||||
处理器漏洞由 L1TF、L1 Terminal Fault 和 Foreshadow 组成。研究人员在 1 月份发现了这个问题并向英特尔报告称其为 “Foreshadow”。它类似于过去发现的漏洞(例如 Spectre)。
|
||||
|
||||
此漏洞是特定于 Intel 的。其他处理器不受影响。与其他一些漏洞一样,它之所以存在,是因为设计时为了优化内核处理速度,但允许其他进程访问数据。
|
||||
|
||||
**[另请阅读:[22 个必要的 Linux 安全命令][1]]**
|
||||
|
||||
已为此问题分配了三个 CVE:
|
||||
|
||||
* CVE-2018-3615:英特尔软件保护扩展(英特尔 SGX)
|
||||
* CVE-2018-3620:操作系统和系统管理模式(SMM)
|
||||
* CVE-2018-3646:虚拟化的影响
|
||||
|
||||
|
||||
|
||||
英特尔发言人就此问题发表了这一声明:_“L1 Terminal Fault 通过今年早些时候发布的微代码更新得到解决,再加上从今天开始提供的操作系统和虚拟机管理程序软件的相应更新。我们在网上提供了更多信息,并继续鼓励每个人更新系统,因为这是受到保护的最佳方式之一。我们要感谢 imec-DistriNet、KU Leuven、以色列理工学院,密歇根大学,阿德莱德大学和 Data61 的研究人员以及我们的行业合作伙伴,他们帮助我们识别和解决了这个问题。“_
|
||||
|
||||
### L1TF 会影响你的 Linux 系统吗?
|
||||
|
||||
简短的回答是“可能不会”。如果你因为在今年 1 月爆出的[ Spectre 和 Meltdown 漏洞][2]修补过系统,那你应该是安全的。与 Spectre 和 Meltdown 一样,英特尔声称真实世界中还没有系统受到影响的报告或者检测到。他们还表示,这些变化不太可能在单个系统上产生明显的性能影响,但它们可能对使用虚拟化操作系统的数据中心产生大的影响。
|
||||
|
||||
即使如此,仍然推荐频繁地打补丁。要检查你当前的内核版本,使用 **uname -r** 命令:
|
||||
```
|
||||
$ uname -r
|
||||
4.18.0-041800-generic
|
||||
|
||||
```
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.networkworld.com/article/3298157/linux/linux-and-l1tf.html
|
||||
|
||||
作者:[Sandra Henry-Stocker][a]
|
||||
选题:[lujun9972](https://github.com/lujun9972)
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:https://www.networkworld.com/author/Sandra-Henry_Stocker/
|
||||
[1]:https://www.networkworld.com/article/3272286/open-source-tools/22-essential-security-commands-for-linux.html
|
||||
[2]:https://www.networkworld.com/article/3245813/security/meltdown-and-spectre-exploits-cutting-through-the-fud.html
|
||||
[3]:https://www.facebook.com/NetworkWorld/
|
||||
[4]:https://www.linkedin.com/company/network-world
|
@ -0,0 +1,313 @@
|
||||
打包更多有用的 Unix 实用程序
|
||||
======
|
||||
|
||||
![](https://www.ostechnix.com/wp-content/uploads/2017/08/Moreutils-720x340.png)
|
||||
|
||||
我们都了解 **<ruby>GNU 核心实用程序<rt>GNU Core Utilities</rt></ruby>**,所有类 Unix 操作系统都预装了它们。它们是 GNU 操作系统中与文件、Shell 和 文本处理相关的基础实用工具。GNU 核心实用程序包括很多日常操作命令,例如 `cat`,`ls`, `rm`,`mkdir`,`rmdir`,`touch`,`tail` 和 `wc` 等。除了这些实用程序,还有更多有用的实用程序没有预装在类 Unix 操作系统中,它们汇集起来构成了 `moreutilis` 这个日益增长的集合。`moreutils` 可以在 GNU/Linux 和包括 FreeBSD,openBSD 及 Mac OS 在内的多种 Unix 类型操作系统上安装。
|
||||
|
||||
截至到编写这份指南时, `moreutils` 提供如下实用程序:
|
||||
|
||||
* `chronic` – 运行程序并忽略正常运行的输出
|
||||
* `combine` – 使用布尔操作合并文件
|
||||
* `errno` – 查询 errno 名称及描述
|
||||
* `ifdata` – 获取网络接口信息,无需解析 `ifconfig` 的结果
|
||||
* `ifne` – 在标准输入非空的情况下运行程序
|
||||
* `isutf8` – 检查文件或标准输入是否采用 UTF-8 编码
|
||||
* `lckdo` – 运行程序时考虑文件锁
|
||||
* `mispipe` – 使用管道连接两个命令,返回第一个命令的退出状态
|
||||
* `parallel` – 同时运行多个任务
|
||||
* `pee` – 将标准输入传递给多个管道
|
||||
* `sponge` – 整合标准输入并写入文件
|
||||
* `ts` – 为标准输入增加时间戳信息
|
||||
* `vidir` – 使用你默认的文本编辑器操作目录文件
|
||||
* `vipe` – 在管道中插入信息编辑
|
||||
* `zrun` – 自动解压并将其作为参数传递给命令
|
||||
|
||||
### 在 Linux 上安装 moreutils
|
||||
|
||||
由于 `moreutils` 已经被打包到多种 Linux 发行版中,你可以使用发行版对应的软件包管理器安装 `moreutils`。
|
||||
|
||||
在 **Arch Linux** 或衍生的 **Antergos** 和 **Manjaro Linux** 上,运行如下命令安装 `moreutils`:
|
||||
|
||||
```
|
||||
$ sudo pacman -S moreutils
|
||||
```
|
||||
|
||||
在 **Fedora** 上,运行:
|
||||
|
||||
```
|
||||
$ sudo dnf install moreutils
|
||||
```
|
||||
|
||||
在 **RHEL**,**CentOS** 和 **Scientific Linux** 上,运行:
|
||||
|
||||
```
|
||||
$ sudo yum install epel-release
|
||||
$ sudo yum install moreutils
|
||||
```
|
||||
|
||||
在 **Debian**,**Ubuntu** 和 **Linux Mint** 上,运行:
|
||||
|
||||
```
|
||||
$ sudo apt-get install moreutils
|
||||
```
|
||||
|
||||
### Moreutils – 打包更多有用的 Unix 实用程序
|
||||
|
||||
让我们看一下几个 `moreutils` 工具的用法细节。
|
||||
|
||||
##### combine 实用程序
|
||||
|
||||
正如 `combine` 名称所示,moreutils 中的这个实用程序可以使用包括 `and`,`not`,`or` 和 `xor` 在内的布尔操作,合并两个文件中的行。
|
||||
|
||||
* `and` – 输出 `file1` 和 `file2` 都包含的行。
|
||||
* `not` – 输出 `file1` 包含但 `file2` 不包含的行。
|
||||
* `or` – 输出 `file1` 或 `file2` 包含的行。
|
||||
* `xor` – 输出仅被 `file1` 或 `file2` 包含的行
|
||||
|
||||
下面举例说明,方便你理解该实用程序的功能。这里有两个文件,文件名分别为 `file1` 和 `file2`,其内容如下:
|
||||
|
||||
```
|
||||
$ cat file1
|
||||
is
|
||||
was
|
||||
were
|
||||
where
|
||||
there
|
||||
|
||||
$ cat file2
|
||||
is
|
||||
were
|
||||
there
|
||||
```
|
||||
|
||||
下面,我使用 `and` 布尔操作合并这两个文件。
|
||||
|
||||
```
|
||||
$ combine file1 and file2
|
||||
is
|
||||
were
|
||||
there
|
||||
```
|
||||
|
||||
从上例的输出中可以看出,`and` 布尔操作只输出那些 `file1` 和 `file2` 都包含的行;更具体的来说,命令输出为两个文件共有的行,即 is,were 和 there。
|
||||
|
||||
下面我们换成 `not` 操作,观察一下输出。
|
||||
|
||||
```
|
||||
$ combine file1 not file2
|
||||
was
|
||||
where
|
||||
```
|
||||
|
||||
从上面的输出中可以看出,`not` 操作输出 `file1` 包含但 `file2` 不包含的行。
|
||||
|
||||
##### ifdata 实用程序
|
||||
|
||||
`ifdata` 实用程序可用于检查网络接口是否存在,也可用于获取网络接口的信息,例如 IP 地址等。与预装的 `ifconfig` 和 `ip` 命令不同,`ifdata` 的输出更容易解析,这种设计的初衷是便于在 Shell 脚本中使用。
|
||||
|
||||
如果希望查看某个接口的 IP 地址,不妨以 `wlp9s0` 为例,运行如下命令:
|
||||
|
||||
```
|
||||
$ ifdata -p wlp9s0
|
||||
192.168.43.192 255.255.255.0 192.168.43.255 1500
|
||||
```
|
||||
|
||||
如果只查看掩码信息,运行如下命令:
|
||||
|
||||
```
|
||||
$ ifdata -pn wlp9s0
|
||||
255.255.255.0
|
||||
```
|
||||
|
||||
如果查看网络接口的物理地址,运行如下命令:
|
||||
|
||||
```
|
||||
$ ifdata -ph wlp9s0
|
||||
A0:15:46:90:12:3E
|
||||
```
|
||||
|
||||
如果判断接口是否存在,可以使用 `-pe` 参数:
|
||||
|
||||
```
|
||||
$ ifdata -pe wlp9s0
|
||||
yes
|
||||
```
|
||||
|
||||
##### pee 命令
|
||||
|
||||
该命令某种程度上类似于 `tee` 命令。
|
||||
|
||||
我们先用一个例子看一下 `tee` 的用法。
|
||||
|
||||
```
|
||||
$ echo "Welcome to OSTechNIx" | tee file1 file2
|
||||
Welcome to OSTechNIx
|
||||
```
|
||||
|
||||
上述命令首先创建两个文件,名为 `file1` 和 `file2`;接着,将 “Welcome to OSTechNix” 行分别附加到两个文件中;最后,在终端中打印输出 “Welcome to OSTechNix”。
|
||||
|
||||
`pee` 命令提供类似的功能,但与 `tee` 又稍微有些差异。查看下面的例子:
|
||||
|
||||
```
|
||||
$ echo "Welcome to OSTechNIx" | pee cat cat
|
||||
Welcome to OSTechNIx
|
||||
Welcome to OSTechNIx
|
||||
```
|
||||
|
||||
从上面的命令输出中可以看出,有两个 `cat` 命令实例获取 `echo` 命令的输出并执行,因而终端中出现两个同样的输出。
|
||||
|
||||
##### sponge 实用程序
|
||||
|
||||
这是 `moreutils` 软件包中的另一个有用的实用程序。`sponge` 读取标准输入并写入到指定的文件中。与 Shell 中的重定向不同,`sponge` 接收到完整输入后再写入输出文件。
|
||||
|
||||
查看下面这个文本文件的内容:
|
||||
|
||||
```
|
||||
$ cat file1
|
||||
I
|
||||
You
|
||||
Me
|
||||
We
|
||||
Us
|
||||
```
|
||||
|
||||
可见,文件包含了一些无序的行;更具体的说,这些行“没有”按照字母顺序排序。如果希望将其内容安装字母顺序排序,你会怎么做呢?
|
||||
|
||||
```
|
||||
$ sort file1 > file1_sorted
|
||||
```
|
||||
|
||||
这样做没错,对吧?当然没错!在上面的命令中,我将 `file1` 文件内容按照字母顺序排序,将排序后的内容保存在 `file1_sorted` 文件中。但如果使用 `sponge` 命令,你可以在不创建新文件(即 `file1_sorted`)的情况下完成同样的任务,命令如下:
|
||||
|
||||
```
|
||||
$ sort file1 | sponge file1
|
||||
```
|
||||
|
||||
那么,让我们检查一下文件内容是否已经按照字母顺序排序:
|
||||
|
||||
```
|
||||
$ cat file1
|
||||
I
|
||||
Me
|
||||
Us
|
||||
We
|
||||
You
|
||||
```
|
||||
|
||||
看到了吧?并不需要创建新文件。在脚本编程中,这非常有用。另一个好消息是,如果待写入的文件已经存在,`sponge` 会保持其<ruby>权限信息<rt>permissions</rt></ruby>不变。
|
||||
|
||||
##### ts 实用程序
|
||||
|
||||
正如名称所示,`ts` 命令在每一行输出的行首增加<ruby>时间戳<rt>timestamp</rt></ruby>。
|
||||
|
||||
查看如下命令的输出:
|
||||
|
||||
```
|
||||
$ ping -c 2 localhost
|
||||
PING localhost(localhost.localdomain (::1)) 56 data bytes
|
||||
64 bytes from localhost.localdomain (::1): icmp_seq=1 ttl=64 time=0.055 ms
|
||||
64 bytes from localhost.localdomain (::1): icmp_seq=2 ttl=64 time=0.079 ms
|
||||
|
||||
--- localhost ping statistics ---
|
||||
2 packets transmitted, 2 received, 0% packet loss, time 1018ms
|
||||
rtt min/avg/max/mdev = 0.055/0.067/0.079/0.012 ms
|
||||
```
|
||||
|
||||
下面,结合 `ts` 实用程序运行同样地命令:
|
||||
|
||||
```
|
||||
$ ping -c 2 localhost | ts
|
||||
Aug 21 13:32:28 PING localhost(localhost (::1)) 56 data bytes
|
||||
Aug 21 13:32:28 64 bytes from localhost (::1): icmp_seq=1 ttl=64 time=0.063 ms
|
||||
Aug 21 13:32:28 64 bytes from localhost (::1): icmp_seq=2 ttl=64 time=0.113 ms
|
||||
Aug 21 13:32:28
|
||||
Aug 21 13:32:28 --- localhost ping statistics ---
|
||||
Aug 21 13:32:28 2 packets transmitted, 2 received, 0% packet loss, time 4ms
|
||||
Aug 21 13:32:28 rtt min/avg/max/mdev = 0.063/0.088/0.113/0.025 ms
|
||||
```
|
||||
|
||||
对比输出可以看出,`ts` 在每一行行首增加了时间戳。下面给出另一个例子:
|
||||
|
||||
```
|
||||
$ ls -l | ts
|
||||
Aug 21 13:34:25 total 120
|
||||
Aug 21 13:34:25 drwxr-xr-x 2 sk users 12288 Aug 20 20:05 Desktop
|
||||
Aug 21 13:34:25 drwxr-xr-x 2 sk users 4096 Aug 10 18:44 Documents
|
||||
Aug 21 13:34:25 drwxr-xr-x 24 sk users 12288 Aug 21 13:06 Downloads
|
||||
[...]
|
||||
```
|
||||
|
||||
##### vidir 实用程序
|
||||
|
||||
`vidir` 实用程序可以让你使用 `vi` 编辑器(或其它 `$EDITOR` 环境变量指定的编辑器)编辑指定目录的内容。如果没有指定目录,`vidir` 会默认编辑你当前的目录。
|
||||
|
||||
下面的命令编辑 `Desktop` 目录的内容:
|
||||
|
||||
```
|
||||
$ vidir Desktop/
|
||||
```
|
||||
|
||||
![vidir][2]
|
||||
|
||||
上述命令使用 `vi` 编辑器打开了指定的目录,其中目录内的文件都会对应一个数字。下面你可以按照 `vi` 的操作方式来编辑目录中的这些文件:例如,删除行意味着删除目录中对应的文件,修改行中字符串意味着对文件进行重命名。
|
||||
|
||||
你也可以编辑子目录。下面的命令会编辑当前目录及所有子目录:
|
||||
|
||||
```
|
||||
$ find | vidir -
|
||||
```
|
||||
|
||||
请注意命令结尾的 `-`。如果 `-` 被指定为待编辑的目录,`vidir` 会从标准输入读取一系列文件名,列出它们让你进行编辑。
|
||||
|
||||
如果你只想编辑当前目录下的文件,可以使用如下命令:
|
||||
|
||||
```
|
||||
$ find -type f | vidir -
|
||||
```
|
||||
|
||||
只想编辑特定类型的文件,例如 `.PNG` 文件?你可以使用如下命令:
|
||||
|
||||
```
|
||||
$ vidir *.png
|
||||
```
|
||||
|
||||
这时命令只会编辑当前目录下以 `.PNG` 为后缀的文件。
|
||||
|
||||
##### vipe 实用程序
|
||||
|
||||
`vipe` 命令可以让你使用默认编辑器接收 Unix 管道输入,编辑之后使用管道输出供下一个程序使用。
|
||||
|
||||
执行下面的命令会打开 `vi` 编辑器(当然是我默认使用的编辑器),你可以编辑 `echo` 命令的管道输入(即 “Welcome to OSTechNix”),最后将编辑过的内容输出到终端中。
|
||||
|
||||
```
|
||||
$ echo "Welcome to OSTechNIx" | vipe
|
||||
Hello World
|
||||
```
|
||||
|
||||
从上面的输出可以看出,我通过管道将“Welcome to OSTechNix”输入到 `vi` 编辑器中,将内容编辑为“Hello World”,最后显示该内容。
|
||||
|
||||
好了,就介绍这么多吧。我只介绍了一小部分实用程序,而 `moreutils` 包含更多有用的实用程序。我在文章开始的时候已经列出目前 `moreutils` 软件包内包含的实用程序,你可以通过 `man` 帮助页面获取更多相关命令的细节信息。举个例子,如果你想了解 `vidir` 命令,请运行:
|
||||
|
||||
```
|
||||
$ man vidir
|
||||
```
|
||||
|
||||
希望这些内容对你有所帮助。我还将继续分享其它有趣且实用的指南,如果你认为这些内容对你有所帮助,请分享到社交网络或专业圈子,也欢迎你支持 OSTechNix 项目。
|
||||
|
||||
干杯!
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.ostechnix.com/moreutils-collection-useful-unix-utilities/
|
||||
|
||||
作者:[SK][a]
|
||||
选题:[lujun9972](https://github.com/lujun9972)
|
||||
译者:[pinewall](https://github.com/pinewall)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]:https://www.ostechnix.com/author/sk/
|
||||
[1]:data:image/gif;base64,lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7
|
||||
[2]:http://www.ostechnix.com/wp-content/uploads/2017/08/sk@sk_001-1.png
|
Loading…
Reference in New Issue
Block a user