diff --git a/sources/talk/20180123 Moving to Linux from dated Windows machines.md b/sources/talk/20180123 Moving to Linux from dated Windows machines.md index 74bf66df68..6acd6e53f2 100644 --- a/sources/talk/20180123 Moving to Linux from dated Windows machines.md +++ b/sources/talk/20180123 Moving to Linux from dated Windows machines.md @@ -1,4 +1,3 @@ -translating by leowang Moving to Linux from dated Windows machines ====== diff --git a/sources/talk/20180127 Write Dumb Code.md b/sources/talk/20180127 Write Dumb Code.md index 505e8198df..acc647b0e5 100644 --- a/sources/talk/20180127 Write Dumb Code.md +++ b/sources/talk/20180127 Write Dumb Code.md @@ -1,5 +1,3 @@ -translating by ynmlml - Write Dumb Code ====== The best way you can contribute to an open source project is to remove lines of code from it. We should endeavor to write code that a novice programmer can easily understand without explanation or that a maintainer can understand without significant time investment. diff --git a/sources/talk/20180308 20 questions DevOps job candidates should be prepared to answer.md b/sources/talk/20180308 20 questions DevOps job candidates should be prepared to answer.md index b862ce311e..da43855266 100644 --- a/sources/talk/20180308 20 questions DevOps job candidates should be prepared to answer.md +++ b/sources/talk/20180308 20 questions DevOps job candidates should be prepared to answer.md @@ -1,4 +1,4 @@ -Translating by FelixYFZ 20 questions DevOps job candidates should be prepared to answer +20 questions DevOps job candidates should be prepared to answer ====== ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/hire-job-career.png?itok=SrZo0QJ3) diff --git a/sources/talk/20180410 Microservices Explained.md b/sources/talk/20180410 Microservices Explained.md index 5a2151a00b..1d7e946a12 100644 --- a/sources/talk/20180410 Microservices Explained.md +++ b/sources/talk/20180410 Microservices Explained.md @@ -1,4 +1,3 @@ -(translating by runningwater) Microservices Explained ====== diff --git a/sources/talk/20180419 3 tips for organizing your open source project-s workflow on GitHub.md b/sources/talk/20180419 3 tips for organizing your open source project-s workflow on GitHub.md index 1f9b80cd13..29e4ea2f48 100644 --- a/sources/talk/20180419 3 tips for organizing your open source project-s workflow on GitHub.md +++ b/sources/talk/20180419 3 tips for organizing your open source project-s workflow on GitHub.md @@ -1,4 +1,3 @@ -translating by aiwhj 3 tips for organizing your open source project's workflow on GitHub ====== diff --git a/sources/talk/20180724 Why moving all your workloads to the cloud is a bad idea.md b/sources/talk/20180724 Why moving all your workloads to the cloud is a bad idea.md index c4a6162068..1d97805178 100644 --- a/sources/talk/20180724 Why moving all your workloads to the cloud is a bad idea.md +++ b/sources/talk/20180724 Why moving all your workloads to the cloud is a bad idea.md @@ -1,5 +1,3 @@ -Translating by jessie-pang - Why moving all your workloads to the cloud is a bad idea ====== diff --git a/sources/tech/20140805 How to Install Cinnamon Desktop on Ubuntu.md b/sources/tech/20140805 How to Install Cinnamon Desktop on Ubuntu.md index 78ba32e2a2..6c6e54934b 100644 --- a/sources/tech/20140805 How to Install Cinnamon Desktop on Ubuntu.md +++ b/sources/tech/20140805 How to Install Cinnamon Desktop on Ubuntu.md @@ -1,4 +1,4 @@ -How to Install Cinnamon Desktop on Ubuntu +dianbanjiu Tranting How to Install Cinnamon Desktop on Ubuntu ====== **This tutorial shows you how to install Cinnamon desktop environment on Ubuntu.** diff --git a/sources/tech/20171111 A CEOs Guide to Emacs.md b/sources/tech/20171111 A CEOs Guide to Emacs.md index ad75b856f0..a694d07917 100644 --- a/sources/tech/20171111 A CEOs Guide to Emacs.md +++ b/sources/tech/20171111 A CEOs Guide to Emacs.md @@ -1,4 +1,4 @@ -# mandeler translating A CEO's Guide to Emacs +A CEO's Guide to Emacs ============================================================ Years—no, decades—ago, I lived in Emacs. I wrote code and documents, managed email and calendar, and shelled all in the editor/OS. I was quite happy. Years went by and I moved to newer, shinier things. As a result, I forgot how to do tasks as basic as efficiently navigating files without a mouse. About three months ago, noticing just how much of my time was spent switching between applications and computers, I decided to give Emacs another try. It was a good decision for several reasons that will be covered in this post. Covered too are `.emacs` and Dropbox tips so that you can set up a good, movable environment. diff --git a/sources/tech/20180215 Build a bikesharing app with Redis and Python.md b/sources/tech/20180215 Build a bikesharing app with Redis and Python.md index 67ddd07730..06e4c6949a 100644 --- a/sources/tech/20180215 Build a bikesharing app with Redis and Python.md +++ b/sources/tech/20180215 Build a bikesharing app with Redis and Python.md @@ -1,5 +1,3 @@ -hankchow translating - Build a bikesharing app with Redis and Python ====== diff --git a/sources/tech/20180516 Manipulating Directories in Linux.md b/sources/tech/20180516 Manipulating Directories in Linux.md deleted file mode 100644 index 4cc8ca4ea1..0000000000 --- a/sources/tech/20180516 Manipulating Directories in Linux.md +++ /dev/null @@ -1,183 +0,0 @@ -Translating by way-ww -Manipulating Directories in Linux -====== - -![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/branches-238379_1920_0.jpg?itok=2PlNpsVu) - -If you are new to this series (and to Linux), [take a look at our first installment][1]. In that article, we worked our way through the tree-like structure of the Linux filesystem, or more precisely, the File Hierarchy Standard. I recommend reading through it to make sure you understand what you can and cannot safely touch. Because this time around, I’ll show how to get all touchy-feely with your directories. - -### Making Directories - -Let's get creative before getting destructive, though. To begin, open a terminal window and use `mkdir` to create a new directory like this: -``` -mkdir - -``` - -If you just put the directory name, the directory will appear hanging off the directory you are currently in. If you just opened a terminal, that will be your home directory. In a case like this, we say the directory will be created _relative_ to your current position: -``` -$ pwd #This tells you where you are now -- see our first tutorial -/home/ -$ mkdir newdirectory #Creates /home//newdirectory - -``` - -(Note that you do not have to type the text following the `#`. Text following the pound symbol `#` is considered a comment and is used to explain what is going on. It is ignored by the shell). - -You can create a directory within an existing directory hanging off your current location by specifying it in the command line: -``` -mkdir Documents/Letters - -``` - -Will create the _Letters_ directory within the _Documents_ directory. - -You can also create a directory above where you are by using `..` in the path. Say you move into the _Documents/Letters/_ directory you just created and you want to create a _Documents/Memos/_ directory. You can do: -``` -cd Documents/Letters # Move into your recently created Letters/ directory -mkdir ../Memos - -``` - -Again, all of the above is done relative to you current position. This is called using a _relative path_. - -You can also use an _absolute path_ to directories: This means telling `mkdir` where to put your directory in relation to the root (`/`) directory: -``` -mkdir /home//Documents/Letters - -``` - -Change `` to your user name in the command above and it will be equivalent to executing `mkdir Documents/Letters` from your home directory, except that it will work from wherever you are located in the directory tree. - -As a side note, regardless of whether you use a relative or an absolute path, if the command is successful, `mkdir` will create the directory silently, without any apparent feedback whatsoever. Only if there is some sort of trouble will `mkdir` print some feedback after you hit _[Enter]_. - -As with most other command-line tools, `mkdir` comes with several interesting options. The `-p` option is particularly useful, as it lets you create directories within directories within directories, even if none exist. To create, for example, a directory for letters to your Mom within _Documents/_ , you could do: -``` -mkdir -p Documents/Letters/Family/Mom - -``` - -And `mkdir` will create the whole branch of directories above _Mom/_ and also the directory _Mom/_ for you, regardless of whether any of the parent directories existed before you issued the command. - -You can also create several folders all at once by putting them one after another, separated by spaces: -``` -mkdir Letters Memos Reports - -``` - -will create the directories _Letters/_ , _Memos/_ and _Reports_ under the current directory. - -### In space nobody can hear you scream - -... Which brings us to the tricky question of spaces in directory names. Can you use spaces in directory names? Yes, you can. Is it advised you use spaces? No, absolutely not. Spaces make everything more complicated and, potentially, dangerous. - -Say you want to create a directory called _letters mom/_. If you didn't know any better, you could type: -``` -mkdir letters mom - -``` - -But this is WRONG! WRONG! WRONG! As we saw above, this will create two directories, _letters/_ and _mom/_ , but not _letters mom/_. - -Agreed that this is a minor annoyance: all you have to do is delete the two directories and start over. No big deal. - -But, wait! Deleting directories is where things get dangerous. Imagine you did create _letters mom/_ using a graphical tool, like, say [Dolphin][2] or [Nautilus][3]. If you suddenly decide to delete _letters mom/_ from a terminal, and you have another directory just called _letters/_ under the same directory, and said directory is full of important documents, and you tried this: -``` -rmdir letters mom - -``` - -You would risk removing _letters/_. I say "risk" because fortunately `rmdir`, the instruction used to remove directories, has a built in safeguard and will warn you if you try to delete a non-empty directory. - -However, this: -``` -rm -Rf letters mom - -``` - -(and this is a pretty standard way of getting rid of directories and their contents) will completely obliterate _letters/_ and will never even tell you what just happened. - -The `rm` command is used to delete files and directories. When you use it with the options `-R` (delete _recursively_ ) and `-f` ( _force_ deletion), it will burrow down into a directory and its subdirectories, deleting all the files they contain, then deleting the subdirectories themselves, then it will delete all the files in the top directory and then the directory itself. - -`rm -Rf` is an instruction you must handle with extreme care. - -My advice is, instead of spaces, use underscores (`_`), but if you still insist on spaces, there are two ways of getting them to work. You can use single or double quotes (`'` or `"`) like so: -``` -mkdir 'letters mom' -mkdir "letters dad" - -``` - -Or, you can _escape_ the spaces. Some characters have a special meaning for the shell. Spaces, as you have seen, are used to separate options and arguments on the command line. "Separating options and arguments" falls under the category of "special meaning". When you want the shell to ignore the special meaning of a character, you need to _escape_ it and to escape a character, you put a backslash (`\`) in front of it: -``` -mkdir letters\ mom -mkdir letter\ dad - -``` - -There are other special characters that would need escaping, like the apostrophe or single quote (`'`), double quotes (`"`), and the ampersand (`&`): -``` -mkdir mom\ \&\ dad\'s\ letters - -``` - -I know what you're thinking: If the backslash has a special meaning (to wit, telling the shell it has to escape the next character), that makes it a special character, too. Then, how would you escape the escape character which is `\`? - -Turns out, the exact way you escape any other special character: -``` -mkdir special\\characters - -``` - -will produce a directory called _special\characters_. - -Confusing? Of course. That's why you should avoid using special characters, including spaces, in directory names. - -For the record, here is a list of special characters you can refer to just in case. - -### Things to Remember - - * Use `mkdir ` to create a new directory. - * Use `rmdir ` to delete a directory (only works if it is empty). - * Use `rm -Rf ` to annihilate a directory -- use with extreme caution. - * Use a relative path to create directories relative to your current directory: `mkdir newdir.`. - * Use an absolute path to create directories relative to the root directory (`/`): `mkdir /home//newdir` - * Use `..` to create a directory in the directory above the current directory: `mkdir ../newdir` - * You can create several directories all in one go by separating them with spaces on the command line: `mkdir onedir twodir threedir` - * You can mix and mash relative and absolute paths when creating several directories simultaneously: `mkdir onedir twodir /home//threedir` - * Using spaces and special characters in directory names guarantees plenty of headaches and heartburn. Don't do it. - - - -For more information, you can look up the manuals of `mkdir`, `rmdir` and `rm`: -``` -man mkdir -man rmdir -man rm - -``` - -To exit the man pages, press _[q]_. - -### Next Time - -In the next installment, you'll learn about creating, modifying, and erasing files, as well as everything you need to know about permissions and privileges. See you then! - -Learn more about Linux through the free ["Introduction to Linux" ][4]course from The Linux Foundation and edX. - --------------------------------------------------------------------------------- - -via: https://www.linux.com/blog/learn/2018/5/manipulating-directories-linux - -作者:[Paul Brown][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.linux.com/users/bro66 -[1]:https://www.linux.com/blog/learn/intro-to-linux/2018/4/linux-filesystem-explained -[2]:https://userbase.kde.org/Dolphin -[3]:https://projects-old.gnome.org/nautilus/screenshots.html -[4]:https://training.linuxfoundation.org/linux-courses/system-administration-training/introduction-to-linux diff --git a/sources/tech/20180518 How to Manage Fonts in Linux.md b/sources/tech/20180518 How to Manage Fonts in Linux.md index 12b450c778..0faca7fa17 100644 --- a/sources/tech/20180518 How to Manage Fonts in Linux.md +++ b/sources/tech/20180518 How to Manage Fonts in Linux.md @@ -1,5 +1,3 @@ -translating by Auk7F7 - How to Manage Fonts in Linux ====== diff --git a/sources/tech/20180531 How to Build an Amazon Echo with Raspberry Pi.md b/sources/tech/20180531 How to Build an Amazon Echo with Raspberry Pi.md index 0bf792f769..a5d4767706 100644 --- a/sources/tech/20180531 How to Build an Amazon Echo with Raspberry Pi.md +++ b/sources/tech/20180531 How to Build an Amazon Echo with Raspberry Pi.md @@ -1,5 +1,3 @@ -heart4lor translating - How to Build an Amazon Echo with Raspberry Pi ====== diff --git a/sources/tech/20180615 Complete Sed Command Guide [Explained with Practical Examples].md b/sources/tech/20180615 Complete Sed Command Guide [Explained with Practical Examples].md index a1d721ae3c..e548213483 100644 --- a/sources/tech/20180615 Complete Sed Command Guide [Explained with Practical Examples].md +++ b/sources/tech/20180615 Complete Sed Command Guide [Explained with Practical Examples].md @@ -1,4 +1,3 @@ -translating by amwps290 Complete Sed Command Guide [Explained with Practical Examples] ====== In a previous article, I showed the [basic usage of Sed][1], the stream editor, on a practical use case. Today, be prepared to gain more insight about Sed as we will take an in-depth tour of the sed execution model. This will be also an opportunity to make an exhaustive review of all Sed commands and to dive into their details and subtleties. So, if you are ready, launch a terminal, [download the test files][2] and sit comfortably before your keyboard: we will start our exploration right now! diff --git a/sources/tech/20180618 What-s all the C Plus Fuss- Bjarne Stroustrup warns of dangerous future plans for his C.md b/sources/tech/20180618 What-s all the C Plus Fuss- Bjarne Stroustrup warns of dangerous future plans for his C.md deleted file mode 100644 index 2f9a6636e7..0000000000 --- a/sources/tech/20180618 What-s all the C Plus Fuss- Bjarne Stroustrup warns of dangerous future plans for his C.md +++ /dev/null @@ -1,155 +0,0 @@ -Translating by qhwdw -What's all the C Plus Fuss? Bjarne Stroustrup warns of dangerous future plans for his C++ -====== - -![](https://regmedia.co.uk/2018/06/15/shutterstock_38621860.jpg?x=442&y=293&crop=1) - -**Interview** Earlier this year, Bjarne Stroustrup, creator of C++, managing director in the technology division of Morgan Stanley, and a visiting professor of computer science at Columbia University in the US, wrote [a letter][1] inviting those overseeing the evolution of the programming language to “Remember the Vasa!” - -Easy for a Dane to understand no doubt, but perhaps more of a stretch for those with a few gaps in their knowledge of 17th century Scandinavian history. The Vasa was a Swedish warship, commissioned by King Gustavus Adolphus. It was the most powerful warship in the Baltic Sea from its maiden voyage on the August 10, 1628, until a few minutes later when it sank. - -The formidable Vasa suffered from a design flaw: it was top-heavy, so much so that it was [undone by a gust of wind][2]. By invoking the memory of the capsized ship, Stroustrup served up a cautionary tale about the risks facing C++ as more and more features get added to the language. - -Quite a few such features have been suggested. Stroustrup cited 43 proposals in his letter. He contends those participating in the evolution of the ISO standard language, a group known as [WG21][3], are working to advance the language but not together. - -In his letter, he wrote: - ->Individually, many proposals make sense. Together they are insanity to the point of endangering the future of C++. - -He makes clear that he doesn’t interpret the fate of the Vasa to mean that incremental improvements spell doom. Rather, he takes it as a lesson to build a solid foundation, to learn from experience and to test thoroughly. - -With the recent conclusion of the C++ Standardization Committee Meeting in Rapperswil, Switzerland, earlier this month, Stroustrup addressed a few questions put to him by _The Register_ about what's next for the language. (The most recent version is C++17, which arrived last year; the next version C++20 is under development and expected in 2020.) - -**_Register:_ In your note, Remember the Vasa!, you wrote:** - ->The foundation begun in C++11 is not yet complete, and C++17 did little to make our foundation more solid, regular, and complete. Instead, it added significant surface complexity and increased the number of features people need to learn. C++ could crumble under the weight of these – mostly not quite fully-baked – proposals. We should not spend most our time creating increasingly complicated facilities for experts, such as ourselves. - -**Is C++ too challenging for newcomers, and if so, what features do you believe would make the language more accessible?** - -_**Stroustrup:**_ Some parts of C++ are too challenging for newcomers. - -On the other hand, there are parts of C++ that makes it far more accessible to newcomers than C or 1990s C++. The difficulty is to get the larger community to focus on those parts and help beginners and casual C++ users to avoid the parts that are there to support implementers of advanced libraries. - -I recommend the [C++ Core Guidelines][4] as an aide for that. - -Also, my “A Tour of C++” can help people get on the right track with modern C++ without getting lost in 1990s complexities or ensnarled by modern facilities meant for expert use. The second edition of “A Tour of C++” covering C++17 and parts of C++20 is on its way to the stores. - -I and others have taught C++ to 1st year university students with no previous programming experience in 3 months. It can be done as long as you don’t try to dig into every obscure corner of the language and focus on modern C++. - -“Making simple things simple” is a long-term goal of mine. Consider the C++11 range-for loop: -``` -for (int& x : v) ++x; // increment each element of the container v - -``` - -where v can be just about any container. In C and C-style C++, that might look like this: -``` -for (int i=0; i** Launch the terminal and type in: - -``` - sudo apt-get install unrar - -``` - --> After installing unrar, you may choose to type in “ **unrar** ” (without the inverted commas) to know more about its usage and how to use RAR files with the help of it. - -The most common usage would obviously be extracting the RAR file you have. So, **you can either perform a right-click on the file and proceed to extract it** from there or you can do it via the terminal with the help of this command: - -``` -unrar x FileName.rar - -``` - -You can see that in action here: - -![Using unrar in Ubuntu][7] - -If the file isn’t present in the Home directory, then you have to navigate to the target folder by using the “ **cd** ” command. For instance, if you have the archive in the Music directory, simply type in “ **cd Music** ” to navigate to the location and then extract the RAR file. - -### Creating & Managing RAR files - -![Using rar archive in Ubuntu Linux][8] - -UNRAR does not let you create RAR files. So, you need to install the RAR command-line tool to be able to create RAR archives. - -To do that, you need to type in the following command: - -``` -sudo apt-get install rar - -``` - -Here, we will help you create a RAR file. In order to do that, follow the command syntax below: - -``` -rar a ArchiveName File_1 File_2 Dir_1 Dir_2 - -``` - -When you type a command in this format, it will add every item inside the directory to the archive. In either case, if you want specific files, just mention the exact name/path. - -By default, the RAR files reside in **HOME** directory. - -In the same way, you can update/manage the RAR files. Just type in a command using the following syntax: - -``` -rar u ArchiveName Filename - -``` - -To get the list of commands for the RAR tool, just type “ **rar** ” in the terminal. - -### Wrapping Up - -Now that you’ve known how to use RAR files on Ubuntu, will you prefer using it over 7-zip, Zip, or Tar.xz? - -Let us know your thoughts in the comments below. - --------------------------------------------------------------------------------- - -via: https://itsfoss.com/use-rar-ubuntu-linux/ - -作者:[Ankush Das][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://itsfoss.com/author/ankush/ -[1]: https://www.rarlab.com/rar_file.htm -[2]: https://www.ubuntu.com/ -[3]: https://www.rarlab.com/ -[4]: https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/09/rar-ubuntu-linux.png -[5]: https://itsfoss.com/things-to-do-after-installing-ubuntu-18-04/ -[6]: https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/08/extract-rar-error.jpg -[7]: https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/08/unrar-rar-extraction.jpg -[8]: https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/09/rar-update-create.jpg diff --git a/translated/tech/20180516 Manipulating Directories in Linux.md b/translated/tech/20180516 Manipulating Directories in Linux.md new file mode 100644 index 0000000000..9e62973064 --- /dev/null +++ b/translated/tech/20180516 Manipulating Directories in Linux.md @@ -0,0 +1,166 @@ +在Linux上操作目录 +====== + +![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/branches-238379_1920_0.jpg?itok=2PlNpsVu) + +如果你不熟悉本系列(以及Linux),[请查看我们的第一部分][1]。在那篇文章中,我们通过Linux文件系统的树状结构,或者更确切地说以文件层次结构标准工作。我建议你仔细阅读,确保你理解自己能安全的做哪些操作。因为这一次,我将向你展示目录操作的魅力。 + +### 新建目录 + +在操作变得具有破坏性之前,让我们发挥创意创造。首先,打开一个终端窗口并使用命令mkdir创建一个新目录,如下所示: +``` +mkdir + +``` +如果你只输入了目录名称,该目录将显示在您当前所在目录中。如果你刚刚打开一个终端,你当前位置为你的家目录。下面这个例子,我们展示了将要创建的目录与你当前所处位置的关系: +``` +$ pwd #This tells you where you are now -- see our first tutorial +/home/ +$ mkdir newdirectory #Creates /home//newdirectory + +``` +(注 你不用输入#后面的文本。#后面的文本为注释内容,用于解释发生了什么。它会被shell忽略,不会被执行). + +你可以在当前位置中已经存在的某个目录下创建新的目录,方法是在命令行中指定它: +``` +mkdir Documents/Letters + +``` +这将在Documents目录中创建Letters目录。 + +你还可以在路径中使用..在当前目录的上一级目录中创建目录。假设你进入刚刚创建的Documents/Letters/目录,并且想要创建Documents/Memos/目录。你可以这样做: +``` +cd Documents/Letters # Move into your recently created Letters/ directory +mkdir ../Memos + +``` +同样,以上所有内容都是相对于你当前的位置做的。这就是使用了相对路径。 +你还可以使用目录的绝对路径:这意味着告诉mkdir命令将目录放在和根目录(/)有关的位置: +``` +mkdir /home//Documents/Letters + +``` +在上面的命令中将更改为你的用户名,这相当于从你的主目录执行mkdir Documents / Letters,通过使用绝对路径你可以在目录树中的任何位置完成这项工作。 + +无论你使用相对路径还是绝对路径,只要命令成功执行,mkdir将静默的创建新目录,而没有任何明显的反馈。只有当遇到某种问题时,mkdir才会在你敲下[Enter]后打印一些反馈。 + +与大多数其他命令行工具一样,mkdir提供了几个有趣的选项。 -p选项特别有用,因为它允许你创建嵌套目录,即使目录不存在也可以。例如,要在Documents /中创建一个目录存放写给妈妈的信,你可以这样做: +``` +mkdir -p Documents/Letters/Family/Mom + +``` +And `mkdir` will create the whole branch of directories above _Mom/_ and also the directory _Mom/_ for you, regardless of whether any of the parent directories existed before you issued the command. + +你也可以用空格来分隔目录名,来同时创建几个目录: +``` +mkdir Letters Memos Reports + +``` +这将在当前目录下创建目录Letters,Memos和Reports。 + +### 目录名中可怕的空格 + +... 这带来了目录名称中关于空格的棘手问题。你能在目录名中使用空格吗?是的你可以。那么建议你使用空格吗?不,绝对不是。空格使一切变得更加复杂,并且可能是危险的操作。 + +假设您要创建一个名为letters mom的目录。如果你不知道如何更好处理,你可能会输入: +``` +mkdir letters mom + +``` +但这是错误的!错误的!错误的!正如我们在上面介绍的,这将创建两个目录letters和mom,而不是一个目录letters mom。 + +得承认这是一个小麻烦:你所要做的就是删除这两个目录并重新开始,这没什么大不了。 + +可是等等!删除目录可是个危险的操作。想象一下,你确实使用图形工具[Dolphin][2]或[Nautilus][3]创建了目录letters mom。如果你突然决定从终端删除目录letters mom,并且您在同一目录下有另一个名为letters的目录,并且该目录中包含重要的文档,结果你为了删除错误的目录尝试了以下操作: +``` +rmdir letters mom + +``` +你将会有风险删除目录letters。这里说“风险”,是因为幸运的是rmdir这条用于删除目录的指令,有一个内置的安全措施,如果你试图删除一个非空目录时,它会发出警告。 + +但是,下面这个: +``` +rm -Rf letters mom + +``` +(注 这是删除目录及其内容的一种非常标准的方式)将完全删除letters目录,甚至永远不会告诉你刚刚发生了什么。 + +rm命令用于删除文件和目录。当你将它与选项-R(递归删除)和-f(强制删除)一起使用时,它会深入到目录及其子目录中,删除它们包含的所有文件,然后删除子目录本身,然后它将删除所有顶层目录中的文件,再然后是删除目录本身。 + +`rm -Rf` 是你必须非常小心处理的命令。 + +我的建议是,你可以使用下划线来代替空格,但如果你仍然坚持使用空格,有两种方法可以使它们起作用。您可以使用单引号或双引号,如下所示: +``` +mkdir 'letters mom' +mkdir "letters dad" + +``` +或者,你可以转义空格。有些字符对shell有特殊意义。正如你所见,空格用于在命令行上分隔选项和参数。 “分离选项和参数”属于“特殊含义”范畴。当你想让shell忽略一个字符的特殊含义时,你需要转义,你可以在它前面放一个反斜杠(\)如: +``` +mkdir letters\ mom +mkdir letter\ dad + +``` +还有其他特殊字符需要转义,如撇号或单引号('),双引号(“)和&符号(&): +``` +mkdir mom\ \&\ dad\'s\ letters + +``` +我知道你在想什么:如果反斜杠有一个特殊的含义(即告诉shell它必须转义下一个字符),这也使它成为一个特殊的字符。然后,你将如何转义转义字符(\)? + +事实证明,你转义任何其他特殊字符都是同样的方式: +``` +mkdir special\\characters + +``` +这将生成一个名为special\characters的目录。 + +感觉困惑?当然。这就是为什么你应该避免在目录名中使用特殊字符,包括空格。 + +以防误操作你可以参考下面这个记录特殊字符的列表。 + +### 总结 + + * 使用 `mkdir ` 创建新目录。 + * 使用 `rmdir ` 删除目录(仅在目录为空时才有效)。 + * 使用 `rm -Rf ` 来完全删除目录及其内容 - 请务必谨慎使用。 + * 使用相对路径创建相对于当前目录的目录: `mkdir newdir.`. + * 使用绝对路径创建相对于根目录(`/`)的目录: `mkdir /home//newdir` + * 使用 `..` 在当前目录的上级目录中创建目录: `mkdir ../newdir` + * 你可以通过在命令行上使用空格分隔目录名来创建多个目录: `mkdir onedir twodir threedir` + * 同时创建多个目录时,你可以混合使用相对路径和绝对路径: `mkdir onedir twodir /home//threedir` + * 在目录名称中使用空格和特殊字符真的会让你很头疼,你最好不要那样做。 + + + +有关更多信息,您可以查看`mkdir`, `rmdir` 和 `rm`的手册: +``` +man mkdir +man rmdir +man rm + +``` +要退出手册页,请按键盘[q]键。 + +### 下次预告 + +在下一部分中,你将学习如何创建,修改和删除文件,以及你需要了解的有关权限和特权的所有信息! + +通过Linux Foundation和edX免费提供的["Introduction to Linux" ][4]课程了解有关Linux的更多信息。 + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/blog/learn/2018/5/manipulating-directories-linux + +作者:[Paul Brown][a] +选题:[lujun9972](https://github.com/lujun9972) +译者:[way-ww](https://github.com/way-ww) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://www.linux.com/users/bro66 +[1]:https://www.linux.com/blog/learn/intro-to-linux/2018/4/linux-filesystem-explained +[2]:https://userbase.kde.org/Dolphin +[3]:https://projects-old.gnome.org/nautilus/screenshots.html +[4]:https://training.linuxfoundation.org/linux-courses/system-administration-training/introduction-to-linux diff --git a/translated/tech/20180618 What-s all the C Plus Fuss- Bjarne Stroustrup warns of dangerous future plans for his C.md b/translated/tech/20180618 What-s all the C Plus Fuss- Bjarne Stroustrup warns of dangerous future plans for his C.md new file mode 100644 index 0000000000..42bd3d3dd9 --- /dev/null +++ b/translated/tech/20180618 What-s all the C Plus Fuss- Bjarne Stroustrup warns of dangerous future plans for his C.md @@ -0,0 +1,163 @@ +# 关于 C ++ 的所有争论?Bjarne Stroustrup 警告他的 C++ 未来的计划很危险 + +![](https://regmedia.co.uk/2018/06/15/shutterstock_38621860.jpg?x=442&y=293&crop=1) + +今年早些时候,我们**访谈**了 Bjarne Stroustrup,他是 C++ 语言的创始人,摩根士丹利技术部门的董事总经理,美国哥伦比亚大学计算机科学的客座教授,他写了[一封信][1]邀请那些关注编程语言演进的人去“想想瓦萨号!” + +毫无疑问,对于丹麦人来说,这句话很容易理解,而那些对于 17 世纪的斯堪的纳维亚历史了解不多的人,还需要展开说一下。瓦萨号是一艘瑞典军舰,由国王 Gustavus Adolphus 委托建造。它是在 1628 年 8 月 10 日首航时,当时波罗的海国家中最强大的军舰,但是它在首航几分钟之后就沉没了。 + +巨大的瓦萨号有一个难以解决的设计缺陷:头重脚轻,以至于它被[一阵狂风刮翻了][2]。通过这段翻船历史的回忆,Stroustrup 警示了 C++ 所面临的风险,因为现在越来越多的特性被添加到了 C++ 中。 + +现在已经提议了不少这样的特性。Stroustrup 在他的信中引用了 43 条提议。他认为那些参与 C++ 语言 ISO 标准演进的人(指众所周知的 [WG21][3]),正在努力地让语言更高级,但他们的努力方向却并不一致。 + +在他的信中,他写道: + +> 分开来看,许多提议都很有道理。但将它们综合到一起,这些提议是很愚蠢的,将危害 C++ 的未来。 + +他明确表示,不希望 C++ 重蹈瓦萨号的覆辙,这种渐近式的改进将敲响 C++ 的丧钟。相反,应该吸取瓦萨号的教训,构建一个坚实的基础,吸取经验教训,并做彻底的测试。 + +在瑞士拉普斯威尔(Rapperswill)召开的 C++ 标准化委员会会议之后,本月早些时候,Stroustrup 接受了_《The Register》_ 的采访,回答了有关 C++ 语言下一步发展方向方面的几个问题。(最新版是 C++17,它去年刚发布;下一个版本是 C++20,它正在开发中,预计于 2020 年发布。) + +**Register:在你的信件《想想瓦萨号!》中,你写道:** + +> 在 C++11 开始基础不再完整,而 C++17 中在使基础更加稳固、规范和完整方面几乎没有改善。相反地,却增加了重要接口的复杂度,让人们需要学习的特性数量越来越多。C++ 可能在这种提议的重压之下崩溃 —— 这些提议大多数都不成熟。我们不应该花费大量的时间为专家级用户们(比如我们自己)去创建越来越复杂的东西。~~(还要考虑普通用户的学习曲线,越复杂的东西越不易普及。)~~ + +**对新人来说,C++ 很难吗?如果是这样,你认为怎样的特性让新人更易理解?** + +**Stroustrup:**C++ 的有些东西对于新人来说确实很难。 + +换句话说,C++ 中有些东西对于新人来说,比起 C 或上世纪九十年代的 C++ 更容易理解了。而难点是让大型社区专注于这些部分,并且帮助新手和普通 C++ 用户去规避那些对高级库实现提供支持的部分。 + +我建议使用 [C++ 核心准则][4] 作为实现上述目标的一个辅助。 + +此外,我的 “C++ 教程” 也可以帮助人们在使用现代 C++ 时走上正确的方向,而不会迷失在自上世纪九十年代以来的复杂性中,或困惑于只有专家级的用户才能理解的东西中。第二版的 “C++ 教程” 涵盖了 C++17 和部分 C++20 的内容,这本书即将要出版了。 + +我和其他人给没有编程经验的大一新生教过 C++,只要你不去深挖编程语言的每个晦涩难懂的角落,把注意力集中到 C++ 中最主流的部分,在三个月内新可以学会 C++。 + +“让简单的东西保持简单” 是我长期追求的目标。比如 C++11 的 `range-for` 循环: + +``` +for (int& x : v) ++x; // increment each element of the container v + +``` + +`v` 的位置可以是任何容器。在 C 和 C 风格的 C++ 中,它可能看到的是这样: + +``` +for (int i=0; i