Merge branch 'master' of github.com:GOLinux/TranslateProject

This commit is contained in:
GOLinux 2015-07-24 07:12:38 +08:00
commit ac6dcd4805
8 changed files with 232 additions and 223 deletions

View File

@ -1,3 +1,5 @@
alim0x translating
The history of Android
================================================================================
![The Honeycomb app lineup lost a ton of apps. This also shows the notification panel and the new quick settings.](http://cdn.arstechnica.net/wp-content/uploads/2014/02/apps-and-notifications2.png)
@ -83,4 +85,4 @@ via: http://arstechnica.com/gadgets/2014/06/building-android-a-40000-word-histor
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[a]:http://arstechnica.com/author/ronamadeo
[t]:https://twitter.com/RonAmadeo
[t]:https://twitter.com/RonAmadeo

View File

@ -1,3 +1,5 @@
translating...
How to set up IPv6 BGP peering and filtering in Quagga BGP router
================================================================================
In the previous tutorials, we demonstrated how we can set up a [full-fledged BGP router][1] and configure [prefix filtering][2] with Quagga. In this tutorial, we are going to show you how we can set up IPv6 BGP peering and advertise IPv6 prefixes through BGP. We will also demonstrate how we can filter IPv6 prefixes advertised or received by using prefix-list and route-map features.
@ -255,4 +257,4 @@ via: http://xmodulo.com/ipv6-bgp-peering-filtering-quagga-bgp-router.html
[1]:http://xmodulo.com/centos-bgp-router-quagga.html
[2]:http://xmodulo.com/filter-bgp-routes-quagga-bgp-router.html
[3]:http://ask.xmodulo.com/open-port-firewall-centos-rhel.html
[4]:http://xmodulo.com/filter-bgp-routes-quagga-bgp-router.html
[4]:http://xmodulo.com/filter-bgp-routes-quagga-bgp-router.html

View File

@ -1,88 +0,0 @@
translating...
Fix Minimal BASH like line editing is supported GRUB Error In Linux
================================================================================
The other day when I [installed Elementary OS in dual boot with Windows][1], I encountered a Grub error at the reboot time. I was presented with command line with error message:
**Minimal BASH like line editing is supported. For the first word, TAB lists possible command completions. anywhere else TAB lists possible device or file completions.**
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/02/Boot_Repair_Ubuntu_Linux_1.jpeg)
Indeed this is not an error specific to Elementary OS. It is a common [Grub][2] error that could occur with any Linux OS be it Ubuntu, Fedora, Linux Mint etc.
In this post we shall see **how to fix this “minimal BASH like line editing is supported” Grub error in Ubuntu** based Linux systems.
> You can read this tutorial to fix similar and more frequent issue, [error: no such partition grub rescue in Linux][3].
### Prerequisites ###
To fix this issue, you would need the followings:
- A live USB or disk of the same OS and same version
- A working internet connection in the live session
Once you make sure that you have the prerequisites, lets see how to fix the black screen of death for Linux (if I can call it that ;)).
### How to fix this “minimal BASH like line editing is supported” Grub error in Ubuntu based Linux ###
I know that you might point out that this Grub error is not exclusive to Ubuntu or Ubuntu based Linux distributions, then why am I putting emphasis on the world Ubuntu? The reason is, here we will take an easy way out and use a tool called **Boot Repair** to fix our problem. I am not sure if this tool is available for other distributions like Fedora. Without wasting anymore time, lets see how to solve minimal BASH like line editing is supported Grub error.
### Step 1: Boot in lives session ###
Plug in the live USB and boot in to the live session.
### Step 2: Install Boot Repair ###
Once you are in the lives session, open the terminal and use the following commands to install Boot Repair:
sudo add-apt-repository ppa:yannubuntu/boot-repair
sudo apt-get update
sudo apt-get install boot-repair
Note: Follow this tutorial to [fix failed to fetch cdrom apt-get update cannot be used to add new CD-ROMs error][4], if you encounter it while running the above command.
### Step 3: Repair boot with Boot Repair ###
Once you installed Boot Repair, run it from the command line using the following command:
boot-repair &
Actually things are pretty straight forward from here. You just need to follow the instructions provided by Boot Repair tool. First, click on **Recommended repair** option in the Boot Repair.
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/02/Boot_Repair_Ubuntu.png)
It will take couple of minutes for Boot Repair to analyze the problem with boot and Grub. Afterwards, it will provide you some commands to use in the command line. Copy the commands one by one in terminal. For me it showed me a screen like this:
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/02/Boot_Repair_Ubuntu_1.png)
It will do some processes after you enter these commands:
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/02/Boot_Repair_Ubuntu_2.png)
Once the process finishes, it will provide you a URL which consists of the logs of the boot repair. If your boot issue is not fixed even now, you can go to the forum or mail to the dev team and provide them the URL as a reference. Cool, isnt it?
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/02/Boot_Repair_Final_Ubuntu.png)
After the boot repair finishes successfully, shutdown your computer, remove the USB and boot again. For me it booted successfully but added two additional lines in the Grub screen. Something which was not of importance to me as I was happy to see the system booting normally again.
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/02/Boot_Repair_Ubuntu_Linux_2.jpeg)
### Did it work for you? ###
So this is how I fixed **minimal BASH like line editing is supported Grub error in Elementary OS Freya**. How about you? Did it work for you? Feel free to ask a question or drop a suggestion in the comment box below.
--------------------------------------------------------------------------------
via: http://itsfoss.com/fix-minimal-bash-line-editing-supported-grub-error-linux/
作者:[Abhishek][a]
译者:[译者ID](https://github.com/译者ID)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[a]:http://itsfoss.com/author/abhishek/
[1]:http://itsfoss.com/guide-install-elementary-os-luna/
[2]:http://www.gnu.org/software/grub/
[3]:http://itsfoss.com/solve-error-partition-grub-rescue-ubuntu-linux/
[4]:http://itsfoss.com/fix-failed-fetch-cdrom-aptget-update-add-cdroms/

View File

@ -1,3 +1,4 @@
Translating by ictlyh
Howto Interactively Perform Tasks with Docker using Kitematic
================================================================================
In this article, we'll learn about the installating Kitematic in Windows Operating System and deploying a Hello World Nginx Web Server. Kitematic is a free and open source software which is a modern designed GUI software that allows us to interactively perform tasks with docker. Kitematic has a beautiful design and pretty good interface. It is pretty fast and easy to setup our containers out of the box without needing to enter commands for it, we can deploy our apps it in just a click with its GUI inteface. Kitematic has Docker Hub Intergration which allows us to search any required image, pull and deploy our apps with it. It also has a beautiful feature to switch to CUI mode simultaneously. Currently, it includes some features like automatically map ports, visually change environment variables, configuring volumes, streamline logs and many more.

View File

@ -1,296 +1,301 @@
[translating by xiqingongzi]
RHCSA Series: Reviewing Essential Commands & System Documentation Part 1
RHCSA系列: 复习基础命令及系统文档 第一部分
================================================================================
RHCSA (Red Hat Certified System Administrator) is a certification exam from Red Hat company, which provides an open source operating system and software to the enterprise community, It also provides support, training and consulting services for the organizations.
RHCSA (红帽认证系统工程师) 是由给商业公司提供开源操作系统和软件的RedHat公司举行的认证考试, 除此之外,红帽公司还为这些企业和机构提供支持、训练以及咨询服务
![RHCSA Exam Guide](http://www.tecmint.com/wp-content/uploads/2015/02/RHCSA-Series-by-Tecmint.png)
RHCSA Exam Preparation Guide
RHCSA 考试准备指南
RHCSA exam is the certification obtained from Red Hat Inc, after passing the exam (codename EX200). RHCSA exam is an upgrade to the RHCT (Red Hat Certified Technician) exam, and this upgrade is compulsory as the Red Hat Enterprise Linux was upgraded. The main variation between RHCT and RHCSA is that RHCT exam based on RHEL 5, whereas RHCSA certification is based on RHEL 6 and 7, the courseware of these two certifications are also vary to a certain level.
RHCSA 考试(考试编号 EX200)通过后可以获取由Red Hat 公司颁发的证书. RHCSA 考试是RHCT(红帽认证技师)的升级版,而且RHCSA必须在新的Red Hat Enterprise Linux(红帽企业版)下完成.RHCT和RHCSA的主要变化就是RHCT基于 RHEL5 , 而RHCSA基于RHEL6或者7, 这两个认证的等级也有所不同.
This Red Hat Certified System Administrator (RHCSA) is essential to perform the following core system administration tasks needed in Red Hat Enterprise Linux environments:
红帽认证管理员所会的最基础的是在红帽企业版的环境下执行如下系统管理任务:
- Understand and use necessary tools for handling files, directories, command-environments line, and system-wide / packages documentation.
- Operate running systems, even in different run levels, identify and control processes, start and stop virtual machines.
- Set up local storage using partitions and logical volumes.
- Create and configure local and network file systems and its attributes (permissions, encryption, and ACLs).
- Setup, configure, and control systems, including installing, updating and removing software.
- Manage system users and groups, along with use of a centralized LDAP directory for authentication.
- Ensure system security, including basic firewall and SELinux configuration.
- 理解并会使用命令管理文件、目录、命令行以及系统/软件包的文档
- 使用不同的启动等级启动系统,认证和控制进程,启动或停止虚拟机
- 使用分区和逻辑卷管理本地存储
- 创建并且配置本地文件系统和网络文件系统,设置他们的属性(许可、加密、访问控制表)
- 部署、配置、并且控制系统,包括安装、升级和卸载软件
- 管理系统用户和组独立使用集中制的LDAP目录权限控制
- 确保系统安全包括基础的防火墙规则和SELinux配置
To view fees and register for an exam in your country, check the [RHCSA Certification page][1].
To view fees and register for an exam in your country, check the RHCSA Certification page.
关于你所在国家的考试注册费用参考 [RHCSA Certification page][1].
In this 15-article RHCSA series, titled Preparation for the RHCSA (Red Hat Certified System Administrator) exam, we will going to cover the following topics on the latest releases of Red Hat Enterprise Linux 7.
关于你所在国家的考试注册费用参考RHCSA 认证页面
- Part 1: Reviewing Essential Commands & System Documentation
- Part 2: How to Perform File and Directory Management in RHEL 7
- Part 3: How to Manage Users and Groups in RHEL 7
- Part 4: Editing Text Files with Nano and Vim / Analyzing text with grep and regexps
- Part 5: Process Management in RHEL 7: boot, shutdown, and everything in between
- Part 6: Using Parted and SSM to Configure and Encrypt System Storage
- Part 7: Using ACLs (Access Control Lists) and Mounting Samba / NFS Shares
- Part 8: Securing SSH, Setting Hostname and Enabling Network Services
- Part 9: Installing, Configuring and Securing a Web and FTP Server
- Part 10: Yum Package Management, Automating Tasks with Cron and Monitoring System Logs
- Part 11: Firewall Essentials and Control Network Traffic Using FirewallD and Iptables
- Part 12: Automate RHEL 7 Installations Using Kickstart
- Part 13: RHEL 7: What is SELinux and how it works?
- Part 14: Use LDAP-based authentication in RHEL 7
- Part 15: Virtualization in RHEL 7: KVM and Virtual machine management
In this Part 1 of the RHCSA series, we will explain how to enter and execute commands with the correct syntax in a shell prompt or terminal, and explained how to find, inspect, and use system documentation.
在这个有15章的RHCSA(红帽认证管理员)备考系列,我们将覆盖以下的关于红帽企业Linux第七版的最新的信息
- Part 1: 回顾必会的命令和系统文档
- Part 2: 在RHEL7如何展示文件和管理目录
- Part 3: 在RHEL7中如何管理用户和组
- Part 4: 使用nano和vim管理命令/ 使用grep和正则表达式分析文本
- Part 5: RHEL7的进程管理:启动,关机,以及其他介于二者之间的.
- Part 6: 使用 'Parted'和'SSM'来管理和加密系统存储
- Part 7: 使用ACLs(访问控制表)并挂载 Samba /NFS 文件分享
- Part 8: 加固SSH设置主机名并开启网络服务
- Part 9: 安装、配置和加固一个WebFTP服务器
- Part 10: Yum 包管理方式,使用Cron进行自动任务管理以及监控系统日志
- Part 11: 使用FirewallD和Iptables设置防火墙控制网络流量
- Part 12: 使用Kickstart 自动安装RHEL 7
- Part 13: RHEL7:什么是SeLinux?他的原理是什么?
- Part 14: 在RHEL7 中使用基于LDAP的权限控制
- Part 15: RHEL7的虚拟化:KVM 和虚拟机管理
在第一章我们讲解如何输入和运行正确的命令在终端或者Shell窗口并且讲解如何找到、插入以及使用系统文档
![RHCSA: Reviewing Essential Linux Commands Part 1](http://www.tecmint.com/wp-content/uploads/2015/02/Reviewing-Essential-Linux-Commands.png)
RHCSA: Reviewing Essential Linux Commands Part 1
RHCSA回顾必会的Linux命令 - 第一部分
#### Prerequisites: ####
#### 前提: ####
At least a slight degree of familiarity with basic Linux commands such as:
至少你要熟悉如下命令
- [cd command][2] (change directory)
- [ls command][3] (list directory)
- [cp command][4] (copy files)
- [mv command][5] (move or rename files)
- [touch command][6] (create empty files or update the timestamp of existing ones)
- rm command (delete files)
- mkdir command (make directory)
- [cd command][2] (改变目录)
- [ls command][3] (列举文件)
- [cp command][4] (复制文件)
- [mv command][5] (移动或重命名文件)
- [touch command][6] (创建一个新的文件或更新已存在文件的时间表)
- rm command (删除文件)
- mkdir command (创建目录)
The correct usage of some of them are anyway exemplified in this article, and you can find further information about each of them using the suggested methods in this article.
在这篇文章中你将会找到更多的关于如何更好的使用他们的正确用法和特殊用法.
Though not strictly required to start, as we will be discussing general commands and methods for information search in a Linux system, you should try to install RHEL 7 as explained in the following article. It will make things easier down the road.
虽然没有严格的要求但是作为讨论常用的Linux命令和方法,你应该安装RHEL7 来尝试使用文章中提到的命令.这将会使你学习起来更省力.
- [Red Hat Enterprise Linux (RHEL) 7 Installation Guide][7]
- [红帽企业版Linux(RHEL)7 安装指南][7]
### Interacting with the Linux Shell ###
### 使用Shell进行交互 ###
如果我们使用文本模式登陆Linux我们就无法使用鼠标在默认的shell。另一方面如果我们使用图形化界面登陆,我们将会通过启动一个终端来开启shell无论那种方式我们都会看到用户提示,并且我们可以开始输入并且执行命令(当按下Enter时命令就会被执行)
If we log into a Linux box using a text-mode login screen, chances are we will be dropped directly into our default shell. On the other hand, if we login using a graphical user interface (GUI), we will have to open a shell manually by starting a terminal. Either way, we will be presented with the user prompt and we can start typing and executing commands (a command is executed by pressing the Enter key after we have typed it).
Commands are composed of two parts:
当我们使用文本模式登陆Linux时
命令是由两个部分组成的:
- the name of the command itself, and
- arguments
- 命令本身
- 参数
Certain arguments, called options (usually preceded by a hyphen), alter the behavior of the command in a particular way while other arguments specify the objects upon which the command operates.
某些参数,称为选项(通常使用一个连字符区分),改变了由其他参数定义的命令操作.
The type command can help us identify whether another certain command is built into the shell or if it is provided by a separate package. The need to make this distinction lies in the place where we will find more information about the command. For shell built-ins we need to look in the shells man page, whereas for other binaries we can refer to its own man page.
命令的类型可以帮助我们识别某一个特定的命令是由shell内建的还是由一个单独的包提供。这样的区别在于我们能够找到更多关于该信息的命令,对shell内置的命令我们需要看shell的ManPage如果是其他提供的我们需要看它自己的ManPage.
![Check Shell built in Commands](http://www.tecmint.com/wp-content/uploads/2015/02/Check-shell-built-in-Commands.png)
Check Shell built in Commands
检查Shell的内建命令
In the examples above, cd and type are shell built-ins, while top and less are binaries external to the shell itself (in this case, the location of the command executable is returned by type).
在上面的例子中, cd 和 type 是shell内建的命令top和 less 是由其他的二进制文件提供的(在这种情况下type将返回命令的位置)
其他的内建命令
Other well-known shell built-ins include:
- [echo command][8]: Displays strings of text.
- [pwd command][9]: Prints the current working directory.
- [echo command][8]: 展示字符串
- [pwd command][9]: 输出当前的工作目录
![More Built in Shell Commands](http://www.tecmint.com/wp-content/uploads/2015/02/More-Built-in-Shell-Commands.png)
More Built in Shell Commands
更多内建函数
**exec command**
**exec 命令**
Runs an external program that we specify. Note that in most cases, this is better accomplished by just typing the name of the program we want to run, but the exec command has one special feature: rather than create a new process that runs alongside the shell, the new process replaces the shell, as can verified by subsequent.
运行我们指定的外部程序。请注意最好是只输入我们想要运行的程序的名字不过exec命令有一个特殊的特性:使用旧的shell运行而不是创建新的进程可以作为子请求的验证.
# ps -ef | grep [original PID of the shell process]
# ps -ef | grep [shell 进程的PID]
When the new process terminates, the shell terminates with it. Run exec top and then hit the q key to quit top. You will notice that the shell session ends when you do, as shown in the following screencast:
当新的进程注销Shell也随之注销,运行 exec top 然后按下 q键来退出top你会注意到shell 会话会结束,如下面的屏幕录像展示的那样:
youtube视频
<iframe width="640" height="405" frameborder="0" allowfullscreen="allowfullscreen" src="https://www.youtube.com/embed/f02w4WT73LE"></iframe>
**export command**
**export 命令**
Exports variables to the environment of subsequently executed commands.
输出之后执行的命令的环境的变量
**history Command**
**history 命令**
Displays the command history list with line numbers. A command in the history list can be repeated by typing the command number preceded by an exclamation sign. If we need to edit a command in history list before executing it, we can press Ctrl + r and start typing the first letters associated with the command. When we see the command completed automatically, we can edit it as per our current need:
展示数行之前的历史命令.在感叹号前输入命令编号可以再次执行这个命令.如果我们需要编辑历史列表中的命令,我们可以按下 Ctrl + r 并输入与命令相关的第一个字符.
当我们看到的命令自动补全,我们可以根据我们目前的需要来编辑它:
youtube视频
<iframe width="640" height="405" frameborder="0" allowfullscreen="allowfullscreen" src="https://www.youtube.com/embed/69vafdSMfU4"></iframe>
This list of commands is kept in our home directory in a file called .bash_history. The history facility is a useful resource for reducing the amount of typing, especially when combined with command line editing. By default, bash stores the last 500 commands you have entered, but this limit can be extended by using the HISTSIZE environment variable:
命令列表会保存在一个叫 .bash_history的文件里.history命令是一个非常有用的用于减少输入次数的工具特别是进行命令行编辑的时候.默认情况下bash保留最后输入的500个命令不过可以通过修改 HISTSIZE 环境变量来增加:
![Linux history Command](http://www.tecmint.com/wp-content/uploads/2015/02/Linux-history-Command.png)
Linux history Command
Linux history 命令
But this change as performed above, will not be persistent on our next boot. In order to preserve the change in the HISTSIZE variable, we need to edit the .bashrc file by hand:
但上述变化在我们的下一次启动不会保留。为了保持HISTSIZE变量的变化我们需要通过手工修改文件编辑
# for setting history length see HISTSIZE and HISTFILESIZE in bash(1)
# 设置history请看 HISTSIZE 和 HISTFILESIZE 在 bash(1)的文档
HISTSIZE=1000
**Important**: Keep in mind that these changes will not take effect until we restart our shell session.
**重要**: 我们的更改不会生效,除非我们重启了系统
**alias command**
**alias 命令**
没有参数或使用-p参数将会以 名称=值的标准形式输出alias 列表.当提供了参数时一个alias 将被定义给给定的命令和值
With no arguments or with the -p option prints the list of aliases in the form alias name=value on standard output. When arguments are provided, an alias is defined for each name whose value is given.
使用alias ,我们可以创建我们自己的命令,或修改现有的命令,包括需要的参数.举个例子,假设我们想别名 ls 到 ls color=auto ,这样就可以使用不同颜色输出文件、目录、链接
With alias, we can make up our own commands or modify existing ones by including desired options. For example, suppose we want to alias ls to ls color=auto so that the output will display regular files, directories, symlinks, and so on, in different colors:
# alias ls='ls --color=auto'
![Linux alias Command](http://www.tecmint.com/wp-content/uploads/2015/02/Linux-alias-Command.png)
Linux alias Command
Linux 别名命令
**Note**: That you can assign any name to your “new command” and enclose as many commands as desired between single quotes, but in that case you need to separate them by semicolons, as follows:
**Note**: 你可以给你的新命令起任何的名字,并且附上足够多的使用单引号分割的参数,但是这样的情况下你要用分号区分开他们.
# alias myNewCommand='cd /usr/bin; ls; cd; clear'
**exit command**
**exit 命令**
The exit and logout commands both terminate the shell. The exit command terminates any shell, but the logout command terminates only login shells—that is, those that are launched automatically when you initiate a text-mode login.
Exit和logout命令都是退出shell.exit命令退出所有的shelllogout命令只注销登陆的shell其他的自动以文本模式启动的shell不算.
If we are ever in doubt as to what a program does, we can refer to its man page, which can be invoked using the man command. In addition, there are also man pages for important files (inittab, fstab, hosts, to name a few), library functions, shells, devices, and other features.
如果我们对某个程序由疑问我们可以看他的man Page可以使用man命令调出它额外的还有一些重要的文件的手册页(inittab,fstab,hosts等等),库函数,shells,设备及其他功能
#### Examples: ####
#### 举例: ####
- man uname (print system information, such as kernel name, processor, operating system type, architecture, and so on).
- man inittab (init daemon configuration).
- man uname (输出系统信息,如内核名称、处理器、操作系统类型、架构等).
- man inittab (初始化守护设置).
Another important source of information is provided by the info command, which is used to read info documents. These documents often provide more information than the man page. It is invoked by using the info keyword followed by a command name, such as:
另外一个重要的信息的来源就是info命令提供的,info命令常常被用来读取信息文件.这些文件往往比manpage 提供更多信息.通过info 关键词调用某个命令的信息
# info ls
# info cut
In addition, the /usr/share/doc directory contains several subdirectories where further documentation can be found. They either contain plain-text files or other friendly formats.
Make sure you make it a habit to use these three methods to look up information for commands. Pay special and careful attention to the syntax of each of them, which is explained in detail in the documentation.
另外,在/usr/share/doc 文件夹包含了大量的子目录,里面可以找到大量的文档.他们包含文本文件或其他友好的格式.
确保你使用这三种方法去查找命令的信息。重点关注每个命令文档中介绍的详细的语法
**Converting Tabs into Spaces with expand Command**
**使用expand命令把tabs转换为空格**
Sometimes text files contain tabs but programs that need to process the files dont cope well with tabs. Or maybe we just want to convert tabs into spaces. Thats where the expand tool (provided by the GNU coreutils package) comes in handy.
有时候文本文档包含了tabs但是程序无法很好的处理的tabs.或者我们只是简单的希望将tabs转换成空格.这就是为什么expand (GNU核心组件提供)工具出现,
For example, given the file NumbersList.txt, lets run expand against it, changing tabs to one space, and display on standard output.
举个例子,给我们一个文件 NumberList.txt让我们使用expand处理它将tabs转换为一个空格.并且以标准形式输出.
# expand --tabs=1 NumbersList.txt
![Linux expand Command](http://www.tecmint.com/wp-content/uploads/2015/02/Linux-expand-Command.png)
Linux expand Command
Linux expand 命令
The unexpand command performs the reverse operation (converts spaces into tabs).
unexpand命令可以实现相反的功能(将空格转为tab)
**Display the first lines of a file with head and the last lines with tail**
**使用head输出文件首行及使用tail输出文件尾行**
By default, the head command followed by a filename, will display the first 10 lines of the said file. This behavior can be changed using the -n option and specifying a certain number of lines.
通常情况下head命令后跟着文件名时将会输出该文件的前十行我们可以通过 -n 参数来自定义具体的行数。
# head -n3 /etc/passwd
# tail -n3 /etc/passwd
![Linux head and tail Command](http://www.tecmint.com/wp-content/uploads/2015/02/Linux-head-and-tail-Command.png)
Linux head and tail Command
Linux 的 head 和 tail 命令
One of the most interesting features of tail is the possibility of displaying data (last lines) as the input file grows (tail -f my.log, where my.log is the file under observation). This is particularly useful when monitoring a log to which data is being continually added.
tail 最有意思的一个特性就是能够展现信息(最后一行)就像我们输入文件(tail -f my.log一行一行的就像我们在观察它一样。)这在我们监控一个持续增加的日志文件时非常有用
Read More: [Manage Files Effectively using head and tail Commands][10]
**Merging Lines with paste**
The paste command merges files line by line, separating the lines from each file with tabs (by default), or another delimiter that can be specified (in the following example the fields in the output are separated by an equal sign).
更多: [Manage Files Effectively using head and tail Commands][10]
**使用paste合并文本文件**
paste命令一行一行的合并文件默认会以tab来区分每一行,或者其他你自定义的分行方式.(下面的例子就是输出使用等号划分行的文件).
# paste -d= file1 file2
![Merge Files in Linux](http://www.tecmint.com/wp-content/uploads/2015/02/Merge-Files-in-Linux-with-paste-command.png)
Merge Files in Linux
**Breaking a file into pieces using split command**
**使用split命令将文件分块**
The split command is used split a file into two (or more) separate files, which are named according to a prefix of our choosing. The splitting can be defined by size, chunks, or number of lines, and the resulting files can have a numeric or alphabetic suffixes. In the following example, we will split bash.pdf into files of size 50 KB (-b 50KB), using numeric suffixes (-d):
split 命令常常用于把一个文件切割成两个或多个文由我们自定义的前缀命名的件文件.这些文件可以通过大小、区块、行数,生成的文件会有一个数字或字母的后缀.在下面的例子中我们将切割bash.pdf 每个文件50KB (-b 50KB) ,使用命名后缀 (-d):
# split -b 50KB -d bash.pdf bash_
![Split Files in Linux](http://www.tecmint.com/wp-content/uploads/2015/02/Split-Files-in-Linux-with-split-command.png)
Split Files in Linux
在Linux下划分文件
You can merge the files to recreate the original file with the following command:
你可以使用如下命令来合并这些文件,生成源文件:
# cat bash_00 bash_01 bash_02 bash_03 bash_04 bash_05 > bash.pdf
**Translating characters with tr command**
**使用tr命令改变字符**
The tr command can be used to translate (change) characters on a one-by-one basis or using character ranges. In the following example we will use the same file2 as previously, and we will change:
tr 命令多用于变化(改变)一个一个的字符活使用字符范围.和之前一样,下面的实例我们江使用同样的文件file2我们将实习
- lowercase os to uppercase,
- and all lowercase to uppercase
- 小写字母 o 变成大写
- 所有的小写字母都变成大写字母
# cat file2 | tr o O
# cat file2 | tr [a-z] [A-Z]
![Translate Characters in Linux](http://www.tecmint.com/wp-content/uploads/2015/02/Translate-characters-in-Linux-with-tr-command.png)
Translate Characters in Linux
在Linux中替换文字
**Reporting or deleting duplicate lines with uniq and sort command**
**使用uniq和sort检查或删除重复的文字**
The uniq command allows us to report or remove duplicate lines in a file, writing to stdout by default. We must note that uniq does not detect repeated lines unless they are adjacent. Thus, uniq is commonly used along with a preceding sort (which is used to sort lines of text files).
uniq命令可以帮我们查出或删除文件中的重复的行,默认会写出到stdout.我们应当注意, uniq 只能查出相邻的两个相同的单纯,所以, uniq 往往和sort 一起使用(sort一般用于对文本文件的内容进行排序)
By default, sort takes the first field (separated by spaces) as key field. To specify a different key field, we need to use the -k option. Please note how the output returned by sort and uniq change as we change the key field in the following example:
默认的sort 以第一个参数(使用空格区分)为关键字.想要定义特殊的关键字,我们需要使用 -k参数请注意如何使用sort 和uniq输出我们想要的字段具体可以看下面的例子
# cat file3
# sort file3 | uniq
# sort -k2 file3 | uniq
# sort -k3 file3 | uniq
![Remove Duplicate Lines in Linux](http://www.tecmint.com/wp-content/uploads/2015/02/Remove-Duplicate-Lines-in-file.png)
![删除文件中重复的行](http://www.tecmint.com/wp-content/uploads/2015/02/Remove-Duplicate-Lines-in-file.png)
Remove Duplicate Lines in Linux
删除文件中重复的行
**Extracting text with cut command**
**从文件中提取文本的命令**
The cut command extracts portions of input lines (from stdin or files) and displays the result on standard output, based on number of bytes (-b), characters (-c), or fields (-f).
Cut命令基于字节(-b),字符(-c),或者区块(-f)从stdin活文件中提取到的部分将会以标准的形式展现在屏幕上
When using cut based on fields, the default field separator is a tab, but a different separator can be specified by using the -d option.
当我们使用区块切割时默认的分隔符是一个tab不过你可以通过 -d 参数来自定义分隔符.
# cut -d: -f1,3 /etc/passwd # Extract specific fields: 1 and 3 in this case
# cut -d: -f2-4 /etc/passwd # Extract range of fields: 2 through 4 in this example
# cut -d: -f1,3 /etc/passwd # 这个例子提取了第一块和第三块的文本
# cut -d: -f2-4 /etc/passwd # 这个例子提取了第一块到第三块的文本
![Extract Text From a File in Linux](http://www.tecmint.com/wp-content/uploads/2015/02/Extract-Text-from-a-file.png)
![从文件中提取文本](http://www.tecmint.com/wp-content/uploads/2015/02/Extract-Text-from-a-file.png)
Extract Text From a File in Linux
从文件中提取文本
Note that the output of the two examples above was truncated for brevity.
**Reformatting files with fmt command**
注意,上方的两个输出的结果是十分简洁的。
fmt is used to “clean up” files with a great amount of content or lines, or with varying degrees of indentation. The new paragraph formatting defaults to no more than 75 characters wide. You can change this with the -w (width) option, which set the line length to the specified number of characters.
**使用fmt命令重新格式化文件**
For example, lets see what happens when we use fmt to display the /etc/passwd file setting the width of each line to 100 characters. Once again, output has been truncated for brevity.
fmt 被用于去“清理”有大量内容或行的文件,或者有很多缩进的文件.新的锻炼格式每行不会超过75个字符款你能改变这个设定通过 -w(width 宽度)参数,它可以设置行宽为一个特定的数值
举个例子让我们看看当我们用fmt显示定宽为100个字符的时候的文件/etc/passwd 时会发生什么.再来一次,输出值变得更加简洁.
# fmt -w100 /etc/passwd
![File Reformatting in Linux](http://www.tecmint.com/wp-content/uploads/2015/02/File-Reformatting-in-Linux-with-fmt-command.png)
File Reformatting in Linux
Linux文件重新格式化
**Formatting content for printing with pr command**
**使用pr命令格式化打印内容**
pr paginates and displays in columns one or more files for printing. In other words, pr formats a file to make it look better when printed. For example, the following command:
pr 分页并且在列中展示一个或多个用于打印的文件. 换句话说使用pr格式化一个文件使他打印出来时看起来更好.举个例子,下面这个命令
# ls -a /etc | pr -n --columns=3 -h "Files in /etc"
Shows a listing of all the files found in /etc in a printer-friendly format (3 columns) with a custom header (indicated by the -h option), and numbered lines (-n).
以一个友好的排版方式(3列)输出/etc下的文件,自定义了页眉(通过 -h 选项实现),行号(-n)
![File Formatting in Linux](http://www.tecmint.com/wp-content/uploads/2015/02/File-Formatting-in-Linux-with-pr-command.png)
File Formatting in Linux
Linux的文件格式
### Summary ###
### 总结 ###
In this article we have discussed how to enter and execute commands with the correct syntax in a shell prompt or terminal, and explained how to find, inspect, and use system documentation. As simple as it seems, its a large first step in your way to becoming a RHCSA.
在这篇文章中我们已经讨论了如何在Shell或终端以正确的语法输入和执行命令并解释如何找到检查和使用系统文档。正如你看到的一样简单这就是你成为RHCSA的第一大步
如果你想添加一些其他的你经常使用的能够有效帮你完成你的日常工作的基础命令,并为分享他们而感到自豪,请在下方留言.也欢迎提出问题.我们期待您的回复.
If you would like to add other commands that you use on a periodic basis and that have proven useful to fulfill your daily responsibilities, feel free to share them with the world by using the comment form below. Questions are also welcome. We look forward to hearing from you!
--------------------------------------------------------------------------------

View File

@ -1,3 +1,4 @@
[translating by xiqingongzi]
RHCSA Series: How to Perform File and Directory Management Part 2
================================================================================
In this article, RHCSA Part 2: File and directory management, we will review some essential skills that are required in the day-to-day tasks of a system administrator.
@ -319,4 +320,4 @@ via: http://www.tecmint.com/file-and-directory-management-in-linux/
[a]:http://www.tecmint.com/author/gacanepa/
[1]:http://www.tecmint.com/8-pratical-examples-of-linux-touch-command/
[2]:http://www.tecmint.com/13-basic-cat-command-examples-in-linux/
[3]:http://www.tecmint.com/18-tar-command-examples-in-linux/
[3]:http://www.tecmint.com/18-tar-command-examples-in-linux/

View File

@ -0,0 +1,86 @@
修复Linux中的提供最小化类BASH命令行编辑GRUB错误
================================================================================
这两天我[安装了Elementary OS和Windows双系统][1]在启动的时候遇到了一个Grub错误。命令行中呈现如下信息
**提供最小化类BASH命令行编辑。对于第一个词TAB键补全可以使用的命令。除此之外TAB键补全可用的设备或文件。**
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/02/Boot_Repair_Ubuntu_Linux_1.jpeg)
事实上这并不是Elementary OS独有的错误。这是常见的[Grub][2]错误会在UbuntuFedoraLinux Mint等Linux操作系统上发生。
通过这篇文章里我们可以学到基于Linux系统**如何修复Ubuntu中出现的“minimal BASH like line editing is supported” Grub错误**。
> 你可以参阅这篇教程来修复类似的高频问题,[错误分区未找到Linux grub救援模式][3]。
### 先决条件 ###
要修复这个问题,你需要达成以下的条件:
- 一个包含相同版本、相同OS的LiveUSB或磁盘
- 当前会话的Internet连接正常工作
在确认了你拥有先决条件了之后让我们看看如何修复Linux的死亡黑屏如果我可以这样的称呼它的话
### 如何在基于Ubuntu的Linux中修复“minimal BASH like line editing is supported” Grub错误 ###
我知道你一定疑问这种Grub错误并不局限于在基于Ubuntu的Linux发行版上发生那为什么我要强调在基于Ubuntu的发行版上呢原因是在这里我们将采用一个简单的方法并叫作**Boot Repair**的工具来修复我们的问题。我并不确定在其他的诸如Fedora的发行版中是否有这个工具可用。不再浪费时间我们来看如何修复minimal BASH like line editing is supported Grub错误。
### 步骤 1: 引导进入lives会话 ###
插入live USB引导进入live会话。
### 步骤 2: 安装 Boot Repair ###
等你进入了lives会话后打开终端使用以下命令来安装Boot Repair
sudo add-apt-repository ppa:yannubuntu/boot-repair
sudo apt-get update
sudo apt-get install boot-repair
注意:推荐这篇教程[如何修复 apt-get update 无法添加新的 CD-ROM 的错误][4],如果你在运行以上命令是遭遇同样的问题。
### 步骤 3: 使用Boot Repair修复引导 ###
装完Boot Repair后在命令行运行如下命令启动
boot-repair &
其实操作非常简单直接你仅需按照Boot Repair工具提供的说明操作即可。首先点击Boot Repair中的**Recommended repair**选项。
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/02/Boot_Repair_Ubuntu.png)
Boot Repair需要花费一些时间来分析引导和Grub中存在的问题。然后它会提供一些可在命令行中直接运行的命令。将这些命令一个个在终端中执行。我这边屏幕上显示的是
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/02/Boot_Repair_Ubuntu_1.png)
在输入了这些命令之后,它会执行执行一段时间:
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/02/Boot_Repair_Ubuntu_2.png)
在这一过程结束后它会提供一个由boot repair的日志组成的网页网址。如果你的引导问题这样都没有修复你就可以去社区或是发邮件给开发团队并提交该网址作为参考。很酷不是吗
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/02/Boot_Repair_Final_Ubuntu.png)
在boot repair成功完成后关闭你的电脑移除USB并再次引导。我这就能成功的引导了但是在Grub画面上会多出额外的两行。相比于看到系统能够再次正常引导的喜悦这些对我来说并不重要。
![](http://itsfoss.itsfoss.netdna-cdn.com/wp-content/uploads/2015/02/Boot_Repair_Ubuntu_Linux_2.jpeg)
### 对你有效吗? ###
这就是我修复**Elementary OS Freya中的minimal BASH like line editing is supported Grub 错误**的方法。怎么样?是否对你也有效呢?请自由的在下方的评论区提出你的问题和建议。
--------------------------------------------------------------------------------
via: http://itsfoss.com/fix-minimal-bash-line-editing-supported-grub-error-linux/
作者:[Abhishek][a]
译者:[martin2011qi](https://github.com/martin2011qi)
校对:[校对者ID](https://github.com/校对者ID)
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
[a]:http://itsfoss.com/author/abhishek/
[1]:http://itsfoss.com/guide-install-elementary-os-luna/
[2]:http://www.gnu.org/software/grub/
[3]:http://itsfoss.com/solve-error-partition-grub-rescue-ubuntu-linux/
[4]:http://itsfoss.com/fix-failed-fetch-cdrom-aptget-update-add-cdroms/