From 93084f56b8664d0943c5ffaa58a7e7d967a3ecd5 Mon Sep 17 00:00:00 2001 From: ypingcn <1344632698@qq.com> Date: Thu, 12 Jan 2017 22:20:39 +0800 Subject: [PATCH 01/33] Delete 20161228 10 Linux System Administrators New Years Resolutions 2017.md --- ...ministrators New Years Resolutions 2017.md | 137 ------------------ 1 file changed, 137 deletions(-) delete mode 100644 sources/tech/20161228 10 Linux System Administrators New Years Resolutions 2017.md diff --git a/sources/tech/20161228 10 Linux System Administrators New Years Resolutions 2017.md b/sources/tech/20161228 10 Linux System Administrators New Years Resolutions 2017.md deleted file mode 100644 index 25ad1a53b9..0000000000 --- a/sources/tech/20161228 10 Linux System Administrators New Years Resolutions 2017.md +++ /dev/null @@ -1,137 +0,0 @@ -translating by ypingcn - -10 Linux System Administrators New Year’s Resolutions (2017) -============================================================ - -As we prepare to bid 2016 a more than deserved farewell, it is a time to make our New Year’s resolutions. Regardless of your experience level as a Linux system administrator, we think it is worthy and well to set goals for growth for the next 12 months. - -In case you are out of ideas, in this post we will share 10 simple professional resolutions that you may want to consider for 2017. - -### 1.: Decide to Automate More - -You don’t need to run like a chicken with its head cut off trying to solve foreseeable problems every day. If you find yourself spending time performing repetitive tasks on a daily basis, you need to stop here and now. - -With all the [Linux-based and open source tools][4] at your disposal, you can give yourself some leisure time by [automating as many of your Linux tasks][5] as possible. - -You will find that several of the following resolutions will help you work towards this goal, so keep reading. - -Additionally, do yourself a favor and take a couple of minutes to browse through our [Free eBooks][6] section. - -Chances are you will want to download the books related to [Bash shell scripting][7] and brush up your skills. Happy automating! - -### 2\. Learn a New Scripting Language - -Although every system administrator should be comfortable using Bash for scripting, it is important to consider other modern and robust tools such as [Python][8]. - -But don’t just take our word for it – check this [2-article series on Python][9] that we published not long ago. You will realize that, among other things, Python brings the power of Object-oriented programming and allows you to write shorter and more robust scripts. - -### 3\. Learn a New Programming Language - -In addition to learning a new scripting language, decide to take some time to start or brush up your programming skills. Not sure where to start? This year’s [Stackoverflow Developer Survey][10] reveals that Javascriptcontinues to lead the list of most popular languages for third year in a row. - -Other all-time favorites such as Java and C are also worthy of your consideration. Do check out our [Best Programming Courses of 2016][11]. - -### 4\. Create a GitHub Account and Update it Regularly - -Especially if you are new to programming, you should consider showcasing your work on GitHub. By allowing others to fork your scripts or programs, you will be able to improve your knowledge and create more sophisticated software through the help of others. - -Learn more on [how to install and create GitHub Account][12]. - -### 5\. Contribute to an Open Source Project - -Another great way to learn (or improve your knowledge about) a new scripting or programming language is by contributing to an open source project on GitHub. - -If this sounds like something that may interest you, check the [Explore GitHub][13] pages. There you can browse repositories by popularity or by language, so you will be able to find something interesting to work on. - -On top of this, you’ll get the satisfaction that comes from giving back to the community. - -### 6\. Try Out a New Distribution Each Month - -With new distributions or spin-offs coming out regularly, you have several options to choose from. Who knows that your dream distribution is just around the corner and you have not discovered it yet? Head to Distrowatchand pick a new distribution each month. - -Also, don’t forget to [subscribe to Tecmint][14] to stay informed about new distros hitting the streets, so to speak. - -Hopefully our reviews will help you to determine if you want to give a new distribution a try. Also do check out our articles on top Linux distributions here: - -1. [Top 5 Best Security-Centric Linux Distributions Of 2016][1] -2. [Top Linux Distributions To look Forward To In 2016][2] -3. [10 Top Most Popular Linux Distributions of 2015][3] - -### 7\. Attend a Linux or Open Source Conference - -If you live near a place where a conference sponsored by the [Linux Foundation][15] is scheduled to take place, I strongly encourage you to attend. - -This will not only provide the opportunity to enhance your knowledge about Linux but also give you the chance to meet other open source professionals. - -### 8\. Learn Free or Paid Course from Linux Foundation - -The Linux Foundation continually offers free and paid courses through edX.org and via their own portal, respectively. - -Topics for free courses include (but may not be limited to) Introduction to Linux, Introduction to Cloud Infrastructure Technologies, and Introduction to OpenStack. - -On the other hand, paid options include preparation for the [LFCS Certification][16] and [LFCE certification][17] exams, Linux for developers, Kernel internals, Linux Security, Performance testing, High Availability, and more. - -As a plus, they offer discounts for enterprise courses, so try to convince your boss to pay for your and your colleagues’ training. Additionally, free webinars are offered on a periodic basis so don’t forget to subscribe to< their newsletters! - -You may also consider checking out our best [Online Linux Training Courses][18]. - -### 9\. Answer X Questions in a Linux Forum Per Week - -Another great way to give back to the community is by helping others who are just starting off with their Linux journey. You will find lots of people looking for answers in Linux forums all over the web. - -Keep in mind that you were once a newbie just like them, and try to put yourself in their shoes. - -### 10\. Teach a Kid or Teenager to Use Linux - -If I could go back 20 years, I wish I had a computer back then and the chance to [learn Linux as a teenager][19]. - -I also wish I had to start off with programming much earlier than I did. Without a doubt, things would have been a whole lot easier. That kind of gives me the perspective that teaching at least basic Linux and programming skills to kids or teenagers (I do it with my own kids) is an important endeavor. - -Educating the raising generation on how to effectively use open source technologies will give them the freedom of choice, and they will thank you forever for it. - -##### Summary - -In this article we have shared 10 prospective New Year’s resolutions for system administrators. The [Tecmint.com][20] wishes you the best of luck as you work towards your goals and hope to keep you as a frequent reader in 2017. - -As always, don’t hesitate to use the form below if you have questions or comments about this article. We look forward to hearing from you! - --------------------------------------------------------------------------------- - - -作者简介: - -![](http://1.gravatar.com/avatar/d9d14c5b51331864398e6288cb0c2091?s=128&d=blank&r=g) - -Gabriel Cánepa is a GNU/Linux sysadmin and web developer from Villa Mercedes, San Luis, Argentina. He works for a worldwide leading consumer product company and takes great pleasure in using FOSS tools to increase productivity in all areas of his daily work. - --------------------------------------------------------------------------------- - -via: http://www.tecmint.com/linux-system-administrators-new-years-resolutions-ideas/ - -作者:[Gabriel Cánepa][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:http://www.tecmint.com/author/gacanepa/ -[1]:http://www.tecmint.com/best-security-centric-linux-distributions-of-2016/ -[2]:http://www.tecmint.com/top-linux-distributions-to-look-forward-in-2016/ -[3]:http://www.tecmint.com/10-top-most-popular-linux-distributions-of-2015/ -[4]:http://www.tecmint.com/category/top-tools/ -[5]:http://www.tecmint.com/using-shell-script-to-automate-linux-system-maintenance-tasks/ -[6]:http://tecmint.tradepub.com/category/information-technology-servers-and-linux-server-os/806/ -[7]:http://tecmint.tradepub.com/free/w_syst05/?p=w_syst05 -[8]:http://www.tecmint.com/category/python/ -[9]:http://www.tecmint.com/learn-python-programming-and-scripting-in-linux/ -[10]:http://stackoverflow.com/research/developer-survey-2016#technology -[11]:https://deals.tecmint.com/collections/best-of-bundles-2016 -[12]:http://www.tecmint.com/install-git-centos-fedora-redhat/ -[13]:https://help.github.com/articles/where-can-i-find-open-source-projects-to-work-on/ -[14]:http://subscribe.tecmint.com/newsletter -[15]:http://events.linuxfoundation.org/ -[16]:http://www.tecmint.com/sed-command-to-create-edit-and-manipulate-files-in-linux/ -[17]:http://www.tecmint.com/installing-network-services-and-configuring-services-at-system-boot/ -[18]:http://www.tecmint.com/linux-online-training-courses/ -[19]:http://www.tecmint.com/free-online-linux-learning-guide-for-beginners/ -[20]:http://tecmint.com/ From 2250e2d0f2e85a0400b514cc05554c1793a015e4 Mon Sep 17 00:00:00 2001 From: wxy Date: Thu, 12 Jan 2017 22:21:35 +0800 Subject: [PATCH 02/33] PUB:20170104 5 Ways to Find a Binary Command Description and Location on File System @geekpi --- ...Description and Location on File System.md | 51 ++++++++++--------- 1 file changed, 28 insertions(+), 23 deletions(-) rename {translated/tech => published}/20170104 5 Ways to Find a Binary Command Description and Location on File System.md (69%) diff --git a/translated/tech/20170104 5 Ways to Find a Binary Command Description and Location on File System.md b/published/20170104 5 Ways to Find a Binary Command Description and Location on File System.md similarity index 69% rename from translated/tech/20170104 5 Ways to Find a Binary Command Description and Location on File System.md rename to published/20170104 5 Ways to Find a Binary Command Description and Location on File System.md index 6d49f75fa7..1468fe38df 100644 --- a/translated/tech/20170104 5 Ways to Find a Binary Command Description and Location on File System.md +++ b/published/20170104 5 Ways to Find a Binary Command Description and Location on File System.md @@ -1,33 +1,34 @@ -5个找出“二进制命令”描述和系统中位置的方法 +5 个找出“二进制命令”描述和系统中位置的方法 ============================================================ -在数千个[ Linux 系统可用的命令/程序][1]中,知道给定命令的类型和目的以及其在系统上的位置(绝对路径)对于新手来说可能是一个挑战。 +在数千个 [Linux 系统上的命令/程序][1]中,知道给定命令的类型和目的以及其在系统上的位置(绝对路径)对于新手来说可能是一个挑战。 -知道命令/程序的一些细节不仅有助于[ Linux 用户掌握大量命令][2],还能使用户理解命令行或脚本在系统上的操作。 +知道命令/程序的一些细节不仅有助于 [Linux 用户掌握大量命令][2],还能使用户理解命令行或脚本在系统上的操作。 因此,在本文中我们将向你解释五个有用的命令,用于显示给定命令的简短描述和位置。 要在系统上发现新命令,请查看 PATH 环境变量中的所有目录。这些目录存储系统上安装的所有命令/程序。 -一旦你找到一个有趣的命令名,在继续阅读更多关于它的手册页之前,请尝试如下收集一些简要的信息。 +一旦你找到一个有趣的命令,在继续阅读更多关于它的手册页之前,请尝试如下收集一些简要的信息。 -假设你输出了 PATH 的值,并进到目录 /usr/local/bin,注意到一个名为[ fswatch(监视文件修改更改)][3]的新命令: +假设你输出了 `PATH` 的值,然后进到其中的一个目录 `/usr/local/bin`,注意到一个名为 [`fswatch`(监视文件修改更改)][3]的新命令: ``` $ echo $PATH $ cd /usr/local/bin ``` + [ ![Find New Commands in Linux](http://www.tecmint.com/wp-content/uploads/2017/01/Find-New-Commands-in-Linux.png) ][4] *在 Linux 中找出新命令* -现在让我们在 Linux 中用不同的方法找出 fswatch 命令的描述和位置。 +现在让我们在 Linux 中用不同的方法找出 `fswatch` 命令的描述和位置。 -### 1\. whatis 命令 +### 1、 whatis 命令 -whatis 用于显示你作为参数输入的命令名的单行描述(例如下面命令中的fswatch)。 +`whatis` 用于显示你作为参数输入的命令名的单行描述(例如下面命令中的 `fswatch`)。 如果描述太长,一些部分在默认情况下会被省略,使用 `-l` 标志来显示完整的描述。 @@ -41,9 +42,9 @@ $ whatis -l fswatch *Linux whatis 命令示例* -### 2\. apropos 命令 +### 2、 apropos 命令 -**apropos** 会搜索手册页名称和关键字描述(命令名作为正则)。 +`apropos` 会搜索手册页名称和关键字描述(以命令名作为正则表达式搜索)。 使用 `-l` 标志来显示完整的描述。 @@ -51,13 +52,14 @@ $ whatis -l fswatch $ apropos fswatch $ apropos -l fswatch ``` + [ ![Linux apropos Command Example](http://www.tecmint.com/wp-content/uploads/2017/01/Linux-apropos-Command-Example.png) ][6] *Linux apropos 命令示例* -默认上,apropos 会如示例那样输出所有匹配的行。你可以使用 `-e` 选项来精确匹配: +默认上,`apropos` 会如示例那样输出所有匹配的行。你可以使用 `-e` 选项来精确匹配: ``` $ apropos fmt @@ -69,54 +71,57 @@ $ apropos -e fmt *Linux apropos 命令根据关键词显示* -### 3\. type 命令 +### 3、 type 命令 -**type** 命令会输出给定命令的完整路径名,此外,如果输入的命令名不是做为独立磁盘文件存在的程序,type 还会告诉你命令分类: +`type` 命令会输出给定命令的完整路径名,此外,如果输入的命令名不是做为独立存储在磁盘的文件的程序,`type` 还会告诉你命令分类: -- shell 内置命令 或 -- shell 关键字或保留字 或 -- 别名 +- shell 内置命令 +- shell 关键字或保留字 +- 别名 ``` $ type fswatch ``` + [ ![Linux type Command Example](http://www.tecmint.com/wp-content/uploads/2017/01/Linux-type-Command-Example.png) ][8] *Linux type 命令示例* -当命令是另外一个命令的别名时,**type** 会显示运行别名时执行的命令。使用 **alias** 命令查看你系统上创建的所有别名: +当命令是另外一个命令的别名时,`type` 会显示运行别名时所执行的命令。使用 `alias` 命令可以查看你系统上创建的所有别名: ``` $ alias $ type l $ type ll ``` + [ ![Show All Aliases in Linux](http://www.tecmint.com/wp-content/uploads/2017/01/Show-All-Aliases-in-Linux.png) ][9] *显示 Linux 中所有别名* -### 4\. which 命令 +### 4、 which 命令 -**which** 帮助命令定位,它打印出命令的绝对路径: +`which` 可以帮助命令定位命令,它会打印出命令的绝对路径: ``` $ which fswatch ``` + [ ![Find Linux Command Location](http://www.tecmint.com/wp-content/uploads/2017/01/Find-Linux-Command-Location.png) ][10] *找出 Linux 命令位置* -一些二进制文件存在于 PATH 中的多个目录,使用 `-a` 标志来找出所有匹配的路径名。 +一些二进制文件存在于 `PATH` 环境变量中的多个目录,使用 `-a` 标志来找出所有匹配的路径名。 -### 5\. whereis 命令 +### 5、 whereis 命令 -**whereis** 定位指定命令名的二进制、源和帮助页文件,如下所示: +`whereis` 定位指定命令名的二进制、源和帮助页文件,如下所示: ``` $ whereis fswatch @@ -148,7 +153,7 @@ Aaron Kili 是 Linux 和 F.O.S.S 爱好者,将来的 Linux SysAdmin、web 开 -------------------------------------------------------------------------------- via: http://www.tecmint.com/find-linux-command-description-and-location/ -作者:[Aaron Kili ][a] +作者:[Aaron Kili][a] 译者:[geekpi](https://github.com/geekpi) 校对:[jasminepeng](https://github.com/jasminepeng) From 3dc941b1db96402f6fce61fdba9c792e72269d49 Mon Sep 17 00:00:00 2001 From: ypingcn <1344632698@qq.com> Date: Thu, 12 Jan 2017 22:26:18 +0800 Subject: [PATCH 03/33] translated --- ...ministrators New Years Resolutions 2017.md | 139 ++++++++++++++++++ 1 file changed, 139 insertions(+) create mode 100644 translated/tech/20161228 10 Linux System Administrators New Years Resolutions 2017.md diff --git a/translated/tech/20161228 10 Linux System Administrators New Years Resolutions 2017.md b/translated/tech/20161228 10 Linux System Administrators New Years Resolutions 2017.md new file mode 100644 index 0000000000..1a21e63580 --- /dev/null +++ b/translated/tech/20161228 10 Linux System Administrators New Years Resolutions 2017.md @@ -0,0 +1,139 @@ + +10个 Linux 系统管理员新年决心 +============================================================ + +当我们准备告别2016时,也到时间定下我们的新年决心了。不管你身为 Linux 系统管理员的经验水平如何,我们认为,制定接下来12个月的成长目标是很值得的。 + +万一你没什么想法的话,我们将会在这篇文章分享10个简单专业的决心,你可以为 2017 年考虑一下。 + +### 1. 决定更自动化 + +你没必要每天忙得像头无头苍蝇,忙于解决可预见的问题。如果你发现自己每天都花费时间在执行重复的任务,你有必要现在就停下来。 + +你了解了所有[基于 Linux 而且开源的工具][4]后,你能通过尽可能地[自动化你的 Linux 任务][5]来给你自己休闲的时间。 + +你会发现,接下来的几个决心会帮你在工作上朝着这个目标前进。所以继续看下去吧。 + +另外,帮自己一个忙,花费几分钟来浏览我们[免费的电子书][6]部分。 + +你将有机会下载跟[Bash shell 脚本编程][7]相关的书籍来巩固你的技能。开心地自动化! + +### 2\. 学习一门新的脚本语言 + +虽然每一个系统管理员应该熟练地使用 Bash 编程,但考虑一下其他更现代化、鲁棒性更强的工具也是很重要的,例如 Python 。 + +但别只是相信我们说的话——点这个不久之前我们出版的[两篇关于 Python 的系列文章][9]。你将会意识到,与其他相比,Python 带来了面向对象编程的力量和允许你写出更短、鲁棒性更强的脚本。 + +### 3\. 学习一门新的编程语言 + +除了学习一门新的脚本语言,(你也可以)决定花费点时间来开始学习或者巩固你的编程技能。不确定从何处开始?今年的 [Stackoverflow 开发者调查][10]表明 Javascript连续第三年继续引领最流行语言的榜单。 + +其他经典例如 Java 和 C 也值得考虑。来看我们[2016年最好的编程课程][11] + +### 4\. 注册一个 Github 账户并且定期更新 + +特别是如果你是一个编程新手,你应该考虑一下在 Github 上展示你的成果。通过允许别人去复刻你的脚本或者程序,你就能提高知识水平和通过别人的帮帮助来创造出更复杂的软件。 + +在[《如何安装和注册 Github 帐号》][12]一文中了解更多。 + +### 5\. 向一个开源项目做贡献 + +在 Github 上向一个开源项目做贡献,这是另一个学习或者提高一门新脚本语言或者编程语言能力的好办法。 + +如果这吸引到了你的兴趣,点击 [Explore Github][13] 页面。这里你能按热度或者编程语言浏览仓库,你能在这里面找到一些有趣的事情来做。 + +在此基础上,你能因回馈社区而获得满足感。 + + +### 6\. 每月尝试一个新的发行版 + +经常会有新的发行版或者分支出现,你有不同的选项以供选择。谁知道你梦想中的发行版是否就在角落,而你还没发现它?每个月去一次 Distrowatch 然后选择一个新的发行版。 + +也别忘了[订阅 Techmint][14] 来获取新发行版的消息,这样说吧,了解刚出现的发行版。 + +如果你想要尝试一个新的发行版,希望我们的评论能帮你做出决定。也可以点击我们这里关于最好的 Linux发行版的文章: + + +1. [2016年最好的5个注重安全的 Linux 发行版][1] +2. [2016年最值得期待的 Linux 发行版][2] +3. [2015年最流行的10个 Linux 发行版][3] + +### 7\. 参加一个 Linux 或者开源会议。 + +如果你住在由 Linux 基金会赞助的会议举办地附近,我强烈建议你去参加会议。 + +这不仅将会给你一个巩固关于 Linux 知识的机会,而且将是个会见其他开源专家的机会。 + +### 8\. 从 Linux 基金会的免费或付费课程中学习 + +Linux 基金会分别通过 edX.org 和他们自己的入口,不断地提供免费或付费课程。 + +免费课程的话题包括(但不仅限于)Linux 介绍,云基础设施技术介绍和 OpenStack 介绍。 + +另一方面,付费课程包括 [LFCS 认证][16] 和 [LFCE 认证][17] 考试的准备,给开发者的 Linux ,内核内部构件,Linux 安全,性能试验,高可用性及其他。 + +另外,他们对企业课程有折扣,所以尝试去说服你上司来为你和你同事的训练付费。还有,也会提供周期性的免费在线研讨会,所以别忘了订阅他们的时事通讯。 + +你也可以考虑下看看我们最棒的[在线 Linux 训练课程][18] + +### 9\. 每周在 Linux 论坛上回答特定数量的问题 + +另一个回馈社区的好方法是帮助那些刚开始使用 Linux 的人。你将会发现全网的 Linux 论坛上有许多人正在寻找着答复。 + +牢记你曾经也是像他们那样是个新手,试着换位思考。 + +### 10\. 教一个孩子或少年使用 Linux + +如果我能回到20年前,我希望我能有台电脑,有个能[在青年时学习 Linux ][19]的机会。 + +我也希望我能比现在尽早地开始编程。毫无疑问,这样事情就会变得简单许多。那样会使我认为给孩子和青年教授至少是基础的 Linux 和编程技巧(我对我的孩子这样做)是个重要的尝试。 + +教育成长中的一代如何有效地使用开源技术将会给他们选择的自由,而他们会因此永远感激你。 + +##### 总结 +##### Summary + +在这篇文章里我们分享了10个适合系统管理员的可能新年决心。[Tecmint.com][20]祝你在朝着目标的工作顺顺利利,希望你能在2017年成为我们网站的常客。 + +如果你有关于这篇文章的问题或者评论,永远不要犹豫地使用下面的表格。我们期待着收到您的信息。 + +-------------------------------------------------------------------------------- + + +作者简介: + +![](http://1.gravatar.com/avatar/d9d14c5b51331864398e6288cb0c2091?s=128&d=blank&r=g) + +Gabriel Cánepa 是个 GNU/Linux 系统管理员和网页开发者,他来自阿根廷圣路易斯的 Villa Mercedes 。他供职于全球领先的消费品公司,享受在日常工作的方方面面使用 FOSS(自由及开源软件) 工具来提高生产效率。 + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/linux-system-administrators-new-years-resolutions-ideas/ + +作者:[Gabriel Cánepa][a] +译者:[ypingcn](https://github.com/ypingcn) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: http://www.tecmint.com/author/gacanepa/ +[1]: http://www.tecmint.com/best-security-centric-linux-distributions-of-2016/ +[2]: http://www.tecmint.com/top-linux-distributions-to-look-forward-in-2016/ +[3]: http://www.tecmint.com/10-top-most-popular-linux-distributions-of-2015/ +[4]: http://www.tecmint.com/category/top-tools/ +[5]: http://www.tecmint.com/using-shell-script-to-automate-linux-system-maintenance-tasks/ +[6]: http://tecmint.tradepub.com/category/information-technology-servers-and-linux-server-os/806/ +[7]: http://tecmint.tradepub.com/free/w_syst05/?p=w_syst05 +[8]: http://www.tecmint.com/category/python/ +[9]: http://www.tecmint.com/learn-python-programming-and-scripting-in-linux/ +[10]: http://stackoverflow.com/research/developer-survey-2016#technology +[11]: https://deals.tecmint.com/collections/best-of-bundles-2016 +[12]: http://www.tecmint.com/install-git-centos-fedora-redhat/ +[13]: https://help.github.com/articles/where-can-i-find-open-source-projects-to-work-on/ +[14]: http://subscribe.tecmint.com/newsletter +[15]: http://events.linuxfoundation.org/ +[16]: http://www.tecmint.com/sed-command-to-create-edit-and-manipulate-files-in-linux/ +[17]: http://www.tecmint.com/installing-network-services-and-configuring-services-at-system-boot/ +[18]: http://www.tecmint.com/linux-online-training-courses/ +[19]: http://www.tecmint.com/free-online-linux-learning-guide-for-beginners/ +[20]: http://tecmint.com/ From 768304d613561c678f56c8ebf07326fbcd874082 Mon Sep 17 00:00:00 2001 From: xiaojin Date: Thu, 12 Jan 2017 22:38:09 +0800 Subject: [PATCH 04/33] =?UTF-8?q?Delete=2020170105=20PhotoRec=20=E2=80=93?= =?UTF-8?q?=20Recover=20Deleted=20or=20Lost=20Files=20in=20Linux.md?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 翻译完成,删除原文 --- ... Recover Deleted or Lost Files in Linux.md | 178 ------------------ 1 file changed, 178 deletions(-) delete mode 100644 sources/tech/20170105 PhotoRec – Recover Deleted or Lost Files in Linux.md diff --git a/sources/tech/20170105 PhotoRec – Recover Deleted or Lost Files in Linux.md b/sources/tech/20170105 PhotoRec – Recover Deleted or Lost Files in Linux.md deleted file mode 100644 index b9e18192bb..0000000000 --- a/sources/tech/20170105 PhotoRec – Recover Deleted or Lost Files in Linux.md +++ /dev/null @@ -1,178 +0,0 @@ -#rusking translating - -PhotoRec – Recover Deleted or Lost Files in Linux -============================================================ - -When you delete a file accidentally or intentionally on your system using ‘shift + delete‘ or delete option or empty Trash, the file content is not destroyed from the hard disk (or any storage media). - -It is simply removed from the the directory structure and you cannot see the file in the directory where you deleted it, but it still remains somewhere in your hard drive. - -If you have the appropriate tools and knowledge, you can [recover lost files from your computer][1]. However, as you store more files on your hard disk, the deleted files are overwritten, you may only recover recently deleted files. - -In this tutorial, we will explain how to recover lost or deleted files on a hard disk in Linux using Testdisk, is a remarkable recovery tool ships in with a free tool called PhotoRec. - -PhotoRec is used to recover lost files from storage media such as hard drives, digital camera and cdrom. - -### Install Testdisk (PhotoRec) in Linux Systems - -To install Testdisk by running the relevant command below for your distribution: - -``` -------- On Debian/Ubuntu/Linux Mint ------- -$ sudo apt-get install testdisk -------- On CentOS/RHEL/Fedora ------- -$ sudo yum install testdisk -------- On Fedora 22+ ------- -$ sudo dnf install testdisk -------- On Arch Linux ------- -$ pacman -S testdisk -------- On Gentoo ------- -$ emerge testdisk -``` - -In case it is not available on your Linux distribution’s repositories, download it from [here][2] and run it on a Live CD. - -It can also be found in rescue CD such as Gparted LiveCD, Parted Magic, Ubuntu Boot CD, Ubuntu-Rescue-Remix and many more. - -Once the installation is complete, start PhotoRec in a text window as follows with root privileges and specify the partition from which the files where deleted: - -``` -$ sudo photorec /dev/sda3 -``` - -You’ll see the interface below: - -[ - ![PhotoRec Data Recovery Tool for Linux](http://www.tecmint.com/wp-content/uploads/2017/01/PhotoRec-Data-Recovery-Tool.png) -][3] - -PhotoRec Data Recovery Tool for Linux - -Use the `right` and `left` arrow keys to select a menu item, and press Enter. To continue with the recovery operation, select `[Proceed]` and hit Enter. - -You will be at the following interface: - -[ - ![Select Partition to Proceed File Recovery](http://www.tecmint.com/wp-content/uploads/2017/01/Select-Partition-to-Proceed-File-Recovery.png) -][4] - -Select Partition to Proceed File Recovery - -Select `[Options]` to view available recovery operation options as in the interface below: - -[ - ![Linux File Recovery Options](http://www.tecmint.com/wp-content/uploads/2017/01/Linux-File-Recovery-Options.png) -][5] - -Linux File Recovery Options - -Press `Q` to move back, at the interface below, you can specify the file extensions you want to search and recover. Therefore, select `[File Opt]` and press Enter. - -Press `s` to disable/enable all file extensions, and in case you have disabled all file extensions, only choose types of files you want to recover by selecting them using `right` arrow keys (or `left` arrow key to deselect). - -For instance, I want to recover all `.mov` files that I lost on my system. - -[ - ![Specify Recovery File Type](http://www.tecmint.com/wp-content/uploads/2017/01/Specify-Recovery-File-Type.png) -][6] - -Specify Recovery File Type - -Then press `b` to save the setting, you should see the message below after pressing it. Move back by hitting Enter (or simply press `Q` button), then press `Q` again to go back to the main menu. - -[ - ![Save File Recovery Settings](http://www.tecmint.com/wp-content/uploads/2017/01/Save-File-Recovery-Settings.png) -][7] - -Save File Recovery Settings - -Now select `[Search]` to start the recovery process. In the interface below, choose the filesystem type where the file(s) were stored and hit Enter. - -[ - ![Select Filesystem to Recover Deleted Files](http://www.tecmint.com/wp-content/uploads/2017/01/Select-Filesystem-to-Recover-Files.png) -][8] - -Select Filesystem to Recover Deleted Files - -Next, choose if only free space or the whole partition needs to be analyzed as below. Note that choosing whole partition will make the operation slower and longer. Once you have selected the appropriate option, press Enterto proceed. - -[ - ![Choose Filesystem to Analyze](http://www.tecmint.com/wp-content/uploads/2017/01/Select-Filesystem-to-Analyze.png) -][9] - -Choose Filesystem to Analyze - -Closely select a directory where recovered files will be stored, if the destination is correct, press `C` button to continue. Choose a directory on a different partition to avoid deleted files being overwritten when more data is stored on the partition. - -To move back until the root partition, use the `left` arrow key. - -[ - ![Select Directory to Save Recovered Files](http://www.tecmint.com/wp-content/uploads/2017/01/Select-Directory-to-Save-Recovered-Files.png) -][10] - -Select Directory to Save Recovered Files - -The screenshot below shows deleted files of the specified type being recovered. You can stop the operation by pressing Enter. - -Note: Your system may become slow, and possibly freeze at certain moments, so you need to be patient until when the process is complete. - -[ - ![Recovering Deleted Files in Linux](http://www.tecmint.com/wp-content/uploads/2017/01/Recover-Deleted-Files-in-Linux.png) -][11] - -Recovering Deleted Files in Linux - -At the end of the operation, Photorec will show you the number and the location of files recovered. - -[ - ![Linux File Recovery Summary](http://www.tecmint.com/wp-content/uploads/2017/01/Linux-File-Recovery-Summary.png) -][12] - -Linux File Recovery Summary - -The recovered files will be stored with root privileges by default, therefore open your file manager with elevated privileges to access the files. - -Use the command below (specify your file manager): - -``` -$ gksudo nemo -or -$ gksudo nautilus -``` - -For more information, visit PhotoRec homepage: [http://www.cgsecurity.org/wiki/PhotoRec][13]. - -That’s all! In this tutorial, we explained the necessary steps to recover deleted or lost files from hard disk using PhotoRec. This is so far the most reliable and effective recovery tool I have ever used, if you know any other similar tool, do share with us in the comments. - --------------------------------------------------------------------------------- - -作者简介: - -![](http://1.gravatar.com/avatar/4e444ab611c7b8c7bcb76e58d2e82ae0?s=128&d=blank&r=g) - -Aaron Kili is a Linux and F.O.S.S enthusiast, an upcoming Linux SysAdmin, web developer, and currently a content creator for TecMint who loves working with computers and strongly believes in sharing knowledge. - --------------------------------------------------------------------------------- - -via: http://www.tecmint.com/photorec-recover-deleted-lost-files-in-linux/ - -作者:[Aaron Kili][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:http://www.tecmint.com/author/aaronkili/ -[1]:http://www.tecmint.com/recover-deleted-file-in-linux/ -[2]:http://www.cgsecurity.org/wiki/TestDisk_Download -[3]:http://www.tecmint.com/wp-content/uploads/2017/01/PhotoRec-Data-Recovery-Tool.png -[4]:http://www.tecmint.com/wp-content/uploads/2017/01/Select-Partition-to-Proceed-File-Recovery.png -[5]:http://www.tecmint.com/wp-content/uploads/2017/01/Linux-File-Recovery-Options.png -[6]:http://www.tecmint.com/wp-content/uploads/2017/01/Specify-Recovery-File-Type.png -[7]:http://www.tecmint.com/wp-content/uploads/2017/01/Save-File-Recovery-Settings.png -[8]:http://www.tecmint.com/wp-content/uploads/2017/01/Select-Filesystem-to-Recover-Files.png -[9]:http://www.tecmint.com/wp-content/uploads/2017/01/Select-Filesystem-to-Analyze.png -[10]:http://www.tecmint.com/wp-content/uploads/2017/01/Select-Directory-to-Save-Recovered-Files.png -[11]:http://www.tecmint.com/wp-content/uploads/2017/01/Recover-Deleted-Files-in-Linux.png -[12]:http://www.tecmint.com/wp-content/uploads/2017/01/Linux-File-Recovery-Summary.png -[13]:http://www.cgsecurity.org/wiki/PhotoRec From cac63837af1ec8cd68823d3903b30f0912788013 Mon Sep 17 00:00:00 2001 From: xiaojin Date: Thu, 12 Jan 2017 22:40:12 +0800 Subject: [PATCH 05/33] =?UTF-8?q?Add=2020170105=20PhotoRec=20=E2=80=93=20R?= =?UTF-8?q?ecover=20Deleted=20or=20Lost=20Files=20in=20Linux?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 翻译完成,添加译文 --- ... Recover Deleted or Lost Files in Linux.md | 177 ++++++++++++++++++ 1 file changed, 177 insertions(+) create mode 100644 translated/tech/20170105 PhotoRec – Recover Deleted or Lost Files in Linux.md diff --git a/translated/tech/20170105 PhotoRec – Recover Deleted or Lost Files in Linux.md b/translated/tech/20170105 PhotoRec – Recover Deleted or Lost Files in Linux.md new file mode 100644 index 0000000000..80262071f0 --- /dev/null +++ b/translated/tech/20170105 PhotoRec – Recover Deleted or Lost Files in Linux.md @@ -0,0 +1,177 @@ +PhotoRec – Recover Deleted or Lost Files in Linux +============================================================ +在 Linux 系统下使用 PhotoRec 工具来恢复已删除或丢失的文件 + +当你在系统中有意或无意地使用 'shift + delete‘ 组合键或者删除选项或是清空回收站的方式来删除一个文件时,该文件的内容并没有从硬盘(或是其它存储设备)上直接销毁。 + +它仅仅是从系统的目录结构中被移除,然后你在删除文件的目录下就看不到该文件了,但是这个文件仍然存在你磁盘中的某个位置上。 + +如果你有一个合适的工具和相关的专业知识,你就可以[从电脑中恢复已丢失的文件][1]。然而,随着你存储的文件越来越多,删除的文件将会被覆盖,你只能恢复最近删除的文件。 + +在这篇文章中,我们将阐明如何在 Linux 系统中使用磁盘分区修复工具来恢复硬盘上已删除或丢失的文件,这个非常优秀的免费修复工具叫做 PhotoRec 。 + +PhoteRec 工具用于从存储介质比如硬盘,数码相机和 cdrom 设备中恢复丢失的文件。 + +### 在 Linux 系统中安装磁盘分区修复工具(PhotoRec) + +在系统中执行以下相关的命令来安装磁盘分区修复工具: + +``` +------- On Debian/Ubuntu/Linux Mint ------- +$ sudo apt-get install testdisk +------- On CentOS/RHEL/Fedora ------- +$ sudo yum install testdisk +------- On Fedora 22+ ------- +$ sudo dnf install testdisk +------- On Arch Linux ------- +$ pacman -S testdisk +------- On Gentoo ------- +$ emerge testdisk +``` + +如果你的 Linux 系统 yum 源仓库中没有这个安装包,可以从 [这里][2] 下载然后在 Live CD 中运行即可。 + +这个安装包也可以在其它应急修复 CD 工具中找到,比如 Gparted LiveCD 、 Parted Magic 、 Ubuntu Boot CD 、 Ubuntu-Rescue-Remix 及其它工具中也有。 + +安装完成之后,使用 root 账号权限打开控制台界面,启动 PhotoRec 工具,并指定已删除文件的分区: + +``` +$ sudo photorec /dev/sda3 +``` + +你将会看到下面的交互界面: + +[ + ![PhotoRec Data Recovery Tool for Linux](http://www.tecmint.com/wp-content/uploads/2017/01/PhotoRec-Data-Recovery-Tool.png) +][3] + +Linux 系统 PhotoRec 数据恢复工具 + +使用左右箭头选择菜单选项,按 Enter 键确认。要继续恢复操作,选择 '[继续]' 并单击 Enter。 + +你将看到下面的界面: + +[ + ![Select Partition to Proceed File Recovery](http://www.tecmint.com/wp-content/uploads/2017/01/Select-Partition-to-Proceed-File-Recovery.png) +][4] + +选择分区进行文件恢复 + +选择 '[选项]' 来查看可用的恢复选项,如下图所示: + +[ + ![Linux File Recovery Options](http://www.tecmint.com/wp-content/uploads/2017/01/Linux-File-Recovery-Options.png) +][5] + +Linux 系统文件恢复选项 + +按 `Q`  返回,在下图界面,你可以指定你想要查询并恢复的文件扩展名。因此,选择 '[文件选项]' ,按 Enter 键确认。 + +按 's' 停止或启用所有文件扩展名,如果你已经停止所有文件扩展,只需要使用向右箭头选择你想要恢复的文件类型即可(或者按向左箭头取消选择)。 + +例如,我想恢复所有系统中丢失的 ’.mov‘ 类型的文件: + +[ + ![Specify Recovery File Type](http://www.tecmint.com/wp-content/uploads/2017/01/Specify-Recovery-File-Type.png) +][6] + +指定恢复文件类型 + +按 ‘b’ 键保存设置,之后你应该看到如下图所示信息。单击 Enter 键返回(或者按 ‘Q' 键),再将按 ’Q' 键返回到主界面。 + +[ + ![Save File Recovery Settings](http://www.tecmint.com/wp-content/uploads/2017/01/Save-File-Recovery-Settings.png) +][7] + +保存文件恢复设置 + +现在选择 '[查询]' 开始文件恢复。在下图中,选择存储文件分区的文件系统类型,然后按 Enter 键。 + +[ + ![Select Filesystem to Recover Deleted Files](http://www.tecmint.com/wp-content/uploads/2017/01/Select-Filesystem-to-Recover-Files.png) +][8] + +选择文件系统类型来恢复删除的文件 + +下一步,如下图所示,选择是否对空闲空间或者是整个分区进行分析。注意选择整个分区将会让操作过程变得更长更慢。选择合适的选项后,按 Enter 键继续。 + +[ + ![Choose Filesystem to Analyze](http://www.tecmint.com/wp-content/uploads/2017/01/Select-Filesystem-to-Analyze.png) +][9] + +选择文件系统进行分析 + +注意选择一个目录用于存储将要恢复的文件,选择完成之后,按 ’C' 键继续。选择不同分区的目录以避免当更多的文件存储在这个分区时覆盖掉已删除的文件。 + +按向左箭头返回到根分区下。 + +[ + ![Select Directory to Save Recovered Files](http://www.tecmint.com/wp-content/uploads/2017/01/Select-Directory-to-Save-Recovered-Files.png) +][10] + +选择要保存恢复文件的目录 + +下图显示正在被恢复的指定类型的已删除文件。你可以按 Enter 键来停止操作。 + +注意:在恢复的过程中,你的系统会变得很慢,很可能会卡住一段时间,请耐心等待直至恢复完成。 + +[ + ![Recovering Deleted Files in Linux](http://www.tecmint.com/wp-content/uploads/2017/01/Recover-Deleted-Files-in-Linux.png) +][11] + +在 Linux 系统中恢复已删除的文件 + +最后, Photorec 工具将会显示出已恢复文件的数量及保存的路径。 + +[ + ![Linux File Recovery Summary](http://www.tecmint.com/wp-content/uploads/2017/01/Linux-File-Recovery-Summary.png) +][12] + +Linux 文件恢复总结 + +默认情况下,已恢复的文件将会以 root 账号权限被保存,因此,你需要以提升权限的方式打开文件管理器来访问这些文件。 + +使用如下命令(指定你的文件管理器): + +``` +$ gksudo nemo +or +$ gksudo nautilus +``` + +想了解更多的信息,访问 PhotoRec 官网: [http://www.cgsecurity.org/wiki/PhotoRec][13]。 + +到此为止吧!在这篇文章中,我们阐明了使用 PhotoRec 工具来恢复磁盘中已删除或丢失文件每一个步骤。这是目前为止我使用过的最可靠和有效的恢复工具,如果你知道还有其它相似的工具,请在评论中跟大家分享。 + +-------------------------------------------------------------------------------- + +作者简介: + +![](http://1.gravatar.com/avatar/4e444ab611c7b8c7bcb76e58d2e82ae0?s=128&d=blank&r=g) + +Aaron Kili 是一个 Linux 系统及 F.O.S.S 爱好者,即将成为一名系统管理员及 Web 开发人员,他现在是 TecMint 网站的内容创建者,他喜欢使用电脑来工作,并且他坚信分享知识是一种美德。 + +-------------------------------------------------------------------------------- + +via: http://www.tecmint.com/photorec-recover-deleted-lost-files-in-linux/ + +作者:[Aaron Kili][a] +译者:[rusking](https://github.com/rusking) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://www.tecmint.com/author/aaronkili/ +[1]:http://www.tecmint.com/recover-deleted-file-in-linux/ +[2]:http://www.cgsecurity.org/wiki/TestDisk_Download +[3]:http://www.tecmint.com/wp-content/uploads/2017/01/PhotoRec-Data-Recovery-Tool.png +[4]:http://www.tecmint.com/wp-content/uploads/2017/01/Select-Partition-to-Proceed-File-Recovery.png +[5]:http://www.tecmint.com/wp-content/uploads/2017/01/Linux-File-Recovery-Options.png +[6]:http://www.tecmint.com/wp-content/uploads/2017/01/Specify-Recovery-File-Type.png +[7]:http://www.tecmint.com/wp-content/uploads/2017/01/Save-File-Recovery-Settings.png +[8]:http://www.tecmint.com/wp-content/uploads/2017/01/Select-Filesystem-to-Recover-Files.png +[9]:http://www.tecmint.com/wp-content/uploads/2017/01/Select-Filesystem-to-Analyze.png +[10]:http://www.tecmint.com/wp-content/uploads/2017/01/Select-Directory-to-Save-Recovered-Files.png +[11]:http://www.tecmint.com/wp-content/uploads/2017/01/Recover-Deleted-Files-in-Linux.png +[12]:http://www.tecmint.com/wp-content/uploads/2017/01/Linux-File-Recovery-Summary.png +[13]:http://www.cgsecurity.org/wiki/PhotoRec From 59f3aaffb5a81cbdf9bccc541f12df0fab24b120 Mon Sep 17 00:00:00 2001 From: xiaojin Date: Thu, 12 Jan 2017 22:48:54 +0800 Subject: [PATCH 06/33] Update 20161220 How Linux got to be Linux: Test driving 1993-2003 distros.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 申请翻译 --- ...How Linux got to be Linux: Test driving 1993-2003 distros.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sources/tech/20161220 How Linux got to be Linux: Test driving 1993-2003 distros.md b/sources/tech/20161220 How Linux got to be Linux: Test driving 1993-2003 distros.md index b0713a8f5e..20116aa08d 100644 --- a/sources/tech/20161220 How Linux got to be Linux: Test driving 1993-2003 distros.md +++ b/sources/tech/20161220 How Linux got to be Linux: Test driving 1993-2003 distros.md @@ -1,3 +1,5 @@ +# rusking translating + How Linux got to be Linux: Test driving 1993-2003 distros ============================================================ From b443639b2b062c835459b9a53f6df2e5bcdc8bc1 Mon Sep 17 00:00:00 2001 From: xiaojin Date: Thu, 12 Jan 2017 22:49:32 +0800 Subject: [PATCH 07/33] Update 20170110 What engineers and marketers can learn from each other.md MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 申请翻译 --- ...10 What engineers and marketers can learn from each other.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sources/talk/20170110 What engineers and marketers can learn from each other.md b/sources/talk/20170110 What engineers and marketers can learn from each other.md index 238093423c..f88aa0117a 100644 --- a/sources/talk/20170110 What engineers and marketers can learn from each other.md +++ b/sources/talk/20170110 What engineers and marketers can learn from each other.md @@ -1,3 +1,5 @@ +# rusking translating + What engineers and marketers can learn from each other ============================================================ From 0ddfe6454a93b56f00f5bbf883d43fe91d11f33f Mon Sep 17 00:00:00 2001 From: wxy Date: Fri, 13 Jan 2017 00:04:15 +0800 Subject: [PATCH 08/33] PUB:20160929 Getting Started with HTTP2 - Part 2 @GitFuture --- ...929 Getting Started with HTTP2 - Part 2.md | 87 +++++++++---------- 1 file changed, 42 insertions(+), 45 deletions(-) rename {translated/tech => published}/20160929 Getting Started with HTTP2 - Part 2.md (51%) diff --git a/translated/tech/20160929 Getting Started with HTTP2 - Part 2.md b/published/20160929 Getting Started with HTTP2 - Part 2.md similarity index 51% rename from translated/tech/20160929 Getting Started with HTTP2 - Part 2.md rename to published/20160929 Getting Started with HTTP2 - Part 2.md index 80683810d0..c7f566a0da 100644 --- a/translated/tech/20160929 Getting Started with HTTP2 - Part 2.md +++ b/published/20160929 Getting Started with HTTP2 - Part 2.md @@ -1,10 +1,10 @@ -初识 HTTP/2(第二部分) +初识 HTTP/2(二) ============================================================ ![](https://static.viget.com/_284x284_crop_center-center/ben-t-http-blog-thumb-01_360.png?mtime=20160928234634) -首先制定一个坚定的 HTTP/2 前端开发目标。 +> HTTP/2 时代的开启为前端开发带来了最佳体验。 -如果你对 HTTP/2 有所了解,那你可能用过它,或者至少想过怎样能把它融入你的项目中。尽管有很多关于它如何改变工作流程,提高 Web 速度和效率等方面的猜想,但最好的使用方式还没有定下来。这里我想讲的就是我在之前的项目中所发现的 HTTP/2 的最佳实践。 +如果你对 HTTP/2 有所了解,那你可能用过它,或者至少想过怎样能把它融入你的项目中。尽管有很多关于它如何改变工作流程,提高 Web 速度和效率等方面的猜想,但最佳使用方式还没有定下来。这里我想讲的就是我在之前的项目中所发现的 HTTP/2 的最佳实践。 如果你还不确定什么是 HTTP/2,或者为什么它能改进你的工作,可以先看看我[介绍背景方面的第一篇文章][4]。 @@ -12,118 +12,116 @@ ### 🙏 [热身工作] -首先组织好你的文件。看一看下面的文件树结构,作为组织样式表的起点: +首先组织好你的文件。看一看下面的文件树结构,作为组织你的样式表的起点: ``` -`/styles +/styles |── /setup -| /* variables, mixins and functions */ +| /* 变量、混入(minin)和函数 */ |── /global -| /* reusable components that could be within any component or section */ +| /* 能放在任何组件和部分中的可重用组件 */ |── /components -| /* specific components and sections */ -|── setup.scss // index for setup styles -|── global.scss // index for global styles` +| /* 特殊组件和部分 */ +|── setup.scss // setup 样式索引 +|── global.scss // 全局样式索引 ``` -这会把你的样式分到三个目录下面:Setup,Global 和 Componenets。接下来我会说明这些目录对你的项目有什么用。  +这会把你的样式分到三个目录下面:`setup`、`global` 和 `componenets`。接下来我会说明这些目录对你的项目有什么用。  -### Setup 目录 +### setup 目录 -Setup 目录保存所有的变量,函数,mixins 以及其它文件正常编译需要的任意定义。要想让这个目录物尽其用,把这个目录下所有内容导入到 `setup.scss` 文件中是个很不错的主意,这样这个文件就会像下面所展示的一样: +`setup` 目录保存所有的变量、函数、混入(minin)以及一些正常编译需要的其它文件的定义。要想让这个目录物尽其用,把这个目录下所有内容导入到 `setup.scss` 文件中是个很不错的主意,这样这个文件就会像下面所展示的一样: ``` -`/* setup.scss */ +/* setup.scss */ -/* variables */ +/* 变量 */ @import "setup/variables/colors"; -/* mixins */ +/* 混入 */ @import "setup/mixins/color"; -/* functions */ +/* 函数 */ @import "setup/functions/color"; -... etc` +... 等等 ``` 现在我们能快速引用这个站点中的所有定义,应该确保在所有的样式文件顶部包含我们这里创建的这个文件。 -### Global 目录 +### global 目录 -接下来的目录,Global (全局)目录,应该包含可在当前站点的多个部分或者每一个页面中重复使用的组件。像按钮、文本、主要样式以及你的浏览器默认设置应该放在这里。我不建议把 头部header底部样式footer styles 放在这儿,因为某些项目中没有头部,或者不同页面头部不同。而且,底部永远是页面的最后一个元素,所以在用户加载完当前站点的其它东西前,不必过分优先考虑加载底部样式。 +接下来的目录,global 目录,应该包含可在当前站点的多个部分或者每一个页面中重复使用的组件。像按钮、文本、主要样式,以及你的浏览器默认设置应该放在这里。我不建议把页面的头部或底部样式放在这儿,因为某些项目中没有头部,或者不同页面头部不同。而且,底部永远是页面的最后一个元素,所以在用户加载完当前站点的其它东西前,不必过分优先考虑加载底部样式。 -记住,如果没有那些定义在 Setup 目录下的东西,你的 Global 样式就可能没有作用,你的 Global 文件看起来应该像这样: +记住,如果没有那些定义在 setup 目录下的东西,你的 global 样式就可能没有作用,你的 global 文件看起来应该像这样: ``` -`/* global.scss */ +/* global.scss */ -/* application definitions */ +/* 应用定义 */ @import "setup"; -/* global styles */ +/* 全局样式 */ @import "global/reset"; @import "global/buttons"; @import "global/typography"; @import "global/grid"; -... etc` +... 等等 ``` -注意,首先要做的就是导入 Setup 样式。这样的话,这个样式里定义的所有文件都能够获得引用。 +注意,首先要做的就是导入 setup 样式。这样的话,之后的文件都可以引用这个样式里的定义。 -由于 Global 样式需要存在于每个页面中,我们可以用典型的方式加载它们,在 `` 标签内用一个 `` 标签。你所看到的将是一个十分小巧的 css 文件,或者说理论上小巧的,这取决于你需要多少全局样式。 +由于站点内的每个页面都需要 global 样式,我们可以用典型的方式,在 `` 标签内用一个 `` 标签来加载它们。你所看到的将是一个十分小巧的 css 文件,或者说理论上小巧的,这取决于你需要多少全局样式。 ### 最后,你的组件 -注意,我没有在上述文件树中的 Components(组件)目录里包含索引文件。这是 HTTP/2 所带来的效用。直到现在,我们已经按照标准步骤构建了一个典型的站点,包含 相当简单的结构fairly lean infrastructure,选择仅仅全局化那些最重要的样式。组件充当他们自己的索引文件。 +注意,我没有在上述目录树中的 components 目录里包含索引文件。这是 HTTP/2 所带来的效用。直到现在,我们已经按照标准步骤构建了一个典型的站点,保持相当简单的结构,仅选择全局化那些最重要的样式。组件充当它们自己的索引文件。 大多数开发者有独特的组织组件的方式,因此我并不想影响你的策略。但是,你所有的组件看起来应该像这样: ``` -`/* header.scss */ +/* header.scss */ -/* application definitions */ +/* 应用定义 */ @import "../setup"; header { - // styles + // 样式 } -... etc` +... 等等 ``` -同样的,你要把 Setup 样式包含进来,确保所有东西在编译时都有定义。除了编译这些文件,以及可能要把他们放到 /assets 目录,以便很容易找到模版,对这些文件你不必 链接 concatenate压缩minify 或者改变什么。 +同样的,你要把 setup 样式包含进来,确保所有东西在编译时都定义过。除了编译这些文件,以及可能要把他们放到 `/assets` 目录,以便很容易找到模版,对这些文件你不必 拼接concatenate压缩minify 它们或者改变什么。 现在样式表已经差不多了,构建站点应该很简单。 - ### 构建组件 -或许对于模板语言你有自己的选择,这取决于你的项目,有可能是 Twig, Rails, Jade 或者 Handlebars。我认为考虑组件最好的方式是它是否有自己的模版文件,它该有个与名字相应的样式。这样你的项目中,模版和样式的比例就会是个不错的 1:1 的比例,而且你知道哪个文件有哪些东西,哪里有哪个文件,因为它们的命名是有规律的。 +或许对于模板语言你有自己的选择,这取决于你的项目,有可能是 Twig、Rails、Jade 或者 Handlebars。我认为考虑组件最好的方式是它是否有自己的模版文件,它该有个与名字相应的样式。这样你的项目中,模版和样式的比例就会是个不错的 1:1 的比例,而且你知道哪个文件有哪些东西,哪里有哪个文件,因为它们的命名是有规律的。 现在它正步入正轨,用好 HTTP/2 的多种功能十分简单,让我们做一个模版: ``` -`{# header.html #} +{# header.html #} {# compiled header styles #}

This Awesome HTTP/2 Site

- ... etc` + ... 等等 ``` -非常好!在模版里你可能有更简单的方式链接资源,但这里显示你所要做的仅是在开始构建时,在模版文件中链接一个小小的头部样式。这将允许你的站点仅仅加载特定资源到任意给定页面的组件中,而且,能够设定页面从头到脚的组件的优先级。 - +非常好!在模版里你可能有更简单的方式链接到资源,但这里显示你所要做的仅是在开始构建时,在模版文件中链接一个小小的头部样式。这将允许你的站点仅仅加载特定资源到任意给定页面的组件中,而且,能够设定页面从头到脚的组件的优先级。 ### 结合在一起 -现在所有的组件都有结构,浏览器将会类似以下来渲染它们: +现在所有的组件都有结构,浏览器将会类似以下方式来渲染它们: ``` -` + @@ -156,11 +154,10 @@ header { -` + ``` -这是一个高级别方法,但你的项目中可能有调整的更细致的finer-tuned组件。例如,在头部的 `