mirror of
https://github.com/LCTT/TranslateProject.git
synced 2024-12-26 21:30:55 +08:00
Merge remote-tracking branch 'LCTT/master'
This commit is contained in:
commit
398eccc6cf
92
published/20201202 Why I love Emacs.md
Normal file
92
published/20201202 Why I love Emacs.md
Normal file
@ -0,0 +1,92 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (wxy)
|
||||
[#]: reviewer: (wxy)
|
||||
[#]: publisher: (wxy)
|
||||
[#]: url: (https://linux.cn/article-12923-1.html)
|
||||
[#]: subject: (Why I love Emacs)
|
||||
[#]: via: (https://opensource.com/article/20/12/emacs)
|
||||
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
|
||||
|
||||
为什么我喜欢 Emacs
|
||||
======
|
||||
|
||||
> Emacs 并不是一个单纯的文本编辑器,它将掌控置于你手中,让你几乎可以解决你遇到的任何问题。
|
||||
|
||||
!["表情符号键盘"][1]
|
||||
|
||||
我是一个典型的 [Emacs][2] 用户。不是我选择的 Emacs,而是它选择了我。早在我刚开始学习 Unix 的时候,我偶然发现了一个奇怪的名为 Emacs 的应用程序,它隐藏在我的电脑上,其中有一个鲜为人知的功能。传说中(而且被证明是真的),如果你在终端上输入 `emacs`,按 `Alt+X`,然后输入 `tetris`,你就可以玩一个掉方块的游戏。
|
||||
|
||||
![Tetris in Emacs][3]
|
||||
|
||||
那就是我对 GNU Emacs 的印象。虽然这很肤浅,但它也准确地表明了 Emacs 的意义:用户可以重新编程他们的(虚拟)世界,并且可以用一个应用程序做*任何*他们想做的事情。在你的文本编辑器中玩俄罗斯方块可能不是你日常的主要目标,但这说明 Emacs 是一个值得骄傲的编程平台。事实上,你可以把它看作是 [Jupyter][4] 的一种先驱,它把一种强大的编程语言(准确的说叫 elisp)和自己的实时环境结合起来。因此,Emacs 作为一个文本编辑器是灵活的、可定制的、强大的。
|
||||
|
||||
如果你习惯于 Bash、Python 或类似的语言,elisp(以及扩展的 Common Lisp)不一定是最容易入门的语言。但是这种 LISP 方言是很强大的,而且因为 Emacs 是一个 LISP 解释器,所以你可以用它构建应用程序,不管它们是 Emacs 插件还是你想开发成一个独立项目的原型。极其流行的 [org 模式项目][5]就是一个例子:它是一个 Emacs 插件,同时也是一个标记语法,有移动应用可以解释和扩展其功能。类似的有用的 Emacs 内应用的例子还有很多,包括电子邮件客户端、PDF 浏览器、Web 浏览器、shell 和文件管理器。
|
||||
|
||||
### 两个界面
|
||||
|
||||
GNU Emacs 至少有两个用户界面:图形用户界面(GUI)和终端用户界面(TUI)。这有时会让人感到惊讶,因为 Emacs 经常与运行在终端中的 Vi 相提并论(尽管 gVim 为现代 Vi 的实现提供了一个 GUI)。如果你想把 GNU Emacs 以终端程序来运行,你可以用 `-nw` 选项来启动它。
|
||||
|
||||
```
|
||||
$ emacs -nw
|
||||
```
|
||||
|
||||
有了 GUI 程序,你可以直接从应用程序菜单或终端启动 Emacs。
|
||||
|
||||
你可能会认为 GUI 会降低 Emacs 的效率,好像“真正的文本编辑器是在终端中运行的”,但 GUI 可以使 Emacs 更容易学习,因为它的 GUI 遵循了一些典型的惯例(菜单栏、可调节的组件、鼠标交互等)。
|
||||
|
||||
事实上,如果你把 Emacs 作为一个 GUI 应用程序来运行,你可能在一天的时间里会完全没有意识到你在 Emacs 中。只要你使用过 GUI,大多数常用的惯例都适用。例如,你可以用鼠标选择文本,导航到**编辑**菜单,选择**复制**,然后将光标放在其他地方,选择**粘贴**。要保存文档,你可以进入**文件**,然后选择**保存**或**另存为**。你可以按 `Ctrl` 键并向上滚动,使屏幕字体变大,你可以使用滚动条来浏览你的文档,等等。
|
||||
|
||||
了解 Emacs 的 GUI 形式是拉平学习曲线的好方法。
|
||||
|
||||
### Emacs 键盘快捷键
|
||||
|
||||
GNU Emacs 以复杂的键盘组合而恶名远扬。它们不仅陌生(`Alt+W` 来复制?`Ctrl+Y` 来粘贴?),而且还用晦涩难懂的术语来标注(`Alt` 被称为 `Meta`),有时它们成双成对(`Ctrl+X` 后是 `Ctrl+S` 来保存),有时则单独出现(`Ctrl+S` 来搜索)。为什么有人会故意选择使用这些呢?
|
||||
|
||||
嗯,有些人不会。但那些喜欢这些的人是因为这些组合很容易融入到日常打字的节奏中(而且经常让 `Caps Lock` 键充当 `Ctrl` 键)。然而,那些喜欢不同的东西的人有几个选择:
|
||||
|
||||
* “邪恶”模式让你在 Emacs 中使用 Vim 键绑定。就是这么简单。你可以保留你的肌肉记忆中的按键组合,并继承最强大的文本编辑器。
|
||||
* 通用用户访问(CUA)键保留了所有 Emacs 常用的组合键,但最令人头疼的键(复制、剪切、粘贴和撤消)都被映射到现代的键盘绑定中(分别为 `Ctrl+C`、`Ctrl+X`、`Ctrl+V` 和 `Ctrl+Z`)。
|
||||
* `global-set-key` 函数,是 Emacs 编程的一部分,允许你定义自己的键盘快捷键。传统上,用户定义的快捷键以 `Ctrl+C` 开头,但没有什么能阻止你发明自己的方案。Emacs 并不敝帚自珍,欢迎你按照自己的意愿来扭转它。
|
||||
|
||||
### 学习 Emacs
|
||||
|
||||
要想很好地使用 Emacs 是需要时间的。对我来说,这意味着打印出一张[速记表][6],每天都把它放在键盘旁边。当我忘了一个键组合时,我就在我的速记表上查找它。如果它不在我的速记表上,我就学习这个键盘组合,要么通过执行该函数,并注意 Emacs 告诉我如何更快地访问它,要么通过使用 `describe-function`:
|
||||
|
||||
```
|
||||
M-x describe-function: save-buffer
|
||||
|
||||
save-buffer is an interactive compiled Lisp function in ‘files.el’.
|
||||
|
||||
It is bound to C-x C-s, <menu-bar> <file> <save-buffer>.
|
||||
[...]
|
||||
```
|
||||
|
||||
当你使用它的时候,你就会学习它。你对它了解得越多,你就越有能力去改进它,使它变成你自己的。
|
||||
|
||||
### 尝试 Emacs
|
||||
|
||||
人们常开玩笑说 Emacs 是一个包含文本编辑器的操作系统。也许这是在暗示 Emacs 臃肿和过于复杂,当然也有一种说法是文本编辑器根据其默认配置不应该需要 `libpoppler`(你可以不需要它来编译 Emacs)。
|
||||
|
||||
但这个笑话背后潜藏着一个更大的真相,它揭示了 Emacs 如此有趣的原因。将 Emacs 与其他文本编辑器,如 Vim、Nano,甚至 [VSCodium][7] 进行比较是没有意义的,因为 Emacs 真正重要的部分并不是你可以在窗口中输入东西并保存的这种思路。那是连 Bash 都能提供的基本功能。Emacs 的真正意义在于它如何将控制置身于你的手中,以及如何通过 Emacs Lisp([Elisp][8])解决几乎任何问题。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/20/12/emacs
|
||||
|
||||
作者:[Seth Kenlon][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[wxy](https://github.com/wxy)
|
||||
校对:[wxy](https://github.com/wxy)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/seth
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/emoji-keyboard.jpg?itok=JplrSZ9c (Emoji keyboard)
|
||||
[2]: https://en.wikipedia.org/wiki/Emacs
|
||||
[3]: https://opensource.com/sites/default/files/tetris.png (Tetris in Emacs)
|
||||
[4]: https://opensource.com/article/20/11/surprising-jupyter
|
||||
[5]: https://opensource.com/article/19/1/productivity-tool-org-mode
|
||||
[6]: https://opensource.com/downloads/emacs-cheat-sheet
|
||||
[7]: https://opensource.com/article/20/6/open-source-alternatives-vs-code
|
||||
[8]: https://www.gnu.org/software/emacs/manual/html_node/elisp/
|
@ -1,73 +0,0 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (What web developers love about the Brackets text editor)
|
||||
[#]: via: (https://opensource.com/article/20/12/brackets)
|
||||
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
|
||||
|
||||
What web developers love about the Brackets text editor
|
||||
======
|
||||
This basic editor is geared toward web developers, supporting multiple
|
||||
programming languages and offering plenty of extensions to make it your
|
||||
own.
|
||||
![Text editor on a browser, in blue][1]
|
||||
|
||||
The Brackets text editor is an editor geared primarily at web developers. Appropriately, its Edit menu is full of functions especially useful to users of web programming languages, with a focus on the classic combination of HTML, CSS, and Javascript.
|
||||
|
||||
However, it supports many languages and formats relevant to the internet, including XML, Markdown, YAML and JSON, PHP, Lua, Java, and Python, as well as some common general languages like C, C++, and even the output of `diff` commands.
|
||||
|
||||
### Installing Brackets
|
||||
|
||||
Brackets can be installed on Linux, Windows, and macOS from the [Brackets website][2].
|
||||
|
||||
Alternatively, on Linux, you can install it as a Flatpak from [flathub.org][3].
|
||||
|
||||
![Brackets editor][4]
|
||||
|
||||
### Using Brackets
|
||||
|
||||
For the most part, Brackets is a "normal" text editor, with features similar to jEdit or Medit. There’s syntax highlighting, configurable tab spacing, character encoding settings, and so on. These are available in the status bar at the bottom of the window.
|
||||
|
||||
From the View menu, there are theme settings, line numbering, word wrapping, and even options to split the window so you can see two files in one window.
|
||||
|
||||
In the Edit menu, however, there are some special functions for programming. Here are some of my favorites:
|
||||
|
||||
* Indent and unindent blocks of text using the **Ctrl+[** or **Ctrl+]** keyboard shortcuts, which are useful not only for keeping HTML, CSS, and Javascript tidy but essential for Python code.
|
||||
* Make a line into a comment with **Ctrl+/**. The way Brackets marks a comment depends on the language you’re using, so this function works whether your document uses slashes, dashes, arrows, hashes, or anything else for commenting.
|
||||
* Move a line up or down in your document with **Shift+Ctrl+Up** or **Shift+Ctrl+Down**.
|
||||
* Delete an entire line with **Shift+Ctrl+D**.
|
||||
* Duplicate a line with **Ctrl+D**.
|
||||
|
||||
|
||||
|
||||
These are all seemingly niche functions you might not think you’ll use often, but once you have them, you come to rely on them.
|
||||
|
||||
### Extensions
|
||||
|
||||
Brackets can also accept extensions so you and other coders can add to its features. To see what extensions are available, click the File menu and select Extension Manager. There’s a wide variety of extensions available, including Beautify to adjust code formatting, multiple support kits for additional languages, a function to go to the beginning or end of a tag, and much more.
|
||||
|
||||
Extensions can make all the difference to an editor and whether it’s right for you, so if you try Brackets and enjoy everything about it, but you’re missing some vital feature, have a browse through the available extensions before you give up on it.
|
||||
|
||||
### Try Brackets
|
||||
|
||||
Brackets is a somewhat subdued editor. While it advertises itself as a "code editor for the web," it’s actually a nice general-purpose editor with some extra features thrown in for common web toolchains. If you like the look of Brackets and what it has to offer, give it a try!
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/20/12/brackets
|
||||
|
||||
作者:[Seth Kenlon][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/seth
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/browser_blue_text_editor_web.png?itok=lcf-m6N7 (Text editor on a browser, in blue)
|
||||
[2]: http://brackets.io/
|
||||
[3]: https://flathub.org/apps/details/io.brackets.Brackets
|
||||
[4]: https://opensource.com/sites/default/files/screenshot_2020-12-02_at_16.26.58.png (Brackets editor)
|
@ -1,95 +0,0 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Why I love Emacs)
|
||||
[#]: via: (https://opensource.com/article/20/12/emacs)
|
||||
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
|
||||
|
||||
Why I love Emacs
|
||||
======
|
||||
Emacs isn't a mere text editor; it places you in control and allows you
|
||||
to solve nearly any problem you encounter.
|
||||
![Emoji keyboard][1]
|
||||
|
||||
I'm a habitual [Emacs][2] user. I didn't choose Emacs as much as it chose me. Back when I was first learning about Unix, I stumbled upon a little-known feature in a strange application called Emacs, which was apparently hidden away on my computer. Legend had it (and was proven true) that if you typed `emacs` into a terminal, pressed **Alt**+**X**, and typed `tetris`, you could play a falling-blocks game.
|
||||
|
||||
![Tetris in Emacs][3]
|
||||
|
||||
That was my introduction to GNU Emacs. While it was frivolous, it was also an accurate indication of what Emacs is all about—the idea that users can reprogram their (virtual) worlds and do _whatever_ they want with an application. Playing Tetris in your text editor is probably not your primary goal on an everyday basis, but it goes to show that Emacs is, proudly, a programming platform. In fact, you might think of it as a kind of precursor to [Jupyter][4], combining a powerful programming language (called `elisp`, to be exact) with its own live environment. As a consequence, Emacs is flexible as a text editor, customizable, and powerful.
|
||||
|
||||
Elisp (and Common Lisp, by extension) aren't necessarily the easiest languages to start out on, if you're used to Bash or Python or similar languages. But LISP dialects are powerful, and because Emacs is a LISP interpreter, you can build applications, whether they're Emacs plugins or prototypes of something you want to develop into a stand-alone project. The wildly popular [org-mode project][5] is just one example: it's an Emacs plugin as well as a markdown syntax with mobile apps to interpret and extend its capabilities. There are many examples of similarly useful applications-within-Emacs, including an email client, a PDF viewer, web browser, a shell, and a file manager.
|
||||
|
||||
### Two interfaces
|
||||
|
||||
GNU Emacs has at least two user interfaces: a graphical user interface (GUI) and a terminal user interface (TUI). This sometimes surprises people because Emacs is often pitted against Vi, which runs in a terminal (although gVim provides a GUI for a modern Vi implementation). If you want to run GNU Emacs as a terminal application, you can launch it with the `-nw` option:
|
||||
|
||||
|
||||
```
|
||||
`$ emacs -nw`
|
||||
```
|
||||
|
||||
With a GUI, you can just launch Emacs from your application menu or a terminal.
|
||||
|
||||
You might think that a GUI renders Emacs less effective, as if "real text editors run in a terminal," but a GUI can make Emacs easier to learn because its GUI follows some typical conventions (a menu bar, adjustable widgets, mouse interaction, and so on).
|
||||
|
||||
In fact, if you run Emacs as a GUI application, you can probably get through the day without noticing you're in Emacs at all. Most of the usual conventions apply, as long as you use the GUI. For instance, you can select text with your mouse, navigate to the **Edit** menu, select **Copy**, and then place your cursor elsewhere and select **Paste**. To save a document, you can go to **File** and **Save** or **Save As**. You can press **Ctrl** and scroll up to make your screen font larger, you can use the scroll bar to navigate through your document, and so on.
|
||||
|
||||
Getting to know Emacs in its GUI form is a great way to flatten the learning curve.
|
||||
|
||||
### Emacs keyboard shortcuts
|
||||
|
||||
GNU Emacs is infamous for complex keyboard combinations. They're not only unfamiliar (**Alt**+**W** to copy? **Ctrl**+**Y** to paste?), they're also notated with arcane terminology ("Alt" is called "Meta"), and sometimes they come in pairs (**Ctrl**+**X** followed by **Ctrl**+**S** to save) and other times alone (**Ctrl**+**S** to search). Why would anyone willfully choose to use this?
|
||||
|
||||
Well, some don't. But those who do are fans of how these combinations easily flow into the rhythm of everyday typing (and often have the **Caps Lock** key serve as a **Ctrl** key). Those who prefer something different, however, have several options.
|
||||
|
||||
* The `evil` mode lets you use Vim keybindings in Emacs. It's that simple: You get to keep the key combinations you've committed to muscle memory, and you inherit the most powerful text editor available.
|
||||
* Common User Access (CUA) keys keep all of the usual Emacs key combinations but the most jarring ones—copy, cut, paste, and undo—are all mapped to their modern bindings (**Ctrl**+**C**, **Ctrl**+**X**, **Ctrl**+**V**, and **Ctrl**+**Z**, respectively).
|
||||
* The `global-set-key` function, part of the programming side of Emacs, allows you to define your own keyboard shortcuts. Traditionally, user-defined shortcuts start with **Ctrl**+**C**, but nothing is stopping you from inventing your own scheme. Emacs isn't precious of its own identity. You're welcome to bend it to your will.
|
||||
|
||||
|
||||
|
||||
### Learn Emacs
|
||||
|
||||
It takes time to get very good with Emacs. For me, that meant printing out a [cheat sheet][6] and keeping it next to my keyboard all day, every day. When I forgot a key combo, I looked it up on my cheat sheet. If it wasn't on my cheat sheet, I learned the keyboard combo, either by executing the function and noting how Emacs told me I could access it quicker or by using `describe-function`:
|
||||
|
||||
|
||||
```
|
||||
M-x describe-function: save-buffer
|
||||
|
||||
save-buffer is an interactive compiled Lisp function in ‘files.el’.
|
||||
|
||||
It is bound to C-x C-s, <menu-bar> <file> <save-buffer>.
|
||||
[...]
|
||||
```
|
||||
|
||||
As you use it, you learn it. And the more you learn about it, the more empowered you become to improve it and make it your own.
|
||||
|
||||
### Try Emacs
|
||||
|
||||
It's a common joke to say that Emacs is an operating system with a text editor included. Maybe that's meant to insinuate Emacs is bloated and overly complex, and there's certainly an argument that a text editor shouldn't require `libpoppler` according to its default configuration (you can compile Emacs without it).
|
||||
|
||||
But there's a greater truth lurking behind this joke, and it reveals a lot about what makes Emacs so fun. It doesn't make sense to compare Emacs to other text editors, like Vim, Nano, or even [VSCodium][7], because the really important part of Emacs isn't the idea that you can type stuff into a window and save it. That's basic functionality that even Bash provides. The true significance of Emacs is how it places you in control and how, through Emacs Lisp ([Elisp][8]), nearly any problem can be solved.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/20/12/emacs
|
||||
|
||||
作者:[Seth Kenlon][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/seth
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/emoji-keyboard.jpg?itok=JplrSZ9c (Emoji keyboard)
|
||||
[2]: https://en.wikipedia.org/wiki/Emacs
|
||||
[3]: https://opensource.com/sites/default/files/tetris.png (Tetris in Emacs)
|
||||
[4]: https://opensource.com/article/20/11/surprising-jupyter
|
||||
[5]: https://opensource.com/article/19/1/productivity-tool-org-mode
|
||||
[6]: https://opensource.com/downloads/emacs-cheat-sheet
|
||||
[7]: https://opensource.com/article/20/6/open-source-alternatives-vs-code
|
||||
[8]: https://www.gnu.org/software/emacs/manual/html_node/elisp/
|
@ -1,70 +0,0 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Make medit your next Linux terminal text editor)
|
||||
[#]: via: (https://opensource.com/article/20/12/medit)
|
||||
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
|
||||
|
||||
Make medit your next Linux terminal text editor
|
||||
======
|
||||
This classic text editor offers all the basics and some exciting extra
|
||||
features that let you customize your experience.
|
||||
![Person drinking a hot drink at the computer][1]
|
||||
|
||||
There’s [XEDIT][2], jEdit, NEdit, [gedit][3], and, as it turns out, [medit][4].
|
||||
|
||||
I had not heard about medit until I started searching for editors I hadn’t yet tried, but I’m glad to have discovered it. If you’re looking for a classic gedit experience (circa Gnome 2), then medit is, probably unintentionally, an excellent and modern approximation. It’s also got many additional features, such as the ability to write plugins in Python, Lua, or C, and a means to integrate even shell scripts into its menu system. All the other usual features are here, too—a tabbed interface, an on-demand shell, indentation management, syntax highlighting, and so on.
|
||||
|
||||
### Installing medit
|
||||
|
||||
You can download medit from [mooedit.sourceforge.net][5]. It’s confirmed to work on Linux and Windows. If you’re using Linux, you may also find it in your repository. I installed my copy from [slackbuilds.org][6] on Slackware.
|
||||
|
||||
![Medit terminal showing examples of Bash script in editor][7]
|
||||
|
||||
### Using medit
|
||||
|
||||
Medit advertises itself as an editor "for programming and around programming," and in fact, started its life out as part of a larger project called [GAP (Groups, Algorithms, Programming)][8]. Most of its features are aimed at typical developer expectations. For instance, in the **Edit** menu, there are options to increase and decrease indentation, a common task for any programmer trying to indicate scope visually (and a literal requirement for Python programmers), and options to comment or uncomment blocks of text.
|
||||
|
||||
Some features can be useful for general users, too. Medit has an easy-to-use tabbed interface (both at the top of the window and as a pop-up list along the side), a side panel for quick filesystem browsing, the ability to bookmark places in a file, and so on. It also has syntax highlighting for both programming languages, as well as markup and markdown languages, so it’s a useful editor for code and prose alike.
|
||||
|
||||
### Color schemes
|
||||
|
||||
When editing plain text with no syntax associated with it or a format like Asciidoc, for which medit has no preset highlighting scheme, the editor assumes your system default. I use a dark theme, so medit displays white text on a dark gray background.
|
||||
|
||||
For syntax highlighting, though, the text becomes colorful depending on the part each word plays in its structured language. At first, I was a little frustrated at some of the choices medit made; many of the colors were too dark against my dark background to be legible, and I didn’t feel that all the important elements were unique enough. The answer to this problem, should you disagree with medit’s choices, is in **Preferences**, where you can change the color theme. I changed mine to the Tango colors, which rendered a solarized color array that stood out nicely against my dark editor background and even added color to elements that were kept white under the medit theme.
|
||||
|
||||
![Medit terminal showing examples of Bash script in editor using Tango color scheme against dark background][9]
|
||||
|
||||
### Pop-up Python
|
||||
|
||||
At the bottom of the medit window, there’s a pop-up terminal for quick access to a shell. This is a nice feature, but frankly, after you’ve experienced Emacs and [Kate][10], it feels pretty common. What surprised me about medit was its pop-up Python console, which launches from the **Tools** menu with **moo** and **gtk** modules pre-imported. In other words, when you launch medit’s Python shell, you can look through the Python and GTK modules that medit itself is partly built upon. It’s a great feature and one that might inspire you to write a plugin (the Terminal pop-up is a plugin written in Python, so you can also look through its code to get a feel for how a plugin is written).
|
||||
|
||||
### Classic editing
|
||||
|
||||
Medit is a great GTK-based editor with all the important basic features and several tantalizing extras to help inspire you to extend the application and make it your own. As it accepts C, Python, Lua, and Bash, there are several entry points for doing just that. If you’re looking for a no-nonsense editor for your writing, whether it’s code or markdown or something in between, give medit a chance.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/20/12/medit
|
||||
|
||||
作者:[Seth Kenlon][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/seth
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/coffee_tea_laptop_computer_work_desk.png?itok=D5yMx_Dr (Person drinking a hot drink at the computer)
|
||||
[2]: https://opensource.com/article/20/12/xedit
|
||||
[3]: https://opensource.com/article/20/12/gedit
|
||||
[4]: http://mooedit.sourceforge.net/
|
||||
[5]: https://sourceforge.net/projects/mooedit/files/medit/
|
||||
[6]: https://slackbuilds.org/repository/14.2/development/medit
|
||||
[7]: https://opensource.com/sites/default/files/uploads/medit-31_days_medit-opensource.png (Medit terminal showing examples of Bash script in editor)
|
||||
[8]: https://www.gap-system.org/
|
||||
[9]: https://opensource.com/sites/default/files/uploads/medit-tango-colour-31_days_medit-opensource.png (Medit terminal showing examples of Bash script in editor using Tango color scheme against dark background)
|
||||
[10]: https://opensource.com/article/20/12/kate-text-editor
|
@ -1,5 +1,5 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
|
@ -0,0 +1,107 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (6 container concepts you need to understand)
|
||||
[#]: via: (https://opensource.com/article/20/12/containers-101)
|
||||
[#]: author: (Mike Calizo https://opensource.com/users/mcalizo)
|
||||
|
||||
6 container concepts you need to understand
|
||||
======
|
||||
Containers are everywhere, and they've radically changed the IT
|
||||
landscape. What do you need to know about them?
|
||||
![Ships at sea on the web][1]
|
||||
|
||||
Containerization has radically changed the IT landscape because of the significant value and wide array of benefits it brings to business. Nearly any recent business innovation has containerization as a contributing factor, if not the central element.
|
||||
|
||||
In modern application architectures, the ability to deliver changes quickly to the production environment gives you an edge over your competitors. Containers deliver speed by using a microservices architecture that helps development teams create functionality, fail small, and recover faster. Containerization also enables applications to start faster and automatically scale cloud resources on demand. Furthermore, [DevOps][2] maximizes containerization's benefits by enabling the flexibility, portability, and efficiency required to go to market early.
|
||||
|
||||
While speed, agility, and flexibility are the main promises of containerization using DevOps, security is a critical factor. This led to the rise of DevSecOps, which incorporates security into application development from the start and throughout the lifecycle of a containerized application. By default, containerization massively improves security because it isolates the application from the host and other containerized applications.
|
||||
|
||||
### What are containers?
|
||||
|
||||
Containers are the solution to problems inherited from monolithic architectures. Although monoliths have strengths, they prevent organizations from moving fast the agile way. Containers allow you to break monoliths into [microservices][3].
|
||||
|
||||
Essentially, a container is an application bundle of lightweight components, such as application dependencies, libraries, and configuration files, that run in an isolated environment on top of traditional operating systems or in virtualized environments for easy portability and flexibility.
|
||||
|
||||
![Container architecture][4]
|
||||
|
||||
(Michael Calizo, [CC BY-SA 4.0][5])
|
||||
|
||||
To summarize, containers provide isolation by taking advantage of kernel technologies like cgroups, [kernel namespaces][6], and [SELinux][7]. Containers share a kernel with the host, which allows them to use fewer resources than a virtual machine (VM) would require.
|
||||
|
||||
### Container advantages
|
||||
|
||||
This architecture provides agility that is not feasible with VMs. Furthermore, containers support a more flexible model when it comes to compute and memory resources, and they allow resource-burst modes so that applications can consume more resources, when required, within the defined boundaries. In other words, containers provide scalability and flexibility that you cannot get from running an application on top of a VM.
|
||||
|
||||
Containers make it easy to share and deploy applications on public or private clouds. More importantly, they provide consistency that helps operations and development teams reduce the complexity that comes with multi-platform deployment.
|
||||
|
||||
Containers also enable a common set of building blocks that can be reused in any stage of development to recreate identical environments for development, testing, staging, and production, extending the concept of "write-once, deploy anywhere."
|
||||
|
||||
Compared to virtualization, containers make it simpler to achieve flexibility, consistency, and the ability to deploy applications faster—the main principles of DevOps.
|
||||
|
||||
### The Docker factor
|
||||
|
||||
[Docker][8] has become synonymous with containers. Docker revolutionized and popularized containers, even though the technology existed before Docker. Examples include AIX Workload partitions, Solaris Containers, and Linux containers ([LXC][9]), which was created to [run multiple Linux environments in a single Linux host][10].
|
||||
|
||||
### The Kubernetes effect
|
||||
|
||||
Kubernetes is widely recognized as the leading [orchestration engine][11]. In the last few years, [Kubernetes' popularity][12] coupled with maturing container adoption created the ideal scenario for ops, devs, and security teams to embrace the changing landscape.
|
||||
|
||||
Kubernetes provides a holistic approach to managing containers. It can run containers across a cluster to enable features like autoscaling cloud resources, including event-driven application requirements, in an automated and distributed way. This ensures high availability "for free" (i.e., neither developers nor admins expend extra effort to make it happen).
|
||||
|
||||
In addition, OpenShift and similar Kubernetes enterprise offerings make container adoption much easier.
|
||||
|
||||
![Kubernetes cluster][13]
|
||||
|
||||
(Michael Calizo, [CC BY-SA 4.0][5])
|
||||
|
||||
### Will containers replace VMs?
|
||||
|
||||
[KubeVirt][14] and similar [open source][15] projects show a lot of promise that containers will replace VMs. KubeVirt brings VMs into containerized workflows by converting the VMs into containers, where they run with the benefits of containerized applications.
|
||||
|
||||
Right now, containers and VMs work as complementary solutions rather than competing technologies. Containers run atop VMs to increase availability, especially for applications that require persistency, and take advantage of virtualization technology that makes it easier to manage the hardware infrastructure (like storage and networking) required to support containers.
|
||||
|
||||
### What about Windows containers?
|
||||
|
||||
There is a big push from Microsoft and the open source community to make Windows containers successful. Kubernetes Operators have fast-tracked Windows container adoption, and products like OpenShift now enable [Windows worker nodes][16] to run Windows containers.
|
||||
|
||||
Windows containerization creates a lot of enticing possibilities, especially for enterprises with mixed environments. Being able to run your most critical applications on top of a Kubernetes cluster is a big advantage towards achieving a hybrid- or multi-cloud environment.
|
||||
|
||||
### The future of containers
|
||||
|
||||
Containers play a big role in the shifting IT landscape because enterprises are moving towards fast, agile delivery of software and solutions to [get ahead of competitors][17].
|
||||
|
||||
Containers are here to stay. In the very near future, other use cases, like serverless on the edge, will emerge and further change how we think about the speed of getting information to and from digital devices. The only way to survive these changes is to adapt to them.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/20/12/containers-101
|
||||
|
||||
作者:[Mike Calizo][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/mcalizo
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/kubernetes_containers_ship_lead.png?itok=9EUnSwci (Ships at sea on the web)
|
||||
[2]: https://opensource.com/resources/devops
|
||||
[3]: https://opensource.com/resources/what-are-microservices
|
||||
[4]: https://opensource.com/sites/default/files/uploads/container_architecture.png (Container architecture)
|
||||
[5]: https://creativecommons.org/licenses/by-sa/4.0/
|
||||
[6]: https://opensource.com/article/19/10/namespaces-and-containers-linux
|
||||
[7]: https://opensource.com/article/20/11/selinux-containers
|
||||
[8]: https://opensource.com/resources/what-docker
|
||||
[9]: https://linuxcontainers.org/
|
||||
[10]: https://opensource.com/article/18/11/behind-scenes-linux-containers
|
||||
[11]: https://opensource.com/article/20/11/orchestration-vs-automation
|
||||
[12]: https://enterprisersproject.com/article/2020/6/kubernetes-statistics-2020
|
||||
[13]: https://opensource.com/sites/default/files/uploads/kubernetes_cluster.png (Kubernetes cluster)
|
||||
[14]: https://kubevirt.io/
|
||||
[15]: https://opensource.com/resources/what-open-source
|
||||
[16]: https://www.openshift.com/blog/announcing-the-community-windows-machine-config-operator-on-openshift-4.6
|
||||
[17]: https://www.imd.org/research-knowledge/articles/the-battle-for-digital-disruption-startups-vs-incumbents/
|
@ -0,0 +1,175 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (9 things to do in your first 10 minutes on a Linux server)
|
||||
[#]: via: (https://opensource.com/article/20/12/linux-server)
|
||||
[#]: author: (Gaurav Kamathe https://opensource.com/users/gkamathe)
|
||||
|
||||
9 things to do in your first 10 minutes on a Linux server
|
||||
======
|
||||
Before putting a newly provisioned server to work, make sure you know
|
||||
what you're working with.
|
||||
![Parts, modules, containers for software][1]
|
||||
|
||||
When I test software on Linux (a regular part of my job), I need to use multiple servers with various architectures running Linux. I provision the machines, install the required software packages, run my tests, gather the results, and return the machine to the pool so that others can use it for their tests.
|
||||
|
||||
Since I do this so often (even multiple times a day), my first 10 minutes on a Linux server have become a daily ritual. When I first log into a Linux server, I look for certain things using commands to gather the information I need. I'll go through my process in this article, but please note that, in most cases, I'll just give the command name, so you will need to identify the specific flags for those commands to get the information that you need. Reading man pages for the commands is a good starting point.
|
||||
|
||||
### 1\. First contact
|
||||
|
||||
As soon as I log into a server, the first thing I do is check whether it has the operating system, kernel, and hardware architecture needed for the tests I will be running. I often check how long a server has been up and running. While this does not matter very much for a test system because it will be rebooted multiple times, I still find this information helpful.
|
||||
|
||||
Use the following commands to get this information. I mostly use Red Hat Linux for testing, so if you are using another Linux distro, use `*-release` in the filename instead of `redhat-release`:
|
||||
|
||||
|
||||
```
|
||||
cat /etc/redhat-release
|
||||
uname -a
|
||||
hostnamectl
|
||||
uptime
|
||||
```
|
||||
|
||||
### 2\. Is anyone else on board?
|
||||
|
||||
Once I know that the machine meets my test needs, I need to ensure no one else is logged into the system at the same time running their own tests. Although it is highly unlikely, given that the provisioning system takes care of this for me, it's still good to check once in a while—especially if it's my first time logging into a server. I also check whether there are other users (other than root) who can access the system.
|
||||
|
||||
Use the following commands to find this information. The last command looks for users in the `/etc/passwd` file who have shell access; it skips other services in the file that do not have shell access or have a shell set to `nologin`:
|
||||
|
||||
|
||||
```
|
||||
who
|
||||
who -Hu
|
||||
grep sh$ /etc/passwd
|
||||
```
|
||||
|
||||
### 3\. Physical or virtual machine
|
||||
|
||||
Now that I know I have the machine to myself, I need to identify whether it's a physical machine or a virtual machine (VM). If I provisioned the machine myself, I could be sure that I have what I asked for. However, if you are using a machine that you did not provision, you should check whether the machine is physical or virtual.
|
||||
|
||||
Use the following commands to identify this information. If it's a physical system, you will see the vendor's name (e.g., HP, IBM, etc.) and the make and model of the server; whereas, in a virtual machine, you should see KVM, VirtualBox, etc., depending on what virtualization software was used to create the VM:
|
||||
|
||||
|
||||
```
|
||||
dmidecode -s system-manufacturer
|
||||
dmidecode -s system-product-name
|
||||
lshw -c system | grep product | head -1
|
||||
cat /sys/class/dmi/id/product_name
|
||||
cat /sys/class/dmi/id/sys_vendor
|
||||
```
|
||||
|
||||
### 4\. Hardware
|
||||
|
||||
Because I often test hardware connected to the Linux machine, I usually work with physical servers, not VMs. On a physical machine, my next step is to identify the server's hardware capabilities—for example, what kind of CPU is running, how many cores does it have, which flags are enabled, and how much memory is available for running tests. If I am running network tests, I check the type and capacity of the Ethernet or other network devices connected to the server.
|
||||
|
||||
Use the following commands to display the hardware connected to a Linux server. Some of the commands might be deprecated in newer operating system versions, but you can still install them from yum repos or switch to their equivalent new commands:
|
||||
|
||||
|
||||
```
|
||||
lscpu or cat /proc/cpuinfo
|
||||
lsmem or cat /proc/meminfo
|
||||
ifconfig -a
|
||||
ethtool <devname>
|
||||
lshw
|
||||
lspci
|
||||
dmidecode
|
||||
```
|
||||
|
||||
### 5\. Installed software
|
||||
|
||||
Testing software always requires installing additional dependent packages, libraries, etc. However, before I install anything, I check what is already installed (including what version it is), as well as which repos are configured, so I know where the software comes from, and I can debug any package installation issues.
|
||||
|
||||
Use the following commands to identify what software is installed:
|
||||
|
||||
|
||||
```
|
||||
rpm -qa
|
||||
rpm -qa | grep <pkgname>
|
||||
rpm -qi <pkgname>
|
||||
yum repolist
|
||||
yum repoinfo
|
||||
yum install <pkgname>
|
||||
ls -l /etc/yum.repos.d/
|
||||
```
|
||||
|
||||
### 6\. Running processes and services
|
||||
|
||||
Once I check the installed software, it's natural to check what processes are running on the system. This is crucial when running a performance test on a system—if a running process, daemon, test software, etc. is eating up most of the CPU/RAM, it makes sense to stop that process before running the tests. This also checks that the processes or daemons the test requires are up and running. For example, if the tests require httpd to be running, the service to start the daemon might not have run even if the package is installed.
|
||||
|
||||
Use the following commands to identify running processes and enabled services on your system:
|
||||
|
||||
|
||||
```
|
||||
pstree -pa 1
|
||||
ps -ef
|
||||
ps auxf
|
||||
systemctl
|
||||
```
|
||||
|
||||
### 7\. Network connections
|
||||
|
||||
Today's machines are heavily networked, and they need to communicate with other machines or services on the network. I identify which ports are open on the server, if there are any connections from the network to the test machine, if a firewall is enabled, and if so, is it blocking any ports, and which DNS servers the machine talks to.
|
||||
|
||||
Use the following commands to identify network services-related information. If a deprecated command is not available, install it from a yum repo or use the equivalent newer command:
|
||||
|
||||
|
||||
```
|
||||
netstat -tulpn
|
||||
netstat -anp
|
||||
lsof -i
|
||||
ss
|
||||
iptables -L -n
|
||||
cat /etc/resolv.conf
|
||||
```
|
||||
|
||||
### 8\. Kernel
|
||||
|
||||
When doing systems testing, I find it helpful to know kernel-related information, such as the kernel version and which kernel modules are loaded. I also list any [tunable kernel parameters][2] and what they are set to and check the options used when booting the running kernel.
|
||||
|
||||
Use the following commands to identify this information:
|
||||
|
||||
|
||||
```
|
||||
uname -r
|
||||
cat /proc/cmdline
|
||||
lsmod
|
||||
modinfo <module>
|
||||
sysctl -a
|
||||
cat /boot/grub2/grub.cfg
|
||||
```
|
||||
|
||||
### 9\. Logs
|
||||
|
||||
By now, I have a good idea about the server, including what software is installed and what processes are running. One other thing I cannot escape is log files—I need to know where to check the information that is continuously being updated.
|
||||
|
||||
Use the following commands to see your system's logs:
|
||||
|
||||
|
||||
```
|
||||
dmesg
|
||||
tail -f /var/log/messages
|
||||
journalctl
|
||||
```
|
||||
|
||||
### Next steps
|
||||
|
||||
While commands and utilities will change, the underlying information they show remains more or less the same. You need a high-level view of the information you are looking for and what category it falls into before you can focus on which commands to master.
|
||||
|
||||
Since Linux saves most information in files, these commands basically read information from the files and present them in an easy-to-understand way. A good next step is to identify the files each command uses to get the information to display. A hint for finding that information is the `strace` command.
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/20/12/linux-server
|
||||
|
||||
作者:[Gaurav Kamathe][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/gkamathe
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/containers_modules_networking_hardware_parts.png?itok=rPpVj92- (Parts, modules, containers for software)
|
||||
[2]: https://www.oreilly.com/library/view/red-hat-enterprise/9781785283550/ch10s05.html
|
@ -0,0 +1,65 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Cut your Cloud Computing Costs by Half with Unikraft)
|
||||
[#]: via: (https://www.linux.com/news/cut-your-cloud-computing-costs-by-half-with-unikraft/)
|
||||
[#]: author: (Linux.com Editorial Staff https://www.linux.com/author/linuxdotcom/)
|
||||
|
||||
Cut your Cloud Computing Costs by Half with Unikraft
|
||||
======
|
||||
|
||||
***A novel modular unikernel allows for extreme tailoring of your operating system to your application’s needs. A proof of concept, built on Unikraft, a Xen Project subproject, shows up to 50% efficiency improvements than standard Linux on AWS EC2. ***
|
||||
|
||||
Cloud computing has revolutionized the way we think about IT infrastructure: Another web server? More database capacity? Resources for your artificial intelligence use case? Just spin-up another instance, and you are good to go. Virtualization and containers have allowed us to deploy services without worrying about physical hardware constraints. As a result, most companies heavily rely on micro-services, which are individual servers highly specialized to perform a specific task.
|
||||
|
||||
The problem is that general-purpose operating systems such as Linux struggle to keep pace with this growing trend towards specialization. The status quo is that most microservices are built on top of a complete Linux kernel and distribution. It is as if you wanted to enable individual air travel with only one passenger seat per aircraft but kept the powerful engines of a jumbo jet. The result of having a proliferation of general-purpose OSes in the cloud are bloated instances, that feast on memory and processing power while uselessly burning electrical energy as well as your infrastructure budget.
|
||||
|
||||
![Figure 1. Linux kernel components have strong inter-dependencies making it difficult to remove or replace them.][1]
|
||||
|
||||
Despite this, putting Linux and other monolithic OSes on a diet is far from trivial. Removing unneeded components from the Linux kernel is a tedious endeavor due to the interdependencies among subsystems of the kernel: Figure 1 above illustrates a large number of such inter-dependencies a line denotes a dependency and a blue number the amount of such dependencies between two components.
|
||||
|
||||
An alternative is to build so-called _unikernels_, images tailored to specific applications and often built on much smaller kernels. Unikernels have shown great promise and performance numbers (e.g., boot times of a few milliseconds, memory consumption when running off-the-shelf applications such as nginx of only a few MBs, and high throughput). However, their Achilles heel has been that they often require substantial expert work to create them and that at least part of the work has to be redone for each additional application. These issues, coupled with the fact that most unikernel projects don’t have a rich set of tools and ecosystem (e.g., Kubernetes integration, debugging and monitoring tools, etc.), resulting in 1GB Linux instances for jobs that might be as easy as delivering static web pages.
|
||||
|
||||
## **Unikraft: A Revolutionary Way Forward**
|
||||
|
||||
[Unikraft][2] is on a mission to change that. In stark contrast to other unikernel projects, Unikraft, a Xen Project subproject, has developed a truly modular unikernel common code base from which building tailored made (uni)kernels is orders of magnitude faster than in the past.
|
||||
|
||||
“Without Unikraft, you have to choose between unikernel projects that only work for a specific language or application, or projects that aim to support POSIX but do so while sacrificing performance and thus defeating the purpose of using unikernels in the first place”, says Felipe Huici, one of the Unikraft team’s core contributors. “
|
||||
|
||||
Unikraft aims to run a large set of off-the-shelf application and languages (C/C++, Python, Go, Ruby, Lua, and WASM are supported, with Rust and Java on the way), but still allows for easy customization and even removal of unneeded kernel parts; also, it provides a set of rich, performance-oriented APIs that allows further customization by plugging the application at different levels of the stack for even higher performance.”
|
||||
|
||||
A sample of such APIs are shown in Figure 2 below.
|
||||
|
||||
![Figure 2. Rhea architecture \(APIs in black boxes\) enables specialization by allowing apps to plug into APIs at different levels and to choose from multiple API implementations.][3]
|
||||
|
||||
Unikraft already supports more than 130 syscalls in terms of POSIX compatibility, and the number is continuously increasing. While this is certainly short of the 300+ that Linux supports, it turns out that only a subset of these are needed for running most of the major server applications. This, and ongoing efforts to support standard frameworks such as Kubernetes and Prometheus make Unikraft an enticing proposition and mark the coming of age of unikernels into the mainstream.
|
||||
|
||||
## **Unikraft Goes to the Cloud**
|
||||
|
||||
But what’s really in it for end-users? To demonstrate the power and efficiency of Unikraft, the team created an experimental Unikraft AWS EC2 image running nginx, currently the world’s most popular web server. “We’ve built a Unikraft nginx image and compared it to a ngnix running on an off-the-shelf Debian image to compare the performance of the two when serving static web pages. We’ve been more than pleased with the results” says Huici. “On Unikraft, nginx could handle twice the number of requests per second compared to the Debian instance. Or you could take a less performant AWS EC2 instance at half the price and get the same job done. Further, Unikraft needed about a sixth the amount of memory to run”. The throughput results can be seen in Figure 3 below.
|
||||
|
||||
![][4]
|
||||
|
||||
So far, this is only a proof of concept, but Huici and the Unikraft team are moving quickly. “We are currently working on a system to make the process of creating a Unikraft image as easy as online-shopping” – this includes analyzing the applications which are meant to run on top of it and providing a ready-to-use operating system that has everything the specific use case needs, and nothing more. “Why should we waste money, resources, and pollute the environment running software in the background that is not needed for a specific service?”
|
||||
|
||||
_**About the author: Simon Kuenzer is the Project Lead and Maintainer of Unikraft, which is part of the Xen Project at the Linux Foundation.**_
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.linux.com/news/cut-your-cloud-computing-costs-by-half-with-unikraft/
|
||||
|
||||
作者:[Linux.com Editorial Staff][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者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/author/linuxdotcom/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://www.linux.com/wp-content/uploads/2020/12/unikraft1.png
|
||||
[2]: https://xenproject.org/developers/teams/unikraft/
|
||||
[3]: https://www.linux.com/wp-content/uploads/2020/12/unikraft2.png
|
||||
[4]: https://www.linux.com/wp-content/uploads/2020/12/unikraft3.png
|
@ -0,0 +1,193 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (How to View Images from the Linux Terminal)
|
||||
[#]: via: (https://www.2daygeek.com/how-to-view-display-images-from-linux-terminal/)
|
||||
[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/)
|
||||
|
||||
How to View Images from the Linux Terminal
|
||||
======
|
||||
|
||||
Linux has many GUI applications for viewing images.
|
||||
|
||||
But I have never tried any CLI applications to see it.
|
||||
|
||||
Fortunately while working with the **[ImageMagick tool][1]** I got a command to view an image from the terminal.
|
||||
|
||||
The command name is **“display”**, which is part of the ImageMagick tool.
|
||||
|
||||
This is a great tool that allows NIX users to view images from the terminal.
|
||||
|
||||
Also, I got another great tool called FIM for this purpose.
|
||||
|
||||
We will show you how to install and use it to view images from the Linux terminal.
|
||||
|
||||
These commands use the system’s framebuffer to display images directly from the command line.
|
||||
|
||||
### How to View Images from Terminal Using display Command
|
||||
|
||||
[ImageMagick][2] is a free and open source, feature-rich, command-line based image manipulation tool.
|
||||
|
||||
It used to create, edit, compose, or convert bitmap images.
|
||||
|
||||
It can read and write images in a variety of formats (over 200) including PNG, JPEG, GIF, PDF, SVG and etc,.
|
||||
|
||||
It can resize, mirror, rotate, transform images, adjust image colors, apply various special effects, etc,.
|
||||
|
||||
It supports batch process, which allow you to processes all images at once.
|
||||
|
||||
### How to Install ImageMagick?
|
||||
|
||||
The ImageMagick package is included in the official repository of most Linux distributions. Use the distribution package manager to install it.
|
||||
|
||||
**Make a note:** Make sure you already have “**[Development Tools][3]**” installed on your Linux system as a prerequisite for this.
|
||||
|
||||
For **RHEL/CentOS 6/7** systems, use the **[yum command][4]** to install ImageMagick.
|
||||
|
||||
```
|
||||
$ sudo yum install -y ImageMagick ImageMagick-devel
|
||||
```
|
||||
|
||||
For **RHEL/CentOS 8** and **Fedora** systems, use the **[dnf command][5]** to install ImageMagick.
|
||||
|
||||
```
|
||||
$ sudo dnf install -y ImageMagick ImageMagick-devel
|
||||
```
|
||||
|
||||
For **Debian/Ubuntu** systems, use the **[apt command][6]** or **[apt-get command][7]** to install ImageMagick.
|
||||
|
||||
```
|
||||
$ sudo apt-get update
|
||||
$ sudo apt-get install imagemagick
|
||||
```
|
||||
|
||||
For **openSUSE** systems, use the **[zypper command][8]** to install ImageMagick
|
||||
|
||||
```
|
||||
$ sudo zypper install -y ImageMagick
|
||||
```
|
||||
|
||||
To view any image file, run display command as follows. You can close the image by pressing the **“Esc/q”** button.
|
||||
|
||||
```
|
||||
$ display bird.jpg
|
||||
```
|
||||
|
||||
![][9]
|
||||
|
||||
If you want to open the image with the specified size of the window, use the **“-geometry”** flag.
|
||||
|
||||
```
|
||||
$ display -geometry 1000x600 ~/Downloads/bird.jpg
|
||||
```
|
||||
|
||||
You can also input position information of the image with display command. The below command open your image 800 pixels from the top and 800 pixels from the top left corner of your desktop.
|
||||
|
||||
```
|
||||
$ display -geometry 1000x600+800+800 ~/Downloads/bird.jpg
|
||||
```
|
||||
|
||||
If you want to resize the image with the display command, use the following format.
|
||||
|
||||
```
|
||||
$ display -resize 600x400 ~/Downloads/bird.jp
|
||||
```
|
||||
|
||||
Alternatively, you can use percentage to resize the image.
|
||||
|
||||
```
|
||||
$ display -resize 50% ~/Downloads/bird.jpg
|
||||
```
|
||||
|
||||
### How to View Images from the Terminal Using fim Command
|
||||
|
||||
[FIM][10] is a lightweight global image viewer designed specifically for Linux.
|
||||
|
||||
But it is not limited to Linux and can be configured to run on other OS such as MS-Windows.
|
||||
|
||||
It’s highly customizable and scriptable image viewer for users who are familiar with software like the VIM text editor.
|
||||
|
||||
It displays the image in full screen and can be easily controlled using the keyboard shortcuts.
|
||||
|
||||
It is very lightweight tool because it only depends on certain libraries.
|
||||
|
||||
It can open many file formats and it can display images in the following video modes.
|
||||
|
||||
* Graphically, with the Linux framebuffer device
|
||||
* Graphically, under X/Xorg, using the SDL library
|
||||
* Graphically, under X/Xorg, using the Imlib2 library
|
||||
* Rendered as ASCII Art in any textual console, using the AAlib library
|
||||
|
||||
|
||||
|
||||
The right video mode gets auto-detected or selected at runtime, and may be opted in/out before build at configure time, if desired.
|
||||
|
||||
FIM stands for Fbi IMproved, which is the fork of the Fbi Image viewer.
|
||||
|
||||
FIM can be easily installed on Debian/Ubuntu based systems as the package is available in the distribution official repository. For other distributions, you may need to compile it from the source.
|
||||
|
||||
```
|
||||
$ sudo apt install fim
|
||||
```
|
||||
|
||||
Once installed, you can display an image using the following command.
|
||||
|
||||
```
|
||||
$ fim bird.jpg
|
||||
```
|
||||
|
||||
You can automatically zoom an image using the **“-a”** option.
|
||||
|
||||
```
|
||||
$ fim -a bird.jpg
|
||||
```
|
||||
|
||||
![][9]
|
||||
|
||||
If you want to open multiple image files in the current directory, use the wildcard to open them all. Use the **“Pageup/Down”** keyboard shortcuts to move to the next or previous image.
|
||||
|
||||
```
|
||||
$ fim -a *.jpg
|
||||
```
|
||||
|
||||
To view the image in ASCII format, you can use the **“-t”** flag.
|
||||
|
||||
```
|
||||
$ fim -t bird.jpg
|
||||
```
|
||||
|
||||
The below keyboard shortcuts allow you to control the images.
|
||||
|
||||
* PageUp/Down : Prev/Next image
|
||||
* +/- : Zoom in/out
|
||||
* a : Autoscale
|
||||
* w : Fit to width
|
||||
* ESC/q : Quit
|
||||
|
||||
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://www.2daygeek.com/how-to-view-display-images-from-linux-terminal/
|
||||
|
||||
作者:[Magesh Maruthamuthu][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者ID](https://github.com/译者ID)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://www.2daygeek.com/author/magesh/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://www.2daygeek.com/resize-convert-images-from-linux-command-line/
|
||||
[2]: https://imagemagick.org/
|
||||
[3]: https://www.2daygeek.com/install-development-tools-on-ubuntu-debian-arch-linux-mint-fedora-centos-rhel-opensuse/
|
||||
[4]: https://www.2daygeek.com/linux-yum-command-examples-manage-packages-rhel-centos-systems/
|
||||
[5]: https://www.2daygeek.com/linux-dnf-command-examples-manage-packages-fedora-centos-rhel-systems/
|
||||
[6]: https://www.2daygeek.com/apt-command-examples-manage-packages-debian-ubuntu-systems/
|
||||
[7]: https://www.2daygeek.com/apt-get-apt-cache-command-examples-manage-packages-debian-ubuntu-systems/
|
||||
[8]: https://www.2daygeek.com/zypper-command-examples-manage-packages-opensuse-system/
|
||||
[9]: data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7
|
||||
[10]: https://www.nongnu.org/fbi-improved/#docs
|
@ -0,0 +1,109 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: ( )
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Radicle: An Open-Source Decentralized App for Code Collaboration [P2P GitHub Alternative])
|
||||
[#]: via: (https://itsfoss.com/radicle-p2p/)
|
||||
[#]: author: (Ankush Das https://itsfoss.com/author/ankush/)
|
||||
|
||||
Radicle: An Open-Source Decentralized App for Code Collaboration [P2P GitHub Alternative]
|
||||
======
|
||||
|
||||
_**Brief: Radicle is an open-source project that aims to facilitate peer-to-peer code collaboration without depending on a centralized server. In other words, it’s a P2P alternative to GitHub.**_
|
||||
|
||||
Most of the open-source projects that we talk about are usually hosted at [GitHub][1] or other [GitHub alternatives like GitLab][2]. Even though you get many benefits and features from such platforms (not to mention the potential exposure), there are also downsides of using it.
|
||||
|
||||
For instance, [youtube-dl project was taken down by Microsoft][3] to comply with a DMCA request.
|
||||
|
||||
With a centralized approach, you do not have a lot of control and privacy. Of course, this may not be a big deal for many folks but if you are someone who does not want centralized servers, want to have peer-to-peer code collaboration feature, and something that works offline, [Radicle][4] will be a good tool for them.
|
||||
|
||||
### Radicle: A Peer-to-Peer Code Collaboration Platform
|
||||
|
||||
![][5]
|
||||
|
||||
[Radicle][4] is an open-source project that aims to provide a decentralized app for code collaboration. You can connect peer-to-peer if you need to share the project and work along with someone else.
|
||||
|
||||
It is still something in beta but it is definitely worth looking at. I did some quick tests without our team to see if the basic features to share the project works or not.
|
||||
|
||||
But, before you try it out, let me highlight the important features that you get with Radicle and what you can expect from it in the near future.
|
||||
|
||||
### Features of Radicle
|
||||
|
||||
![][6]
|
||||
|
||||
* Ability to add multiple remote peers
|
||||
* Manage multiple peers
|
||||
* Feature to follow a project from a specific peer
|
||||
* Share your project using a unique ID
|
||||
* Does not depend on central servers
|
||||
* No censorship
|
||||
* One network interconnected with peers
|
||||
* Ability to work offline
|
||||
* Local issues & patches
|
||||
* Built on Git to make it easy and comfortable for most developers
|
||||
* Your infrastructure
|
||||
* Ability to receive funding from your supporters (Ethereum)
|
||||
* Manage codebases together
|
||||
|
||||
|
||||
|
||||
Expect more features for bug reporting and code review in the near future considering that it is still in early development.
|
||||
|
||||
**Recommended Read:**
|
||||
|
||||
![][7]
|
||||
|
||||
#### [Meet LBRY, A Blockchain-based Decentralized Alternative to YouTube][8]
|
||||
|
||||
LBRY is a new Blockchain-based, open source platform for sharing digital content. It is gaining popularity as a decentralized alternative to YouTube but LBRY is more than just a video sharing service.
|
||||
|
||||
### Installing Radicle on Linux
|
||||
|
||||
It provides an AppImage for Linux distributions. So, no matter whether you have an Ubuntu-based system or an Arch system, you can easily use it on your Linux system. In case you do not know, please refer to our guide on [using AppImage in Linux][9] to get started quickly.
|
||||
|
||||
[Download Radicle][10]
|
||||
|
||||
### Thoughts on Using Radicle
|
||||
|
||||
![][11]
|
||||
|
||||
If you are familiar with [Git version control system][12], using this should be a breeze. I just did some basic testing where I created a test repository and shared it with my teammate.
|
||||
|
||||
It works quite well. But, you need to configure Git with your name and email address before you get started.
|
||||
|
||||
Of course, you will need the terminal to configure and use the git version control, but the GUI is easy to use and understand. It is easy to manage remotes, copy the unique ID to share the project, and you can explore more when you try to use it for your projects.
|
||||
|
||||
I’d advise you to experiment with it and go through the [documentation][13], [official site][4], along with their [GitHub page][14] before trying it out for an important project.
|
||||
|
||||
What do you think about Radicle? Even though it is in BETA phase, do you think it will gain traction and be something popular among the open-source developers?
|
||||
|
||||
Let me know your thoughts in the comments below!
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://itsfoss.com/radicle-p2p/
|
||||
|
||||
作者:[Ankush Das][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[译者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/
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://github.com/
|
||||
[2]: https://itsfoss.com/github-alternatives/
|
||||
[3]: https://itsfoss.com/youtube-dl-github-takedown/
|
||||
[4]: https://radicle.xyz/
|
||||
[5]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/12/radicle-featured.png?resize=800%2C462&ssl=1
|
||||
[6]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2020/12/radicle-upstream.jpg?resize=799%2C600&ssl=1
|
||||
[7]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/04/lbry-featured.jpg?fit=800%2C450&ssl=1
|
||||
[8]: https://itsfoss.com/lbry/
|
||||
[9]: https://itsfoss.com/use-appimage-linux/
|
||||
[10]: https://radicle.xyz/downloads.html
|
||||
[11]: https://i0.wp.com/itsfoss.com/wp-content/uploads/2020/12/radicle-settings.jpg?resize=800%2C598&ssl=1
|
||||
[12]: https://git-scm.com/
|
||||
[13]: https://docs.radicle.xyz/docs/what-is-radicle.html
|
||||
[14]: https://github.com/radicle-dev
|
@ -0,0 +1,69 @@
|
||||
[#]: collector: (lujun9972)
|
||||
[#]: translator: (geekpi)
|
||||
[#]: reviewer: ( )
|
||||
[#]: publisher: ( )
|
||||
[#]: url: ( )
|
||||
[#]: subject: (Make medit your next Linux terminal text editor)
|
||||
[#]: via: (https://opensource.com/article/20/12/medit)
|
||||
[#]: author: (Seth Kenlon https://opensource.com/users/seth)
|
||||
|
||||
让 medit 成为你的下一个 Linux 终端文本编辑器
|
||||
======
|
||||
这款经典的文本编辑器提供了所有的基本功能和一些让你自定义你的体验的令人兴奋的功能。
|
||||
![Person drinking a hot drink at the computer][1]
|
||||
|
||||
这里有 [XEDIT][2]、jEdit、NEdit、[gedit][3],最后还有 [medit][4]。
|
||||
|
||||
在我开始搜索我还没有尝试过的编辑器之前,我还没有听说过 medit,但我很高兴发现了它。如果你正在寻找经典的 gedit 体验(大约是 Gnome 2),那么 medit 可能无意间是一种出色且现代的近似。它也有许多额外的功能,比如可以用 Python、Lua 或 C 语言编写插件,以及将 shell 脚本集成到菜单系统。所有其他常用的功能也都在这里:标签式界面、一个按需的 shell、缩进管理、语法高亮等等。
|
||||
|
||||
### 安装 medit
|
||||
|
||||
你可以从 [mooedit.sourceforge.net][5] 下载 medit。它确认可以在 Linux 和 Windows 上工作。如果你使用的是 Linux,你也可以在你的仓库中找到它。在 Slackware 上,我从 [slackbuilds.org][6] 安装了它。
|
||||
|
||||
![Medit terminal showing examples of Bash script in editor][7]
|
||||
|
||||
### 使用 medit
|
||||
|
||||
medit 标称自己是一个“为编程和围绕编程”的编辑器,事实上,它是作为一个名为 [GAP(Groups、Algorithms、Programming)][8] 的更大项目的一部分开始的。它的大部分功能都是针对典型的开发者期望的。例如,在 **Edit**菜单中,有增加和减少缩进的选项,这对于任何试图以视觉方式指示范围的程序员来说都是一个常见的任务 (对于 Python 程序员来说也是一个字面要求),还有注释或取消注释文本块的选项。
|
||||
|
||||
有些功能对普通用户也很有用。medit 有一个易于使用的标签式界面 (既在窗口顶部,也在侧面的弹出式列表中),一个用于快速浏览文件系统的侧板,在文件中添加书签的功能等等。它还具有针对两种编程语言以及标记和 markdown 语言的语法高亮显示功能,因此它是代码和散文的有用编辑器。
|
||||
|
||||
### 颜色方案
|
||||
|
||||
当编辑没有语法关联的纯文本或像 Asciidoc 这样的格式时,medit 没有预设的高亮方案,编辑器会采用你的系统默认值。我使用的是黑暗主题,所以 medit 在深灰色背景上显示白色文本。
|
||||
|
||||
不过对于语法高亮,文本会根据每个单词在其结构化语言中扮演的角色而变成彩色。一开始,我对 medit 的一些选择有些失望,很多颜色在我的深色背景下太暗,无法辨认,而且我觉得所有重要的元素都不够独特。如果你不同意 medit 的选择,这个问题的答案在 **Preferences** 中,你可以更改颜色主题。我把我的颜色改成了 Tango,它呈现出一个日光照射的颜色阵列,在我的深色编辑器背景下非常突出,甚至给在 medit 主题下保持白色的元素添加了颜色。
|
||||
|
||||
![Medit terminal showing examples of Bash script in editor using Tango color scheme against dark background][9]
|
||||
|
||||
### 弹出式 Python
|
||||
|
||||
在 medit 窗口的底部,有一个弹出的终端,用于快速访问 shell。这是一个很好的功能,但坦率地说,在你体验过 Emacs 和 [Kate][10]之后,这感觉很普通。medit 让我惊讶的是它的弹出式 Python 控制台,它从 **Tools** 菜单中启动,并预先导入了 **moo** 和 **gtk** 模块。换句话说,当你启动 medit 的 Python shell 时,你可以查看 medit 自身部分构建的 Python 和 GTK 模块。这是一个很好的功能,也许会给你写插件的灵感(终端弹出的是一个用 Python 编写的插件,所以你也可以通过它的代码来了解一个插件是如何编写的)。
|
||||
|
||||
### 经典编辑
|
||||
|
||||
medit 是一个出色的基于 GTK 的编辑器,它具有所有重要的基本功能和一些诱人的额外功能,可以帮助你扩展应用并使其成为你自己的。因为它接受 C、Python、Lua 和 Bash,所以有几个切入点可以做到这一点。如果你正在为你的写作寻找一个有用的编辑器,无论是代码还是 markdown 或介于两者之间的东西,给 medit 一个机会。
|
||||
|
||||
--------------------------------------------------------------------------------
|
||||
|
||||
via: https://opensource.com/article/20/12/medit
|
||||
|
||||
作者:[Seth Kenlon][a]
|
||||
选题:[lujun9972][b]
|
||||
译者:[geekpi](https://github.com/geekpi)
|
||||
校对:[校对者ID](https://github.com/校对者ID)
|
||||
|
||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||
|
||||
[a]: https://opensource.com/users/seth
|
||||
[b]: https://github.com/lujun9972
|
||||
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/coffee_tea_laptop_computer_work_desk.png?itok=D5yMx_Dr (Person drinking a hot drink at the computer)
|
||||
[2]: https://opensource.com/article/20/12/xedit
|
||||
[3]: https://opensource.com/article/20/12/gedit
|
||||
[4]: http://mooedit.sourceforge.net/
|
||||
[5]: https://sourceforge.net/projects/mooedit/files/medit/
|
||||
[6]: https://slackbuilds.org/repository/14.2/development/medit
|
||||
[7]: https://opensource.com/sites/default/files/uploads/medit-31_days_medit-opensource.png (Medit terminal showing examples of Bash script in editor)
|
||||
[8]: https://www.gap-system.org/
|
||||
[9]: https://opensource.com/sites/default/files/uploads/medit-tango-colour-31_days_medit-opensource.png (Medit terminal showing examples of Bash script in editor using Tango color scheme against dark background)
|
||||
[10]: https://opensource.com/article/20/12/kate-text-editor
|
Loading…
Reference in New Issue
Block a user