mirror of
https://github.com/LCTT/TranslateProject.git
synced 2024-12-26 21:30:55 +08:00
乌龙茶翻译完成
This commit is contained in:
parent
72bd720294
commit
325d6f7dda
@ -1,69 +0,0 @@
|
|||||||
乌龙茶占坑
|
|
||||||
Command Line Tuesdays – Part Two
|
|
||||||
================================================================================
|
|
||||||
Heya geekos!
|
|
||||||
|
|
||||||
Let’s refresh our memories. [Last week][1], we skimmed through some basic commands, learned what a shell is actually, and made a steady introduction into our CLI Tuesdays series.
|
|
||||||
|
|
||||||
Today’s menu offers something else: navigation through the file system.
|
|
||||||
|
|
||||||
Now, the best picture I managed to find on the www is from a site called [devopsbootcamp][2]. You can find their tutorials and the rest here. But anyway, here’s a very nice diagram of what a linux root filesystem looks like.
|
|
||||||
|
|
||||||
![Filesys](http://devopsbootcamp.readthedocs.org/en/latest/_images/hierarchy.jpg)
|
|
||||||
|
|
||||||
For example, as stated in the above picture, your user directory (where you usually store your movies, music, documents etc.) is located in the /home folder. /home folder is located under /. Then you have the /etc folder, where most of the files for configuration are located. Anyway, you can find the detailed description here, as we’ll not be getting into which folder is for what, until we start using and configuring them. Today is reserved for navigation only. And on that note, let’s get down to the first command of the day…
|
|
||||||
|
|
||||||
### pwd ###
|
|
||||||
|
|
||||||
pwd, or ‘print working directory’ is a very useful command if you think you are lost navigating through the folders. At any given moment, type pwd, and voila! What appears is a complete pathway you took to arrive to this folder. Those guys in The Cube could sure use it, losers.
|
|
||||||
|
|
||||||
![Cube](http://bloody-disgusting.com/images/news/cube2review1.gif)
|
|
||||||
注:此图原文哪里看不到,看看能通过什么途径得到
|
|
||||||
|
|
||||||
Imagine yourselves walking from room to room inside a massive apartment, loosing your way. pwd is like the breadcrumb trail leading you to your starting point, so you don’t loose your way inside the folder maze!
|
|
||||||
|
|
||||||
![pwd](http://redhat.activeventure.com/73/gettingstartedguide/figs/basics/pwd.png)
|
|
||||||
|
|
||||||
### cd ###
|
|
||||||
|
|
||||||
Now you know in which directory you’re situated thanks to your usage of the pwd command. Now you want to take the next step and move to another directory. Let’s say you have a folder/directory inside your home folder you want to relocate your top secret terminal operation to. For this, you use the ‘cd’ command. cd, or ‘change directory’, will change the location of wanted directory. How do you use it? Simple, type cd and the path to your folder. Let’s say, for example, you want to enter your Hello Kitty picture collection in your home folder. You type ‘cd /home/username/Hello\ Kitty’.
|
|
||||||
|
|
||||||
As you see, we didn’t only use the space bar in the folder name. That’s because the terminal won’t recognize it. Whenever you want to navigate to a folder containing a space in it’s name, you **replace it with the backslash character, followed by space**. You can also, without using the backslash+space option, just put the **whole folder name into quotes**, f.ex. cd /home/username/”Hello Kitty”.
|
|
||||||
|
|
||||||
![cd](http://blogote.com/wp-content/uploads/2010/06/terminal-cd-desktop.png)
|
|
||||||
|
|
||||||
Try it out yourself. Navigate to a different directory using cd, and when there, type pwd to see if everything worked as it’s supposed to.
|
|
||||||
|
|
||||||
### Mr. Shotts’ Shottcuts ###
|
|
||||||
|
|
||||||
Mr. Shotts reminds us there are also some shortcuts available.
|
|
||||||
|
|
||||||
If you type only cd, without the path following it, your terminal will change your working directory (whatever it may be) to your /home folder.
|
|
||||||
|
|
||||||
The same, if you type cd `~user_name` it will lead you to the home folder of the specific user you stated.
|
|
||||||
|
|
||||||
### Next Week ###
|
|
||||||
|
|
||||||
Next week, we’ll head over to the next chapter – we’ll learn how to list files and directories, view text files and classify file’s contents so it will be a bit more work than we’re used to, but I hope you’ll have enough time. Command by command, and if you haven’t the time to do it yourself, we’ll learn the basics together in a matter of months!
|
|
||||||
|
|
||||||
and remember…
|
|
||||||
|
|
||||||
### …have a lot of fun! ###
|
|
||||||
|
|
||||||
P.S.: Thanks to bwl’s comment, we fixed an error in the text regarding the space bar in directory names.
|
|
||||||
|
|
||||||
P.P.S.: GreatEmerald also added some fresh information about file hierarchy. You can read it in [the comments][3].
|
|
||||||
|
|
||||||
Thanks for your input/corrections.
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
|
||||||
|
|
||||||
via: https://news.opensuse.org/2014/06/24/command-line-tuesdays-part-two/
|
|
||||||
|
|
||||||
译者:[译者ID](https://github.com/译者ID) 校对:[校对者ID](https://github.com/校对者ID)
|
|
||||||
|
|
||||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
|
||||||
|
|
||||||
[1]:https://news.opensuse.org/2014/06/10/command-line-tuesdays-part-one/
|
|
||||||
[2]:http://devopsbootcamp.readthedocs.org/
|
|
||||||
[3]:https://news.opensuse.org/2014/06/24/command-line-tuesdays-part-two/comment-page-1/#comment-99186
|
|
68
translated/tech/20140701 Command Line Tuesdays--Part Two.md
Normal file
68
translated/tech/20140701 Command Line Tuesdays--Part Two.md
Normal file
@ -0,0 +1,68 @@
|
|||||||
|
命令行星期二-第二部分
|
||||||
|
================================================================================
|
||||||
|
Hi,极客们!
|
||||||
|
|
||||||
|
让我们来更新一下我们的记忆。[上周][1],我们学习了一些基础命令,了解了shell是什么,同时介绍了我们CLI的星期二系列。
|
||||||
|
|
||||||
|
今天的菜单将提供点别的东西:通过文件系统导航。
|
||||||
|
|
||||||
|
现在,我设法找到最好的图片是从一个叫[devopsbootcamp][2]的网站。你可以在上面找到他们其余的教程。但无论如何,这是一个关于Linux根文件系统的看起来非常不错的图。
|
||||||
|
|
||||||
|
![Filesys](http://devopsbootcamp.readthedocs.org/en/latest/_images/hierarchy.jpg)
|
||||||
|
|
||||||
|
例如,在上面的图片说明中,你的用户目录(你通常存储你的电影,音乐,文档等)是位于/home文件夹。 /home文件夹位于/。你有/etc文件夹,其中文件大部分为配置文件。无论如何,你可以在这找到详细的描述,因为我们将进入这些文件夹来了解他们的功能,直到我们开始使用和配置它们。今天是仅用于导航。而关于这一点,让我们来开始今天的第一个命令...
|
||||||
|
|
||||||
|
### pwd ###
|
||||||
|
|
||||||
|
pwd,或者 ‘print working directory’当你认为你在文件中失去了方向是一个非常有用的命令。在任何给定时刻,键入pwd命令,瞧!这是你到达这个文件夹的完整路径。在多维数据集的那些家伙总能利用它。
|
||||||
|
|
||||||
|
![Cube](http://bloody-disgusting.com/images/news/cube2review1.gif)
|
||||||
|
注:此图原文哪里看不到,看看能通过什么途径得到
|
||||||
|
|
||||||
|
想象一下,自己在一个巨大的公寓里面从一个房间走到另一个房间房间,迷路了。 pwd就像面包屑指引着你到你的出发点,这样你就不会在文件夹迷宫里面失去你的方向!
|
||||||
|
|
||||||
|
![pwd](http://redhat.activeventure.com/73/gettingstartedguide/figs/basics/pwd.png)
|
||||||
|
|
||||||
|
### cd ###
|
||||||
|
|
||||||
|
现在你知道了如果想知道自己在哪个目录的pwd命令的用法。现在,你要采取的下一步骤,并移动到另一个目录。比方说,你想从home文件夹移动到里面有你想要的绝密的一个文件夹/目录。对于这一点,你用'cd'命令。 cd,或‘change directory’,将改变所处目录的位置。你怎么使用它呢?简单,键入cd和你的文件夹路径。比方说,例如,你想从你的主文件夹进入你的Hello Kitty图片集。你输入‘cd /home/username/Hello\ Kitty’。
|
||||||
|
|
||||||
|
正如你看到的,我们并没有只使用文件夹名称的空格键。这是因为终端将无法识别它。每当你要导航到它的名称中有空格的文件夹,你**用反斜杠字符,后跟空格**代替它。您也可以不使用反斜杠+空格选项,只是把**整个文件夹名称加引号**,例如,cd /home/username/”Hello Kitty”。
|
||||||
|
|
||||||
|
![cd](http://blogote.com/wp-content/uploads/2010/06/terminal-cd-desktop.png)
|
||||||
|
|
||||||
|
自己尝试一下。使用cd导航到不同的目录,同时,键入pwd命令,看看一切工作是否如期望的那样。
|
||||||
|
|
||||||
|
### Shotts先生的快捷键 ###
|
||||||
|
|
||||||
|
肖茨先生提醒我们也有一些可用的快捷键。
|
||||||
|
|
||||||
|
如果你仅键入cd,不带路径,你的终端将你的工作目录(不管它可能是)改变为你的/home文件夹。
|
||||||
|
|
||||||
|
同样地,如果你键入cd `~user_name`它会带你到你规定的特定用户的主文件夹。
|
||||||
|
|
||||||
|
### 下周 ###
|
||||||
|
|
||||||
|
下周,我们将进入到下一章 - 我们将学习如何列出文件和目录,查看文本文件和文件的内容进,因此会比之前我们已经学习的有更多的工作,但我希望你将会有足够的时间。命令通过命令,如果你没有时间自己做,我们将一起在几个月内学习基础知识!
|
||||||
|
|
||||||
|
同时,记得...
|
||||||
|
|
||||||
|
### …玩得开心! ###
|
||||||
|
|
||||||
|
P.S.:感谢bwl的评论,我们修正了一个在目录名称中包含空格的文本的一个错误。
|
||||||
|
|
||||||
|
P.P.S:GreatEmerald还增加了有关文件层次结构的一些新信息。您可以在[意见][3]中阅读。
|
||||||
|
|
||||||
|
感谢你们的贡献和更正
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: https://news.opensuse.org/2014/06/24/command-line-tuesdays-part-two/
|
||||||
|
|
||||||
|
译者:[乌龙茶](https://github.com/yechunxiao19) 校对:[校对者ID](https://github.com/校对者ID)
|
||||||
|
|
||||||
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创翻译,[Linux中国](http://linux.cn/) 荣誉推出
|
||||||
|
|
||||||
|
[1]:https://news.opensuse.org/2014/06/10/command-line-tuesdays-part-one/
|
||||||
|
[2]:http://devopsbootcamp.readthedocs.org/
|
||||||
|
[3]:https://news.opensuse.org/2014/06/24/command-line-tuesdays-part-two/comment-page-1/#comment-99186
|
Loading…
Reference in New Issue
Block a user