From 0de6dfe349bcbfc028cb935d2253a099ddf8b984 Mon Sep 17 00:00:00 2001 From: darksun Date: Tue, 18 Sep 2018 16:58:26 +0800 Subject: [PATCH 01/39] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Backup=20Installed?= =?UTF-8?q?=20Packages=20And=20Restore=20Them=20On=20Freshly=20Installed?= =?UTF-8?q?=20Ubuntu?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...estore Them On Freshly Installed Ubuntu.md | 107 ++++++++++++++++++ 1 file changed, 107 insertions(+) create mode 100644 sources/tech/20180915 Backup Installed Packages And Restore Them On Freshly Installed Ubuntu.md diff --git a/sources/tech/20180915 Backup Installed Packages And Restore Them On Freshly Installed Ubuntu.md b/sources/tech/20180915 Backup Installed Packages And Restore Them On Freshly Installed Ubuntu.md new file mode 100644 index 0000000000..d5927effee --- /dev/null +++ b/sources/tech/20180915 Backup Installed Packages And Restore Them On Freshly Installed Ubuntu.md @@ -0,0 +1,107 @@ +Backup Installed Packages And Restore Them On Freshly Installed Ubuntu +====== + +![](https://www.ostechnix.com/wp-content/uploads/2018/09/apt-clone-720x340.png) + +Installing the same set of packages on multiple Ubuntu systems is time consuming and boring task. You don’t want to spend your time to install the same packages over and over on multiple systems. When it comes to install packages on similar architecture Ubuntu systems, there are many methods available to make this task easier. You could simply migrate your old Ubuntu system’s applications, settings and data to a newly installed system with a couple mouse clicks using [**Aptik**][1]. Or, you can take the [**backup entire list of installed packages**][2] using your package manager (Eg. APT), and install them later on a freshly installed system. Today, I learned that there is also yet another dedicated utility available to do this job. Say hello to **apt-clone** , a simple tool that lets you to create a list of installed packages for Debian/Ubuntu systems that can be restored on freshly installed systems or containers or into a directory. + +Apt-clone will help you on situations where you want to, + + * Install consistent applications across multiple systems running with similar Ubuntu (and derivatives) OS. + * Install same set of packages on multiple systems often. + * Backup the entire list of installed applications and restore them on demand wherever and whenever necessary. + + + +In this brief guide, we will be discussing how to install and use Apt-clone on Debian-based systems. I tested this utility on Ubuntu 18.04 LTS system, however it should work on all Debian and Ubuntu-based systems. + +### Backup Installed Packages And Restore Them Later On Freshly Installed Ubuntu System + +Apt-clone is available in the default repositories. To install it, just enter the following command from the Terminal: + +``` +$ sudo apt install apt-clone +``` + +Once installed, simply create the list of installed packages and save them in any location of your choice. + +``` +$ mkdir ~/mypackages + +$ sudo apt-clone clone ~/mypackages +``` + +The above command saved all installed packages in my Ubuntu system in a file named **apt-clone-state-ubuntuserver.tar.gz** under **~/mypackages** directory. + +To view the details of the backup file, run: + +``` +$ apt-clone info mypackages/apt-clone-state-ubuntuserver.tar.gz +Hostname: ubuntuserver +Arch: amd64 +Distro: bionic +Meta: +Installed: 516 pkgs (33 automatic) +Date: Sat Sep 15 10:23:05 2018 +``` + +As you can see, I have 516 packages in total in my Ubuntu server. + +Now, copy this file on your USB or external drive and go to any other system that want to install the same set of packages. Or you can also transfer the backup file to the system on the network and install the packages by using the following command: + +``` +$ sudo apt-clone restore apt-clone-state-ubuntuserver.tar.gz +``` + +Please be mindful that this command will overwrite your existing **/etc/apt/sources.list** and will install/remove packages. You have been warned! Also, just make sure the destination system is on same arch and same OS. For example, if the source system is running with 18.04 LTS 64bit, the destination system must also has the same. + +If you don’t want to restore packages on the system, you can simply use `--destination /some/location` option to debootstrap the clone into this directory. + +``` +$ sudo apt-clone restore apt-clone-state-ubuntuserver.tar.gz --destination ~/oldubuntu +``` + +In this case, the above command will restore the packages in a folder named **~/oldubuntu**. + +For more details, refer help section: + +``` +$ apt-clone -h +``` + +Or, man pages: + +``` +$ man apt-clone +``` + +**Suggested read:** + ++ [Systemback – Restore Ubuntu Desktop and Server to previous state][3] ++ [Cronopete – An Apple’s Time Machine Clone For Linux][4] + +And, that’s all for now. Hope this was useful. More good stuffs to come. Stay tuned! + +Cheers! + + + + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/backup-installed-packages-and-restore-them-on-freshly-installed-ubuntu-system/ + +作者:[SK][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.ostechnix.com/author/sk/ +[1]: https://www.ostechnix.com/how-to-migrate-system-settings-and-data-from-an-old-system-to-a-newly-installed-ubuntu-system/ +[2]: https://www.ostechnix.com/create-list-installed-packages-install-later-list-centos-ubuntu/#comment-12598 + +[3]: https://www.ostechnix.com/systemback-restore-ubuntu-desktop-and-server-to-previous-state/ + +[4]: https://www.ostechnix.com/cronopete-apples-time-machine-clone-linux/ From f21ff0975c34ca978acaabb841b06eeb284d10f4 Mon Sep 17 00:00:00 2001 From: qhwdw Date: Fri, 21 Sep 2018 19:43:03 +0800 Subject: [PATCH 02/39] Translated by qhwdw --- ...feinated 6.828:Lab 2 Memory Management.md | 234 ------------------ ...feinated 6.828:Lab 2 Memory Management.md | 232 +++++++++++++++++ 2 files changed, 232 insertions(+), 234 deletions(-) delete mode 100644 sources/tech/20140114 Caffeinated 6.828:Lab 2 Memory Management.md create mode 100644 translated/tech/20140114 Caffeinated 6.828:Lab 2 Memory Management.md diff --git a/sources/tech/20140114 Caffeinated 6.828:Lab 2 Memory Management.md b/sources/tech/20140114 Caffeinated 6.828:Lab 2 Memory Management.md deleted file mode 100644 index a52f7ac36a..0000000000 --- a/sources/tech/20140114 Caffeinated 6.828:Lab 2 Memory Management.md +++ /dev/null @@ -1,234 +0,0 @@ -Translating by qhwdw - -# Caffeinated 6.828:Lab 2: Memory Management - -### Introduction - -In this lab, you will write the memory management code for your operating system. Memory management has two components. - -The first component is a physical memory allocator for the kernel, so that the kernel can allocate memory and later free it. Your allocator will operate in units of 4096 bytes, called pages. Your task will be to maintain data structures that record which physical pages are free and which are allocated, and how many processes are sharing each allocated page. You will also write the routines to allocate and free pages of memory. - -The second component of memory management is virtual memory, which maps the virtual addresses used by kernel and user software to addresses in physical memory. The x86 hardware’s memory management unit (MMU) performs the mapping when instructions use memory, consulting a set of page tables. You will modify JOS to set up the MMU’s page tables according to a specification we provide. - -### Getting started - -In this and future labs you will progressively build up your kernel. We will also provide you with some additional source. To fetch that source, use Git to commit changes you’ve made since handing in lab 1 (if any), fetch the latest version of the course repository, and then create a local branch called lab2 based on our lab2 branch, origin/lab2: - -``` -athena% cd ~/6.828/lab -athena% add git -athena% git pull -Already up-to-date. -athena% git checkout -b lab2 origin/lab2 -Branch lab2 set up to track remote branch refs/remotes/origin/lab2. -Switched to a new branch "lab2" -athena% -``` - -You will now need to merge the changes you made in your lab1 branch into the lab2 branch, as follows: - -``` -athena% git merge lab1 -Merge made by recursive. - kern/kdebug.c | 11 +++++++++-- - kern/monitor.c | 19 +++++++++++++++++++ - lib/printfmt.c | 7 +++---- - 3 files changed, 31 insertions(+), 6 deletions(-) -athena% -``` - -Lab 2 contains the following new source files, which you should browse through: - -- inc/memlayout.h -- kern/pmap.c -- kern/pmap.h -- kern/kclock.h -- kern/kclock.c - -memlayout.h describes the layout of the virtual address space that you must implement by modifying pmap.c. memlayout.h and pmap.h define the PageInfo structure that you’ll use to keep track of which pages of physical memory are free. kclock.c and kclock.h manipulate the PC’s battery-backed clock and CMOS RAM hardware, in which the BIOS records the amount of physical memory the PC contains, among other things. The code in pmap.c needs to read this device hardware in order to figure out how much physical memory there is, but that part of the code is done for you: you do not need to know the details of how the CMOS hardware works. - -Pay particular attention to memlayout.h and pmap.h, since this lab requires you to use and understand many of the definitions they contain. You may want to review inc/mmu.h, too, as it also contains a number of definitions that will be useful for this lab. - -Before beginning the lab, don’t forget to add exokernel to get the 6.828 version of QEMU. - -### Hand-In Procedure - -When you are ready to hand in your lab code and write-up, add your answers-lab2.txt to the Git repository, commit your changes, and then run make handin. - -``` -athena% git add answers-lab2.txt -athena% git commit -am "my answer to lab2" -[lab2 a823de9] my answer to lab2 4 files changed, 87 insertions(+), 10 deletions(-) -athena% make handin -``` - -### Part 1: Physical Page Management - -The operating system must keep track of which parts of physical RAM are free and which are currently in use. JOS manages the PC’s physical memory with page granularity so that it can use the MMU to map and protect each piece of allocated memory. - -You’ll now write the physical page allocator. It keeps track of which pages are free with a linked list of struct PageInfo objects, each corresponding to a physical page. You need to write the physical page allocator before you can write the rest of the virtual memory implementation, because your page table management code will need to allocate physical memory in which to store page tables. - -> Exercise 1 -> -> In the file kern/pmap.c, you must implement code for the following functions (probably in the order given). -> -> boot_alloc() -> -> mem_init() (only up to the call to check_page_free_list()) -> -> page_init() -> -> page_alloc() -> -> page_free() -> -> check_page_free_list() and check_page_alloc() test your physical page allocator. You should boot JOS and see whether check_page_alloc() reports success. Fix your code so that it passes. You may find it helpful to add your own assert()s to verify that your assumptions are correct. - -This lab, and all the 6.828 labs, will require you to do a bit of detective work to figure out exactly what you need to do. This assignment does not describe all the details of the code you’ll have to add to JOS. Look for comments in the parts of the JOS source that you have to modify; those comments often contain specifications and hints. You will also need to look at related parts of JOS, at the Intel manuals, and perhaps at your 6.004 or 6.033 notes. - -### Part 2: Virtual Memory - -Before doing anything else, familiarize yourself with the x86’s protected-mode memory management architecture: namely segmentationand page translation. - -> Exercise 2 -> -> Look at chapters 5 and 6 of the Intel 80386 Reference Manual, if you haven’t done so already. Read the sections about page translation and page-based protection closely (5.2 and 6.4). We recommend that you also skim the sections about segmentation; while JOS uses paging for virtual memory and protection, segment translation and segment-based protection cannot be disabled on the x86, so you will need a basic understanding of it. - -### Virtual, Linear, and Physical Addresses - -In x86 terminology, a virtual address consists of a segment selector and an offset within the segment. A linear address is what you get after segment translation but before page translation. A physical address is what you finally get after both segment and page translation and what ultimately goes out on the hardware bus to your RAM. - -![屏幕快照 2018-09-04 11.22.20](/Users/qhwdw/Desktop/屏幕快照 2018-09-04 11.22.20.png) - -Recall that in part 3 of lab 1, we installed a simple page table so that the kernel could run at its link address of 0xf0100000, even though it is actually loaded in physical memory just above the ROM BIOS at 0x00100000. This page table mapped only 4MB of memory. In the virtual memory layout you are going to set up for JOS in this lab, we’ll expand this to map the first 256MB of physical memory starting at virtual address 0xf0000000 and to map a number of other regions of virtual memory. - -> Exercise 3 -> -> While GDB can only access QEMU’s memory by virtual address, it’s often useful to be able to inspect physical memory while setting up virtual memory. Review the QEMU monitor commands from the lab tools guide, especially the xp command, which lets you inspect physical memory. To access the QEMU monitor, press Ctrl-a c in the terminal (the same binding returns to the serial console). -> -> Use the xp command in the QEMU monitor and the x command in GDB to inspect memory at corresponding physical and virtual addresses and make sure you see the same data. -> -> Our patched version of QEMU provides an info pg command that may also prove useful: it shows a compact but detailed representation of the current page tables, including all mapped memory ranges, permissions, and flags. Stock QEMU also provides an info mem command that shows an overview of which ranges of virtual memory are mapped and with what permissions. - -From code executing on the CPU, once we’re in protected mode (which we entered first thing in boot/boot.S), there’s no way to directly use a linear or physical address. All memory references are interpreted as virtual addresses and translated by the MMU, which means all pointers in C are virtual addresses. - -The JOS kernel often needs to manipulate addresses as opaque values or as integers, without dereferencing them, for example in the physical memory allocator. Sometimes these are virtual addresses, and sometimes they are physical addresses. To help document the code, the JOS source distinguishes the two cases: the type uintptr_t represents opaque virtual addresses, and physaddr_trepresents physical addresses. Both these types are really just synonyms for 32-bit integers (uint32_t), so the compiler won’t stop you from assigning one type to another! Since they are integer types (not pointers), the compiler will complain if you try to dereference them. - -The JOS kernel can dereference a uintptr_t by first casting it to a pointer type. In contrast, the kernel can’t sensibly dereference a physical address, since the MMU translates all memory references. If you cast a physaddr_t to a pointer and dereference it, you may be able to load and store to the resulting address (the hardware will interpret it as a virtual address), but you probably won’t get the memory location you intended. - -To summarize: - -| C type | Address type | -| ------------ | ------------ | -| `T*` | Virtual | -| `uintptr_t` | Virtual | -| `physaddr_t` | Physical | - ->Question -> ->Assuming that the following JOS kernel code is correct, what type should variable x have, >uintptr_t or physaddr_t? -> ->![屏幕快照 2018-09-04 11.48.54](/Users/qhwdw/Desktop/屏幕快照 2018-09-04 11.48.54.png) -> - -The JOS kernel sometimes needs to read or modify memory for which it knows only the physical address. For example, adding a mapping to a page table may require allocating physical memory to store a page directory and then initializing that memory. However, the kernel, like any other software, cannot bypass virtual memory translation and thus cannot directly load and store to physical addresses. One reason JOS remaps of all of physical memory starting from physical address 0 at virtual address 0xf0000000 is to help the kernel read and write memory for which it knows just the physical address. In order to translate a physical address into a virtual address that the kernel can actually read and write, the kernel must add 0xf0000000 to the physical address to find its corresponding virtual address in the remapped region. You should use KADDR(pa) to do that addition. - -The JOS kernel also sometimes needs to be able to find a physical address given the virtual address of the memory in which a kernel data structure is stored. Kernel global variables and memory allocated by boot_alloc() are in the region where the kernel was loaded, starting at 0xf0000000, the very region where we mapped all of physical memory. Thus, to turn a virtual address in this region into a physical address, the kernel can simply subtract 0xf0000000. You should use PADDR(va) to do that subtraction. - -### Reference counting - -In future labs you will often have the same physical page mapped at multiple virtual addresses simultaneously (or in the address spaces of multiple environments). You will keep a count of the number of references to each physical page in the pp_ref field of thestruct PageInfo corresponding to the physical page. When this count goes to zero for a physical page, that page can be freed because it is no longer used. In general, this count should equal to the number of times the physical page appears below UTOP in all page tables (the mappings above UTOP are mostly set up at boot time by the kernel and should never be freed, so there’s no need to reference count them). We’ll also use it to keep track of the number of pointers we keep to the page directory pages and, in turn, of the number of references the page directories have to page table pages. - -Be careful when using page_alloc. The page it returns will always have a reference count of 0, so pp_ref should be incremented as soon as you’ve done something with the returned page (like inserting it into a page table). Sometimes this is handled by other functions (for example, page_insert) and sometimes the function calling page_alloc must do it directly. - -### Page Table Management - -Now you’ll write a set of routines to manage page tables: to insert and remove linear-to-physical mappings, and to create page table pages when needed. - -> Exercise 4 -> -> In the file kern/pmap.c, you must implement code for the following functions. -> -> pgdir_walk() -> -> boot_map_region() -> -> page_lookup() -> -> page_remove() -> -> page_insert() -> -> check_page(), called from mem_init(), tests your page table management routines. You should make sure it reports success before proceeding. - -### Part 3: Kernel Address Space - -JOS divides the processor’s 32-bit linear address space into two parts. User environments (processes), which we will begin loading and running in lab 3, will have control over the layout and contents of the lower part, while the kernel always maintains complete control over the upper part. The dividing line is defined somewhat arbitrarily by the symbol ULIM in inc/memlayout.h, reserving approximately 256MB of virtual address space for the kernel. This explains why we needed to give the kernel such a high link address in lab 1: otherwise there would not be enough room in the kernel’s virtual address space to map in a user environment below it at the same time. - -You’ll find it helpful to refer to the JOS memory layout diagram in inc/memlayout.h both for this part and for later labs. - -### Permissions and Fault Isolation - -Since kernel and user memory are both present in each environment’s address space, we will have to use permission bits in our x86 page tables to allow user code access only to the user part of the address space. Otherwise bugs in user code might overwrite kernel data, causing a crash or more subtle malfunction; user code might also be able to steal other environments’ private data. - -The user environment will have no permission to any of the memory above ULIM, while the kernel will be able to read and write this memory. For the address range [UTOP,ULIM), both the kernel and the user environment have the same permission: they can read but not write this address range. This range of address is used to expose certain kernel data structures read-only to the user environment. Lastly, the address space below UTOP is for the user environment to use; the user environment will set permissions for accessing this memory. - -### Initializing the Kernel Address Space - -Now you’ll set up the address space above UTOP: the kernel part of the address space. inc/memlayout.h shows the layout you should use. You’ll use the functions you just wrote to set up the appropriate linear to physical mappings. - -> Exercise 5 -> -> Fill in the missing code in mem_init() after the call to check_page(). - -Your code should now pass the check_kern_pgdir() and check_page_installed_pgdir() checks. - -> Question -> -> ​ 1、What entries (rows) in the page directory have been filled in at this point? What addresses do they map and where do they point? In other words, fill out this table as much as possible: -> -> EntryBase Virtual AddressPoints to (logically): -> -> 1023 ? Page table for top 4MB of phys memory -> -> 1022 ? ? -> -> . ? ? -> -> . ? ? -> -> . ? ? -> -> 2 0x00800000 ? -> -> 1 0x00400000 ? -> -> 0 0x00000000 [see next question] -> -> ​ 2、(From 20 Lecture3) We have placed the kernel and user environment in the same address space. Why will user programs not be able to read or write the kernel’s memory? What specific mechanisms protect the kernel memory? -> -> ​ 3、What is the maximum amount of physical memory that this operating system can support? Why? -> -> ​ 4、How much space overhead is there for managing memory, if we actually had the maximum amount of physical memory? How is this overhead broken down? -> -> ​ 5、Revisit the page table setup in kern/entry.S and kern/entrypgdir.c. Immediately after we turn on paging, EIP is still a low number (a little over 1MB). At what point do we transition to running at an EIP above KERNBASE? What makes it possible for us to continue executing at a low EIP between when we enable paging and when we begin running at an EIP above KERNBASE? Why is this transition necessary? - -### Address Space Layout Alternatives - -The address space layout we use in JOS is not the only one possible. An operating system might map the kernel at low linear addresses while leaving the upper part of the linear address space for user processes. x86 kernels generally do not take this approach, however, because one of the x86’s backward-compatibility modes, known as virtual 8086 mode, is “hard-wired” in the processor to use the bottom part of the linear address space, and thus cannot be used at all if the kernel is mapped there. - -It is even possible, though much more difficult, to design the kernel so as not to have to reserve any fixed portion of the processor’s linear or virtual address space for itself, but instead effectively to allow allow user-level processes unrestricted use of the entire 4GB of virtual address space - while still fully protecting the kernel from these processes and protecting different processes from each other! - -Generalize the kernel’s memory allocation system to support pages of a variety of power-of-two allocation unit sizes from 4KB up to some reasonable maximum of your choice. Be sure you have some way to divide larger allocation units into smaller ones on demand, and to coalesce multiple small allocation units back into larger units when possible. Think about the issues that might arise in such a system. - -This completes the lab. Make sure you pass all of the make grade tests and don’t forget to write up your answers to the questions inanswers-lab2.txt. Commit your changes (including adding answers-lab2.txt) and type make handin in the lab directory to hand in your lab. - ------- - -via: - -作者:[Mit][] -译者:[译者ID](https://github.com/%E8%AF%91%E8%80%85ID) -校对:[校对者ID](https://github.com/%E6%A0%A1%E5%AF%B9%E8%80%85ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 \ No newline at end of file diff --git a/translated/tech/20140114 Caffeinated 6.828:Lab 2 Memory Management.md b/translated/tech/20140114 Caffeinated 6.828:Lab 2 Memory Management.md new file mode 100644 index 0000000000..0e2a348679 --- /dev/null +++ b/translated/tech/20140114 Caffeinated 6.828:Lab 2 Memory Management.md @@ -0,0 +1,232 @@ +# Caffeinated 6.828:实验 2:内存管理 + +### 简介 + +在本实验中,你将为你的操作系统写内存管理方面的代码。内存管理有两部分组成。 + +第一部分是内核的物理内存分配器,内核通过它来分配内存,以及在不需要时释放所分配的内存。分配器以页为单位分配内存,每个页的大小为 4096 字节。你的任务是去维护那个数据结构,它负责记录物理页的分配和释放,以及每个分配的页有多少进程共享它。本实验中你将要写出分配和释放内存页的全套代码。 + +第二个部分是虚拟内存的管理,它负责由内核和用户软件使用的虚拟内存地址到物理内存地址之间的映射。当使用内存时,x86 架构的硬件是由内存管理单元(MMU)负责执行映射操作来查阅一组页表。接下来你将要修改 JOS,以根据我们提供的特定指令去设置 MMU 的页表。 + +### 预备知识 + +在本实验及后面的实验中,你将逐步构建你的内核。我们将会为你提供一些附加的资源。使用 Git 去获取这些资源、提交自实验 1 以来的改变(如有需要的话)、获取课程仓库的最新版本、以及在我们的实验 2 (origin/lab2)的基础上创建一个称为 lab2 的本地分支: + +``` +athena% cd ~/6.828/lab +athena% add git +athena% git pull +Already up-to-date. +athena% git checkout -b lab2 origin/lab2 +Branch lab2 set up to track remote branch refs/remotes/origin/lab2. +Switched to a new branch "lab2" +athena% +``` + +现在,你需要将你在 lab1 分支中的改变合并到 lab2 分支中,命令如下: + +``` +athena% git merge lab1 +Merge made by recursive. + kern/kdebug.c | 11 +++++++++-- + kern/monitor.c | 19 +++++++++++++++++++ + lib/printfmt.c | 7 +++---- + 3 files changed, 31 insertions(+), 6 deletions(-) +athena% +``` + +实验 2 包含如下的新源代码,后面你将遍历它们: + +- inc/memlayout.h +- kern/pmap.c +- kern/pmap.h +- kern/kclock.h +- kern/kclock.c + +`memlayout.h` 描述虚拟地址空间的布局,这个虚拟地址空间是通过修改 `pmap.c`、`memlayout.h` 和 `pmap.h` 所定义的 *PageInfo* 数据结构来实现的,这个数据结构用于跟踪物理内存页面是否被释放。`kclock.c` 和 `kclock.h` 维护 PC 基于电池的时钟和 CMOS RAM 硬件,在 BIOS 中记录了 PC 上安装的物理内存数量,以及其它的一些信息。在 `pmap.c` 中的代码需要去读取这个设备硬件信息,以算出在这个设备上安装了多少物理内存,这些只是由你来完成的一部分代码:你不需要知道 CMOS 硬件工作原理的细节。 + +特别需要注意的是 `memlayout.h` 和 `pmap.h`,因为本实验需要你去使用和理解的大部分内容都包含在这两个文件中。你或许还需要去复习 `inc/mmu.h` 这个文件,因为它也包含了本实验中用到的许多定义。 + +开始本实验之前,记得去添加 `exokernel` 以获取 QEMU 的 6.828 版本。 + +### 实验过程 + +在你准备进行实验和写代码之前,先添加你的 `answers-lab2.txt` 文件到 Git 仓库,提交你的改变然后去运行 `make handin`。 + +``` +athena% git add answers-lab2.txt +athena% git commit -am "my answer to lab2" +[lab2 a823de9] my answer to lab2 4 files changed, 87 insertions(+), 10 deletions(-) +athena% make handin +``` + +### 第 1 部分:物理页面管理 + +操作系统必须跟踪物理内存页是否使用的状态。JOS 以页为最小粒度来管理 PC 的物理内存,以便于它使用 MMU 去映射和保护每个已分配的内存片段。 + +现在,你将要写内存的物理页分配器的代码。它使用链接到 `PageInfo` 数据结构的一组列表来保持对物理页的状态跟踪,每个列表都对应到一个物理内存页。在你能够写出剩下的虚拟内存实现之前,你需要先写出物理内存页面分配器,因为你的页表管理代码将需要去分配物理内存来存储页表。 + +> 练习 1 +> +> 在文件 `kern/pmap.c` 中,你需要去实现以下函数的代码(或许要按给定的顺序来实现)。 +> +> boot_alloc() +> +> mem_init()(只要能够调用 check_page_free_list() 即可) +> +> page_init() +> +> page_alloc() +> +> page_free() +> +> `check_page_free_list()` 和 `check_page_alloc()` 可以测试你的物理内存页分配器。你将需要引导 JOS 然后去看一下 `check_page_alloc()` 是否报告成功即可。如果没有报告成功,修复你的代码直到成功为止。你可以添加你自己的 `assert()` 以帮助你去验证是否符合你的预期。 + +本实验以及所有的 6.828 实验中,将要求你做一些检测工作,以便于你搞清楚它们是否按你的预期来工作。这个任务不需要详细描述你添加到 JOS 中的代码的细节。查找 JOS 源代码中你需要去修改的那部分的注释;这些注释中经常包含有技术规范和提示信息。你也可能需要去查阅 JOS、和 Intel 的技术手册、以及你的 6.004 或 6.033 课程笔记的相关部分。 + +### 第 2 部分:虚拟内存 + +在你开始动手之前,需要先熟悉 x86 内存管理架构的保护模式:即分段和页面转换。 + +> 练习 2 +> +> 如果你对 x86 的保护模式还不熟悉,可以查看 Intel 80386 参考手册的第 5 章和第 6 章。阅读这些章节(5.2 和 6.4)中关于页面转换和基于页面的保护。我们建议你也去了解关于段的章节;在虚拟内存和保护模式中,JOS 使用了分页、段转换、以及在 x86 上不能禁用的基于段的保护,因此你需要去理解这些基础知识。 + +### 虚拟地址、线性地址和物理地址 + +在 x86 的专用术语中,一个虚拟地址是由一个段选择器和在段中的偏移量组成。一个线性地址是在页面转换之前、段转换之后得到的一个地址。一个物理地址是段和页面转换之后得到的最终地址,它最终将进入你的物理内存中的硬件总线。 + +![屏幕快照 2018-09-04 11.22.20](https://ws1.sinaimg.cn/large/0069RVTdly1fuxgrc398jj30gx04bgm1.jpg) + +回顾实验 1 中的第 3 部分,我们安装了一个简单的页表,这样内核就可以在 0xf0100000 链接的地址上运行,尽管它实际上是加载在 0x00100000 处的 ROM BIOS 的物理内存上。这个页表仅映射了 4MB 的内存。在实验中,你将要为 JOS 去设置虚拟内存布局,我们将从虚拟地址 0xf0000000 处开始扩展它,首先将物理内存扩展到 256MB,并映射许多其它区域的虚拟内存。 + +> 练习 3 +> +> 虽然 GDB 能够通过虚拟地址访问 QEMU 的内存,它经常用于在配置虚拟内存期间检查物理内存。在实验工具指南中复习 QEMU 的监视器命令,尤其是 `xp` 命令,它可以让你去检查物理内存。访问 QEMU 监视器,可以在终端中按 `Ctrl-a c`(相同的绑定返回到串行控制台)。 +> +> 使用 QEMU 监视器的 `xp` 命令和 GDB 的 `x` 命令去检查相应的物理内存和虚拟内存,以确保你看到的是相同的数据。 +> +> 我们的打过补丁的 QEMU 版本提供一个非常有用的 `info pg` 命令:它可以展示当前页表的一个简单描述,包括所有已映射的内存范围、权限、以及标志。Stock QEMU 也提供一个 `info mem` 命令用于去展示一个概要信息,这个信息包含了已映射的虚拟内存范围和使用了什么权限。 + +在 CPU 上运行的代码,一旦处于保护模式(这是在 boot/boot.S 中所做的第一件事情)中,是没有办法去直接使用一个线性地址或物理地址的。所有的内存引用都被解释为虚拟地址,然后由 MMU 来转换,这意味着在 C 语言中的指针都是虚拟地址。 + +例如在物理内存分配器中,JOS 内存经常需要在不反向引用的情况下,去维护作为地址的一个很难懂的值或一个整数。有时它们是虚拟地址,而有时是物理地址。为便于在代码中证明,JOS 源文件中将它们区分为两种:类型 `uintptr_t` 表示一个难懂的虚拟地址,而类型 `physaddr_trepresents` 表示物理地址。这些类型其实不过是 32 位整数(uint32_t)的同义词,因此编译器不会阻止你将一个类型的数据指派为另一个类型!因为它们都是整数(而不是指针)类型,如果你想去反向引用它们,编译器将报错。 + +JOS 内核能够通过将它转换为指针类型的方式来反向引用一个 `uintptr_t` 类型。相反,内核不能反向引用一个物理地址,因为这是由 MMU 来转换所有的内存引用。如果你转换一个 `physaddr_t` 为一个指针类型,并反向引用它,你或许能够加载和存储最终结果地址(硬件将它解释为一个虚拟地址),但你并不会取得你想要的内存位置。 + +总结如下: + +| C type | Address type | +| ------------ | ------------ | +| `T*` | Virtual | +| `uintptr_t` | Virtual | +| `physaddr_t` | Physical | + +>问题: +> +>假设下面的 JOS 内核代码是正确的,那么变量 `x` 应该是什么类型?uintptr_t 还是 physaddr_t ? +> +>![屏幕快照 2018-09-04 11.48.54](https://ws3.sinaimg.cn/large/0069RVTdly1fuxgrbkqd3j30m302bmxc.jpg) +> + +JOS 内核有时需要去读取或修改它知道物理地址的内存。例如,添加一个映射到页表,可以要求分配物理内存去存储一个页目录,然后去初始化它们。然而,内核也和其它的软件一样,并不能跳过虚拟地址转换,内核并不能直接加载和存储物理地址。一个原因是 JOS 将重映射从虚拟地址 0xf0000000 处物理地址 0 开始的所有的物理地址,以帮助内核去读取和写入它知道物理地址的内存。为转换一个物理地址为一个内核能够真正进行读写操作的虚拟地址,内核必须添加 0xf0000000 到物理地址以找到在重映射区域中相应的虚拟地址。你应该使用 KADDR(pa) 去做那个添加操作。 + +JOS 内核有时也需要能够通过给定的内核数据结构中存储的虚拟地址找到内存中的物理地址。内核全局变量和通过 `boot_alloc()` 分配的内存是加载到内核的这些区域中,从 0xf0000000 处开始,到全部物理内存映射的区域。因此,在这些区域中转变一个虚拟地址为物理地址时,内核能够只是简单地减去 0xf0000000 即可得到物理地址。你应该使用 PADDR(va) 去做那个减法操作。 + +### 引用计数 + +在以后的实验中,你将会经常遇到多个虚拟地址(或多个环境下的地址空间中)同时映射到相同的物理页面上。你将在 PageInfo 数据结构中用 pp_ref 字段来提供一个引用到每个物理页面的计数器。如果一个物理页面的这个计数器为 0,表示这个页面已经被释放,因为它不再被使用了。一般情况下,这个计数器应该等于相应的物理页面出现在所有页表下面的 UTOP 的次数(UTOP 上面的映射大都是在引导时由内核设置的,并且它从不会被释放,因此不需要引用计数器)。我们也使用它去跟踪到页目录的指针数量,反过来就是,页目录到页表的数量。 + +使用 `page_alloc` 时要注意。它返回的页面引用计数总是为 0,因此,一旦对返回页做了一些操作(比如将它插入到页表),`pp_ref` 就应该增加。有时这需要通过其它函数(比如,`page_instert`)来处理,而有时这个函数是直接调用 `page_alloc` 来做的。 + +### 页表管理 + +现在,你将写一套管理页表的代码:去插入和删除线性地址到物理地址的映射表,并且在需要的时候去创建页表。 + +> 练习 4 +> +> 在文件 `kern/pmap.c` 中,你必须去实现下列函数的代码。 +> +> pgdir_walk() +> +> boot_map_region() +> +> page_lookup() +> +> page_remove() +> +> page_insert() +> +> `check_page()`,调用 `mem_init()`,测试你的页表管理动作。在进行下一步流程之前你应该确保它成功运行。 + +### 第 3 部分:内核地址空间 + +JOS 分割处理器的 32 位线性地址空间为两部分:用户环境(进程),我们将在实验 3 中开始加载和运行,它将控制其上的布局和低位部分的内容,而内核总是维护对高位部分的完全控制。线性地址的定义是在 `inc/memlayout.h` 中通过符号 ULIM 来划分的,它为内核保留了大约 256MB 的虚拟地址空间。这就解释了为什么我们要在实验 1 中给内核这样的一个高位链接地址的原因:如是不这样做的话,内核的虚拟地址空间将没有足够的空间去同时映射到下面的用户空间中。 + +你可以在 `inc/memlayout.h` 中找到一个图表,它有助于你去理解 JOS 内存布局,这在本实验和后面的实验中都会用到。 + +### 权限和缺页隔离 + +由于内核和用户的内存都存在于它们各自环境的地址空间中,因此我们需要在 x86 的页表中使用权限位去允许用户代码只能访问用户所属地址空间的部分。否则的话,用户代码中的 bug 可能会覆写内核数据,导致系统崩溃或者发生各种莫名其妙的的故障;用户代码也可能会偷窥其它环境的私有数据。 + +对于 ULIM 以上部分的内存,用户环境没有任何权限,只有内核才可以读取和写入这部分内存。对于 [UTOP,ULIM] 地址范围,内核和用户都有相同的权限:它们可以读取但不能写入这个地址范围。这个地址范围是用于向用户环境暴露某些只读的内核数据结构。最后,低于 UTOP 的地址空间是为用户环境所使用的;用户环境将为访问这些内核设置权限。 + +### 初始化内核地址空间 + +现在,你将去配置 UTOP 以上的地址空间:内核部分的地址空间。`inc/memlayout.h` 中展示了你将要使用的布局。我将使用函数去写相关的线性地址到物理地址的映射配置。 + +> 练习 5 +> +> 完成调用 `check_page()` 之后在 `mem_init()` 中缺失的代码。 + +现在,你的代码应该通过了 `check_kern_pgdir()` 和 `check_page_installed_pgdir()` 的检查。 + +> 问题: +> +> ​ 1、在这个时刻,页目录中的条目(行)是什么?它们映射的址址是什么?以及它们映射到哪里了?换句话说就是,尽可能多地填写这个表: +> +> EntryBase Virtual AddressPoints to (logically): +> +> 1023 ? Page table for top 4MB of phys memory +> +> 1022 ? ? +> +> . ? ? +> +> . ? ? +> +> . ? ? +> +> 2 0x00800000 ? +> +> 1 0x00400000 ? +> +> 0 0x00000000 [see next question] +> +> ​ 2、(来自课程 3) 我们将内核和用户环境放在相同的地址空间中。为什么用户程序不能去读取和写入内核的内存?有什么特殊机制保护内核内存? +> +> ​ 3、这个操作系统能够支持的最大的物理内存数量是多少?为什么? +> +> ​ 4、我们真实地拥有最大数量的物理内存吗?管理内存的开销有多少?这个开销可以减少吗? +> +> ​ 5、复习在 `kern/entry.S` 和 `kern/entrypgdir.c` 中的页表设置。一旦我们打开分页,EIP 中是一个很小的数字(稍大于 1MB)。在什么情况下,我们转而去运行在 KERNBASE 之上的一个 EIP?当我们启用分页并开始在 KERNBASE 之上运行一个 EIP 时,是什么让我们能够持续运行一个很低的 EIP?为什么这种转变是必需的? + +### 地址空间布局的其它选择 + +在 JOS 中我们使用的地址空间布局并不是我们唯一的选择。一个操作系统可以在低位的线性地址上映射内核,而为用户进程保留线性地址的高位部分。然而,x86 内核一般并不采用这种方法,而 x86 向后兼容模式是不这样做的其中一个原因,这种模式被称为“虚拟 8086 模式”,处理器使用线性地址空间的最下面部分是“不可改变的”,所以,如果内核被映射到这里是根本无法使用的。 + +虽然很困难,但是设计这样的内核是有这种可能的,即:不为处理器自身保留任何固定的线性地址或虚拟地址空间,而有效地允许用户级进程不受限制地使用整个 4GB 的虚拟地址空间 —— 同时还要在这些进程之间充分保护内核以及不同的进程之间相互受保护! + +将内核的内存分配系统进行概括类推,以支持二次幂为单位的各种页大小,从 4KB 到一些你选择的合理的最大值。你务必要有一些方法,将较大的分配单位按需分割为一些较小的单位,以及在需要时,将多个较小的分配单位合并为一个较大的分配单位。想一想在这样的一个系统中可能会出现些什么样的问题。 + +这个实验做完了。确保你通过了所有的等级测试,并记得在 `answers-lab2.txt` 中写下你对上述问题的答案。提交你的改变(包括添加 `answers-lab2.txt` 文件),并在 `lab` 目录下输入 `make handin` 去提交你的实验。 + +------ + +via: + +作者:[Mit][] +译者:[qhwdw](https://github.com/qhwdw) +校对:[校对者ID](https://github.com/%E6%A0%A1%E5%AF%B9%E8%80%85ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 \ No newline at end of file From 79394ff5dd8147a8e8d0db5060d605bf892ebdf9 Mon Sep 17 00:00:00 2001 From: darksun Date: Tue, 25 Sep 2018 11:41:53 +0800 Subject: [PATCH 03/39] =?UTF-8?q?=E9=80=89=E9=A2=98:=20A=20Simple,=20Beaut?= =?UTF-8?q?iful=20And=20Cross-platform=20Podcast=20App?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...eautiful And Cross-platform Podcast App.md | 112 ++++++++++++++++++ 1 file changed, 112 insertions(+) create mode 100644 sources/tech/20180924 A Simple, Beautiful And Cross-platform Podcast App.md diff --git a/sources/tech/20180924 A Simple, Beautiful And Cross-platform Podcast App.md b/sources/tech/20180924 A Simple, Beautiful And Cross-platform Podcast App.md new file mode 100644 index 0000000000..ae9f91b548 --- /dev/null +++ b/sources/tech/20180924 A Simple, Beautiful And Cross-platform Podcast App.md @@ -0,0 +1,112 @@ +A Simple, Beautiful And Cross-platform Podcast App +====== + +![](https://www.ostechnix.com/wp-content/uploads/2018/09/cpod-720x340.png) + +Podcasts have become very popular in the last few years. Podcasts are what’s called “infotainment”, they are generally light-hearted, but they generally give you valuable information. Podcasts have blown up in the last few years, and if you like something, chances are there is a podcast about it. There are a lot of podcast players out there for the Linux desktop, but if you want something that is visually beautiful, has slick animations, and works on every platform, there aren’t a lot of alternatives to **CPod**. CPod (formerly known as **Cumulonimbus** ) is an open source and slickest podcast app that works on Linux, MacOS and Windows. + +CPod runs on something called **Electron** – a tool that allows developers to build cross-platform (E.g Windows, MacOs and Linux) desktop GUI applications. In this brief guide, we will be discussing – how to install and use CPod podcast app in Linux. + +### Installing CPod + +Go to the [**releases page**][1] of CPod. Download and Install the binary for your platform of choice. If you use Ubuntu/Debian, you can just download and install the .deb file from the releases page as shown below. + +``` +$ wget https://github.com/z-------------/CPod/releases/download/v1.25.7/CPod_1.25.7_amd64.deb + +$ sudo apt update + +$ sudo apt install gdebi + +$ sudo gdebi CPod_1.25.7_amd64.deb +``` + +If you use any other distribution, you probably should use the **AppImage** in the releases page. + +Download the AppImage file from the releases page. + +Open your terminal, and go to the directory where the AppImage file has been stored. Change the permissions to allow execution: + +``` +$ chmod +x CPod-1.25.7-x86_64.AppImage +``` + +Execute the AppImage File: + +``` +$ ./CPod-1.25.7-x86_64.AppImage +``` + +You’ll be presented a dialog asking whether to integrate the app with the system. Click **Yes** if you want to do so. + +### Features + +**Explore Tab** + +![](https://www.ostechnix.com/wp-content/uploads/2018/09/CPod-features-tab.png) + +CPod uses the Apple iTunes database to find podcasts. This is good, because the iTunes database is the biggest one out there. If there is a podcast out there, chances are it’s on iTunes. To find podcasts, just use the top search bar in the Explore section. The Explore Section also shows a few popular podcasts. + +**Home Tab** + +![](http://www.ostechnix.com/wp-content/uploads/2018/09/CPod-home-tab.png) + +The Home Tab is the tab that opens by default when you open the app. The Home Tab shows a chronological list of all the episodes of all the podcasts that you have subscribed to. + +From the home tab, you can: + + 1. Mark episodes read. + 2. Download them for offline playing + 3. Add them to the queue. + +![](https://www.ostechnix.com/wp-content/uploads/2018/09/The-podcasts-queue.png) + +**Subscriptions Tab** + +![](https://www.ostechnix.com/wp-content/uploads/2018/09/CPod-subscriptions-tab.png) + +You can of course, subscribe to podcasts that you like. A few other things you can do in the Subscriptions Tab is: + + 1. Refresh Podcast Artwork + 2. Export and Import Subscriptions to/from an .OPML file. + + + +**The Player** + +![](https://www.ostechnix.com/wp-content/uploads/2018/09/CPod-Podcast-Player.png) + +The player is perhaps the most beautiful part of CPod. The app changes the overall look and feel according to the banner of the podcast. There’s a sound visualiser at the bottom. To the right, you can see and search for other episodes of this podcast. + +**Cons/Missing Features** + +While I love this app, there are a few features and disadvantages that CPod does have: + + 1. Poor MPRIS Integration – You can play/pause the podcast from the media player dialog of your desktop environment, but not much more. The name of the podcast is not shown, and you can go to the next/previous episode. + 2. No support for chapters. + 3. No auto-downloading – you have to manually download episodes. + 4. CPU usage during use is pretty high (even for an Electron app). + + + +### Verdict + +While it does have its cons, CPod is clearly the most aesthetically pleasing podcast player app out there, and it has most basic features down. If you love using visually beautiful apps, and don’t need the advanced features, this is the perfect app for you. I know for a fact that I’m going to use it. + +Do you like CPod? Please put your opinions on the comments below! + + + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/cpod-a-simple-beautiful-and-cross-platform-podcast-app/ + +作者:[EDITOR][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.ostechnix.com/author/editor/ +[1]: https://github.com/z-------------/CPod/releases From ead74acd359cd2bb75829d292b3770c2b3fbd4f2 Mon Sep 17 00:00:00 2001 From: darksun Date: Tue, 25 Sep 2018 11:44:51 +0800 Subject: [PATCH 04/39] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Make=20The=20Output?= =?UTF-8?q?=20Of=20Ping=20Command=20Prettier=20And=20Easier=20To=20Read?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ing Command Prettier And Easier To Read.md | 129 ++++++++++++++++++ 1 file changed, 129 insertions(+) create mode 100644 sources/tech/20180924 Make The Output Of Ping Command Prettier And Easier To Read.md diff --git a/sources/tech/20180924 Make The Output Of Ping Command Prettier And Easier To Read.md b/sources/tech/20180924 Make The Output Of Ping Command Prettier And Easier To Read.md new file mode 100644 index 0000000000..39ca57bc43 --- /dev/null +++ b/sources/tech/20180924 Make The Output Of Ping Command Prettier And Easier To Read.md @@ -0,0 +1,129 @@ +Make The Output Of Ping Command Prettier And Easier To Read +====== + +![](https://www.ostechnix.com/wp-content/uploads/2018/09/prettyping-720x340.png) + +As we all know, the **ping** command is used to check if a target host is reachable or not. Using Ping command, we can send ICMP Echo request to our target host, and verify whether the destination host is up or down. If you use ping command often, I’d like to recommend you to try **“Prettyping”**. Prettyping is just a wrapper for the standard ping tool and makes the output of the ping command prettier, easier to read, colorful and compact. The prettyping runs the standard ping command in the background and parses the output with colors and unicode characters. It is free and open source tool written in **Bash** and **awk** and supports most Unix-like operating systems such as GNU/Linux, FreeBSD and Mac OS X. Prettyping is not only used to make the output of ping command prettier, but also ships with other notable features as listed below. + + * Detects the lost or missing packets and marks them in the output. + * Shows live statistics. The statistics are constantly updated after each response is received, while ping only shows after it ends. + * Smart enough to handle “unknown messages” (like error messages) without messing up the output. + * Avoids printing the repeated messages. + * You can use most common ping parameters with Prettyping. + * Can run as normal user. + * Can be able to redirect the output to a file. + * Requires no installation. Just download the binary, make it executable and run. + * Fast and lightweight. + * And, finally makes the output pretty, colorful and very intuitive. + + + +### Installing Prettyping + +Like I said already, Prettyping does not requires any installation. It is portable application! Just download the Prettyping binary file using command: + +``` +$ curl -O https://raw.githubusercontent.com/denilsonsa/prettyping/master/prettyping +``` + +Move the binary file to your $PATH, for example **/usr/local/bin**. + +``` +$ sudo mv prettyping /usr/local/bin +``` + +And, make it executable as like below: + +``` +$ sudo chmod +x /usr/local/bin/prettyping +``` + +It’s that simple. + +### Let us Make The Output Of Ping Command Prettier And Easier To Read + +Once installed, ping any host or IP address and see the ping command output in graphical way. + +``` +$ prettyping ostechnix.com +``` + +Here is the visually displayed ping output: + +![](https://www.ostechnix.com/wp-content/uploads/2018/09/prettyping-in-action.gif) + +If you run Prettyping without any arguments, it will keep running until you manually stop it by pressing **Ctrl+c**. + +Since Prettyping is just a wrapper to the ping command, you can use most common ping parameters. For instance, you can use **-c** flag to ping a host only a specific number of times, for example **5** : + +``` +$ prettyping -c 5 ostechnix.com +``` + +By default, prettynping displays the output in colored format. Don’t like the colored output? No problem! Use `--nocolor` option. + +``` +$ prettyping --nocolor ostechnix.com +``` + +Similarly, you can disable mult-color support using `--nomulticolor` option: + +``` +$ prettyping --nomulticolor ostechnix.com +``` + +To disable unicode characters, use `--nounicode` option: + +![](https://www.ostechnix.com/wp-content/uploads/2018/09/prettyping-without-unicode-support.png) + +This can be useful if your terminal does not support **UTF-8**. If you can’t fix the unicode (fonts) in your system, simply pass `--nounicode` option. + +Prettyping can redirect the output to a file as well. The following command will write the output of `prettyping ostechnix.com` command in `ostechnix.txt` file. + +``` +$ prettyping ostechnix.com | tee ostechnix.txt +``` + +Prettyping has few more options which helps you to do various tasks, such as, + + * Enable/disable the latency legend. (default value is: enabled) + * Force the output designed to a terminal. (default: auto) + * Use the last “n” pings at the statistics line. (default: 60) + * Override auto-detection of terminal dimensions. + * Override the awk interpreter. (default: awk) + * Override the ping tool. (default: ping) + + + +For more details, view the help section: + +``` +$ prettyping --help +``` + +Even though Prettyping doesn’t add any extra functionality, I personally like the following feature implementations in it: + + * Live statistics – You can see all the live statistics all the time. The standard ping command will only shows the statistics after it ends. + * Compact – You can see a longer timespan at your terminal. + * Prettyping detects missing responses. + + + +If you’re ever looking for a way to visually display the output of the ping command, Prettyping will definitely help. Give it a try, you won’t be disappointed. + +And, that’s all for now. Hope this was useful. More good stuffs to come. Stay tuned! + + + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/prettyping-make-the-output-of-ping-command-prettier-and-easier-to-read/ + +作者:[SK][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.ostechnix.com/author/sk/ From 631b6af13e46e307d2b70a27b95e2f7a55812916 Mon Sep 17 00:00:00 2001 From: darksun Date: Tue, 25 Sep 2018 11:49:22 +0800 Subject: [PATCH 05/39] =?UTF-8?q?=E9=80=89=E9=A2=98:=205=20ways=20to=20pla?= =?UTF-8?q?y=20old-school=20games=20on=20a=20Raspberry=20Pi?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...play old-school games on a Raspberry Pi.md | 169 ++++++++++++++++++ 1 file changed, 169 insertions(+) create mode 100644 sources/tech/20180924 5 ways to play old-school games on a Raspberry Pi.md diff --git a/sources/tech/20180924 5 ways to play old-school games on a Raspberry Pi.md b/sources/tech/20180924 5 ways to play old-school games on a Raspberry Pi.md new file mode 100644 index 0000000000..539ac42082 --- /dev/null +++ b/sources/tech/20180924 5 ways to play old-school games on a Raspberry Pi.md @@ -0,0 +1,169 @@ +5 ways to play old-school games on a Raspberry Pi +====== + +Relive the golden age of gaming with these open source platforms for Raspberry Pi. + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/arcade_game_gaming.jpg?itok=84Rjk_32) + +They don't make 'em like they used to, do they? Video games, I mean. + +Sure, there's a bit more grunt in the gear now. Princess Zelda used to be 16 pixels in each direction; there's now enough graphics power for every hair on her head. Today's processors could beat up 1988's processors in a cage-fight deathmatch without breaking a sweat. + +But you know what's missing? The fun. + +You've got a squillion and one buttons to learn just to get past the tutorial mission. There's probably a storyline, too. You shouldn't need a backstory to kill bad guys. All you need is jump and shoot. So, it's little wonder that one of the most enduring popular uses for a Raspberry Pi is to relive the 8- and 16-bit golden age of gaming in the '80s and early '90s. But where to start? + +There are a few ways to play old-school games on the Pi. Each has its strengths and weaknesses, which I'll discuss here. + +### Retropie + +[Retropie][1] is probably the most popular retro-gaming platform for the Raspberry Pi. It's a solid all-rounder and a great default option for emulating classic desktop and console gaming systems. + +#### What is it? + +Retropie is built to run on [Raspbian][2]. It can also be installed over an existing Raspbian image if you'd prefer. It uses [EmulationStation][3] as a graphical front-end for a library of open source emulators, including the [Libretro][4] emulators. + +You don't need to understand a word of that to play your games, though. + +#### What's great about it + +It's very easy to get started. All you need to do is burn the image to an SD card, configure your controllers, copy your games over, and start killing bad guys. + +The huge user base means that there is a wealth of support and information out there, and active online communities to turn to for questions. + +In addition to the emulators that come installed with the Retropie image, there's a huge library of emulators you can install from the package manager, and it's growing all the time. Retropie also offers a user-friendly menu system to manage this, saving you time. + +From the Retropie menu, it's easy to add Kodi and the Raspbian desktop, which comes with the Chromium web browser. This means your retro-gaming rig is also good for home theatre, [YouTube][5], [SoundCloud][6], and all those other “lounge room computer” goodies. + +Retropie also has a number of other customization options: You can change the graphics in the menus, set up different control pad configurations for different emulators, make your Raspberry Pi file system visible to your local Windows network—all sorts of stuff. + +Retropie is built on Raspbian, which means you have the Raspberry Pi's most popular operating system to explore. Most Raspberry Pi projects and tutorials you find floating around are written for Raspbian, making it easy to customize and install new things on it. I've used my Retropie rig as a wireless bridge, installed MIDI synthesizers on it, taught myself a bit of Python, and more—all without compromising its use as a gaming machine. + +#### What's not so great about it + +Retropie's simple installation and ease of use is, in a way, a double-edged sword. You can go for a long time with Retropie without ever learning simple stuff like `sudo apt-get`, which means you're missing out on a lot of the Raspberry Pi experience. + +It doesn't have to be this way; the command line is still there under the hood when you want it, but perhaps users are a bit too insulated from a Bash shell that's ultimately a lot less scary than it looks. Retropie's main menu is operable only with a control pad, which can be annoying when you don't have one plugged in because you've been using the system for things other than gaming. + +#### Who's it for? + +Anyone who wants to get straight into some gaming, anyone who wants the biggest and best library of emulators, and anyone who wants a great way to start exploring Linux when they're not playing games. + +### Recalbox + +[Recalbox][7] is a newer open source suite of emulators for the Raspberry Pi. It also supports other ARM-based small-board computers. + +#### What is it? + +Like Retropie, Recalbox is built on EmulationStation and Libretro. Where it differs is that it's not built on Raspbian, but on its own flavor of Linux: RecalboxOS. + +#### What's great about it + +The setup for Recalbox is even easier than for Retropie. You don't even need to image an SD card; simply copy some files over and go. It also has out-of-the-box support for some game controllers, getting you to Level 1 that little bit faster. Kodi comes preinstalled. This is a ready-to-go gaming and media rig. + +#### What's not so great about it + +Recalbox has fewer emulators than Retropie, fewer customization options, and a smaller user community. + +Your Recalbox rig is probably always just going to be for emulators and Kodi, the same as when you installed it. If you feel like getting deeper into Linux, you'll probably want a new SD card for Raspbian. + +#### Who's it for? + +Recalbox is great if you want the absolute easiest retro gaming experience and can happily go without some of the more obscure gaming platforms, or if you are intimidated by the idea of doing anything a bit technical (and have no interest in growing out of that). + +For most opensource.com readers, Recalbox will probably come in most handy to recommend to your not-so-technical friend or relative. Its super-simple setup and overall lack of options might even help you avoid having to help them with it. + +### Roll your own + +Ok, if you've been paying attention, you might have noticed that both Retropie and Recalbox are built from many of the same open source components. So what's to stop you from putting them together yourself? + +#### What is it? + +Whatever you want it to be, baby. The nature of open source software means you could use an existing emulator suite as a starting point, or pilfer from them at will. + +#### What's great about it + +If you have your own custom interface in mind, I guess there's nothing to do but roll your sleeves up and get to it. This is also a way to install emulators that haven't quite found their way into Retropie yet, such as [BeebEm][8] or [ArcEm][9]. + +#### What's not so great about it + +Well, it's a bit of work, isn't it? + +#### Who's it for? + +Hackers, tinkerers, builders, seasoned hobbyists, and such. + +### Native RISC OS gaming + +Now here's a dark horse: [RISC OS][10], the original operating system for ARM devices. + +#### What is it? + +Before ARM went on to become the world's most popular CPU architecture, it was originally built to be the heart of the Acorn Archimedes. That's kind of a forgotten beast nowadays, but for a few years it was light years ahead as the most powerful desktop computer in the world, and it attracted a lot of games development. + +Because the ARM processor in the Pi is the great-grandchild of the one in the Archimedes, we can still install RISC OS on it, and with a little bit of work, get these games running. This is different to the emulator options we've covered so far because we're playing our games on the operating system and CPU architecture for which they were written. + +#### What's great about it + +It's the perfect introduction to RISC OS. This is an absolute gem of an operating system and well worth checking out in its own right. + +The fact that you're using much the same operating system as back in the day to load and play your games makes your retro gaming rig just that little bit more of a time machine. This definitely adds some charm and retro value to the project. + +There are a few superb games that were released only on the Archimedes. The massive hardware advantage of the Archimedes also means that it often had the best graphics and smoothest gameplay of a lot of multi-platform titles. The rights holders to many of these games have been generous enough to make them legally available for free download. + +#### What's not so great about it + +Once you have installed RISC OS, it still takes a bit of elbow grease to get the games working. Here's a [guide to getting started][11]. + +This is definitely not a great all-rounder for the lounge room. There's nothing like [Kodi][12]. There's a web browser, [NetSurf][13], but it's struggling to catch up to the modern web. You won't get the range of titles to play as you would with an emulator suite. RISC OS Open is free for hobbyists to download and use and much of the source code has been made open. But despite the name, it's not a 100% open source operating system. + +#### Who's it for? + +This one's for novelty seekers, absolute retro heads, people who want to explore an interesting operating system from the '80s, people who are nostalgic for Acorn machines from back in the day, and people who want a totally different retro gaming project. + +### Command line gaming + +Do you really need to install an emulator or an exotic operating system just to relive the glory days? Why not just install some native linux games from the command line? + +#### What is it? + +There's a whole range of native Linux games tested to work on the [Raspberry Pi][14]. + +#### What's great about it + +You can install most of these from packages using the command line and start playing. Easy. If you've already got Raspbian up and running, it's probably your fastest path to getting a game running. + +#### What's not so great about it + +This isn't, strictly speaking, actual retro gaming. Linux was born in 1991 and took a while longer to come together as a gaming platform. This isn't quite gaming from the classic 8- and 16-bit era; these are ports and retro-influenced games that were built later. + +#### Who's it for? + +If you're just after a bucket of fun, no problem. But if you're trying to relive the actual era, this isn't quite it. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/9/retro-gaming-raspberry-pi + +作者:[James Mawson][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://opensource.com/users/dxmjames +[1]: https://retropie.org.uk/ +[2]: https://www.raspbian.org/ +[3]: https://emulationstation.org/ +[4]: https://www.libretro.com/ +[5]: https://www.youtube.com/ +[6]: https://soundcloud.com/ +[7]: https://www.recalbox.com/ +[8]: http://www.mkw.me.uk/beebem/ +[9]: http://arcem.sourceforge.net/ +[10]: https://opensource.com/article/18/7/gentle-intro-risc-os +[11]: https://blog.dxmtechsupport.com.au/playing-badass-acorn-archimedes-games-on-a-raspberry-pi/ +[12]: https://kodi.tv/ +[13]: https://www.netsurf-browser.org/ +[14]: https://www.raspberrypi.org/forums/viewtopic.php?f=78&t=51794 From be92daaafcc72653662b7510887e207d8bdd2fe8 Mon Sep 17 00:00:00 2001 From: darksun Date: Tue, 25 Sep 2018 12:04:38 +0800 Subject: [PATCH 06/39] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Gunpoint=20is=20a?= =?UTF-8?q?=20Delight=20for=20Stealth=20Game=20Fans?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...oint is a Delight for Stealth Game Fans.md | 104 ++++++++++++++++++ 1 file changed, 104 insertions(+) create mode 100644 sources/tech/20180923 Gunpoint is a Delight for Stealth Game Fans.md diff --git a/sources/tech/20180923 Gunpoint is a Delight for Stealth Game Fans.md b/sources/tech/20180923 Gunpoint is a Delight for Stealth Game Fans.md new file mode 100644 index 0000000000..3ff6857f78 --- /dev/null +++ b/sources/tech/20180923 Gunpoint is a Delight for Stealth Game Fans.md @@ -0,0 +1,104 @@ +Gunpoint is a Delight for Stealth Game Fans +====== +Gunpoint is a 2D stealth game in which you play as a spy stealing secrets and hacking networks like Ethan Hunt of Mission Impossible movie series. + + + +Hi, Fellow Linux gamers. Let’s take a look at a fun stealth game. Let’s take a look at [Gunpoint][1]. + +Gunpoint is neither free nor open source. It is an independent game you can purchase directly from the creator or from Steam. + +![][2] + +### The Interesting History of Gunpoint + +> The instant success of Gunpoint enabled its creator to become a full time game developer. + +Gunpoint is a stealth game created by [Tom Francis][3]. Francis was inspired to create the game after he heard about Spelunky, which was created by one person. Francis played games as part of his day job, as an editor for PC Gamer UK magazine. He had no previous programming experience but used the easy-to-use Game Maker. He planned to create a demo with the hopes of getting a job as a developer. + +He released his first prototype in May 2010 under the name Private Dick. Based on the response, Francis continued to work on the game. The final version was released in June of 2013 to high praise. + +In a [blog post][4] weeks after Gunpoint’s launch, Francis revealed that he made back all the money he spent on development ($30 for Game Maker 8) in 64 seconds. Francis didn’t reveal Gunpoint’s sales figures, but he did quit his job and today creates [games][5] full time. + +### Experiencing the Gunpoint Gameplay + +![Gunpoint Gameplay][6] + +Like I said earlier, Gunpoint is a stealth game. You play a freelance spy named Richard Conway. As Conway, you will use a pair of Bullfrog hypertrousers to infiltrate buildings for clients. The hypertrousers allow you to jump very high, even through windows. You can also cling to walls or ceilings like a ninja. + +Another tool you have is the Crosslink, which allows you to rewire circuits. Often you will need to use the Crosslink to reroute motion detections to unlock doors instead of setting off an alarm or rewire a light switch to turn off the light on another floor to distract a guard. + +When you sneak into a building, your biggest concern is the on-site security guards. If they see Conway, they will shoot and in this game, it’s one shot one kill. You can jump off a three-story building no problem, but bullets will take you down. Thankfully, if Conway is killed you can just jump back a few seconds and try again. + +Along the way, you will earn money to upgrade your tools and unlock new features. For example, I just unlocked the ability to rewire a guard’s gun. Don’t ask me how that works. + +### Minimum System Requirements + +Here are the minimum system requirements for Gunpoint: + +##### Linux + + * Processor: 2GHz + * Memory: 1GB RAM + * Video card: 512MB + * Hard Drive: 700MB HD space + + + +##### Windows + + * OS: Windows XP, Visa, 7 or 8 + * Processor: 2GHz + * Memory: 1GB RAM + * Video card: 512MB + * DirectX®: 9.0 + * Hard Drive: 700MB HD space + + + +##### macOS + + * OS: OS X 10.7 or later + * Processor: 2GHz + * Memory: 1GB RAM + * Video card: 512MB + * Hard Drive: 700MB HD space + + + +### Thoughts on Gunpoint + +![Gunpoint game on Linux][7] +Image Courtesy: Steam Community + +Gunpoint is a very fun game. The early levels are easy to get through, but the later levels make you put your thinking cap on. The hypertrousers and Crosslink are fun to play with. There is nothing like turning the lights off on a guard and bouncing over his head to hack a terminal. + +Besides the fun mechanics, it also has an interesting [noir][8] murder mystery story. Several different (and conflicting) clients hire you to look into different aspects of the case. Some of them seem to have ulterior motives that are not in your best interest. + +I always enjoy good mysteries and this one is no different. If you like noir or platforming games, be sure to check out [Gunpoint][1]. + +Have you every played Gunpoint? What other games should we review for your entertainment? Let us know in the comments below. + +If you found this article interesting, please take a minute to share it on social media, Hacker News or [Reddit][9]. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/gunpoint-game-review/ + +作者:[John Paul][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/john/ +[1]: http://www.gunpointgame.com/ +[2]: https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/08/gunpoint.jpg +[3]: https://www.pentadact.com/ +[4]: https://www.pentadact.com/2013-06-18-gunpoint-recoups-development-costs-in-64-seconds/ +[5]: https://www.pentadact.com/2014-08-09-what-im-working-on-and-what-ive-done/ +[6]: https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/08/gunpoint-gameplay-1.jpeg +[7]: https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/08/gunpoint-game-1.jpeg +[8]: https://en.wikipedia.org/wiki/Noir_fiction +[9]: http://reddit.com/r/linuxusersgroup From d5e112d38945d772a97645a90acd97eeb0290ebc Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 26 Sep 2018 14:42:58 +0800 Subject: [PATCH 07/39] =?UTF-8?q?=E9=80=89=E9=A2=98:=20How=20to=20Replace?= =?UTF-8?q?=20one=20Linux=20Distro=20With=20Another=20in=20Dual=20Boot=20[?= =?UTF-8?q?Guide]?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...Distro With Another in Dual Boot -Guide.md | 160 ++++++++++++++++++ 1 file changed, 160 insertions(+) create mode 100644 sources/tech/20180925 How to Replace one Linux Distro With Another in Dual Boot -Guide.md diff --git a/sources/tech/20180925 How to Replace one Linux Distro With Another in Dual Boot -Guide.md b/sources/tech/20180925 How to Replace one Linux Distro With Another in Dual Boot -Guide.md new file mode 100644 index 0000000000..ab9fa8acc3 --- /dev/null +++ b/sources/tech/20180925 How to Replace one Linux Distro With Another in Dual Boot -Guide.md @@ -0,0 +1,160 @@ +How to Replace one Linux Distro With Another in Dual Boot [Guide] +====== +**If you have a Linux distribution installed, you can replace it with another distribution in the dual boot. You can also keep your personal documents while switching the distribution.** + +![How to Replace One Linux Distribution With Another From Dual Boot][1] + +Suppose you managed to [successfully dual boot Ubuntu and Windows][2]. But after reading the [Linux Mint versus Ubuntu discussion][3], you realized that [Linux Mint][4] is more suited for your needs. What would you do now? How would you [remove Ubuntu][5] and [install Mint in dual boot][6]? + +You might think that you need to uninstall [Ubuntu][7] from dual boot first and then repeat the dual booting steps with Linux Mint. Let me tell you something. You don’t need to do all of that. + +If you already have a Linux distribution installed in dual boot, you can easily replace it with another. You don’t have to uninstall the existing Linux distribution. You simply delete its partition and install the new distribution on the disk space vacated by the previous distribution. + +Another good news is that you may be able to keep your Home directory with all your documents and pictures while switching the Linux distributions. + +Let me show you how to switch Linux distributions. + +### Replace one Linux with another from dual boot + + + +Let me describe the scenario I am going to use here. I have Linux Mint 19 installed on my system in dual boot mode with Windows 10. I am going to replace it with elementary OS 5. I’ll also keep my personal files (music, pictures, videos, documents from my home directory) while switching distributions. + +Let’s first take a look at the requirements: + + * A system with Linux and Windows dual boot + * Live USB of Linux you want to install + * Backup of your important files in Windows and in Linux on an external disk (optional yet recommended) + + + +#### Things to keep in mind for keeping your home directory while changing Linux distribution + +If you want to keep your files from existing Linux install as it is, you must have a separate root and home directory. You might have noticed that in my [dual boot tutorials][8], I always go for ‘Something Else’ option and then manually create root and home partitions instead of choosing ‘Install alongside Windows’ option. This is where all the troubles in manually creating separate home partition pay off. + +Keeping Home on a separate partition is helpful in situations when you want to replace your existing Linux install with another without losing your files. + +Note: You must remember the exact username and password of your existing Linux install in order to use the same home directory as it is in the new distribution. + +If you don’t have a separate Home partition, you may create it later as well BUT I won’t recommend that. That process is slightly complicated and I don’t want you to mess up your system. + +With that much background information, it’s time to see how to replace a Linux distribution with another. + +#### Step 1: Create a live USB of the new Linux distribution + +Alright! I already mentioned it in the requirements but I still included it in the main steps to avoid confusion. + +You can create a live USB using a start up disk creator like [Etcher][9] in Windows or Linux. The process is simple so I am not going to list the steps here. + +#### Step 2: Boot into live USB and proceed to installing Linux + +Since you have already dual booted before, you probably know the drill. Plugin the live USB, restart your system and at the boot time, press F10 or F12 repeatedly to enter BIOS settings. + +In here, choose to boot from the USB. And then you’ll see the option to try the live environment or installing it immediately. + +You should start the installation procedure. When you reach the ‘Installation type’ screen, choose the ‘Something else’ option. + +![Replacing one Linux with another from dual boot][10] +Select ‘Something else’ here + +#### Step 3: Prepare the partition + +You’ll see the partitioning screen now. Look closely and you’ll see your Linux installation with Ext4 file system type. + +![Identifying Linux partition in dual boot][11] +Identify where your Linux is installed + +In the above picture, the Ext4 partition labeled as Linux Mint 19 is the root partition. The second Ext4 partition of 82691 MB is the Home partition. I [haven’t used any swap space][12] here. + +Now, if you have just one Ext4 partition, that means that your home directory is on the same partition as root. In this case, you won’t be able to keep your Home directory. I suggest that you copy the important files to an external disk else you’ll lose them forever. + +It’s time to delete the root partition. Select the root partition and click the – sign. This will create some free space. + +![Delete root partition of your existing Linux install][13] +Delete root partition + +When you have the free space, click on + sign. + +![Create root partition for the new Linux][14] +Create a new root partition + +Now you should create a new partition out of this free space. If you had just one root partition in your previous Linux install, you should create root and home partitions here. You can also create the swap partition if you want to. + +If you had root and home partition separately, just create a root partition from the deleted root partition. + +![Create root partition for the new Linux][15] +Creating root partition + +You may ask why did I use delete and add instead of using the ‘change’ option. It’s because a few years ago, using change didn’t work for me. So I prefer to do a – and +. Is it superstition? Maybe. + +One important thing to do here is to mark the newly created partition for format. f you don’t change the size of the partition, it won’t be formatted unless you explicitly ask it to format. And if the partition is not formatted, you’ll have issues. + +![][16] +It’s important to format the root partition + +Now if you already had a separate Home partition on your existing Linux install, you should select it and click on change. + +![Recreate home partition][17] +Retouch the already existing home partition (if any) + +You just have to specify that you are mounting it as home partition. + +![Specify the home mount point][18] +Specify the home mount point + +If you had a swap partition, you can repeat the same steps as the home partition. This time specify that you want to use the space as swap. + +At this stage, you should have a root partition (with format option selected) and a home partition (and a swap if you want to). Hit the install now button to start the installation. + +![Verify partitions while replacing one Linux with another][19] +Verify the partitions + +The next few screens would be familiar to you. What matters is the screen where you are asked to create user and password. + +If you had a separate home partition previously and you want to use the same home directory, you MUST use the same username and password that you had before. Computer name doesn’t matter. + +![To keep the home partition intact, use the previous user and password][20] +To keep the home partition intact, use the previous user and password + +Your struggle is almost over. You don’t have to do anything else other than waiting for the installation to finish. + +![Wait for installation to finish][21] +Wait for installation to finish + +Once the installation is over, restart your system. You’ll have a new Linux distribution or version. + +In my case, I had the entire home directory of Linux Mint 19 as it is in the elementary OS. All the videos, pictures I had remained as it is. Isn’t that nice? + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/replace-linux-from-dual-boot/ + +作者:[Abhishek Prakash][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/abhishek/ +[1]: https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/09/Replace-Linux-Distro-from-dual-boot.png +[2]: https://itsfoss.com/install-ubuntu-1404-dual-boot-mode-windows-8-81-uefi/ +[3]: https://itsfoss.com/linux-mint-vs-ubuntu/ +[4]: https://www.linuxmint.com/ +[5]: https://itsfoss.com/uninstall-ubuntu-linux-windows-dual-boot/ +[6]: https://itsfoss.com/guide-install-linux-mint-16-dual-boot-windows/ +[7]: https://www.ubuntu.com/ +[8]: https://itsfoss.com/guide-install-elementary-os-luna/ +[9]: https://etcher.io/ +[10]: https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/09/replace-linux-with-another-1.jpg +[11]: https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/09/replace-linux-with-another-2.jpg +[12]: https://itsfoss.com/swap-size/ +[13]: https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/09/replace-linux-with-another-3.jpg +[14]: https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/09/replace-linux-with-another-4.jpg +[15]: https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/09/replace-linux-with-another-5.jpg +[16]: https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/09/replace-linux-with-another-6.jpg +[17]: https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/09/replace-linux-with-another-7.jpg +[18]: https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/09/replace-linux-with-another-8.jpg +[19]: https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/09/replace-linux-with-another-9.jpg +[20]: https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/09/replace-linux-with-another-10.jpg +[21]: https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/09/replace-linux-with-another-11.jpg From bade2cc0b46f98aaa8067426f60b1f9fc1ae2d6e Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 26 Sep 2018 14:46:34 +0800 Subject: [PATCH 08/39] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Why=20Linux=20users?= =?UTF-8?q?=20should=20try=20Rust?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...0180924 Why Linux users should try Rust.md | 171 ++++++++++++++++++ 1 file changed, 171 insertions(+) create mode 100644 sources/tech/20180924 Why Linux users should try Rust.md diff --git a/sources/tech/20180924 Why Linux users should try Rust.md b/sources/tech/20180924 Why Linux users should try Rust.md new file mode 100644 index 0000000000..db60883eb9 --- /dev/null +++ b/sources/tech/20180924 Why Linux users should try Rust.md @@ -0,0 +1,171 @@ +Why Linux users should try Rust +====== + +![](https://images.idgesg.net/images/article/2018/09/rust-rusted-metal-100773678-large.jpg) + +Rust is a fairly young and modern programming language with a lot of features that make it incredibly flexible and very secure. It's also becoming quite popular, having won first place for the "most loved programming language" in the Stack Overflow Developer Survey three years in a row — [2016][1], [2017][2], and [2018][3]. + +Rust is also an _open-source_ language with a suite of special features that allow it to be adapted to many different programming projects. It grew out of what was a personal project of a Mozilla employee back in 2006, was picked up as a special project by Mozilla a few years later (2009), and then announced for public use in 2010. + +Rust programs run incredibly fast, prevent segfaults, and guarantee thread safety. These attributes make the language tremendously appealing to developers focused on application security. Rust is also a very readable language and one that can be used for anything from simple programs to very large and complex projects. + +Rust is: + + * Memory safe — Rust will not suffer from dangling pointers, buffer overflows, or other memory-related errors. And it provides memory safety without garbage collection. + * General purpose — Rust is an appropriate language for any type of programming + * Fast — Rust is comparable in performance to C/C++ but with far better security features. + * Efficient — Rust is built to facilitate concurrent programming. + * Project-oriented — Rust has a built-in dependency and build management system called Cargo. + * Well supported — Rust has an impressive [support community][4]. + + + +Rust also enforces RAII (Resource Acquisition Is Initialization). That means when an object goes out of scope, its destructor will be called and its resources will be freed, providing a shield against resource leaks. It provides functional abstractions and a great [type system][5] together with speed and mathematical soundness. + +In short, Rust is an impressive systems programming language with features that other most languages lack, making it a serious contender for languages like C, C++ and Objective-C that have been used for years. + +### Installing Rust + +Installing Rust is a fairly simple process. + +``` +$ curl https://sh.rustup.rs -sSf | sh +``` + +Once Rust in installed, calling rustc with the **\--version** argument or using the **which** command displays version information. + +``` +$ which rustc +rustc 1.27.2 (58cc626de 2018-07-18) +$ rustc --version +rustc 1.27.2 (58cc626de 2018-07-18) +``` + +### Getting started with Rust + +The simplest code example is not all that different from what you'd enter if you were using one of many scripting languages. + +``` +$ cat hello.rs +fn main() { + // Print a greeting + println!("Hello, world!"); +} +``` + +In these lines, we are setting up a function (main), adding a comment describing the function, and using a println statement to create output. You could compile and then run a program like this using the command shown below. + +``` +$ rustc hello.rs +$ ./hello +Hello, world! +``` + +Alternately, you might create a "project" (generally used only for more complex programs than this one!) to keep your code organized. + +``` +$ mkdir ~/projects +$ cd ~/projects +$ mkdir hello_world +$ cd hello_world +``` + +Notice that even a simple program, once compiled, becomes a fairly large executable. + +``` +$ ./hello +Hello, world! +$ ls -l hello* +-rwxrwxr-x 1 shs shs 5486784 Sep 23 19:02 hello <== executable +-rw-rw-r-- 1 shs shs 68 Sep 23 15:25 hello.rs +``` + +And, of course, that's just a start — the traditional "Hello, world!" program. The Rust language has a suite of features to get you moving quickly to advanced levels of programming skill. + +### Learning Rust + +![rust programming language book cover][6] +No Starch Press + +The Rust Programming Language book by Steve Klabnik and Carol Nichols (2018) provides one of the best ways to learn Rust. Written by two members of the core development team, this book is available in print from [No Starch Press][7] or in ebook format at [rust-lang.org][8]. It has earned its reference as "the book" among the Rust developer community. + +Among the many topics covered, you will learn about these advanced topics: + + * Ownership and borrowing + * Safety guarantees + * Testing and error handling + * Smart pointers and multi-threading + * Advanced pattern matching + * Using Cargo (the built-in package manager) + * Using Rust's advanced compiler + + + +#### Table of Contents + +The table of contents is shown below. + +``` +Foreword by Nicholas Matsakis and Aaron Turon +Acknowledgements +Introduction +Chapter 1: Getting Started +Chapter 2: Guessing Game +Chapter 3: Common Programming Concepts +Chapter 4: Understanding Ownership +Chapter 5: Structs +Chapter 6: Enums and Pattern Matching +Chapter 7: Modules +Chapter 8: Common Collections +Chapter 9: Error Handling +Chapter 10: Generic Types, Traits, and Lifetimes +Chapter 11: Testing +Chapter 12: An Input/Output Project +Chapter 13: Iterators and Closures +Chapter 14: More About Cargo and Crates.io +Chapter 15: Smart Pointers +Chapter 16: Concurrency +Chapter 17: Is Rust Object Oriented? +Chapter 18: Patterns +Chapter 19: More About Lifetimes +Chapter 20: Advanced Type System Features +Appendix A: Keywords +Appendix B: Operators and Symbols +Appendix C: Derivable Traits +Appendix D: Macros +Index + +``` + +[The Rust Programming Language][7] takes you from basic installation and language syntax to complex topics, such as modules, error handling, crates (synonymous with a ‘library’ or ‘package’ in other languages), modules (allowing you to partition your code within the crate itself), lifetimes, etc. + +Probably the most important thing to say is that the book can move you from basic programming skills to building and compiling complex, secure and very useful programs. + +### Wrap-up + +If you're ready to get into some serious programming with a language that's well worth the time and effort to study and becoming increasingly popular, Rust is a good bet! + +Join the Network World communities on [Facebook][9] and [LinkedIn][10] to comment on topics that are top of mind. + +-------------------------------------------------------------------------------- + +via: https://www.networkworld.com/article/3308162/linux/why-you-should-try-rust.html + +作者:[Sandra Henry-Stocker][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.networkworld.com/author/Sandra-Henry_Stocker/ +[1]: https://insights.stackoverflow.com/survey/2016#technology-most-loved-dreaded-and-wanted +[2]: https://insights.stackoverflow.com/survey/2017#technology-most-loved-dreaded-and-wanted-languages +[3]: https://insights.stackoverflow.com/survey/2018#technology-most-loved-dreaded-and-wanted-languages +[4]: https://www.rust-lang.org/en-US/community.html +[5]: https://doc.rust-lang.org/reference/type-system.html +[6]: https://images.idgesg.net/images/article/2018/09/rust-programming-language_book-cover-100773679-small.jpg +[7]: https://nostarch.com/Rust +[8]: https://doc.rust-lang.org/book/2018-edition/index.html +[9]: https://www.facebook.com/NetworkWorld/ +[10]: https://www.linkedin.com/company/network-world From e0285aa5ab48a6ce7082ae736f307391f2291387 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 26 Sep 2018 14:50:23 +0800 Subject: [PATCH 09/39] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Taking=20the=20Audi?= =?UTF-8?q?ophile=20Linux=20distro=20for=20a=20spin?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ... the Audiophile Linux distro for a spin.md | 161 ++++++++++++++++++ 1 file changed, 161 insertions(+) create mode 100644 sources/tech/20180925 Taking the Audiophile Linux distro for a spin.md diff --git a/sources/tech/20180925 Taking the Audiophile Linux distro for a spin.md b/sources/tech/20180925 Taking the Audiophile Linux distro for a spin.md new file mode 100644 index 0000000000..1c813cb30a --- /dev/null +++ b/sources/tech/20180925 Taking the Audiophile Linux distro for a spin.md @@ -0,0 +1,161 @@ +Taking the Audiophile Linux distro for a spin +====== + +This lightweight open source audio OS offers a rich feature set and high-quality digital sound. + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/LIFE_givingmusic.jpg?itok=xVKF1dlb) + +I recently stumbled on the [Audiophile Linux project][1], one of a number of special-purpose music-oriented Linux distributions. Audiophile Linux: + + 1. is based on [ArchLinux][2] + + 2. provides a real-time Linux kernel customized for playing music + + 3. uses the lightweight [Fluxbox][3] window manager + + 4. avoids unnecessary daemons and services + + 5. allows playback of DSF and supports the usual PCM formats + + 6. supports various music players, including one of my favorite combos: MPD + Cantata + + + + +The Audiophile Linux site hasn’t shown a lot of activity since April 2017, but it does contain some updates and commentary from this year. Given its orientation and feature set, I decided to take it for a spin on my old Toshiba laptop. + +### Installing Audiophile Linux + +The site provides [a clear set of install instructions][4] that require the use of the terminal. The first step after downloading the .iso is burning it to a USB stick. I used the GNOME Disks utility’s Restore Disk Image for this purpose. Once I had the USB set up and ready to go, I plugged it into the Toshiba and booted it. When the splash screen came up, I set the boot device to the USB stick and a minute or so later, the Arch Grub menu was displayed. I booted Linux from that menu, which put me in a root shell session, where I could carry out the install to the hard drive: + +![](https://opensource.com/sites/default/files/uploads/root_shell_session.jpg) + +I was willing to sacrifice the 320-GB hard drive in the Toshiba for this test, so I was able to use the previous Linux partitioning (from the last experiment). I then proceeded as follows: + +``` +fdisk -l              # find the disk / partition, in my case /dev/sda and /dev/sda1 +mkfs.ext4 /dev/sda1   # build the ext4 filesystem in the root partition +mount /dev/sda1 /mnt  # mount the new file system +time cp -ax / /mnt    # copy over the OS +        # reported back cp -ax / /mnt 1.36s user 136.54s system 88% cpu 2:36.37 total +arch-chroot /mnt /bin/bash # run in the new system root +cd /etc/apl-files +./runme.sh            # do the rest of the install +grub-install --target=i386-pc /dev/sda # make the new OS bootable part 1 +grub-mkconfig -o /boot/grub/grub.cfg   # part 2 +passwd root           # set root’s password +ln -s /usr/share/zoneinfo/America/Vancouver /etc/localtime # set my time zone +hwclock --systohc --utc # update the hardware clock +./autologin.sh        # set the system up so that it automatically logs in +exit                  # done with the chroot session +genfstab -U /mnt >> /mnt/etc/fstab # create the fstab for the new system +``` + +At that point, I was ready to boot the new operating system, so I did—and voilà, up came the system! + +![](https://opensource.com/sites/default/files/uploads/audiophile_linux.jpg) + +### Finishing the configuration + +Once Audiophile Linux was up and running, I needed to [finish the configuration][4] and load some music. Grabbing the application menu by right-clicking on the screen background, I started **X-terminal** and entered the remaining configuration commands: + +``` +ping 8.8.8.8 # check connectivity (works fine) +su # become root +pacman-key –init # create pacman’s encryption data part 1 +pacman-key --populate archlinux # part 2 +pacman -Sy # part 3 +pacman -S archlinux-keyring # part 4 +``` + +At this point, the install instructions note that there is a problem with updating software with the `pacman -Suy` command, and that first the **libxfont** package must be removed using `pacman -Rc libxfont`. I followed this instruction, but the second run of `pacman -Suy` led to another dependency error, this time with the **x265** package. I looked further down the page in the install instructions and saw this recommendation: + +_Again there is an error in upstream repo of Arch packages. Try to remove conflicting packages with “pacman -R ffmpeg2.8” and then do pacman -Suy later._ + +I chose to use `pacman -Rc ffmpeg2.8`, and then reran `pacman -Suy`. (As an aside, typing all these **pacman** commands made me realize how familiar I am with **apt** , and how much this whole process made me feel like I was trying to write an email in some language I don’t know using an online translator.) + +To be clear, here was my sequence of operations: + +``` +pacman -Suy # failed +pacman -Rc libxfont +pacman -Suy # failed, again +pacman -Rc ffmpeg2.8 # uninstalled Cantata, have to fix that later! +pacman -Suy # worked! +``` + +Now back to the rest of the instructions: + +``` +pacman -S terminus-font +pacman -S xorg-server +pacman -S firefox # the docs suggested installing chromium but I prefer FF +reboot +``` + +And the last little bit, fiddling `/etc/fstab` to avoid access time modifications. I also thought I’d try installing [Cantata][5] once more using `pacman -S cantata`, and it worked just fine (no `ffmpeg2.8` problems). + +I found the `DAC Setup > List cards` on the application menu, which showed the built-in Intel sound hardware plus my USB DAC that I had plugged in earlier. Then I selected `DAC Setup > Edit mpd.conf` and adjusted the output stanza of `mpd.conf`. I used `scp` to copy an album over from my main music server into **~/Music**. And finally, I used the application menu `DAC Setup > Restart mpd`. And… nothing… the **conky** info on the screen indicated “MPD not responding”. So I scanned again through the comments at the bottom of the installation instructions and spotted this: + +_After every update of mpd, you have to do: +1. Become root +``` +$su +``` +2. run this commands +``` +# cat /etc/apl-files/mpd.service > /usr/lib/systemd/system/mpd.service +# systemctl daemon-reload +# systemctl restart mpd.service_ +``` +_And this will be fixed._ + +![](https://opensource.com/sites/default/files/uploads/library.png) + +And it works! Right now I’m enjoying [Nils Frahm’s "All Melody"][6] from the album of the same name, playing over my [Schiit Fulla 2][7] in glorious high-resolution sound. Time to copy in some more music so I can give it a better listen. + +So… does it sound better than the same DAC connected to my regular work laptop and playing back through [Guayadeque][8] or [GogglesMM][9]? I’m going to see if I can detect a difference at some point, but right now all I can say is it sounds just wonderful; plus [I like the Cantata / mpd combo a lot][10], and I really enjoy having the heads-up display in the upper right of the screen. + +### As for the music... + +The other day I was reorganizing my work hard drive a bit and I decided to check to make sure that 1) all the music on it was also on the house music servers and 2) _vice versa_ (gotta set up `rsync` for that purpose one day soon). In doing so, I found some music I hadn’t enjoyed for a while, which is kind of like buying a brand-new album, except it costs much less. + +[Six Degrees Records][11] has long been one of my favorite purveyors of unusual music. A great example is the group [Zuco 103][12]'s album [Whaa!][13], whose CD version I purchased from Six Degrees’ online store some years ago. Check out [this fun documentary about the group][14]. + + + +For a completely different experience, take a look at the [Ragazze Quartet’s performance of Terry Riley’s "Four Four Three."][15] I picked up ahigh-resolutionn version of this fascinating music from [Channel Classics][16], which operates a Linux-friendly download store (no bloatware to install on your computer). + +And finally, I was saddened to hear of the recent passing of [Rachid Taha][17], whose wonderful blend of North African and French musical traditions, along with his frank confrontation of the challenges of being North African and living in Europe, has made some powerful—and fun—music. Check out [Taha’s version of "Rock the Casbah."][18] I have a few of his songs scattered around various compilation albums, and some time ago bought the CD version of [Rachid Taha: The Definitive Collection][19], which I’ve been enjoying again recently. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/9/audiophile-linux-distro + +作者:[Chris Hermansen][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://opensource.com/users/clhermansen +[1]: https://www.ap-linux.com/ +[2]: https://www.archlinux.org/ +[3]: http://fluxbox.org/ +[4]: https://www.ap-linux.com/documentation/ap-linux-v4-install-instructions/ +[5]: https://github.com/CDrummond/cantata +[6]: https://www.youtube.com/watch?v=1PTj1qIqcWM +[7]: https://www.audiostream.com/content/listening-session-history-lesson-bw-schiit-and-shinola-together-last +[8]: http://www.guayadeque.org/ +[9]: https://gogglesmm.github.io/ +[10]: https://opensource.com/article/17/8/cantata-music-linux +[11]: https://www.sixdegreesrecords.com/ +[12]: https://www.sixdegreesrecords.com/?s=zuco+103 +[13]: https://www.musicomh.com/reviews/albums/zuco-103-whaa +[14]: https://www.youtube.com/watch?v=ncaqD92cjQ8 +[15]: https://www.youtube.com/watch?v=DwMaO7bMVD4 +[16]: https://www.channelclassics.com/catalogue/37816-Riley-Four-Four-Three/ +[17]: https://en.wikipedia.org/wiki/Rachid_Taha +[18]: https://www.youtube.com/watch?v=n1p_dkJo6Y8 +[19]: http://www.bbc.co.uk/music/reviews/26rg/ From 02b69bf88a8005574b7cb77cd11908d2bb97e1b5 Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 26 Sep 2018 14:58:15 +0800 Subject: [PATCH 10/39] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Clinews=20=E2=80=93?= =?UTF-8?q?=20Read=20News=20And=20Latest=20Headlines=20From=20Commandline?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...s And Latest Headlines From Commandline.md | 136 ++++++++++++++++++ 1 file changed, 136 insertions(+) create mode 100644 sources/tech/20180921 Clinews - Read News And Latest Headlines From Commandline.md diff --git a/sources/tech/20180921 Clinews - Read News And Latest Headlines From Commandline.md b/sources/tech/20180921 Clinews - Read News And Latest Headlines From Commandline.md new file mode 100644 index 0000000000..24ae89f461 --- /dev/null +++ b/sources/tech/20180921 Clinews - Read News And Latest Headlines From Commandline.md @@ -0,0 +1,136 @@ +Clinews – Read News And Latest Headlines From Commandline +====== + +![](https://www.ostechnix.com/wp-content/uploads/2018/09/clinews-720x340.jpeg) + +A while ago, we have written about a CLI news client named [**InstantNews**][1] that helps you to read news and latest headlines from commandline instantly. Today, I stumbled upon a similar utility named **Clinews** which serves the same purpose – reading news and latest headlines from popular websites, blogs from Terminal. You don’t need to install GUI applications or mobile apps. You can read what’s happening in the world right from your Terminal. It is free, open source utility written using **NodeJS**. + +### Installing Clinews + +Since Clinews is written using NodeJS, you can install it using NPM package manager. If you haven’t install NodeJS, install it as described in the following link. + +Once node installed, run the following command to install Clinews: + +``` +$ npm i -g clinews +``` + +You can also install Clinews using **Yarn** : + +``` +$ yarn global add clinews +``` + +Yarn itself can installed using npm + +``` +$ npm -i yarn +``` + +### Configure News API + +Clinews retrieves all news headlines from [**News API**][2]. News API is a simple and easy-to-use API that returns JSON metadata for the headlines currently published on a range of news sources and blogs. It currently provides live headlines from 70 popular sources, including Ars Technica, BBC, Blooberg, CNN, Daily Mail, Engadget, ESPN, Financial Times, Google News, hacker News, IGN, Mashable, National Geographic, Reddit r/all, Reuters, Speigel Online, Techcrunch, The Guardian, The Hindu, The Huffington Post, The Newyork Times, The Next Web, The Wall street Journal, USA today and [**more**][3]. + +First, you need an API key from News API. Go to [**https://newsapi.org/register**][4] URL and register a free account to get the API key. + +Once you got the API key from News API site, edit your **.bashrc** file: + +``` +$ vi ~/.bashrc + +``` + +Add newsapi API key at the end like below: + +``` +export IN_API_KEY="Paste-API-key-here" + +``` + +Please note that you need to paste the key inside the double quotes. Save and close the file. + +Run the following command to update the changes. + +``` +$ source ~/.bashrc + +``` + +Done. Now let us go ahead and fetch the latest headlines from new sources. + +### Read News And Latest Headlines From Commandline + +To read news and latest headlines from specific new source, for example **The Hindu** , run: + +``` +$ news fetch the-hindu + +``` + +Here, **“the-hindu”** is the new source id (fetch id). + +The above command will fetch latest 10 headlines from The Hindu news portel and display them in the Terminal. Also, it displays a brief description of the news, the published date and time, and the actual link to the source. + +**Sample output:** + +![](https://www.ostechnix.com/wp-content/uploads/2018/09/clinews-1.png) + +To read a news in your browser, hold Ctrl key and click on the URL. It will open in your default web browser. + +To view all the sources you can get news from, run: + +``` +$ news sources + +``` + +**Sample output:** + +![](https://www.ostechnix.com/wp-content/uploads/2018/09/clinews-2.png) + +As you see in the above screenshot, Clinews lists all news sources including the name of the news source, fetch id, description of the site, website URL and the country where it is located. As of writing this guide, Clinews currently supports 70+ news sources. + +Clinews can also able to search for news stories across all sources matching search criteria/term. Say for example, to list all news stories with titles containing the words **“Tamilnadu”** , use the following command: + +``` +$ news search "Tamilnadu" +``` + +This command will scrap all news sources for stories that match term **Tamilnadu**. + +Clinews has some extra flags that helps you to + + * limit the amount of news stories you want to see, + * sort news stories (top, latest, popular), + * display news stories category wise (E.g. business, entertainment, gaming, general, music, politics, science-and-nature, sport, technology) + + + +For more details, see the help section: + +``` +$ clinews -h +``` + +And, that’s all for now. Hope this was useful. More good stuffs to come. Stay tuned! + +Cheers! + + + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/clinews-read-news-and-latest-headlines-from-commandline/ + +作者:[SK][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.ostechnix.com/author/sk/ +[1]: https://www.ostechnix.com/get-news-instantly-commandline-linux/ +[2]: https://newsapi.org/ +[3]: https://newsapi.org/sources +[4]: https://newsapi.org/register From d3f075d5e18638fbd3054c4536d78bae33961719 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 26 Sep 2018 14:59:14 +0800 Subject: [PATCH 11/39] PRF:20180907 What do open source and cooking have in common.md @sd886393 --- ... open source and cooking have in common.md | 31 ++++++++----------- 1 file changed, 13 insertions(+), 18 deletions(-) diff --git a/translated/talk/20180907 What do open source and cooking have in common.md b/translated/talk/20180907 What do open source and cooking have in common.md index 2f5f150f1a..ae99bed725 100644 --- a/translated/talk/20180907 What do open source and cooking have in common.md +++ b/translated/talk/20180907 What do open source and cooking have in common.md @@ -3,48 +3,46 @@ ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/waffles-recipe-eggs-cooking-mix.png?itok=Fp06VOBx) -有什么好的方法,既可以宣传开源的精神又不用写代码呢?这里有个点子:“开源食堂”。在过去的8年间,这就是我们在慕尼黑做的事情。 +有什么好的方法,既可以宣传开源的精神又不用写代码呢?这里有个点子:“开源食堂open source cooking”。在过去的 8 年间,这就是我们在慕尼黑做的事情。 开源食堂已经是我们常规的开源宣传活动了,因为我们发现开源与烹饪有很多共同点。 ### 协作烹饪 -[慕尼黑开源聚会][1]自2009年7月在[Café Netzwerk][2]创办以来,已经组织了若干次活动,活动一般在星期五的晚上组织。该聚会为开源项目工作者或者开源爱好者们提供了相互认识的方式。我们的信条是:“每四周的星期五属于免费软件(Every fourth Friday for free software)”。当然在一些周末,我们还会举办一些研讨会。那之后,我们很快加入了很多其他的活动,包括白香肠早餐、桑拿与烹饪活动。 +[慕尼黑开源聚会][1]自 2009 年 7 月在 [Café Netzwerk][2] 创办以来,已经组织了若干次活动,活动一般在星期五的晚上组织。该聚会为开源项目工作者或者开源爱好者们提供了相互认识的方式。我们的信条是:“每四周的星期五属于自由软件Every fourth Friday for free software”。当然在一些周末,我们还会举办一些研讨会。那之后,我们很快加入了很多其他的活动,包括白香肠早餐、桑拿与烹饪活动。 -事实上,第一次开源烹饪聚会举办的有些混乱,但是我们经过这8年来以及15次的组织,已经可以为25-30个与会者提供丰盛的美食了。 +事实上,第一次开源烹饪聚会举办的有些混乱,但是我们经过这 8 年来以及 15 次的活动,已经可以为 25-30 个与会者提供丰盛的美食了。 回头看看这些夜晚,我们愈发发现共同烹饪与开源社区协作之间,有很多相似之处。 -### 烹饪步骤中的开源精神 +### 烹饪步骤中的自由开源精神 这里是几个烹饪与开源精神相同的地方: * 我们乐于合作且朝着一个共同的目标前进 - * 我们成立社区组织 + * 我们成了一个社区 * 由于我们有相同的兴趣与爱好,我们可以更多的了解我们自身与他人,并且可以一同协作 - * 我们也会犯错,但我们会从错误中学习,并为了共同的李医生去分享关于错误的经验,从而让彼此避免再犯相同的错误 + * 我们也会犯错,但我们会从错误中学习,并为了共同的利益去分享关于错误的经验,从而让彼此避免再犯相同的错误 * 每个人都会贡献自己擅长的事情,因为每个人都有自己的一技之长 * 我们会动员其他人去做出贡献并加入到我们之中 * 虽说协作是关键,但难免会有点混乱 * 每个人都会从中收益 - - ### 烹饪中的开源气息 同很多成功的开源聚会一样,开源烹饪也需要一些协作和组织结构。在每次活动之前,我们会组织所有的成员对菜单进行投票,而不单单是直接给每个人分一角披萨,我们希望真正的作出一道美味,迄今为止我们做过日本、墨西哥、匈牙利、印度等地区风味的美食,限于篇幅就不一一列举了。 -就像在生活中,共同烹饪一样需要各个成员之间相互的尊重和理解,所以我们也会试着为素食主义者、食物过敏者、或者对某些事物有偏好的人提供针对性的事物。正式开始烹饪之前,在家预先进行些小规模的测试会非常有帮助(乐趣!) +就像在生活中,共同烹饪同样需要各个成员之间相互的尊重和理解,所以我们也会试着为素食主义者、食物过敏者、或者对某些事物有偏好的人提供针对性的事物。正式开始烹饪之前,在家预先进行些小规模的测试会非常有帮助(和乐趣!) -可扩展性也很重要,在杂货店采购必要的食材很容易就消耗掉3个小时。所以我们使用一些表格工具(自然是 LibreOffice Calc)来做一些所需要的食材以及相应的成本。 +可扩展性也很重要,在杂货店采购必要的食材很容易就消耗掉 3 个小时。所以我们使用一些表格工具(自然是 LibreOffice Calc)来做一些所需要的食材以及相应的成本。 -我们会同志愿者一起,为每次晚餐准备一个“包管理器”,从而及时的制作出菜单并在问题产生的时候寻找一些独到的解决方法。 +我们会同志愿者一起,对于每次晚餐我们都有一个“包维护者”,从而及时的制作出菜单并在问题产生的时候寻找一些独到的解决方法。 虽然不是所有人都是大厨,但是只要给与一些帮助,并比较合理的分配任务和责任,就很容易让每个人都参与其中。某种程度上来说,处理 18kg 的西红柿和 100 个鸡蛋都不会让你觉得是件难事,相信我!唯一的限制是一个烤炉只有四个灶,所以可能是时候对基础设施加大投入了。 -发布有时间要求,当然要求也不那么严格,我们通常会在21:30和01:30之间的相当“灵活”时间内供应主菜,即便如此,这个时间也是硬性的发布规定。 +发布有时间要求,当然要求也不那么严格,我们通常会在 21:30 和 01:30 之间的相当“灵活”时间内供应主菜,即便如此,这个时间也是硬性的发布规定。 -最后,想很多开源项目一样,烹饪文档同样有提升的空间。类似洗碟子这样的扫尾工作同样也有可优化的地方。 +最后,像很多开源项目一样,烹饪文档同样有提升的空间。类似洗碟子这样的扫尾工作同样也有可优化的地方。 ### 未来的一些新功能点 @@ -54,21 +52,18 @@ * 购买和烹饪一个价值 700 欧元的大南瓜,并且 * 找家可以为我们采购提供折扣的商店 - 最后一点,也是开源软件的动机:永远记住,还有一些人们生活在阴影中,他们为没有同等的权限去访问资源而苦恼着。我们如何通过开源的精神去帮助他们呢? 一想到这点,我便期待这下一次的开源烹饪聚会。如果读了上面的东西让你觉得不够完美,并且想自己运作这样的活动,我们非常乐意你能够借鉴我们的想法,甚至抄袭一个。我们也乐意你能够参与到我们其中,甚至做一些演讲和问答。 -Article originally appeared on [blog.effenberger.org][3]. Reprinted with permission. - -------------------------------------------------------------------------------- via: https://opensource.com/article/18/9/open-source-cooking 作者:[Florian Effenberger][a] 选题:[lujun9972](https://github.com/lujun9972) -译者:[译者ID](https://github.com/sd886393) -校对:[校对者ID](https://github.com/校对者ID) +译者:[sd886393](https://github.com/sd886393) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 2dd5f756e62d138abe843d914a3be0ed383e018b Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 26 Sep 2018 14:59:32 +0800 Subject: [PATCH 12/39] PUB:20180907 What do open source and cooking have in common.md @sd886393 https://linux.cn/article-10052-1.html --- .../20180907 What do open source and cooking have in common.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/talk => published}/20180907 What do open source and cooking have in common.md (100%) diff --git a/translated/talk/20180907 What do open source and cooking have in common.md b/published/20180907 What do open source and cooking have in common.md similarity index 100% rename from translated/talk/20180907 What do open source and cooking have in common.md rename to published/20180907 What do open source and cooking have in common.md From f1e6337f2faa1d4b7d370ffa77ff197cb13d576e Mon Sep 17 00:00:00 2001 From: darksun Date: Wed, 26 Sep 2018 15:19:09 +0800 Subject: [PATCH 13/39] =?UTF-8?q?=E9=80=89=E9=A2=98:=20How=20To=20Find=20O?= =?UTF-8?q?ut=20Which=20Port=20Number=20A=20Process=20Is=20Using=20In=20Li?= =?UTF-8?q?nux?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...Port Number A Process Is Using In Linux.md | 278 ++++++++++++++++++ 1 file changed, 278 insertions(+) create mode 100644 sources/tech/20180924 How To Find Out Which Port Number A Process Is Using In Linux.md diff --git a/sources/tech/20180924 How To Find Out Which Port Number A Process Is Using In Linux.md b/sources/tech/20180924 How To Find Out Which Port Number A Process Is Using In Linux.md new file mode 100644 index 0000000000..21b6633730 --- /dev/null +++ b/sources/tech/20180924 How To Find Out Which Port Number A Process Is Using In Linux.md @@ -0,0 +1,278 @@ +How To Find Out Which Port Number A Process Is Using In Linux +====== +As a Linux administrator, you should know whether the corresponding service is binding/listening with correct port or not. + +This will help you to easily troubleshoot further when you are facing port related issues. + +A port is a logical connection that identifies a specific process on Linux. There are two kind of port are available like, physical and software. + +Since Linux operating system is a software hence, we are going to discuss about software port. + +Software port is always associated with an IP address of a host and the relevant protocol type for communication. The port is used to distinguish the application. + +Most of the network related services have to open up a socket to listen incoming network requests. Socket is unique for every service. + +**Suggested Read :** +**(#)** [4 Easiest Ways To Find Out Process ID (PID) In Linux][1] +**(#)** [3 Easy Ways To Kill Or Terminate A Process In Linux][2] + +Socket is combination of IP address, software Port and protocol. The port numbers area available for both TCP and UDP protocol. + +The Transmission Control Protocol (TCP) and the User Datagram Protocol (UDP) use port numbers for communication. It is a value from 0 to 65535. + +Below are port assignments categories. + + * `0-1023:` Well Known Ports or System Ports + * `1024-49151:` Registered Ports for applications + * `49152-65535:` Dynamic Ports or Private Ports + + + +You can check the details of the reserved ports in the /etc/services file on Linux. + +``` +# less /etc/services +# /etc/services: +# $Id: services,v 1.55 2013/04/14 ovasik Exp $ +# +# Network services, Internet style +# IANA services version: last updated 2013-04-10 +# +# Note that it is presently the policy of IANA to assign a single well-known +# port number for both TCP and UDP; hence, most entries here have two entries +# even if the protocol doesn't support UDP operations. +# Updated from RFC 1700, ``Assigned Numbers'' (October 1994). Not all ports +# are included, only the more common ones. +# +# The latest IANA port assignments can be gotten from +# http://www.iana.org/assignments/port-numbers +# The Well Known Ports are those from 0 through 1023. +# The Registered Ports are those from 1024 through 49151 +# The Dynamic and/or Private Ports are those from 49152 through 65535 +# +# Each line describes one service, and is of the form: +# +# service-name port/protocol [aliases ...] [# comment] + +tcpmux 1/tcp # TCP port service multiplexer +tcpmux 1/udp # TCP port service multiplexer +rje 5/tcp # Remote Job Entry +rje 5/udp # Remote Job Entry +echo 7/tcp +echo 7/udp +discard 9/tcp sink null +discard 9/udp sink null +systat 11/tcp users +systat 11/udp users +daytime 13/tcp +daytime 13/udp +qotd 17/tcp quote +qotd 17/udp quote +msp 18/tcp # message send protocol (historic) +msp 18/udp # message send protocol (historic) +chargen 19/tcp ttytst source +chargen 19/udp ttytst source +ftp-data 20/tcp +ftp-data 20/udp +# 21 is registered to ftp, but also used by fsp +ftp 21/tcp +ftp 21/udp fsp fspd +ssh 22/tcp # The Secure Shell (SSH) Protocol +ssh 22/udp # The Secure Shell (SSH) Protocol +telnet 23/tcp +telnet 23/udp +# 24 - private mail system +lmtp 24/tcp # LMTP Mail Delivery +lmtp 24/udp # LMTP Mail Delivery + +``` + +This can be achieved using the below six methods. + + * `ss:` ss is used to dump socket statistics. + * `netstat:` netstat is displays a list of open sockets. + * `lsof:` lsof – list open files. + * `fuser:` fuser – list process IDs of all processes that have one or more files open + * `nmap:` nmap – Network exploration tool and security / port scanner + * `systemctl:` systemctl – Control the systemd system and service manager + + + +In this tutorial we are going to find out which port number the SSHD daemon is using. + +### Method-1: Using ss Command + +ss is used to dump socket statistics. It allows showing information similar to netstat. It can display more TCP and state informations than other tools. + +It can display stats for all kind of sockets such as PACKET, TCP, UDP, DCCP, RAW, Unix domain, etc. + +``` +# ss -tnlp | grep ssh +LISTEN 0 128 *:22 *:* users:(("sshd",pid=997,fd=3)) +LISTEN 0 128 :::22 :::* users:(("sshd",pid=997,fd=4)) +``` + +Alternatively you can check this with port number as well. + +``` +# ss -tnlp | grep ":22" +LISTEN 0 128 *:22 *:* users:(("sshd",pid=997,fd=3)) +LISTEN 0 128 :::22 :::* users:(("sshd",pid=997,fd=4)) +``` + +### Method-2: Using netstat Command + +netstat – Print network connections, routing tables, interface statistics, masquerade connections, and multicast memberships. + +By default, netstat displays a list of open sockets. If you don’t specify any address families, then the active sockets of all configured address families will be printed. This program is obsolete. Replacement for netstat is ss. + +``` +# netstat -tnlp | grep ssh +tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 997/sshd +tcp6 0 0 :::22 :::* LISTEN 997/sshd +``` + +Alternatively you can check this with port number as well. + +``` +# netstat -tnlp | grep ":22" +tcp 0 0 0.0.0.0:22 0.0.0.0:* LISTEN 1208/sshd +tcp6 0 0 :::22 :::* LISTEN 1208/sshd +``` + +### Method-3: Using lsof Command + +lsof – list open files. The Linux lsof command lists information about files that are open by processes running on the system. + +``` +# lsof -i -P | grep ssh +COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME +sshd 11584 root 3u IPv4 27625 0t0 TCP *:22 (LISTEN) +sshd 11584 root 4u IPv6 27627 0t0 TCP *:22 (LISTEN) +sshd 11592 root 3u IPv4 27744 0t0 TCP vps.2daygeek.com:ssh->103.5.134.167:49902 (ESTABLISHED) +``` + +Alternatively you can check this with port number as well. + +``` +# lsof -i tcp:22 +COMMAND PID USER FD TYPE DEVICE SIZE/OFF NODE NAME +sshd 1208 root 3u IPv4 20919 0t0 TCP *:ssh (LISTEN) +sshd 1208 root 4u IPv6 20921 0t0 TCP *:ssh (LISTEN) +sshd 11592 root 3u IPv4 27744 0t0 TCP vps.2daygeek.com:ssh->103.5.134.167:49902 (ESTABLISHED) +``` + +### Method-4: Using fuser Command + +The fuser utility shall write to standard output the process IDs of processes running on the local system that have one or more named files open. + +``` +# fuser -v 22/tcp + USER PID ACCESS COMMAND +22/tcp: root 1208 F.... sshd + root 12388 F.... sshd + root 49339 F.... sshd +``` + +### Method-5: Using nmap Command + +Nmap (“Network Mapper”) is an open source tool for network exploration and security auditing. It was designed to rapidly scan large networks, although it works fine against single hosts. + +Nmap uses raw IP packets in novel ways to determine what hosts are available on the network, what services (application name and version) those hosts are offering, what operating systems (and OS versions) they are running, what type of packet filters/firewalls are in use, and dozens of other characteristics. + +``` +# nmap -sV -p 22 localhost + +Starting Nmap 6.40 ( http://nmap.org ) at 2018-09-23 12:36 IST +Nmap scan report for localhost (127.0.0.1) +Host is up (0.000089s latency). +Other addresses for localhost (not scanned): 127.0.0.1 +PORT STATE SERVICE VERSION +22/tcp open ssh OpenSSH 7.4 (protocol 2.0) + +Service detection performed. Please report any incorrect results at http://nmap.org/submit/ . +Nmap done: 1 IP address (1 host up) scanned in 0.44 seconds +``` + +### Method-6: Using systemctl Command + +systemctl – Control the systemd system and service manager. This is the replacement of old SysV init system management and most of the modern Linux operating systems were adapted systemd. + +**Suggested Read :** +**(#)** [chkservice – A Tool For Managing Systemd Units From Linux Terminal][3] +**(#)** [How To Check All Running Services In Linux][4] + +``` +# systemctl status sshd +● sshd.service - OpenSSH server daemon + Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled; vendor preset: enabled) + Active: active (running) since Sun 2018-09-23 02:08:56 EDT; 6h 11min ago + Docs: man:sshd(8) + man:sshd_config(5) + Main PID: 11584 (sshd) + CGroup: /system.slice/sshd.service + └─11584 /usr/sbin/sshd -D + +Sep 23 02:08:56 vps.2daygeek.com systemd[1]: Starting OpenSSH server daemon... +Sep 23 02:08:56 vps.2daygeek.com sshd[11584]: Server listening on 0.0.0.0 port 22. +Sep 23 02:08:56 vps.2daygeek.com sshd[11584]: Server listening on :: port 22. +Sep 23 02:08:56 vps.2daygeek.com systemd[1]: Started OpenSSH server daemon. +Sep 23 02:09:15 vps.2daygeek.com sshd[11589]: Connection closed by 103.5.134.167 port 49899 [preauth] +Sep 23 02:09:41 vps.2daygeek.com sshd[11592]: Accepted password for root from 103.5.134.167 port 49902 ssh2 +``` + +The above out will be showing the actual listening port of SSH service when you start the SSHD service recently. Otherwise it won’t because it updates recent logs in the output frequently. + +``` +# systemctl status sshd +● sshd.service - OpenSSH server daemon + Loaded: loaded (/usr/lib/systemd/system/sshd.service; enabled; vendor preset: enabled) + Active: active (running) since Thu 2018-09-06 07:40:59 IST; 2 weeks 3 days ago + Docs: man:sshd(8) + man:sshd_config(5) + Main PID: 1208 (sshd) + CGroup: /system.slice/sshd.service + ├─ 1208 /usr/sbin/sshd -D + ├─23951 sshd: [accepted] + └─23952 sshd: [net] + +Sep 23 12:50:36 vps.2daygeek.com sshd[23909]: Invalid user pi from 95.210.113.142 port 51666 +Sep 23 12:50:36 vps.2daygeek.com sshd[23909]: input_userauth_request: invalid user pi [preauth] +Sep 23 12:50:37 vps.2daygeek.com sshd[23911]: pam_unix(sshd:auth): check pass; user unknown +Sep 23 12:50:37 vps.2daygeek.com sshd[23911]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=95.210.113.142 +Sep 23 12:50:37 vps.2daygeek.com sshd[23909]: pam_unix(sshd:auth): check pass; user unknown +Sep 23 12:50:37 vps.2daygeek.com sshd[23909]: pam_unix(sshd:auth): authentication failure; logname= uid=0 euid=0 tty=ssh ruser= rhost=95.210.113.142 +Sep 23 12:50:39 vps.2daygeek.com sshd[23911]: Failed password for invalid user pi from 95.210.113.142 port 51670 ssh2 +Sep 23 12:50:39 vps.2daygeek.com sshd[23909]: Failed password for invalid user pi from 95.210.113.142 port 51666 ssh2 +Sep 23 12:50:40 vps.2daygeek.com sshd[23911]: Connection closed by 95.210.113.142 port 51670 [preauth] +Sep 23 12:50:40 vps.2daygeek.com sshd[23909]: Connection closed by 95.210.113.142 port 51666 [preauth] +``` + +Most of the time the above output won’t shows the process actual port number. in this case i would suggest you to check the details using the below command from the journalctl log file. + +``` +# journalctl | grep -i "openssh\|sshd" +Sep 23 02:08:56 vps138235.vps.ovh.ca sshd[997]: Received signal 15; terminating. +Sep 23 02:08:56 vps138235.vps.ovh.ca systemd[1]: Stopping OpenSSH server daemon... +Sep 23 02:08:56 vps138235.vps.ovh.ca systemd[1]: Starting OpenSSH server daemon... +Sep 23 02:08:56 vps138235.vps.ovh.ca sshd[11584]: Server listening on 0.0.0.0 port 22. +Sep 23 02:08:56 vps138235.vps.ovh.ca sshd[11584]: Server listening on :: port 22. +Sep 23 02:08:56 vps138235.vps.ovh.ca systemd[1]: Started OpenSSH server daemon. +``` + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/how-to-find-out-which-port-number-a-process-is-using-in-linux/ + +作者:[Prakash Subramanian][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.2daygeek.com/author/prakash/ +[1]: https://www.2daygeek.com/how-to-check-find-the-process-id-pid-ppid-of-a-running-program-in-linux/ +[2]: https://www.2daygeek.com/kill-terminate-a-process-in-linux-using-kill-pkill-killall-command/ +[3]: https://www.2daygeek.com/chkservice-a-tool-for-managing-systemd-units-from-linux-terminal/ +[4]: https://www.2daygeek.com/how-to-check-all-running-services-in-linux/ From 56e04296329b5b4357b9380e1584edc0adbf91a1 Mon Sep 17 00:00:00 2001 From: HankChow <280630620@qq.com> Date: Wed, 26 Sep 2018 15:26:12 +0800 Subject: [PATCH 14/39] hankchow translating --- ...ke The Output Of Ping Command Prettier And Easier To Read.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sources/tech/20180924 Make The Output Of Ping Command Prettier And Easier To Read.md b/sources/tech/20180924 Make The Output Of Ping Command Prettier And Easier To Read.md index 39ca57bc43..7ef713eae4 100644 --- a/sources/tech/20180924 Make The Output Of Ping Command Prettier And Easier To Read.md +++ b/sources/tech/20180924 Make The Output Of Ping Command Prettier And Easier To Read.md @@ -1,3 +1,5 @@ +HankChow translating + Make The Output Of Ping Command Prettier And Easier To Read ====== From 757a39980406948b0b921d0398489c9b71f88c42 Mon Sep 17 00:00:00 2001 From: belitex Date: Wed, 26 Sep 2018 17:04:20 +0800 Subject: [PATCH 15/39] =?UTF-8?q?=E7=BF=BB=E8=AF=91=E5=AE=8C=E6=88=90:=208?= =?UTF-8?q?=20Python=20packages=20that=20will=20simplify=20your=20life=20w?= =?UTF-8?q?ith=20Django?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...hat will simplify your life with Django.md | 124 ------------------ ...hat will simplify your life with Django.md | 121 +++++++++++++++++ 2 files changed, 121 insertions(+), 124 deletions(-) delete mode 100644 sources/tech/20180920 8 Python packages that will simplify your life with Django.md create mode 100644 translated/tech/20180920 8 Python packages that will simplify your life with Django.md diff --git a/sources/tech/20180920 8 Python packages that will simplify your life with Django.md b/sources/tech/20180920 8 Python packages that will simplify your life with Django.md deleted file mode 100644 index e341a8b0a6..0000000000 --- a/sources/tech/20180920 8 Python packages that will simplify your life with Django.md +++ /dev/null @@ -1,124 +0,0 @@ -belitex 翻译中 -8 Python packages that will simplify your life with Django -====== - -This month's Python column looks at Django packages that will benefit your work, personal, or side projects. - -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/water-stone-balance-eight-8.png?itok=1aht_V5V) - -Django developers, we're devoting this month's Python column to packages that will help you. These are our favorite [Django][1] libraries for saving time, cutting down on boilerplate code, and generally simplifying our lives. We've got six packages for Django apps and two for Django's REST Framework, and we're not kidding when we say these packages show up in almost every project we work on. - -But first, see our tips for making the [Django Admin more secure][2] and an article on 5 favorite [open source Django packages][3]. - -### A kitchen sink of useful time-savers: django-extensions - -[Django-extensions][4] is a favorite Django package chock full of helpful tools like these management commands: - - * **shell_plus** starts the Django shell with all your database models already loaded. No more importing from several different apps to test one complex relationship! - * **clean_pyc** removes all .pyc projects from everywhere inside your project directory. - * **create_template_tags** creates a template tag directory structure inside the app you specify. - * **describe_form** displays a form definition for a model, which you can then copy/paste into forms.py. (Note that this produces a regular Django form, not a ModelForm.) - * **notes** displays all comments with stuff like TODO, FIXME, etc. throughout your project. - - - * **TimeStampedModel** : This base class includes the fields **created** and **modified** and a **save()** method that automatically updates these fields appropriately. - * **ActivatorModel** : If your model will need fields like **status** , **activate_date** , and **deactivate_date** , use this base class. It comes with a manager that enables **.active()** and **.inactive()** querysets. - * **TitleDescriptionModel** and **TitleSlugDescriptionModel** : These include the **title** and **description** fields, and the latter also includes a **slug** field. The **slug** field will automatically populate based on the **title** field. - - - -Django-extensions also includes useful abstract base classes to use for common patterns in your own models. Inherit from these base classes when you create your models to get their: - -Django-extensions has more features you may find useful in your projects, so take a tour through its [docs][5]! - -### 12-factor-app settings: django-environ - -[Django-environ][6] allows you to use [12-factor app][7] methodology to manage your settings in your Django project. It collects other libraries, including [envparse][8] and [honcho][9]. Once you install django-environ, create an .env file at your project's root. Define in that module any settings variables that may change between environments or should remain secret (like API keys, debug status, and database URLs). - -Then, in your project's settings.py file, import **environ** and set up variables for **environ.PATH()** and **environ.Env()** according to the [example][10]. Access settings variables defined in your .env file with **env('VARIABLE_NAME')**. - -### Creating great management commands: django-click - -[Django-click][11], based on [Click][12] (which we have recommended [before][13]… [twice][14]), helps you write Django management commands. This library doesn't have extensive documentation, but it does have a directory of [test commands][15] in its repository that are pretty useful. A basic Hello World command would look like this: - -``` -# app_name.management.commands.hello.py -import djclick as click - -@click.command() -@click.argument('name') -def command(name): -    click.secho(f'Hello, {name}') -``` - -Then in the command line, run: - -``` ->> ./manage.py hello Lacey -Hello, Lacey -``` - -### Handling finite state machines: django-fsm - -[Django-fsm][16] adds support for finite state machines to your Django models. If you run a news website and need articles to process through states like Writing, Editing, and Published, django-fsm can help you define those states and manage the rules and restrictions around moving from one state to another. - -Django-fsm provides an FSMField to use for the model attribute that defines the model instance's state. Then you can use django-fsm's **@transition** decorator to define methods that move the model instance from one state to another and handle any side effects from that transition. - -Although django-fsm is light on documentation, [Workflows (States) in Django][17] is a gist that serves as an excellent introduction to both finite state machines and django-fsm. - -### Contact forms: #django-contact-form - -A contact form is such a standard thing on a website. But don't write all that boilerplate code yourself—set yours up in minutes with [django-contact-form][18]. It comes with an optional spam-filtering contact form class (and a regular, non-filtering class) and a **ContactFormView** base class with methods you can override or customize, and it walks you through the templates you will need to create to make your form work. - -### Registering and authenticating users: django-allauth - -[Django-allauth][19] is an app that provides views, forms, and URLs for registering users, logging them in and out, resetting their passwords, and authenticating users with outside sites like GitHub or Twitter. It supports email-as-username authentication and is extensively documented. It can be a little confusing to set up the first time you use it; follow the [installation instructions][20] carefully and read closely when you [customize your settings][21] to make sure you're using all the settings you need to enable a specific feature. - -### Handling user authentication with Django REST Framework: django-rest-auth - -If your Django development includes writing APIs, you're probably using [Django REST Framework][22] (DRF). If you're using DRF, you should check out [django-rest-auth][23], a package that enables endpoints for user registration, login/logout, password reset, and social media authentication (by adding django-allauth, which works well with django-rest-auth). - -### Visualizing a Django REST Framework API: django-rest-swagger - -[Django REST Swagger][24] provides a feature-rich user interface for interacting with your Django REST Framework API. Once you've installed Django REST Swagger and added it to installed apps, add the Swagger view and URL pattern to your urls.py file; the rest is taken care of in the docstrings of your APIs. - -![](https://opensource.com/sites/default/files/uploads/swagger-ui.png) - -The UI for your API will include all your endpoints and available methods broken out by app. It will also list available operations for those endpoints and enable you to interact with the API (adding/deleting/fetching records, for example). It uses the docstrings in your API views to generate documentation for each endpoint, creating a set of API documentation for your project that's useful to you, your frontend developers, and your users. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/9/django-packages - -作者:[Jeff Triplett][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://opensource.com/users/laceynwilliams -[1]: https://www.djangoproject.com/ -[2]: https://opensource.com/article/18/1/10-tips-making-django-admin-more-secure -[3]: https://opensource.com/business/15/12/5-favorite-open-source-django-packages -[4]: https://django-extensions.readthedocs.io/en/latest/ -[5]: https://django-extensions.readthedocs.io/ -[6]: https://django-environ.readthedocs.io/en/latest/ -[7]: https://www.12factor.net/ -[8]: https://github.com/rconradharris/envparse -[9]: https://github.com/nickstenning/honcho -[10]: https://django-environ.readthedocs.io/ -[11]: https://github.com/GaretJax/django-click -[12]: http://click.pocoo.org/5/ -[13]: https://opensource.com/article/18/9/python-libraries-side-projects -[14]: https://opensource.com/article/18/5/3-python-command-line-tools -[15]: https://github.com/GaretJax/django-click/tree/master/djclick/test/testprj/testapp/management/commands -[16]: https://github.com/viewflow/django-fsm -[17]: https://gist.github.com/Nagyman/9502133 -[18]: https://django-contact-form.readthedocs.io/en/1.5/ -[19]: https://django-allauth.readthedocs.io/en/latest/ -[20]: https://django-allauth.readthedocs.io/en/latest/installation.html -[21]: https://django-allauth.readthedocs.io/en/latest/configuration.html -[22]: http://www.django-rest-framework.org/ -[23]: https://django-rest-auth.readthedocs.io/ -[24]: https://django-rest-swagger.readthedocs.io/en/latest/ diff --git a/translated/tech/20180920 8 Python packages that will simplify your life with Django.md b/translated/tech/20180920 8 Python packages that will simplify your life with Django.md new file mode 100644 index 0000000000..f242007433 --- /dev/null +++ b/translated/tech/20180920 8 Python packages that will simplify your life with Django.md @@ -0,0 +1,121 @@ +简化 Django 开发的八个 Python 包 +====== + +这个月的 Python 专栏将介绍一些 Django 包,它们有益于你的工作,以及你的个人或业余项目。 + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/water-stone-balance-eight-8.png?itok=1aht_V5V) + +Django 开发者们,在这个月的 Python 专栏中,我们会介绍一些能帮助你们的软件包。这些软件包是我们最喜欢的 [Django][1] 库,能够节省开发时间,减少样板代码,通常来说,这会让我们的生活更加轻松。我们为 Django 应用准备了六个包,为 Django 的 REST 框架准备了两个包。几乎所有我们的项目里,都用到了这些包,真的,不是说笑。 + +不过在继续阅读之前,请先看看我们关于[让 Django 管理后台更安全][2]的几个提示,以及这篇关于 [5 个最受欢迎的开源 Django 包][3] 的文章。 + +### 有用又省时的工具集合:django-extensions + +[Django-extensions][4] 这个 Django 包非常受欢迎,全是有用的工具,比如下面这些管理命令: + + * **shell_plus** 打开 Django 的管理 shell,这个 shell 已经自动导入了所有的数据库模型。在测试复杂的数据关系时,就不需要再从几个不同的应用里做 import 的操作了。 + * **clean_pyc** 删除项目目录下所有位置的 .pyc 文件 + * **create_template_tags** 在指定的应用下,创建模板标签的目录结构。 + * **describe_form** 输出模型的表单定义,可以粘贴到 forms.py 文件中。(需要注意的是,这种方法创建的是普通 Django 表单,而不是模型表单。) + * **notes** 输出你项目里所有带 TODO,FIXME 等标记的注释。 + +Django-extensions 还包括几个有用的抽象基类,在定义模型时,它们能满足常见的模式。当你需要以下模型时,可以继承这些基类: + + + * **TimeStampedModel** : 这个模型的基类包含了 **created** 字段和 **modified** 字段,还有一个 **save()** 方法,在适当的场景下,该方法自动更新 created 和 modified 字段的值。 + * **ActivatorModel** : 如果你的模型需要像 **status**,**activate_date** 和 **deactivate_date** 这样的字段,可以使用这个基类。它还自带了一个启用 **.active()** 和 **.inactive()** 查询集的 manager。 + * **TitleDescriptionModel** 和 **TitleSlugDescriptionModel** : 这两个模型包括了 **title** 和 **description** 字段,其中 description 字段还包括 **slug**,它根据 **title** 字段自动产生。 + +Django-extensions 还有其他更多的功能,也许对你的项目有帮助,所以,去浏览一下它的[文档][5]吧! + +### 12 因子应用的配置:django-environ + +在 Django 项目的配置方面,[Django-environ][6] 提供了符合 [12 因子应用][7] 方法论的管理方法。它是其他一些库的集合,包括 [envparse][8] 和 [honcho][9] 等。安装了 django-environ 之后,在项目的根目录创建一个 .env 文件,用这个文件去定义那些随环境不同而不同的变量,或者需要保密的变量。(比如 API keys,是否启用 debug,数据库的 URLs 等) + +然后,在项目的 settings.py 中引入 **environ**,并参考[官方文档的例子][10]设置好 **environ.PATH()** 和 **environ.Env()**。就可以通过 **env('VARIABLE_NAME')** 来获取 .env 文件中定义的变量值了。 + +### 创建出色的管理命令:django-click + +[Django-click][11] 是基于 [Click][12] 的, ( 我们[之前推荐过][13]… [两次][14] Click),它对编写 Django 管理命令很有帮助。这个库没有很多文档,但是代码仓库中有个存放[测试命令][15]的目录,非常有参考价值。 Django-click 基本的 Hello World 命令是这样写的: + +``` +# app_name.management.commands.hello.py +import djclick as click + +@click.command() +@click.argument('name') +def command(name): + click.secho(f'Hello, {name}') +``` + +在命令行下调用它,这样执行即可: + +``` +>> ./manage.py hello Lacey +Hello, Lacey +``` + +### 处理有限状态机:django-fsm + +[Django-fsm][16] 给 Django 的模型添加了有限状态机的支持。如果你管理一个新闻网站,想用类似于“写作中”,“编辑中”,“已发布”来流转文章的状态,django-fsm 能帮你定义这些状态,还能管理状态变化的规则与限制。 + +Django-fsm 为模型提供了 FSMField 字段,用来定义模型实例的状态。用 django-fsm 的 **@transition** 修饰符,可以定义状态变化的方法,并处理状态变化的任何副作用。 + +虽然 django-fsm 文档很轻量,不过 [Django 中的工作流(状态)][17] 这篇 GitHubGist 对有限状态机和 django-fsm 做了非常好的介绍。 + +### 联系人表单:#django-contact-form + +联系人表单可以说是网站的标配。但是不要自己去写全部的样板代码,用 [django-contact-form][18] 在几分钟内就可以搞定。它带有一个可选的能过滤垃圾邮件的表单类(也有不过滤的普通表单类)和一个 **ContactFormView** 基类,基类的方法可以覆盖或自定义修改。而且它还能引导你完成模板的创建,好让表单正常工作。 + +### 用户注册和认证:django-allauth + +[Django-allauth][19] 是一个 Django 应用,它为用户注册,登录注销,密码重置,还有第三方用户认证(比如 GitHub 或 Twitter)提供了视图,表单和 URLs,支持邮件地址作为用户名的认证方式,而且有大量的文档记录。第一次用的时候,它的配置可能会让人有点晕头转向;请仔细阅读[安装说明][20],在[自定义你的配置][21]时要专注,确保启用某个功能的所有配置都用对了。 + +### 处理 Django REST 框架的用户认证:django-rest-auth + +如果 Django 开发中涉及到对外提供 API,你很可能用到了 [Django REST Framework][22] (DRF)。如果你在用 DRF,那么你应该试试 django-rest-auth,它提供了用户注册,登录/注销,密码重置和社交媒体认证的 endpoints (是通过添加 django-allauth 的支持来实现的,这两个包协作得很好)。 + +### Django REST 框架的 API 可视化:django-rest-swagger + +[Django REST Swagger][24] 提供了一个功能丰富的用户界面,用来和 Django REST 框架的 API 交互。你只需要安装 Django REST Swagger,把它添加到 Django 项目的 installed apps 中,然后在 urls.py 中添加 Swagger 的视图和 URL 模式就可以了,剩下的事情交给 API 的 docstring 处理。 + +![](https://opensource.com/sites/default/files/uploads/swagger-ui.png) + +API 的用户界面按照 app 的维度展示了所有 endpoints 和可用方法,并列出了这些 endpoints 的可用操作,而且它提供了和 API 交互的功能(比如添加/删除/获取记录)。django-rest-swagger 从 API 视图中的 docstrings 生成每个 endpoint 的文档,通过这种方法,为你的项目创建了一份 API 文档,这对你,对前端开发人员和用户都很有用。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/9/django-packages + +作者:[Jeff Triplett][a] +选题:[lujun9972](https://github.com/lujun9972) +译者:[belitex](https://github.com/belitex) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://opensource.com/users/laceynwilliams +[1]: https://www.djangoproject.com/ +[2]: https://opensource.com/article/18/1/10-tips-making-django-admin-more-secure +[3]: https://opensource.com/business/15/12/5-favorite-open-source-django-packages +[4]: https://django-extensions.readthedocs.io/en/latest/ +[5]: https://django-extensions.readthedocs.io/ +[6]: https://django-environ.readthedocs.io/en/latest/ +[7]: https://www.12factor.net/ +[8]: https://github.com/rconradharris/envparse +[9]: https://github.com/nickstenning/honcho +[10]: https://django-environ.readthedocs.io/ +[11]: https://github.com/GaretJax/django-click +[12]: http://click.pocoo.org/5/ +[13]: https://opensource.com/article/18/9/python-libraries-side-projects +[14]: https://opensource.com/article/18/5/3-python-command-line-tools +[15]: https://github.com/GaretJax/django-click/tree/master/djclick/test/testprj/testapp/management/commands +[16]: https://github.com/viewflow/django-fsm +[17]: https://gist.github.com/Nagyman/9502133 +[18]: https://django-contact-form.readthedocs.io/en/1.5/ +[19]: https://django-allauth.readthedocs.io/en/latest/ +[20]: https://django-allauth.readthedocs.io/en/latest/installation.html +[21]: https://django-allauth.readthedocs.io/en/latest/configuration.html +[22]: http://www.django-rest-framework.org/ +[23]: https://django-rest-auth.readthedocs.io/ +[24]: https://django-rest-swagger.readthedocs.io/en/latest/ \ No newline at end of file From 50f53143e42ac21f9d481b03c218bbc076c656f1 Mon Sep 17 00:00:00 2001 From: qhwdw Date: Wed, 26 Sep 2018 21:45:48 +0800 Subject: [PATCH 16/39] Translated by qhwdw --- ...Educational Software and Games for Kids.md | 82 ------------------- ...Educational Software and Games for Kids.md | 80 ++++++++++++++++++ 2 files changed, 80 insertions(+), 82 deletions(-) delete mode 100644 sources/tech/20180813 5 of the Best Linux Educational Software and Games for Kids.md create mode 100644 translated/tech/20180813 5 of the Best Linux Educational Software and Games for Kids.md diff --git a/sources/tech/20180813 5 of the Best Linux Educational Software and Games for Kids.md b/sources/tech/20180813 5 of the Best Linux Educational Software and Games for Kids.md deleted file mode 100644 index 66850b2260..0000000000 --- a/sources/tech/20180813 5 of the Best Linux Educational Software and Games for Kids.md +++ /dev/null @@ -1,82 +0,0 @@ -Translating by qhwdw -5 of the Best Linux Educational Software and Games for Kids -====== - -![](https://www.maketecheasier.com/assets/uploads/2018/07/Linux-educational-programs-for-kids-featured.jpg) - -Linux is a very powerful operating system, and that explains why it powers most of the servers on the Internet. Though it may not be the best OS in terms of user friendliness, its diversity is commendable. Everyone has their own need for Linux. Be it for coding, educational purposes or the internet of things (IoT), you’ll always find a suitable Linux distro for every use. To that end, many have dubbed Linux as the OS for future computing. - -Because the future belongs to the kids of today, introducing them to Linux is the best way to prepare them for what the future holds. This OS may not have a reputation for popular games such as FIFA or PES; however, it offers the best educational software and games for kids. These are five of the best Linux educational software to keep your kids ahead of the game. - -**Related** : [The Beginner’s Guide to Using a Linux Distro][1] - -### 1. GCompris - -If you’re looking for the best educational software for kids, [GCompris][2] should be your starting point. This software is specifically designed for kids education and is ideal for kids between two and ten years old. As the pinnacle of all Linux educational software suites for children, GCompris offers about 100 activities for kids. It packs everything you want for your kids from reading practice to science, geography, drawing, algebra, quizzes, and more. - -![Linux educational software and games][3] - -GCompris even has activities for helping your kids learn computer peripherals. If your kids are young and you want them to learn alphabets, colors, and shapes, GCompris has programmes for those, too. What’s more, it also comes with helpful games for kids such as chess, tic-tac-toe, memory, and hangman. GCompris is not a Linux-only app. It’s also available for Windows and Android. - -### 2. TuxMath - -Most students consider math a tough subject. You can change that perception by acquainting your kids with mathematical skills through Linux software applications such as [TuxMath][4]. TuxMath is a top-rated educational Math tutorial game for kids. In this game your role is to help Tux the penguin of Linux protect his planet from a rain of mathematical problems. - -![linux-educational-software-tuxmath-1][5] - -By finding the answer, you help Tux save the planet by destroying the asteroids with your laser before they make an impact. The difficulty of the math problems increases with each level you pass. This game is ideal for kids, as it can help them rack their brains for solutions. Besides making them good at math, it also helps them improve their mental agility. - -### 3. Sugar on a Stick - -[Sugar on a Stick][6] is a dedicated learning program for kids – a brand new pedagogy that has gained a lot of traction. This program provides your kids with a fully-fledged learning platform where they can gain skills in creating, exploring, discovering and also reflecting on ideas. Just like GCompris, Sugar on a Stick comes with a host of learning resources for kids, including games and puzzles. - -![linux-educational-software-sugar-on-a-stick][7] - -The best thing about Sugar on a Stick is that you can set it up on a USB Drive. All you need is an X86-based PC, then plug in the USB, and boot the distro from it. Sugar on a Stick is a project by Sugar Labs – a non-profit organization that is run by volunteers. - -### 4. KDE Edu Suite - -[KDE Edu Suite][8] is a package of software for different user purposes. With a host of applications from different fields, the KDE community has proven that it isn’t just serious about empowering adults; it also cares about bringing the young generation to speed with everything surrounding them. It comes packed with various applications for kids ranging from science to math, geography, and more. - -![linux-educational-software-kde-1][9] - -The KDE Suite can be used for adult needs based on necessities, as a school teaching software, or as a kid’s leaning app. It offers a huge software package and is free to download. The KDE Edu suite can be installed on most GNU/Linux Distros. - -### 5. Tux Paint - -![linux-educational-software-tux-paint-2][10] - -[Tux Paint][11] is another great Linux educational software for kids. This award-winning drawing program is used in schools around the world to help children nurture the art of drawing. It comes with a clean, easy-to-use interface and fun sound effects that help children use the program. There is also an encouraging cartoon mascot that guides kids as they use the program. Tux Paint comes with a variety of drawing tools that help kids unleash their creativity. - -### Summing Up - -Due to the popularity of these educational software for kids, many institutions have embraced these programs as teaching aids in schools and kindergartens. A typical example is [Edubuntu][12], an Ubuntu-derived distro that is widely used by teachers and parents for educating kids. - -Tux Paint is another great example that has grown in popularity over the years and is being used in schools to teach children how to draw. This list is by no means exhaustive. There are hundreds of other Linux educational software and games that can be very useful for your kids. - -If you know of any other great Linux educational software and games for kids, share with us in the comments section below. - --------------------------------------------------------------------------------- - -via: https://www.maketecheasier.com/5-best-linux-software-packages-for-kids/ - -作者:[Kenneth Kimari][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.maketecheasier.com/author/kennkimari/ -[1]:https://www.maketecheasier.com/beginner-guide-to-using-linux-distro/ (The Beginner’s Guide to Using a Linux Distro) -[2]:http://www.gcompris.net/downloads-en.html -[3]:https://www.maketecheasier.com/assets/uploads/2018/07/Linux-educational-software-gcompris.jpg (Linux educational software and games) -[4]:https://tuxmath.en.uptodown.com/ubuntu -[5]:https://www.maketecheasier.com/assets/uploads/2018/07/Linux-educational-software-tuxmath-1.jpg (linux-educational-software-tuxmath-1) -[6]:http://wiki.sugarlabs.org/go/Sugar_on_a_Stick/Downloads -[7]:https://www.maketecheasier.com/assets/uploads/2018/07/Linux-educational-software-sugar-on-a-stick.png (linux-educational-software-sugar-on-a-stick) -[8]:https://edu.kde.org/ -[9]:https://www.maketecheasier.com/assets/uploads/2018/07/Linux-educational-software-kde-1.jpg (linux-educational-software-kde-1) -[10]:https://www.maketecheasier.com/assets/uploads/2018/07/Linux-educational-software-tux-paint-2.jpg (linux-educational-software-tux-paint-2) -[11]:http://www.tuxpaint.org/ -[12]:http://edubuntu.org/ diff --git a/translated/tech/20180813 5 of the Best Linux Educational Software and Games for Kids.md b/translated/tech/20180813 5 of the Best Linux Educational Software and Games for Kids.md new file mode 100644 index 0000000000..3a1981f0bc --- /dev/null +++ b/translated/tech/20180813 5 of the Best Linux Educational Software and Games for Kids.md @@ -0,0 +1,80 @@ +# 5 个给孩子的非常好的 Linux 教育软件和游戏 + +![](https://www.maketecheasier.com/assets/uploads/2018/07/Linux-educational-programs-for-kids-featured.jpg) + +Linux 是一个非常强大的操作系统,因此因特网上的大多数服务器都使用它。尽管它算不上是对用户友好的最佳操作系统,但它的多元化还是值的称赞的。对于 Linux 来说,每个人都能在它上面找到他们自己的所需。不论你是用它来写代码、还是用于教学或物联网(IoT),你总能找到一个适合你用的 Linux 发行版。为此,许多人认为 Linux 是未来计算的最佳操作系统。 + +未来是属于孩子们的,让孩子们了解 Linux 是他们掌控未来的最佳方式。这个操作系统上或许并没有一些像 FIFA 或 PES 那样的声名赫赫的游戏;但是,它为孩子们提供了一些非常好的教育软件和游戏。这里有五款最好的 Linux 教育软件,可以让你的孩子远离游戏。 + +**相关阅读**:[使用一个 Linux 发行版的新手指南][1] + +### 1. GCompris + +如果你正在为你的孩子寻找一款最佳的教育软件,[GCompris][2] 将是你的最好的开端。这款软件专门为 2 到 10 岁的孩子所设计。作为所有的 Linux 教育软件套装的巅峰之作,GCompris 为孩子们提供了大约 100 项活动。它囊括了你期望你的孩子学习的所有内容,从阅读材料到科学、地理、绘画、代数、测验、等等。 + +![Linux educational software and games][3] + +GCompris 甚至有一项活动可以帮你的孩子学习计算机的相关知识。如果你的孩子还很小,你希望他去学习字母、颜色、和形状,GCompris 也有这方面的相关内容。更重要的是,它也为孩子们准备了一些益智类游戏,比如国际象棋、井字棋、好记性、以及猜词游戏。GCompris 并不是一个仅在 Linux 上可运行的游戏。它也可以运行在 Windows 和 Android 上。 + +### 2. TuxMath + +很多学生认为数学是们非常难的课程。你可以通过 Linux 教育软件如 [TuxMath][4] 来让你的孩子了解数学技能,从而来改变这种看法。TuxMath 是为孩子开发的顶级的数学教育辅助游戏。在这个游戏中,你的角色是在如雨点般下降的数学问题中帮助 Linux 企鹅 Tux 来保护它的星球。 + +![linux-educational-software-tuxmath-1][5] + +在它们落下来毁坏 Tux 的星球之前,找到问题的答案,就可以使用你的激光去帮助 Tux 拯救它的星球。数字问题的难度每过一关就会提升一点。这个游戏非常适合孩子,因为它可以让孩子们去开动脑筋解决问题。而且还有助他们学好数学,以及帮助他们开发智力。 + +### 3. Sugar on a Stick + +[Sugar on a Stick][6] 是献给孩子们的学习程序 —— 一个广受好评的全新教学法。这个程序为你的孩子提供一个成熟的教学平台,在那里,他们可以收获创造、探索、发现和思考方面的技能。和 GCompris 一样,Sugar on a Stick 为孩子们带来了包括游戏和谜题在内的大量学习资源。 + +![linux-educational-software-sugar-on-a-stick][7] + +关于 Sugar on a Stick 最大的一个好处是你可以将它配置在一个 U 盘上。你只要有一台 X86 的 PC,插入那个 U 盘,然后就可以从 U 盘引导这个发行版。Sugar on a Stick 是由 Sugar 实验室提供的一个项目 —— 这个实验室是一个由志愿者运作的非盈利组织。 + +### 4. KDE Edu Suite + +[KDE Edu Suite][8] 是一个用途与众不同的软件包。带来了大量不同领域的应用程序,KDE 社区已经证实,它不仅是一系列成年人授权的问题;它还关心年青一代如何适应他们周围的一切。它囊括了一系列孩子们使用的应用程序,从科学到数学、地理等等。 + +![linux-educational-software-kde-1][9] + +KDE Edu 套件根据长大后所必需的知识为基础,既能够用作学校的教学软件,也能够作为孩子们的学习 APP。它提供了大量的可免费下载的软件包。KDE Edu 套件在主流的 GNU/Linux 发行版都能安装。 + +### 5. Tux Paint + +![linux-educational-software-tux-paint-2][10] + +[Tux Paint][11] 是给孩子们的另一个非常好的 Linux 教育软件。这个屡获殊荣的绘画软件在世界各地被用于帮助培养孩子们的绘画技能,它有一个简洁的、易于使用的界面和有趣的音效,可以高效地帮助孩子去使用这个程序。它也有一个卡通吉祥物去鼓励孩子们使用这个程序。Tux Paint 中有许多绘画工具,它们可以帮助孩子们放飞他们的创意。 + +### 总结 + +由于这些教育软件深受孩子们的欢迎,许多学校和幼儿园都使用这些程序进行辅助教学。典型的一个例子就是 [Edubuntu][12],它是儿童教育领域中广受老师和家长们欢迎的一个基于 Ubuntu 的发行版。 + +Tux Paint 是另一个非常好的例子,它在这些年越来越流行,它大量地用于学校中教孩子们如何绘画。以上的这个清单并不很详细。还有成百上千的对孩子有益的其它 Linux 教育软件和游戏。 + +如果你还知道给孩子们的其它非常好的 Linux 教育软件和游戏,在下面的评论区分享给我们吧。 + +------ + +via: https://www.maketecheasier.com/5-best-linux-software-packages-for-kids/ + +作者:[Kenneth Kimari][a] +选题:[lujun9972](https://github.com/lujun9972) +译者:[qhwdw](https://github.com/qhwdw) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.maketecheasier.com/author/kennkimari/ +[1]: https://www.maketecheasier.com/beginner-guide-to-using-linux-distro/ "The Beginner’s Guide to Using a Linux Distro" +[2]: http://www.gcompris.net/downloads-en.html +[3]: https://www.maketecheasier.com/assets/uploads/2018/07/Linux-educational-software-gcompris.jpg "Linux educational software and games" +[4]: https://tuxmath.en.uptodown.com/ubuntu +[5]: https://www.maketecheasier.com/assets/uploads/2018/07/Linux-educational-software-tuxmath-1.jpg "linux-educational-software-tuxmath-1" +[6]: http://wiki.sugarlabs.org/go/Sugar_on_a_Stick/Downloads +[7]: https://www.maketecheasier.com/assets/uploads/2018/07/Linux-educational-software-sugar-on-a-stick.png "linux-educational-software-sugar-on-a-stick" +[8]: https://edu.kde.org/ +[9]: https://www.maketecheasier.com/assets/uploads/2018/07/Linux-educational-software-kde-1.jpg "linux-educational-software-kde-1" +[10]: https://www.maketecheasier.com/assets/uploads/2018/07/Linux-educational-software-tux-paint-2.jpg "linux-educational-software-tux-paint-2" +[11]: http://www.tuxpaint.org/ +[12]: http://edubuntu.org/ \ No newline at end of file From 249d0c33d4d4ac1b33db6bb8818988ad9016c4fd Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 26 Sep 2018 23:23:39 +0800 Subject: [PATCH 17/39] PRF:20180910 3 open source log aggregation tools.md @heguangzhi --- ...910 3 open source log aggregation tools.md | 76 +++++++++---------- 1 file changed, 34 insertions(+), 42 deletions(-) diff --git a/translated/tech/20180910 3 open source log aggregation tools.md b/translated/tech/20180910 3 open source log aggregation tools.md index a026b47625..0bad973eba 100644 --- a/translated/tech/20180910 3 open source log aggregation tools.md +++ b/translated/tech/20180910 3 open source log aggregation tools.md @@ -1,83 +1,75 @@ - - - -3个开源日志聚合工具 +3 个开源日志聚合工具 ====== -日志聚合系统可以帮助我们故障排除并进行其他的任务。以下是三个主要工具介绍。 +> 日志聚合系统可以帮助我们进行故障排除和其它任务。以下是三个主要工具介绍。 ![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/data_metrics_analytics_desktop_laptop.png?itok=9QXd7AUr) - - -指标聚合与日志聚合有何不同?日志不能包括指标吗?日志聚合系统不能做与指标聚合系统相同的事情吗? +指标聚合metrics aggregation日志聚合log aggregation有何不同?日志不能包括指标吗?日志聚合系统不能做与指标聚合系统相同的事情吗? 这些是我经常听到的问题。我还看到供应商推销他们的日志聚合系统作为所有可观察问题的解决方案。日志聚合是一个有价值的工具,但它通常对时间序列数据的支持不够好。 -时间序列指标聚合系统中几个有价值的功能为规则间隔与专门为时间序列数据定制的存储系统。规则间隔允许用户一次性地导出真实的数据结果。如果要求日志聚合系统定期收集指标数据,它也可以。但是,它的存储系统没有针对指标聚合系统中典型的查询类型进行优化。使用日志聚合工具中的存储系统处理这些查询将花费更多的资源和时间。 +时间序列的指标聚合系统中几个有价值的功能是专门为时间序列数据定制的固定间隔regular interval和存储系统。固定间隔允许用户不断地收集实时的数据结果。如果要求日志聚合系统以固定间隔收集指标数据,它也可以。但是,它的存储系统没有针对指标聚合系统中典型的查询类型进行优化。使用日志聚合工具中的存储系统处理这些查询将花费更多的资源和时间。 -所以,我们知道日志聚合系统可能不适合时间序列数据,但是它有什么好处呢?日志聚合系统是收集事件数据的好地方。这些是非常重要的不规则活动。最好的例子为 web 服务的访问日志。这些都很重要,因为我们想知道什么东西正在访问我们的系统,什么时候访问。另一个例子是应用程序错误记录——因为它不是正常的操作记录,所以在故障排除过程中可能很有价值的。 +所以,我们知道日志聚合系统可能不适合时间序列数据,但是它有什么好处呢?日志聚合系统是收集事件数据的好地方。这些无规律的活动是非常重要的。最好的例子为 web 服务的访问日志,这些很重要,因为我们想知道什么正在访问我们的系统,什么时候访问的。另一个例子是应用程序错误记录 —— 因为它不是正常的操作记录,所以在故障排除过程中可能很有价值的。 -日志记录的一些规则: - - * 包含时间戳 - * 包含 JSON 格式 - * 不记录无关紧要的事件 - * 记录所有应用程序的错误 - * 记录警告错误 - * 日志记录开关 - * 以可读的形式记录信息 - * 不在生产环境中记录信息 - * 不记录任何无法阅读或无反馈的内容 +日志记录的一些规则: + * **须**包含时间戳 + * **须**格式化为 JSON + * **不**记录无关紧要的事件 + * **须**记录所有应用程序的错误 + * **可**记录警告错误 + * **可**开关的日志记录 + * **须**以可读的形式记录信息 + * **不**在生产环境中记录信息 + * **不**记录任何无法阅读或反馈的内容 ### 云的成本 -当研究日志聚合工具时,云可能看起来是一个有吸引力的选择。然而,这可能会带来巨大的成本。当跨数百或数千台主机和应用程序聚合时,日志数据是大量的。在基于云的系统中,数据的接收、存储和检索是昂贵的。 +当研究日志聚合工具时,云服务可能看起来是一个有吸引力的选择。然而,这可能会带来巨大的成本。当跨数百或数千台主机和应用程序聚合时,日志数据是大量的。在基于云的系统中,数据的接收、存储和检索是昂贵的。 -作为一个真实的系统,大约500个节点和几百个应用程序的集合每天产生 200GB 的日志数据。这个系统可能还有改进的空间,但是在许多 SaaS 产品中,即使将它减少一半,每月也要花费将近10,000美元。这通常包括仅保留30天,如果你想查看一年一年的趋势数据,就不可能了。 - -并不是要不使用这些系统,尤其是对于较小的组织它们可能非常有价值的。目的是指出可能会有很大的成本,当这些成本达到时,就可能令人非常的沮丧。本文的其余部分将集中讨论自托管的开源和商业解决方案。 +以一个真实的系统来参考,大约 500 个节点和几百个应用程序的集合每天产生 200GB 的日志数据。这个系统可能还有改进的空间,但是在许多 SaaS 产品中,即使将它减少一半,每月也要花费将近 10000 美元。而这通常仅保留 30 天,如果你想查看一年一年的趋势数据,就不可能了。 +并不是要不使用这些基于云的系统,尤其是对于较小的组织它们可能非常有价值的。这里的目的是指出可能会有很大的成本,当这些成本很高时,就可能令人非常的沮丧。本文的其余部分将集中讨论自托管的开源和商业解决方案。 ### 工具选择 #### ELK -[ELK][1] ,简称 Elasticsearch、Logstash 和 Kibana,是最流行的开源日志聚合工具。它被Netflix、Facebook、微软、LinkedIn 和思科使用。这三个组件都是由 [Elastic][2] 开发和维护的。[Elasticsearch][3] 本质上是一个NoSQL,Lucene 搜索引擎实现的。[Logstash][4] 是一个日志管道系统,可以接收数据,转换数据,并将其加载到像 Elasticsearch 这样的应用中。[Kibana][5] 是 Elasticsearch 之上的可视化层。 +[ELK][1],即 Elasticsearch、Logstash 和 Kibana 简称,是最流行的开源日志聚合工具。它被 Netflix、Facebook、微软、LinkedIn 和思科使用。这三个组件都是由 [Elastic][2] 开发和维护的。[Elasticsearch][3] 本质上是一个 NoSQL 数据库,以 Lucene 搜索引擎实现的。[Logstash][4] 是一个日志管道系统,可以接收数据,转换数据,并将其加载到像 Elasticsearch 这样的应用中。[Kibana][5] 是 Elasticsearch 之上的可视化层。 -几年前,Beats 被引入。Beats 是数据采集器。它们简化了将数据运送到日志存储的过程。用户不需要了解每种日志的正确语法,而是可以安装一个 Beats 来正确导出 NGINX 日志或代理日志,以便在Elasticsearch 中有效地使用它们。 +几年前,引入了 Beats 。Beats 是数据采集器。它们简化了将数据运送到 Logstash 的过程。用户不需要了解每种日志的正确语法,而是可以安装一个 Beats 来正确导出 NGINX 日志或 Envoy 代理日志,以便在 Elasticsearch 中有效地使用它们。 -安装生产环境级 ELK stack 时,可能会包括其他几个部分,如 [Kafka][6], [Redis][7], and [NGINX][8]。此外,用 Fluentd 替换 Logstash 也很常见,我们将在后面讨论。这个系统操作起来很复杂,这在早期导致很多问题和投诉。目前,这些基本上已经被修复,不过它仍然是一个复杂的系统,如果你使用少部分的功能,建议不要使用它了。 +安装生产环境级 ELK 套件时,可能会包括其他几个部分,如 [Kafka][6]、[Redis][7] 和 [NGINX][8]。此外,用 Fluentd 替换 Logstash 也很常见,我们将在后面讨论。这个系统操作起来很复杂,这在早期导致了很多问题和抱怨。目前,这些问题基本上已经被修复,不过它仍然是一个复杂的系统,如果你使用少部分的功能,建议不要使用它了。 -也就是说,服务是可用的,所以你不必担心。[Logz.io][9] 也可以使用,但是如果你有很多数据,它的标价有点高。当然,你可能没有很多数据,来使用用它。如果你买不起 Logz.io,你可以看看 [AWS Elasticsearch Service][10] (ES) 。ES 是 Amazon Web Services (AWS) 提供的一项服务,它使得 Elasticsearch 很容易快速工作。它还拥有使用 Lambda 和 S3 将所有AWS日志记录到 ES 的工具。这是一个更便宜的选择,但是需要一些管理操作,并有一些功能限制。 +也就是说,有其它可用的服务,所以你不必苦恼于此。可以使用 [Logz.io][9],但是如果你有很多数据,它的标价有点高。当然,你可能规模比较小,没有很多数据。如果你买不起 Logz.io,你可以看看 [AWS Elasticsearch Service][10] (ES) 。ES 是 Amazon Web Services (AWS) 提供的一项服务,它很容易就可以让 Elasticsearch 马上工作起来。它还拥有使用 Lambda 和 S3 将所有AWS 日志记录到 ES 的工具。这是一个更便宜的选择,但是需要一些管理操作,并有一些功能限制。 +ELK 套件的母公司 Elastic [提供][11] 一款更强大的产品,它使用开源核心open core模式,为分析工具和报告提供了额外的选项。它也可以在谷歌云平台或 AWS 上托管。由于这种工具和托管平台的组合提供了比大多数 SaaS 选项更加便宜,这也许是最好的选择,并且很有用。该系统可以有效地取代或提供 [安全信息和事件管理][12](SIEM)系统的功能。 -Elastic [offers][11] 的母公司提供一款更强大的产品,它使用开放核心模型,为分析工具和报告提供了额外的选项。它也可以在谷歌云平台或 AWS 上托管。由于这种工具和托管平台的组合提供了比大多数 SaaS 选项更加便宜,这将是最好的选择并且具有很大的价值。该系统可以有效地取代或提供[security information and event management][12] ( SIEM )系统的功能。 - -ELK 栈通过 Kibana 提供了很好的可视化工具,但是它缺少警报功能。Elastic 在付费的 X-Pack 插件中提供了提醒功能,但是在开源系统没有内置任何功能。Yelp 已经开发了一种解决这个问题的方法,[ElastAlert][13], 不过还有其他方式。这个额外的软件相当健壮,但是它增加了已经复杂的系统的复杂性。 +ELK 套件通过 Kibana 提供了很好的可视化工具,但是它缺少警报功能。Elastic 在付费的 X-Pack 插件中提供了警报功能,但是在开源系统没有内置任何功能。Yelp 已经开发了一种解决这个问题的方法,[ElastAlert][13],不过还有其他方式。这个额外的软件相当健壮,但是它增加了已经复杂的系统的复杂性。 #### Graylog -[Graylog][14] 最近越来越受欢迎,但它是在2010年 Lennart Koopmann 创建并开发的。两年后,一家公司以同样的名字诞生了。尽管它的使用者越来越多,但仍然远远落后于 ELK 栈。这也意味着它具有较少的社区开发特征,但是它可以使用与 ELK stack 相同的 Beats 。Graylog 由于 Graylog Collector Sidecar 使用 [Go][15] 编写所以在 Go 社区赢得了赞誉。 +[Graylog][14] 最近越来越受欢迎,但它是在 2010 年由 Lennart Koopmann 创建并开发的。两年后,一家公司以同样的名字诞生了。尽管它的使用者越来越多,但仍然远远落后于 ELK 套件。这也意味着它具有较少的社区开发特征,但是它可以使用与 ELK 套件相同的 Beats 。由于 Graylog Collector Sidecar 使用 [Go][15] 编写,所以 Graylog 在 Go 社区赢得了赞誉。 -Graylog 使用 Elasticsearch、[MongoDB][16] 并且 提供 Graylog Server 。这使得它像ELK 栈一样复杂,也许还要复杂一些。然而,Graylog 附带了内置于开源版本中的报警功能,以及其他一些值得注意的功能,如 streaming 、消息重写 和 地理定位。 +Graylog 使用 Elasticsearch、[MongoDB][16] 和底层的 Graylog Server 。这使得它像 ELK 套件一样复杂,也许还要复杂一些。然而,Graylog 附带了内置于开源版本中的报警功能,以及其他一些值得注意的功能,如流、消息重写和地理定位。 -streaming 能允许数据在被处理时被实时路由到特定的 Streams。使用此功能,用户可以在单个Stream 中看到所有数据库错误,在不同的 Stream 中看到 web 服务器错误。当添加新项目或超过阈值时,甚至可以基于这些 Stream 提供警报。延迟可能是日志聚合系统中最大的问题之一,Stream消除了灰色日志中的这一问题。一旦日志进入,它就可以通过 Stream 路由到其他系统,而无需全部处理。 +流功能可以允许数据在被处理时被实时路由到特定的 Stream。使用此功能,用户可以在单个 Stream 中看到所有数据库错误,在另外的 Stream 中看到 web 服务器错误。当添加新项目或超过阈值时,甚至可以基于这些 Stream 提供警报。延迟可能是日志聚合系统中最大的问题之一,Stream 消除了 Graylog 中的这一问题。一旦日志进入,它就可以通过 Stream 路由到其他系统,而无需完全处理好。 -消息重写功能使用开源规则引擎 [Drools][17] 。允许根据用户定义的规则文件评估所有传入的消息,从而可以删除消息(称为黑名单)、添加或删除字段或修改消息。 +消息重写功能使用开源规则引擎 [Drools][17] 。允许根据用户定义的规则文件评估所有传入的消息,从而可以删除消息(称为黑名单)、添加或删除字段或修改消息。 -Graylog 最酷的功能是它的地理定位功能,它支持在地图上绘制 IP 地址。这是一个相当常见的功能,在 Kibana 也可以这样使用,但是它增加了很多价值——特别是如果你想将它用作 SIEM 系统。地理定位功能在系统的开源版本中提供。 +Graylog 最酷的功能或许是它的地理定位功能,它支持在地图上绘制 IP 地址。这是一个相当常见的功能,在 Kibana 也可以这样使用,但是它增加了很多价值 —— 特别是如果你想将它用作 SIEM 系统。地理定位功能在系统的开源版本中提供。 -Graylog 如果你想要的话,它会对开源版本的支持收费。它还为其企业版提供了一个开放的核心模型,提供存档、审计日志记录和其他支持。如果你不需要 Graylog (the company) 支持或托管的,你可以独立使用。 +如果你需要的话,Graylog 公司会提供对开源版本的收费支持。它还为其企业版提供了一个开源核心模式,提供存档、审计日志记录和其他支持。其它提供支持或托管服务的不太多,如果你不需要 Graylog 公司的,你可以托管。 #### Fluentd -[Fluentd][18] 是 [Treasure Data][19] 开发的,[CNCF][20] 已经将它作为一个孵化项目。它是用 C 和 Ruby 编写的,并由[AWS][21] 和 [Google Cloud][22]推荐。fluentd已经成为许多装置中logstach的常用替代品。它充当本地聚合器,收集所有节点日志并将其发送到中央存储系统。它不是日志聚合系统。 +[Fluentd][18] 是 [Treasure Data][19] 开发的,[CNCF][20] 已经将它作为一个孵化项目。它是用 C 和 Ruby 编写的,并被 [AWS][21] 和 [Google Cloud][22] 所推荐。Fluentd 已经成为许多系统中 logstach 的常用替代品。它可以作为一个本地聚合器,收集所有节点日志并将其发送到中央存储系统。它不是日志聚合系统。 -它使用一个强大的插件系统,提供不同数据源和数据输出的快速和简单的集成功能。因为有超过500个插件可用,所以你的大多数用例都应该包括在内。如果没有,这听起来是一个为开源社区做出贡献的机会。 +它使用一个强大的插件系统,提供不同数据源和数据输出的快速和简单的集成功能。因为有超过 500 个插件可用,所以你的大多数用例都应该包括在内。如果没有,这听起来是一个为开源社区做出贡献的机会。 -Fluentd 由于占用内存少(只有几十兆字节)和高吞吐量特性,是 Kubernetes 环境中的常见选择。在像 [Kubernetes][23] 这样的环境中,每个pod 都有一个 Fluentd sidecar ,内存消耗会随着每个新 pod 的创建而线性增加。在这中情况下,使用 Fluentd 将大大降低你的系统利用率。这对于Java开发的工具来说,这是一个常见的问题,这些工具旨在为每个节点运行一个工具,而内存开销并不是主要问题。 +Fluentd 由于占用内存少(只有几十兆字节)和高吞吐量特性,是 Kubernetes 环境中的常见选择。在像 [Kubernetes][23] 这样的环境中,每个 pod 都有一个 Fluentd 附属件 ,内存消耗会随着每个新 pod 的创建而线性增加。在这种情况下,使用 Fluentd 将大大降低你的系统利用率。这对于 Java 开发的工具来说是一个常见的问题,这些工具旨在为每个节点运行一个工具,而内存开销并不是主要问题。 -------------------------------------------------------------------------------- @@ -87,7 +79,7 @@ via: https://opensource.com/article/18/9/open-source-log-aggregation-tools 作者:[Dan Barker][a] 选题:[lujun9972](https://github.com/lujun9972) 译者:[heguangzhi](https://github.com/heguangzhi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 521967e1f7aba7643d064fdab6992fc274458ca6 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Wed, 26 Sep 2018 23:24:02 +0800 Subject: [PATCH 18/39] PUB:20180910 3 open source log aggregation tools.md @heguangzhi https://linux.cn/article-10053-1.html --- .../20180910 3 open source log aggregation tools.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20180910 3 open source log aggregation tools.md (100%) diff --git a/translated/tech/20180910 3 open source log aggregation tools.md b/published/20180910 3 open source log aggregation tools.md similarity index 100% rename from translated/tech/20180910 3 open source log aggregation tools.md rename to published/20180910 3 open source log aggregation tools.md From f4c58714b3d1d30cce80bfa0bda7170cefd9ec07 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 27 Sep 2018 00:08:08 +0800 Subject: [PATCH 19/39] PRF:20180824 Steam Makes it Easier to Play Windows Games on Linux.md @hopefully2333 --- ...t Easier to Play Windows Games on Linux.md | 41 +++++++++++-------- 1 file changed, 23 insertions(+), 18 deletions(-) diff --git a/translated/tech/20180824 Steam Makes it Easier to Play Windows Games on Linux.md b/translated/tech/20180824 Steam Makes it Easier to Play Windows Games on Linux.md index 75c42b3ab3..a257cee609 100644 --- a/translated/tech/20180824 Steam Makes it Easier to Play Windows Games on Linux.md +++ b/translated/tech/20180824 Steam Makes it Easier to Play Windows Games on Linux.md @@ -1,47 +1,50 @@ -steam 让我们在 Linux 上玩 Windows 的游戏更加容易 +Steam 让我们在 Linux 上玩 Windows 的游戏更加容易 ====== + ![Steam Wallpaper][1] -总所周知,Linux 游戏库中的游戏只有 Windows 游戏库中的一部分,实际上,许多人甚至都不会考虑将操作系统转换为 Linux,原因很简单,因为他们喜欢的游戏,大多数都不能在这个平台上运行。 +总所周知,[Linux 游戏][2]库中的游戏只有 Windows 游戏库中的一部分,实际上,许多人甚至都不会考虑将操作系统[转换为 Linux][3],原因很简单,因为他们喜欢的游戏,大多数都不能在这个平台上运行。 -在撰写本文时,steam 上已有超过 5000 种游戏可以在 Linux 上运行,而 steam 上的游戏总数已经接近 27000 种了。现在 5000 种游戏可能看起来很多,但还没有达到 27000 种,确实没有。 +在撰写本文时,Steam 上已有超过 5000 种游戏可以在 Linux 上运行,而 Steam 上的游戏总数已经接近 27000 种了。现在 5000 种游戏可能看起来很多,但还没有达到 27000 种,确实没有。 -虽然几乎所有的新的独立游戏都是在 Linux 中推出的,但我们仍然无法在这上面玩很多的 3A 大作。对我而言,虽然这其中有很多游戏我都很希望能有机会玩,但这从来都不是一个非黑即白的问题。因为我主要是玩独立游戏和复古游戏,所以几乎所有我喜欢的游戏都可以在 Linux 系统上运行。 +虽然几乎所有的新的独立游戏indie game都是在 Linux 中推出的,但我们仍然无法在这上面玩很多的 [3A 大作][4]。对我而言,虽然这其中有很多游戏我都很希望能有机会玩,但这从来都不是一个非黑即白的问题。因为我主要是玩独立游戏和[复古游戏][5],所以几乎所有我喜欢的游戏都可以在 Linux 系统上运行。 -### 认识 Proton,Steam 的一次 WINE 分叉。 +### 认识 Proton,Steam 的一个 WINE 复刻 -现在,这个问题已经成为过去式了,因为本周 Valve 宣布要对 Steam Play 进行一次更新,此次更新会将一个名为 Proton 的分叉版本的 Wine 添加到 Linux 和 Mac 的客户端中。是的,这个工具是开源的,Valve 已经在 GitHub 上开源了源代码,但该功能仍然处于测试阶段,所以你必须使用测试版的 Steam 客户端才能使用这项功能。 +现在,这个问题已经成为过去式了,因为本周 Valve [宣布][6]要对 Steam Play 进行一次更新,此次更新会将一个名为 Proton 的 Wine 复刻版本添加到 Linux 客户端中。是的,这个工具是开源的,Valve 已经在 [GitHub][7] 上开源了源代码,但该功能仍然处于测试阶段,所以你必须使用测试版的 Steam 客户端才能使用这项功能。 -#### 使用 proton ,可以在 Linux 系统上使用 Steam 运行更多的 Windows 上的游戏。 +#### 使用 proton ,可以在 Linux 系统上通过 Steam 运行更多 Windows 游戏 -这对我们这些 Linux 用户来说,实际上意味着什么?简单来说,这意味着我们可以在 Linux 和 Mac 这两种操作系统的电脑上运行全部 27000 种游戏,而无需配置像 PlayOnLinux 或 Lutris 这样的服务。我要告诉你的是,配置这些东西有时候会非常让人头疼。 +这对我们这些 Linux 用户来说,实际上意味着什么?简单来说,这意味着我们可以在 Linux 电脑上运行全部 27000 种游戏,而无需配置像 [PlayOnLinux][8] 或 [Lutris][9] 这样的东西。我要告诉你的是,配置这些东西有时候会非常让人头疼。 -对此更为复杂的答案是,某种原因听起来非常美好。虽然在理论上,你可以用这种方式在 Linux 上玩所有的 Windows 平台上的游戏。但只有一少部分游戏在推出时会正式支持 Linux。这少部分游戏包括 DOOM,最终幻想 VI,铁拳 7,星球大战:前线 2,和其他几个。 +对此更为复杂的答案是,某种原因听起来非常美好。虽然在理论上,你可以用这种方式在 Linux 上玩所有的 Windows 平台上的游戏。但只有一少部分游戏在推出时会正式支持 Linux。这少部分游戏包括 《DOOM》、《最终幻想 VI》、《铁拳 7》、《星球大战:前线 2》,和其他几个。 -#### 你可以在 Linux 上玩所有的 Windows 平台的游戏(理论上) +#### 你可以在 Linux 上玩所有的 Windows 游戏(理论上) -虽然目前该列表只有大约 30 个游戏,你可以点击“为所有游戏使用 Steam play 进行运行”复选框来强制使用 Steam 的 Proton 来安装和运行任意游戏。但你最好不要有太高的期待,它们的稳定性和性能表现不一定有你希望的那么好,所以请把期望值压低一点。 +虽然目前该列表只有大约 30 个游戏,你可以点击“为所有游戏启用 Steam Play”复选框来强制使用 Steam 的 Proton 来安装和运行任意游戏。但你最好不要有太高的期待,它们的稳定性和性能表现不一定有你希望的那么好,所以请把期望值压低一点。 ![Steam Play][10] -#### 体验 Proton,没有我想的那么烂。 +据[这份报告][13],已经有超过一千个游戏可以在 Linux 上玩了。按[此指南][14]来了解如何启用 Steam Play 测试版本。 -例如,我安装了一些中等价格的游戏,使用 Proton 来进行安装。其中一个是上古卷轴 4:湮没,在我玩这个游戏的两个小时里,它只崩溃了一次,而且几乎是紧跟在游戏教程的自动保存点之后。 +#### 体验 Proton,没有我想的那么烂 + +例如,我安装了一些难度适中的游戏,使用 Proton 来进行安装。其中一个是《上古卷轴 4:湮没》,在我玩这个游戏的两个小时里,它只崩溃了一次,而且几乎是紧跟在游戏教程的自动保存点之后。 我有一块英伟达 Gtx 1050 Ti 的显卡。所以我可以使用 1080P 的高配置来玩这个游戏。而且我没有遇到除了这次崩溃之外的任何问题。我唯一真正感到不爽的只有它的帧数没有原本的高。在 90% 的时间里,游戏的帧数都在 60 帧以上,但我知道它的帧数应该能更高。 -我安装和发布的其他所有游戏都运行得很完美,虽然我还没有较长时间地玩过它们中的任何一个。我安装的游戏中包括森林,丧尸围城 4,H1Z1,和刺客信条 2.(你能说我这是喜欢恐怖游戏吗?)。 +我安装和运行的其他所有游戏都运行得很完美,虽然我还没有较长时间地玩过它们中的任何一个。我安装的游戏中包括《森林》、《丧尸围城 4》和《刺客信条 2》。(你觉得我这是喜欢恐怖游戏吗?) #### 为什么 Steam(仍然)要下注在 Linux 上? 现在,一切都很好,这件事为什么会发生呢?为什么 Valve 要花费时间,金钱和资源来做这样的事?我倾向于认为,他们这样做是因为他们懂得 Linux 社区的价值,但是如果要我老实地说,我不相信我们和它有任何的关系。 -如果我一定要在这上面花钱,我想说 Valve 开发了 Proton,因为他们还没有放弃 Steam 机器。因为 Steam OS 是基于 Linux 的发行版,在这类东西上面投资可以获取最大的利润,Steam OS 上可用的游戏越多,就会有更多的人愿意购买 Steam 的机器。 +如果我一定要在这上面花钱,我想说 Valve 开发了 Proton,因为他们还没有放弃 [Steam Machine][11]。因为 [Steam OS][12] 是基于 Linux 的发行版,在这类东西上面投资可以获取最大的利润,Steam OS 上可用的游戏越多,就会有更多的人愿意购买 Steam Machine。 -可能我是错的,但是我敢打赌啊,我们会在不远的未来看到新一批的 Steam 机器。可能我们会在一年内看到它们,也有可能我们再等五年都见不到,谁知道呢! +可能我是错的,但是我敢打赌啊,我们会在不远的未来看到新一批的 Steam Machine。可能我们会在一年内看到它们,也有可能我们再等五年都见不到,谁知道呢! -无论哪种方式,我所知道的是,我终于能兴奋地从我的 Steam 游戏库里玩游戏了。多年来我通过所有的收藏包,游戏促销,和不定时地买一个贱卖的游戏来以防万一,我想去尝试让它在 Lutris 中运行。 +无论哪种方式,我所知道的是,我终于能兴奋地从我的 Steam 游戏库里玩游戏了。这个游戏库是多年来我通过各种慈善包、促销码和不定时地买的游戏慢慢积累的,只不过是想试试让它在 Lutris 中运行。 #### 为 Linux 上越来越多的游戏而激动? @@ -54,7 +57,7 @@ via: https://itsfoss.com/steam-play-proton/ 作者:[Phillip Prado][a] 选题:[lujun9972](https://github.com/lujun9972) 译者:[hopefully2333](https://github.com/hopefully2333) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 @@ -71,3 +74,5 @@ via: https://itsfoss.com/steam-play-proton/ [10]:https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/08/SteamProton.jpg [11]:https://store.steampowered.com/sale/steam_machines [12]:https://itsfoss.com/valve-annouces-linux-based-gaming-operating-system-steamos/ +[13]:https://spcr.netlify.com/ +[14]:https://itsfoss.com/steam-play/ From 82182f5de868fa6b1bb92811ed0fe4cd77ada7c4 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 27 Sep 2018 00:08:33 +0800 Subject: [PATCH 20/39] PUB: 20180824 Steam Makes it Easier to Play Windows Games on Linux.md @hopefully2333 https://linux.cn/article-10054-1.html --- ...180824 Steam Makes it Easier to Play Windows Games on Linux.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20180824 Steam Makes it Easier to Play Windows Games on Linux.md (100%) diff --git a/translated/tech/20180824 Steam Makes it Easier to Play Windows Games on Linux.md b/published/20180824 Steam Makes it Easier to Play Windows Games on Linux.md similarity index 100% rename from translated/tech/20180824 Steam Makes it Easier to Play Windows Games on Linux.md rename to published/20180824 Steam Makes it Easier to Play Windows Games on Linux.md From 424e63e8e49a0bc7d4004d12516c5b98073110a9 Mon Sep 17 00:00:00 2001 From: darksun Date: Thu, 27 Sep 2018 09:05:24 +0800 Subject: [PATCH 21/39] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Hegemon=20=E2=80=93?= =?UTF-8?q?=20A=20Modular=20System=20Monitor=20Application=20Written=20In?= =?UTF-8?q?=20Rust?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...tem Monitor Application Written In Rust.md | 78 +++++++++++++++++++ 1 file changed, 78 insertions(+) create mode 100644 sources/tech/20180925 Hegemon - A Modular System Monitor Application Written In Rust.md diff --git a/sources/tech/20180925 Hegemon - A Modular System Monitor Application Written In Rust.md b/sources/tech/20180925 Hegemon - A Modular System Monitor Application Written In Rust.md new file mode 100644 index 0000000000..14f6a2e947 --- /dev/null +++ b/sources/tech/20180925 Hegemon - A Modular System Monitor Application Written In Rust.md @@ -0,0 +1,78 @@ +Hegemon – A Modular System Monitor Application Written In Rust +====== + +![](https://www.ostechnix.com/wp-content/uploads/2018/09/hegemon-720x340.png) + +When it comes to monitor running processes in Unix-like systems, the most commonly used applications are **top** and **htop** , which is an enhanced version of top. My personal favorite is htop. However, the developers are releasing few alternatives to these applications every now and then. One such alternative to top and htop utilities is **Hegemon**. It is a modular system monitor application written using **Rust** programming language. + +Concerning about the features of Hegemon, we can list the following: + + * Hegemon will monitor the usage of CPU, memory and Swap. + * It monitors the system’s temperature and fan speed. + * The update interval time can be adjustable. The default value is 3 seconds. + * We can reveal more detailed graph and additional information by expanding the data streams. + * Unit tests + * Clean interface + * Free and open source. + + + +### Installing Hegemon + +Make sure you have installed **Rust 1.26** or later version. To install Rust in your Linux distribution, refer the following guide: + +[Install Rust Programming Language In Linux][2] + +Also, install [libsensors][1] library. It is available in the default repositories of most Linux distributions. For example, you can install it in RPM based systems such as Fedora using the following command: + +``` +$ sudo dnf install lm_sensors-devel +``` + +On Debian-based systems like Ubuntu, Linux Mint, it can be installed using command: + +``` +$ sudo apt-get install libsensors4-dev +``` + +Once you installed Rust and libsensors, install Hegemon using command: + +``` +$ cargo install hegemon +``` + +Once hegemon installed, start monitoring the running processes in your Linux system using command: + +``` +$ hegemon +``` + +Here is the sample output from my Arch Linux desktop. + +![](https://www.ostechnix.com/wp-content/uploads/2018/09/Hegemon-in-action.gif) + +To exit, press **Q**. + + +Please be mindful that hegemon is still in its early development stage and it is not complete replacement for **top** command. There might be bugs and missing features. If you came across any bugs, report them in the project’s github page. The developer is planning to bring more features in the upcoming versions. So, keep an eye on this project. + +And, that’s all for now. Hope this helps. More good stuffs to come. Stay tuned! + +Cheers! + + + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/hegemon-a-modular-system-monitor-application-written-in-rust/ + +作者:[SK][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.ostechnix.com/author/sk/ +[1]: https://github.com/lm-sensors/lm-sensors +[2]: https://www.ostechnix.com/install-rust-programming-language-in-linux/ From 40f74a4ac5ff341a4b5d656ddbebfeb606897db6 Mon Sep 17 00:00:00 2001 From: darksun Date: Thu, 27 Sep 2018 09:08:01 +0800 Subject: [PATCH 22/39] =?UTF-8?q?=E9=80=89=E9=A2=98:=20CPU=20Power=20Manag?= =?UTF-8?q?er=20=E2=80=93=20Control=20And=20Manage=20CPU=20Frequency=20In?= =?UTF-8?q?=20Linux?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ntrol And Manage CPU Frequency In Linux.md | 74 +++++++++++++++++++ 1 file changed, 74 insertions(+) create mode 100644 sources/talk/20180926 CPU Power Manager - Control And Manage CPU Frequency In Linux.md diff --git a/sources/talk/20180926 CPU Power Manager - Control And Manage CPU Frequency In Linux.md b/sources/talk/20180926 CPU Power Manager - Control And Manage CPU Frequency In Linux.md new file mode 100644 index 0000000000..aeffd1f144 --- /dev/null +++ b/sources/talk/20180926 CPU Power Manager - Control And Manage CPU Frequency In Linux.md @@ -0,0 +1,74 @@ +CPU Power Manager – Control And Manage CPU Frequency In Linux +====== + +![](https://www.ostechnix.com/wp-content/uploads/2018/09/Manage-CPU-Frequency-720x340.jpeg) + +If you are a laptop user, you probably know that power management on Linux isn’t really as good as on other OSes. While there are tools like **TLP** , [**Laptop Mode Tools** and **powertop**][1] to help reduce power consumption, overall battery life on Linux isn’t as good as Windows or Mac OS. Another way to reduce power consumption is to limit the frequency of your CPU. While this is something that has always been doable, it generally requires complicated terminal commands, making it inconvenient. But fortunately, there’s a gnome extension that helps you easily set and manage your CPU’s frequency – **CPU Power Manager**. CPU Power Manager uses the **intel_pstate** frequency scaling driver (supported by almost every Intel CPU) to control and manage CPU frequency in your GNOME desktop. + +Another reason to use this extension is to reduce heating in your system. There are many systems out there which can get uncomfortably hot in normal usage. Limiting your CPU’s frequency could reduce heating. It will also decrease the wear and tear on your CPU and other components. + +### Installing CPU Power Manager + +First, go to the [**extension’s page**][2], and install the extension. + +Once the extension has installed, you’ll get a CPU icon at the right side of the Gnome top bar. Click the icon, and you get an option to install the extension: + +![](https://www.ostechnix.com/wp-content/uploads/2018/09/CPU-Power-Manager-icon.png) + +If you click **“Attempt Installation”** , you’ll get a password prompt. The extension needs root privileges to add policykit rule for controlling CPU frequency. This is what the prompt looks like: + +![](https://www.ostechnix.com/wp-content/uploads/2018/09/CPU-Power-Manager-1.png) + +Type in your password and Click **“Authenticate”** , and that finishes installation. The last action adds a policykit file – **mko.cpupower.setcpufreq.policy** at **/usr/share/polkit-1/actions**. + +After installation is complete, if you click the CPU icon at the top right, you’ll get something like this: + +![](https://www.ostechnix.com/wp-content/uploads/2018/09/CPU-Power-Manager.png) + +### Features + + * **See the current CPU frequency:** Obviously, you can use this window to see the frequency that your CPU is running at. + * **Set maximum and minimum frequency:** With this extension, you can set maximum and minimum frequency limits in terms of percentage of max frequency. Once these limits are set, the CPU will operate only in this range of frequencies. + * **Turn Turbo Boost On and Off:** This is my favorite feature. Most Intel CPU’s have “Turbo Boost” feature, whereby the one of the cores of the CPU is boosted past the normal maximum frequency for extra performance. While this can make your system more performant, it also increases power consumption a lot. So if you aren’t doing anything intensive, it’s nice to be able to turn off Turbo Boost and save power. In fact, in my case, I have Turbo Boost turned off most of the time. + * **Make Profiles:** You can make profiles with max and min frequency that you can turn on/off easily instead of fiddling with max and frequencies. + + + +### Preferences + +You can also customize the extension via the preferences window: + +![](https://www.ostechnix.com/wp-content/uploads/2018/09/CPU-Power-Manager-preferences.png) + +As you can see, you can set whether CPU frequency is to be displayed, and whether to display it in **Mhz** or **Ghz**. + +You can also edit and create/delete profiles: + +![](https://www.ostechnix.com/wp-content/uploads/2018/09/CPU-Power-Manager-preferences-1.png) + +You can set maximum and minimum frequencies, and turbo boost for each profile. + +### Conclusion + +As I said in the beginning, power management on Linux is not the best, and many people are always looking to eek out a few minutes more out of their Linux laptop. If you are one of those, check out this extension. This is a unconventional method to save power, but it does work. I certainly love this extension, and have been using it for a few months now. + +What do you think about this extension? Put your thoughts in the comments below! + +Cheers! + + + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/cpu-power-manager-control-and-manage-cpu-frequency-in-linux/ + +作者:[EDITOR][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.ostechnix.com/author/editor/ +[1]: https://www.ostechnix.com/improve-laptop-battery-performance-linux/ +[2]: https://extensions.gnome.org/extension/945/cpu-power-manager/ From 7e099356134a14883aa35081fbda3d25a61b0fea Mon Sep 17 00:00:00 2001 From: geekpi Date: Thu, 27 Sep 2018 09:08:10 +0800 Subject: [PATCH 23/39] translating --- ...led Packages And Restore Them On Freshly Installed Ubuntu.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sources/tech/20180915 Backup Installed Packages And Restore Them On Freshly Installed Ubuntu.md b/sources/tech/20180915 Backup Installed Packages And Restore Them On Freshly Installed Ubuntu.md index d5927effee..c775fd5040 100644 --- a/sources/tech/20180915 Backup Installed Packages And Restore Them On Freshly Installed Ubuntu.md +++ b/sources/tech/20180915 Backup Installed Packages And Restore Them On Freshly Installed Ubuntu.md @@ -1,3 +1,5 @@ +translating---geekpi + Backup Installed Packages And Restore Them On Freshly Installed Ubuntu ====== From 8a1bd55b95dae3a227404ca4b0d9a88966f5a0a7 Mon Sep 17 00:00:00 2001 From: darksun Date: Thu, 27 Sep 2018 09:11:35 +0800 Subject: [PATCH 24/39] =?UTF-8?q?=E9=80=89=E9=A2=98:=20How=20to=20Boot=20U?= =?UTF-8?q?buntu=2018.04=20/=20Debian=209=20Server=20in=20Rescue=20(Single?= =?UTF-8?q?=20User=20mode)=20/=20Emergency=20Mode?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...cue (Single User mode) - Emergency Mode.md | 88 +++++++++++++++++++ 1 file changed, 88 insertions(+) create mode 100644 sources/tech/20180925 How to Boot Ubuntu 18.04 - Debian 9 Server in Rescue (Single User mode) - Emergency Mode.md diff --git a/sources/tech/20180925 How to Boot Ubuntu 18.04 - Debian 9 Server in Rescue (Single User mode) - Emergency Mode.md b/sources/tech/20180925 How to Boot Ubuntu 18.04 - Debian 9 Server in Rescue (Single User mode) - Emergency Mode.md new file mode 100644 index 0000000000..ff33e7c175 --- /dev/null +++ b/sources/tech/20180925 How to Boot Ubuntu 18.04 - Debian 9 Server in Rescue (Single User mode) - Emergency Mode.md @@ -0,0 +1,88 @@ +How to Boot Ubuntu 18.04 / Debian 9 Server in Rescue (Single User mode) / Emergency Mode +====== +Booting a Linux Server into a single user mode or **rescue mode** is one of the important troubleshooting that a Linux admin usually follow while recovering the server from critical conditions. In Ubuntu 18.04 and Debian 9, single user mode is known as a rescue mode. + +Apart from the rescue mode, Linux servers can be booted in **emergency mode** , the main difference between them is that, emergency mode loads a minimal environment with read only root file system file system, also it does not enable any network or other services. But rescue mode try to mount all the local file systems & try to start some important services including network. + +In this article we will discuss how we can boot our Ubuntu 18.04 LTS / Debian 9 Server in rescue mode and emergency mode. + +#### Booting Ubuntu 18.04 LTS Server in Single User / Rescue Mode: + +Reboot your server and go to boot loader (Grub) screen and Select “ **Ubuntu** “, bootloader screen would look like below, + +![](https://www.linuxtechi.com/wp-content/uploads/2018/09/Bootloader-Screen-Ubuntu18-04-Server.jpg) + +Press “ **e** ” and then go the end of line which starts with word “ **linux** ” and append “ **systemd.unit=rescue.target** “. Remove the word “ **$vt_handoff** ” if it exists. + +![](https://www.linuxtechi.com/wp-content/uploads/2018/09/rescue-target-ubuntu18-04.jpg) + +Now Press Ctrl-x or F10 to boot, + +![](https://www.linuxtechi.com/wp-content/uploads/2018/09/rescue-mode-ubuntu18-04.jpg) + +Now press enter and then you will get the shell where all file systems will be mounted in read-write mode and do the troubleshooting. Once you are done with troubleshooting, you can reboot your server using “ **reboot** ” command. + +#### Booting Ubuntu 18.04 LTS Server in emergency mode + +Reboot the server and go the boot loader screen and select “ **Ubuntu** ” and then press “ **e** ” and go to the end of line which starts with word linux, and append “ **systemd.unit=emergency.target** ” + +![](https://www.linuxtechi.com/wp-content/uploads/2018/09/Emergecny-target-ubuntu18-04-server.jpg) + +Now Press Ctlr-x or F10 to boot in emergency mode, you will get a shell and do the troubleshooting from there. As we had already discussed that in emergency mode, file systems will be mounted in read-only mode and also there will be no networking in this mode, + +![](https://www.linuxtechi.com/wp-content/uploads/2018/09/Emergency-prompt-debian9.jpg) + +Use below command to mount the root file system in read-write mode, + +``` +# mount -o remount,rw / + +``` + +Similarly, you can remount rest of file systems in read-write mode . + +#### Booting Debian 9 into Rescue & Emergency Mode + +Reboot your Debian 9.x server and go to grub screen and select “ **Debian GNU/Linux** ” + +![](https://www.linuxtechi.com/wp-content/uploads/2018/09/Debian9-Grub-Screen.jpg) + +Press “ **e** ” and go to end of line which starts with word linux and append “ **systemd.unit=rescue.target** ” to boot the system in rescue mode and to boot in emergency mode then append “ **systemd.unit=emergency.target** ” + +#### Rescue mode : + +![](https://www.linuxtechi.com/wp-content/uploads/2018/09/Rescue-mode-Debian9.jpg) + +Now press Ctrl-x or F10 to boot in rescue mode + +![](https://www.linuxtechi.com/wp-content/uploads/2018/09/Rescue-Mode-Shell-Debian9.jpg) + +Press Enter to get the shell and from there you can start troubleshooting. + +#### Emergency Mode: + +![](https://www.linuxtechi.com/wp-content/uploads/2018/09/Emergency-target-grub-debian9.jpg) + +Now press ctrl-x or F10 to boot your system in emergency mode + +![](https://www.linuxtechi.com/wp-content/uploads/2018/09/Emergency-prompt-debian9.jpg) + +Press enter to get the shell and use “ **mount -o remount,rw /** ” command to mount the root file system in read-write mode. + +**Note:** In case root password is already set in Ubuntu 18.04 and Debian 9 Server then you must enter root password to get shell in rescue and emergency mode + +That’s all from this article, please do share your feedback and comments in case you like this article. + + +-------------------------------------------------------------------------------- + +via: https://www.linuxtechi.com/boot-ubuntu-18-04-debian-9-rescue-emergency-mode/ + +作者:[Pradeep Kumar][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]: http://www.linuxtechi.com/author/pradeep/ From 6b52471d8f5834463e97f3f4c6b5e3680ee2e1c8 Mon Sep 17 00:00:00 2001 From: darksun Date: Thu, 27 Sep 2018 09:19:52 +0800 Subject: [PATCH 25/39] =?UTF-8?q?=E9=80=89=E9=A2=98:=20An=20introduction?= =?UTF-8?q?=20to=20swap=20space=20on=20Linux=20systems?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...oduction to swap space on Linux systems.md | 300 ++++++++++++++++++ 1 file changed, 300 insertions(+) create mode 100644 sources/tech/20180926 An introduction to swap space on Linux systems.md diff --git a/sources/tech/20180926 An introduction to swap space on Linux systems.md b/sources/tech/20180926 An introduction to swap space on Linux systems.md new file mode 100644 index 0000000000..036890ef4b --- /dev/null +++ b/sources/tech/20180926 An introduction to swap space on Linux systems.md @@ -0,0 +1,300 @@ +An introduction to swap space on Linux systems +====== + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/fail_progress_cycle_momentum_arrow.png?itok=q-ZFa_Eh) + +Swap space is a common aspect of computing today, regardless of operating system. Linux uses swap space to increase the amount of virtual memory available to a host. It can use one or more dedicated swap partitions or a swap file on a regular filesystem or logical volume. + +There are two basic types of memory in a typical computer. The first type, random access memory (RAM), is used to store data and programs while they are being actively used by the computer. Programs and data cannot be used by the computer unless they are stored in RAM. RAM is volatile memory; that is, the data stored in RAM is lost if the computer is turned off. + +Hard drives are magnetic media used for long-term storage of data and programs. Magnetic media is nonvolatile; the data stored on a disk remains even when power is removed from the computer. The CPU (central processing unit) cannot directly access the programs and data on the hard drive; it must be copied into RAM first, and that is where the CPU can access its programming instructions and the data to be operated on by those instructions. During the boot process, a computer copies specific operating system programs, such as the kernel and init or systemd, and data from the hard drive into RAM, where it is accessed directly by the computer’s processor, the CPU. + +### Swap space + +Swap space is the second type of memory in modern Linux systems. The primary function of swap space is to substitute disk space for RAM memory when real RAM fills up and more space is needed. + +For example, assume you have a computer system with 8GB of RAM. If you start up programs that don’t fill that RAM, everything is fine and no swapping is required. But suppose the spreadsheet you are working on grows when you add more rows, and that, plus everything else that's running, now fills all of RAM. Without swap space available, you would have to stop working on the spreadsheet until you could free up some of your limited RAM by closing down some other programs. + +The kernel uses a memory management program that detects blocks, aka pages, of memory in which the contents have not been used recently. The memory management program swaps enough of these relatively infrequently used pages of memory out to a special partition on the hard drive specifically designated for “paging,” or swapping. This frees up RAM and makes room for more data to be entered into your spreadsheet. Those pages of memory swapped out to the hard drive are tracked by the kernel’s memory management code and can be paged back into RAM if they are needed. + +The total amount of memory in a Linux computer is the RAM plus swap space and is referred to as virtual memory. + +### Types of Linux swap + +Linux provides for two types of swap space. By default, most Linux installations create a swap partition, but it is also possible to use a specially configured file as a swap file. A swap partition is just what its name implies—a standard disk partition that is designated as swap space by the `mkswap` command. + +A swap file can be used if there is no free disk space in which to create a new swap partition or space in a volume group where a logical volume can be created for swap space. This is just a regular file that is created and preallocated to a specified size. Then the `mkswap` command is run to configure it as swap space. I don’t recommend using a file for swap space unless absolutely necessary. + +### Thrashing + +Thrashing can occur when total virtual memory, both RAM and swap space, become nearly full. The system spends so much time paging blocks of memory between swap space and RAM and back that little time is left for real work. The typical symptoms of this are obvious: The system becomes slow or completely unresponsive, and the hard drive activity light is on almost constantly. + +If you can manage to issue a command like `free` that shows CPU load and memory usage, you will see that the CPU load is very high, perhaps as much as 30 to 40 times the number of CPU cores in the system. Another symptom is that both RAM and swap space are almost completely allocated. + +After the fact, looking at SAR (system activity report) data can also show these symptoms. I install SAR on every system I work on and use it for post-repair forensic analysis. + +### What is the right amount of swap space? + +Many years ago, the rule of thumb for the amount of swap space that should be allocated on the hard drive was 2X the amount of RAM installed in the computer (of course, that was when most computers' RAM was measured in KB or MB). So if a computer had 64KB of RAM, a swap partition of 128KB would be an optimum size. This rule took into account the facts that RAM sizes were typically quite small at that time and that allocating more than 2X RAM for swap space did not improve performance. With more than twice RAM for swap, most systems spent more time thrashing than actually performing useful work. + +RAM has become an inexpensive commodity and most computers these days have amounts of RAM that extend into tens of gigabytes. Most of my newer computers have at least 8GB of RAM, one has 32GB, and my main workstation has 64GB. My older computers have from 4 to 8 GB of RAM. + +When dealing with computers having huge amounts of RAM, the limiting performance factor for swap space is far lower than the 2X multiplier. The Fedora 28 online Installation Guide, which can be found online at [Fedora Installation Guide][1], defines current thinking about swap space allocation. I have included below some discussion and the table of recommendations from that document. + +The following table provides the recommended size of a swap partition depending on the amount of RAM in your system and whether you want sufficient memory for your system to hibernate. The recommended swap partition size is established automatically during installation. To allow for hibernation, however, you will need to edit the swap space in the custom partitioning stage. + +_Table 1: Recommended system swap space in Fedora 28 documentation_ + +| **Amount of system RAM** | **Recommended swap space** | **Recommended swap with hibernation** | +|--------------------------|-----------------------------|---------------------------------------| +| less than 2 GB | 2 times the amount of RAM | 3 times the amount of RAM | +| 2 GB - 8 GB | Equal to the amount of RAM | 2 times the amount of RAM | +| 8 GB - 64 GB | 0.5 times the amount of RAM | 1.5 times the amount of RAM | +| more than 64 GB | workload dependent | hibernation not recommended | + +At the border between each range listed above (for example, a system with 2 GB, 8 GB, or 64 GB of system RAM), use discretion with regard to chosen swap space and hibernation support. If your system resources allow for it, increasing the swap space may lead to better performance. + +Of course, most Linux administrators have their own ideas about the appropriate amount of swap space—as well as pretty much everything else. Table 2, below, contains my recommendations based on my personal experiences in multiple environments. These may not work for you, but as with Table 1, they may help you get started. + +_Table 2: Recommended system swap space per the author_ + +| Amount of RAM | Recommended swap space | +|---------------|------------------------| +| ≤ 2GB | 2X RAM | +| 2GB – 8GB | = RAM | +| >8GB | 8GB | + +One consideration in both tables is that as the amount of RAM increases, beyond a certain point adding more swap space simply leads to thrashing well before the swap space even comes close to being filled. If you have too little virtual memory while following these recommendations, you should add more RAM, if possible, rather than more swap space. As with all recommendations that affect system performance, use what works best for your specific environment. This will take time and effort to experiment and make changes based on the conditions in your Linux environment. + +#### Adding more swap space to a non-LVM disk environment + +Due to changing requirements for swap space on hosts with Linux already installed, it may become necessary to modify the amount of swap space defined for the system. This procedure can be used for any general case where the amount of swap space needs to be increased. It assumes sufficient available disk space is available. This procedure also assumes that the disks are partitioned in “raw” EXT4 and swap partitions and do not use logical volume management (LVM). + +The basic steps to take are simple: + + 1. Turn off the existing swap space. + + 2. Create a new swap partition of the desired size. + + 3. Reread the partition table. + + 4. Configure the partition as swap space. + + 5. Add the new partition/etc/fstab. + + 6. Turn on swap. + + + + +A reboot should not be necessary. + +For safety's sake, before turning off swap, at the very least you should ensure that no applications are running and that no swap space is in use. The `free` or `top` commands can tell you whether swap space is in use. To be even safer, you could revert to run level 1 or single-user mode. + +Turn off the swap partition with the command which turns off all swap space: + +``` +swapoff -a + +``` + +Now display the existing partitions on the hard drive. + +``` +fdisk -l + +``` + +This displays the current partition tables on each drive. Identify the current swap partition by number. + +Start `fdisk` in interactive mode with the command: + +``` +fdisk /dev/ + +``` + +For example: + +``` +fdisk /dev/sda + +``` + +At this point, `fdisk` is now interactive and will operate only on the specified disk drive. + +Use the fdisk `p` sub-command to verify that there is enough free space on the disk to create the new swap partition. The space on the hard drive is shown in terms of 512-byte blocks and starting and ending cylinder numbers, so you may have to do some math to determine the available space between and at the end of allocated partitions. + +Use the `n` sub-command to create a new swap partition. fdisk will ask you the starting cylinder. By default, it chooses the lowest-numbered available cylinder. If you wish to change that, type in the number of the starting cylinder. + +The `fdisk` command now allows you to enter the size of the partitions in a number of formats, including the last cylinder number or the size in bytes, KB or MB. Type in 4000M, which will give about 4GB of space on the new partition (for example), and press Enter. + +Use the `p` sub-command to verify that the partition was created as you specified it. Note that the partition will probably not be exactly what you specified unless you used the ending cylinder number. The `fdisk` command can only allocate disk space in increments on whole cylinders, so your partition may be a little smaller or larger than you specified. If the partition is not what you want, you can delete it and create it again. + +Now it is necessary to specify that the new partition is to be a swap partition. The sub-command `t` allows you to specify the type of partition. So enter `t`, specify the partition number, and when it asks for the hex code partition type, type 82, which is the Linux swap partition type, and press Enter. + +When you are satisfied with the partition you have created, use the `w` sub-command to write the new partition table to the disk. The `fdisk` program will exit and return you to the command prompt after it completes writing the revised partition table. You will probably receive the following message as `fdisk` completes writing the new partition table: + +``` +The partition table has been altered! +Calling ioctl() to re-read partition table. +WARNING: Re-reading the partition table failed with error 16: Device or resource busy. +The kernel still uses the old table. +The new table will be used at the next reboot. +Syncing disks. +``` + +At this point, you use the `partprobe` command to force the kernel to re-read the partition table so that it is not necessary to perform a reboot. + +``` +partprobe +``` + +Now use the command `fdisk -l` to list the partitions and the new swap partition should be among those listed. Be sure that the new partition type is “Linux swap”. + +It will be necessary to modify the /etc/fstab file to point to the new swap partition. The existing line may look like this: + +``` +LABEL=SWAP-sdaX   swap        swap    defaults        0 0 + +``` + +where `X` is the partition number. Add a new line that looks similar this, depending upon the location of your new swap partition: + +``` +/dev/sdaY         swap        swap    defaults        0 0 + +``` + +Be sure to use the correct partition number. Now you can perform the final step in creating the swap partition. Use the `mkswap` command to define the partition as a swap partition. + +``` +mkswap /dev/sdaY + +``` + +The final step is to turn swap on using the command: + +``` +swapon -a + +``` + +Your new swap partition is now online along with the previously existing swap partition. You can use the `free` or `top` commands to verify this. + +#### Adding swap to an LVM disk environment + +If your disk setup uses LVM, changing swap space will be fairly easy. Again, this assumes that space is available in the volume group in which the current swap volume is located. By default, the installation procedures for Fedora Linux in an LVM environment create the swap partition as a logical volume. This makes it easy because you can simply increase the size of the swap volume. + +Here are the steps required to increase the amount of swap space in an LVM environment: + + 1. Turn off all swap. + + 2. Increase the size of the logical volume designated for swap. + + 3. Configure the resized volume as swap space. + + 4. Turn on swap. + + + + +First, let’s verify that swap exists and is a logical volume using the `lvs` command (list logical volume). + +``` +[root@studentvm1 ~]# lvs +  LV     VG                Attr       LSize  Pool   Origin Data%  Meta%  Move Log Cpy%Sync Convert +  home   fedora_studentvm1 -wi-ao----  2.00g                                                       +  pool00 fedora_studentvm1 twi-aotz--  2.00g               8.17   2.93                             +  root   fedora_studentvm1 Vwi-aotz--  2.00g pool00        8.17                                   +  swap   fedora_studentvm1 -wi-ao----  8.00g                                                       +  tmp    fedora_studentvm1 -wi-ao----  5.00g                                                       +  usr    fedora_studentvm1 -wi-ao---- 15.00g                                                       +  var    fedora_studentvm1 -wi-ao---- 10.00g                                                       +[root@studentvm1 ~]# +``` + +You can see that the current swap size is 8GB. In this case, we want to add 2GB to this swap volume. First, stop existing swap. You may have to terminate running programs if swap space is in use. + +``` +swapoff -a + +``` + +Now increase the size of the logical volume. + +``` +[root@studentvm1 ~]# lvextend -L +2G /dev/mapper/fedora_studentvm1-swap +  Size of logical volume fedora_studentvm1/swap changed from 8.00 GiB (2048 extents) to 10.00 GiB (2560 extents). +  Logical volume fedora_studentvm1/swap successfully resized. +[root@studentvm1 ~]# +``` + +Run the `mkswap` command to make this entire 10GB partition into swap space. + +``` +[root@studentvm1 ~]# mkswap /dev/mapper/fedora_studentvm1-swap +mkswap: /dev/mapper/fedora_studentvm1-swap: warning: wiping old swap signature. +Setting up swapspace version 1, size = 10 GiB (10737414144 bytes) +no label, UUID=3cc2bee0-e746-4b66-aa2d-1ea15ef1574a +[root@studentvm1 ~]# +``` + +Turn swap back on. + +``` +[root@studentvm1 ~]# swapon -a +[root@studentvm1 ~]# +``` + +Now verify the new swap space is present with the list block devices command. Again, a reboot is not required. + +``` +[root@studentvm1 ~]# lsblk +NAME                                 MAJ:MIN RM  SIZE RO TYPE MOUNTPOINT +sda                                    8:0    0   60G  0 disk +|-sda1                                 8:1    0    1G  0 part /boot +`-sda2                                 8:2    0   59G  0 part +  |-fedora_studentvm1-pool00_tmeta   253:0    0    4M  0 lvm   +  | `-fedora_studentvm1-pool00-tpool 253:2    0    2G  0 lvm   +  |   |-fedora_studentvm1-root       253:3    0    2G  0 lvm  / +  |   `-fedora_studentvm1-pool00     253:6    0    2G  0 lvm   +  |-fedora_studentvm1-pool00_tdata   253:1    0    2G  0 lvm   +  | `-fedora_studentvm1-pool00-tpool 253:2    0    2G  0 lvm   +  |   |-fedora_studentvm1-root       253:3    0    2G  0 lvm  / +  |   `-fedora_studentvm1-pool00     253:6    0    2G  0 lvm   +  |-fedora_studentvm1-swap           253:4    0   10G  0 lvm  [SWAP] +  |-fedora_studentvm1-usr            253:5    0   15G  0 lvm  /usr +  |-fedora_studentvm1-home           253:7    0    2G  0 lvm  /home +  |-fedora_studentvm1-var            253:8    0   10G  0 lvm  /var +  `-fedora_studentvm1-tmp            253:9    0    5G  0 lvm  /tmp +sr0                                   11:0    1 1024M  0 rom   +[root@studentvm1 ~]# +``` + +You can also use the `swapon -s` command, or `top`, `free`, or any of several other commands to verify this. + +``` +[root@studentvm1 ~]# free +              total        used        free      shared  buff/cache   available +Mem:        4038808      382404     2754072        4152      902332     3404184 +Swap:      10485756           0    10485756 +[root@studentvm1 ~]# +``` + +Note that the different commands display or require as input the device special file in different forms. There are a number of ways in which specific devices are accessed in the /dev directory. My article, [Managing Devices in Linux][2], includes more information about the /dev directory and its contents. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/9/swap-space-linux-systems + +作者:[David Both][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://opensource.com/users/dboth +[1]: https://docs.fedoraproject.org/en-US/fedora/f28/install-guide/ +[2]: https://opensource.com/article/16/11/managing-devices-linux From 982cca6773a6fdba251cff08e669b1e5bf2fd46c Mon Sep 17 00:00:00 2001 From: darksun Date: Thu, 27 Sep 2018 09:22:13 +0800 Subject: [PATCH 26/39] =?UTF-8?q?=E9=80=89=E9=A2=98:=209=20Easiest=20Ways?= =?UTF-8?q?=20To=20Find=20Out=20Process=20ID=20(PID)=20In=20Linux?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...s To Find Out Process ID (PID) In Linux.md | 208 ++++++++++++++++++ 1 file changed, 208 insertions(+) create mode 100644 sources/tech/20180925 9 Easiest Ways To Find Out Process ID (PID) In Linux.md diff --git a/sources/tech/20180925 9 Easiest Ways To Find Out Process ID (PID) In Linux.md b/sources/tech/20180925 9 Easiest Ways To Find Out Process ID (PID) In Linux.md new file mode 100644 index 0000000000..ae353bf11f --- /dev/null +++ b/sources/tech/20180925 9 Easiest Ways To Find Out Process ID (PID) In Linux.md @@ -0,0 +1,208 @@ +9 Easiest Ways To Find Out Process ID (PID) In Linux +====== +Everybody knows about PID, Exactly what is PID? Why you want PID? What are you going to do using PID? Are you having the same questions on your mind? If so, you are in the right place to get all the details. + +Mainly, we are looking PID to kill an unresponsive program and it’s similar to Windows task manager. Linux GUI also offering the same feature but CLI is an efficient way to perform the kill operation. + +### What Is Process ID? + +PID stands for process identification number which is generally used by most operating system kernels such as Linux, Unix, macOS and Windows. It is a unique identification number that is automatically assigned to each process when it is created in an operating system. A process is a running instance of a program. + +**Suggested Read :** +**(#)** [How To Find Out Which Port Number A Process Is Using In Linux][1] +**(#)** [3 Easy Ways To Kill Or Terminate A Process In Linux][2] + +Each time process ID will be getting change to all the processes except init because init is always the first process on the system and is the ancestor of all other processes. It’s PID is 1. + +The default maximum value of PIDs is `32,768`. The same has been verified by running the following command on your system `cat /proc/sys/kernel/pid_max`. On 32-bit systems 32768 is the maximum value but we can set to any value up to 2^22 (approximately 4 million) on 64-bit systems. + +You may ask, why we need such amount of PIDs? because we can’t reused the PIDs immediately that’s why. Also in order to prevent possible errors. + +The PID for the running processes on the system can be found by using the below nine methods such as pidof command, pgrep command, ps command, pstree command, ss command, netstat command, lsof command, fuser command and systemctl command. + +This can be achieved using the below six methods. + + * `pidof:` pidof — find the process ID of a running program. + * `pgrep:` pgre – look up or signal processes based on name and other attributes. + * `ps:` ps – report a snapshot of the current processes. + * `pstree:` pstree – display a tree of processes. + * `ss:` ss is used to dump socket statistics. + * `netstat:` netstat is displays a list of open sockets. + * `lsof:` lsof – list open files. + * `fuser:` fuser – list process IDs of all processes that have one or more files open + * `systemctl:` systemctl – Control the systemd system and service manager + + + +In this tutorial we are going to find out the Apache process id to test this article. Make sure your need to input your process name instead of us. + +### Method-1 : Using pidof Command + +pidof used to find the process ID of a running program. It’s prints those id’s on the standard output. To demonstrate this, we are going to find out the Apache2 process id from Debian 9 (stretch) system. + +``` +# pidof apache2 +3754 2594 2365 2364 2363 2362 2361 + +``` + +From the above output you may face difficulties to identify the Process ID because it’s shows all the PIDs (included Parent and Childs) aginst the process name. Hence we need to find out the parent PID (PPID), which is the one we are looking. It could be the first number. In my case it’s `3754` and it’s shorted in descending order. + +### Method-2 : Using pgrep Command + +pgrep looks through the currently running processes and lists the process IDs which match the selection criteria to stdout. + +``` +# pgrep apache2 +2361 +2362 +2363 +2364 +2365 +2594 +3754 + +``` + +This also similar to the above output but it’s shorting the results in ascending order, which clearly says that the parent PID is the last one. In my case it’s `3754`. + +**Note :** If you have more than one process id of the process, you may face trouble to identify the parent process id when using pidof & pgrep command. + +### Method-3 : Using pstree Command + +pstree shows running processes as a tree. The tree is rooted at either pid or init if pid is omitted. If a user name is specified in the pstree command then it’s shows all the process owned by the corresponding user. + +pstree visually merges identical branches by putting them in square brackets and prefixing them with the repetition count. + +``` +# pstree -p | grep "apache2" + |-apache2(3754)-|-apache2(2361) + | |-apache2(2362) + | |-apache2(2363) + | |-apache2(2364) + | |-apache2(2365) + | `-apache2(2594) + +``` + +To get parent process alone, use the following format. + +``` +# pstree -p | grep "apache2" | head -1 + |-apache2(3754)-|-apache2(2361) + +``` + +pstree command is very simple because it’s segregating the Parent and Child processes separately but it’s not easy when using pidof & pgrep command. + +### Method-4 : Using ps Command + +ps displays information about a selection of the active processes. It displays the process ID (pid=PID), the terminal associated with the process (tname=TTY), the cumulated CPU time in [DD-]hh:mm:ss format (time=TIME), and the executable name (ucmd=CMD). Output is unsorted by default. + +``` +# ps aux | grep "apache2" +www-data 2361 0.0 0.4 302652 9732 ? S 06:25 0:00 /usr/sbin/apache2 -k start +www-data 2362 0.0 0.4 302652 9732 ? S 06:25 0:00 /usr/sbin/apache2 -k start +www-data 2363 0.0 0.4 302652 9732 ? S 06:25 0:00 /usr/sbin/apache2 -k start +www-data 2364 0.0 0.4 302652 9732 ? S 06:25 0:00 /usr/sbin/apache2 -k start +www-data 2365 0.0 0.4 302652 8400 ? S 06:25 0:00 /usr/sbin/apache2 -k start +www-data 2594 0.0 0.4 302652 8400 ? S 06:55 0:00 /usr/sbin/apache2 -k start +root 3754 0.0 1.4 302580 29324 ? Ss Dec11 0:23 /usr/sbin/apache2 -k start +root 5648 0.0 0.0 12784 940 pts/0 S+ 21:32 0:00 grep apache2 + +``` + +From the above output we can easily identify the parent process id (PPID) based on the process start date. In my case apache2 process was started @ `Dec11` which is the parent and others are child’s. PID of apache2 is `3754`. + +### Method-5: Using ss Command + +ss is used to dump socket statistics. It allows showing information similar to netstat. It can display more TCP and state informations than other tools. + +It can display stats for all kind of sockets such as PACKET, TCP, UDP, DCCP, RAW, Unix domain, etc. + +``` +# ss -tnlp | grep apache2 +LISTEN 0 128 :::80 :::* users:(("apache2",pid=3319,fd=4),("apache2",pid=3318,fd=4),("apache2",pid=3317,fd=4)) + +``` + +### Method-6: Using netstat Command + +netstat – Print network connections, routing tables, interface statistics, masquerade connections, and multicast memberships. +By default, netstat displays a list of open sockets. + +If you don’t specify any address families, then the active sockets of all configured address families will be printed. This program is obsolete. Replacement for netstat is ss. + +``` +# netstat -tnlp | grep apache2 +tcp6 0 0 :::80 :::* LISTEN 3317/apache2 + +``` + +### Method-7: Using lsof Command + +lsof – list open files. The Linux lsof command lists information about files that are open by processes running on the system. + +``` +# lsof -i -P | grep apache2 +apache2 3317 root 4u IPv6 40518 0t0 TCP *:80 (LISTEN) +apache2 3318 www-data 4u IPv6 40518 0t0 TCP *:80 (LISTEN) +apache2 3319 www-data 4u IPv6 40518 0t0 TCP *:80 (LISTEN) + +``` + +### Method-8: Using fuser Command + +The fuser utility shall write to standard output the process IDs of processes running on the local system that have one or more named files open. + +``` +# fuser -v 80/tcp + USER PID ACCESS COMMAND +80/tcp: root 3317 F.... apache2 + www-data 3318 F.... apache2 + www-data 3319 F.... apache2 + +``` + +### Method-9: Using systemctl Command + +systemctl – Control the systemd system and service manager. This is the replacement of old SysV init system management and +most of the modern Linux operating systems were adapted systemd. + +``` +# systemctl status apache2 +● apache2.service - The Apache HTTP Server + Loaded: loaded (/lib/systemd/system/apache2.service; disabled; vendor preset: enabled) + Drop-In: /lib/systemd/system/apache2.service.d + └─apache2-systemd.conf + Active: active (running) since Tue 2018-09-25 10:03:28 IST; 3s ago + Process: 3294 ExecStart=/usr/sbin/apachectl start (code=exited, status=0/SUCCESS) + Main PID: 3317 (apache2) + Tasks: 55 (limit: 4915) + Memory: 7.9M + CPU: 71ms + CGroup: /system.slice/apache2.service + ├─3317 /usr/sbin/apache2 -k start + ├─3318 /usr/sbin/apache2 -k start + └─3319 /usr/sbin/apache2 -k start + +Sep 25 10:03:28 ubuntu systemd[1]: Starting The Apache HTTP Server... +Sep 25 10:03:28 ubuntu systemd[1]: Started The Apache HTTP Server. + +``` + + +-------------------------------------------------------------------------------- + +via: https://www.2daygeek.com/9-methods-to-check-find-the-process-id-pid-ppid-of-a-running-program-in-linux/ + +作者:[Magesh Maruthamuthu][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.2daygeek.com/author/magesh/ +[1]: https://www.2daygeek.com/how-to-find-out-which-port-number-a-process-is-using-in-linux/ +[2]: https://www.2daygeek.com/kill-terminate-a-process-in-linux-using-kill-pkill-killall-command/ From cbb1782339f6b596c3188d6e248460475a5c45ce Mon Sep 17 00:00:00 2001 From: darksun Date: Thu, 27 Sep 2018 09:24:34 +0800 Subject: [PATCH 27/39] =?UTF-8?q?=E9=80=89=E9=A2=98:=20How=20to=20use=20th?= =?UTF-8?q?e=20Scikit-learn=20Python=20library=20for=20data=20science=20pr?= =?UTF-8?q?ojects?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ython library for data science projects.md | 258 ++++++++++++++++++ 1 file changed, 258 insertions(+) create mode 100644 sources/tech/20180926 How to use the Scikit-learn Python library for data science projects.md diff --git a/sources/tech/20180926 How to use the Scikit-learn Python library for data science projects.md b/sources/tech/20180926 How to use the Scikit-learn Python library for data science projects.md new file mode 100644 index 0000000000..4f5d9aedf6 --- /dev/null +++ b/sources/tech/20180926 How to use the Scikit-learn Python library for data science projects.md @@ -0,0 +1,258 @@ +How to use the Scikit-learn Python library for data science projects +====== + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/brain_data.png?itok=RH6NA32X) + +The Scikit-learn Python library, initially released in 2007, is commonly used in solving machine learning and data science problems—from the beginning to the end. The versatile library offers an uncluttered, consistent, and efficient API and thorough online documentation. + +### What is Scikit-learn? + +[Scikit-learn][1] is an open source Python library that has powerful tools for data analysis and data mining. It's available under the BSD license and is built on the following machine learning libraries: + + * **NumPy** , a library for manipulating multi-dimensional arrays and matrices. It also has an extensive compilation of mathematical functions for performing various calculations. + * **SciPy** , an ecosystem consisting of various libraries for completing technical computing tasks. + * **Matplotlib** , a library for plotting various charts and graphs. + + + +Scikit-learn offers an extensive range of built-in algorithms that make the most of data science projects. + +Here are the main ways the Scikit-learn library is used. + +#### 1. Classification + +The [classification][2] tools identify the category associated with provided data. For example, they can be used to categorize email messages as either spam or not. + + * Support vector machines (SVMs) + * Nearest neighbors + * Random forest + + + +#### 2. Regression + +Classification algorithms in Scikit-learn include: + +Regression involves creating a model that tries to comprehend the relationship between input and output data. For example, regression tools can be used to understand the behavior of stock prices. + +Regression algorithms include: + + * SVMs + * Ridge regression + * Lasso + + + +#### 3. Clustering + +The Scikit-learn clustering tools are used to automatically group data with the same characteristics into sets. For example, customer data can be segmented based on their localities. + +Clustering algorithms include: + + * K-means + * Spectral clustering + * Mean-shift + + + +#### 4. Dimensionality reduction + +Dimensionality reduction lowers the number of random variables for analysis. For example, to increase the efficiency of visualizations, outlying data may not be considered. + +Dimensionality reduction algorithms include: + + * Principal component analysis (PCA) + * Feature selection + * Non-negative matrix factorization + + + +#### 5. Model selection + +Model selection algorithms offer tools to compare, validate, and select the best parameters and models to use in your data science projects. + +Model selection modules that can deliver enhanced accuracy through parameter tuning include: + + * Grid search + * Cross-validation + * Metrics + + + +#### 6. Preprocessing + +The Scikit-learn preprocessing tools are important in feature extraction and normalization during data analysis. For example, you can use these tools to transform input data—such as text—and apply their features in your analysis. + +Preprocessing modules include: + + * Preprocessing + * Feature extraction + + + +### A Scikit-learn library example + +Let's use a simple example to illustrate how you can use the Scikit-learn library in your data science projects. + +We'll use the [Iris flower dataset][3], which is incorporated in the Scikit-learn library. The Iris flower dataset contains 150 details about three flower species: + + * Setosa—labeled 0 + * Versicolor—labeled 1 + * Virginica—labeled 2 + + + +The dataset includes the following characteristics of each flower species (in centimeters): + + * Sepal length + * Sepal width + * Petal length + * Petal width + + + +#### Step 1: Importing the library + +Since the Iris dataset is included in the Scikit-learn data science library, we can load it into our workspace as follows: + +``` +from sklearn import datasets +iris = datasets.load_iris() +``` + +These commands import the **datasets** module from **sklearn** , then use the **load_digits()** method from **datasets** to include the data in the workspace. + +#### Step 2: Getting dataset characteristics + +The **datasets** module contains several methods that make it easier to get acquainted with handling data. + +In Scikit-learn, a dataset refers to a dictionary-like object that has all the details about the data. The data is stored using the **.data** key, which is an array list. + +For instance, we can utilize **iris.data** to output information about the Iris flower dataset. + +``` +print(iris.data) +``` + +Here is the output (the results have been truncated): + +``` +[[5.1 3.5 1.4 0.2] + [4.9 3.  1.4 0.2] + [4.7 3.2 1.3 0.2] + [4.6 3.1 1.5 0.2] + [5.  3.6 1.4 0.2] + [5.4 3.9 1.7 0.4] + [4.6 3.4 1.4 0.3] + [5.  3.4 1.5 0.2] + [4.4 2.9 1.4 0.2] + [4.9 3.1 1.5 0.1] + [5.4 3.7 1.5 0.2] + [4.8 3.4 1.6 0.2] + [4.8 3.  1.4 0.1] + [4.3 3.  1.1 0.1] + [5.8 4.  1.2 0.2] + [5.7 4.4 1.5 0.4] + [5.4 3.9 1.3 0.4] + [5.1 3.5 1.4 0.3] +``` + +Let's also use **iris.target** to give us information about the different labels of the flowers. + +``` +print(iris.target) +``` + +Here is the output: + +``` +[0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 + 0 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 + 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 2 2 2 2 2 2 2 2 2 2 2 + 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 + 2 2] + +``` + +If we use **iris.target_names** , we'll output an array of the names of the labels found in the dataset. + +``` +print(iris.target_names) +``` + +Here is the result after running the Python code: + +``` +['setosa' 'versicolor' 'virginica'] +``` + +#### Step 3: Visualizing the dataset + +We can use the [box plot][4] to produce a visual depiction of the Iris flower dataset. The box plot illustrates how the data is distributed over the plane through their quartiles. + +Here's how to achieve this: + +``` +import seaborn as sns +box_data = iris.data #variable representing the data array +box_target = iris.target #variable representing the labels array +sns.boxplot(data = box_data,width=0.5,fliersize=5) +sns.set(rc={'figure.figsize':(2,15)}) +``` + +Let's see the result: + +![](https://opensource.com/sites/default/files/uploads/scikit_boxplot.png) + +On the horizontal axis: + + * 0 is sepal length + * 1 is sepal width + * 2 is petal length + * 3 is petal width + + + +The vertical axis is dimensions in centimeters. + +### Wrapping up + +Here is the entire code for this simple Scikit-learn data science tutorial. + +``` +from sklearn import datasets +iris = datasets.load_iris() +print(iris.data) +print(iris.target) +print(iris.target_names) +import seaborn as sns +box_data = iris.data #variable representing the data array +box_target = iris.target #variable representing the labels array +sns.boxplot(data = box_data,width=0.5,fliersize=5) +sns.set(rc={'figure.figsize':(2,15)}) +``` + +Scikit-learn is a versatile Python library you can use to efficiently complete data science projects. + +If you want to learn more, check out the tutorials on [LiveEdu][5], such as Andrey Bulezyuk's video on using the Scikit-learn library to create a [machine learning application][6]. + +Do you have any questions or comments? Feel free to share them below. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/9/how-use-scikit-learn-data-science-projects + +作者:[Dr.Michael J.Garbade][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://opensource.com/users/drmjg +[1]: http://scikit-learn.org/stable/index.html +[2]: https://blog.liveedu.tv/regression-versus-classification-machine-learning-whats-the-difference/ +[3]: https://en.wikipedia.org/wiki/Iris_flower_data_set +[4]: https://en.wikipedia.org/wiki/Box_plot +[5]: https://www.liveedu.tv/guides/data-science/ +[6]: https://www.liveedu.tv/andreybu/REaxr-machine-learning-model-python-sklearn-kera/oPGdP-machine-learning-model-python-sklearn-kera/ From 05902bc1d225b9c9c5d54acd86b2df582a491cc8 Mon Sep 17 00:00:00 2001 From: HankChow <280630620@qq.com> Date: Thu, 27 Sep 2018 09:51:24 +0800 Subject: [PATCH 28/39] translated --- ...ing Command Prettier And Easier To Read.md | 131 ------------------ ...ing Command Prettier And Easier To Read.md | 128 +++++++++++++++++ 2 files changed, 128 insertions(+), 131 deletions(-) delete mode 100644 sources/tech/20180924 Make The Output Of Ping Command Prettier And Easier To Read.md create mode 100644 translated/tech/20180924 Make The Output Of Ping Command Prettier And Easier To Read.md diff --git a/sources/tech/20180924 Make The Output Of Ping Command Prettier And Easier To Read.md b/sources/tech/20180924 Make The Output Of Ping Command Prettier And Easier To Read.md deleted file mode 100644 index 7ef713eae4..0000000000 --- a/sources/tech/20180924 Make The Output Of Ping Command Prettier And Easier To Read.md +++ /dev/null @@ -1,131 +0,0 @@ -HankChow translating - -Make The Output Of Ping Command Prettier And Easier To Read -====== - -![](https://www.ostechnix.com/wp-content/uploads/2018/09/prettyping-720x340.png) - -As we all know, the **ping** command is used to check if a target host is reachable or not. Using Ping command, we can send ICMP Echo request to our target host, and verify whether the destination host is up or down. If you use ping command often, I’d like to recommend you to try **“Prettyping”**. Prettyping is just a wrapper for the standard ping tool and makes the output of the ping command prettier, easier to read, colorful and compact. The prettyping runs the standard ping command in the background and parses the output with colors and unicode characters. It is free and open source tool written in **Bash** and **awk** and supports most Unix-like operating systems such as GNU/Linux, FreeBSD and Mac OS X. Prettyping is not only used to make the output of ping command prettier, but also ships with other notable features as listed below. - - * Detects the lost or missing packets and marks them in the output. - * Shows live statistics. The statistics are constantly updated after each response is received, while ping only shows after it ends. - * Smart enough to handle “unknown messages” (like error messages) without messing up the output. - * Avoids printing the repeated messages. - * You can use most common ping parameters with Prettyping. - * Can run as normal user. - * Can be able to redirect the output to a file. - * Requires no installation. Just download the binary, make it executable and run. - * Fast and lightweight. - * And, finally makes the output pretty, colorful and very intuitive. - - - -### Installing Prettyping - -Like I said already, Prettyping does not requires any installation. It is portable application! Just download the Prettyping binary file using command: - -``` -$ curl -O https://raw.githubusercontent.com/denilsonsa/prettyping/master/prettyping -``` - -Move the binary file to your $PATH, for example **/usr/local/bin**. - -``` -$ sudo mv prettyping /usr/local/bin -``` - -And, make it executable as like below: - -``` -$ sudo chmod +x /usr/local/bin/prettyping -``` - -It’s that simple. - -### Let us Make The Output Of Ping Command Prettier And Easier To Read - -Once installed, ping any host or IP address and see the ping command output in graphical way. - -``` -$ prettyping ostechnix.com -``` - -Here is the visually displayed ping output: - -![](https://www.ostechnix.com/wp-content/uploads/2018/09/prettyping-in-action.gif) - -If you run Prettyping without any arguments, it will keep running until you manually stop it by pressing **Ctrl+c**. - -Since Prettyping is just a wrapper to the ping command, you can use most common ping parameters. For instance, you can use **-c** flag to ping a host only a specific number of times, for example **5** : - -``` -$ prettyping -c 5 ostechnix.com -``` - -By default, prettynping displays the output in colored format. Don’t like the colored output? No problem! Use `--nocolor` option. - -``` -$ prettyping --nocolor ostechnix.com -``` - -Similarly, you can disable mult-color support using `--nomulticolor` option: - -``` -$ prettyping --nomulticolor ostechnix.com -``` - -To disable unicode characters, use `--nounicode` option: - -![](https://www.ostechnix.com/wp-content/uploads/2018/09/prettyping-without-unicode-support.png) - -This can be useful if your terminal does not support **UTF-8**. If you can’t fix the unicode (fonts) in your system, simply pass `--nounicode` option. - -Prettyping can redirect the output to a file as well. The following command will write the output of `prettyping ostechnix.com` command in `ostechnix.txt` file. - -``` -$ prettyping ostechnix.com | tee ostechnix.txt -``` - -Prettyping has few more options which helps you to do various tasks, such as, - - * Enable/disable the latency legend. (default value is: enabled) - * Force the output designed to a terminal. (default: auto) - * Use the last “n” pings at the statistics line. (default: 60) - * Override auto-detection of terminal dimensions. - * Override the awk interpreter. (default: awk) - * Override the ping tool. (default: ping) - - - -For more details, view the help section: - -``` -$ prettyping --help -``` - -Even though Prettyping doesn’t add any extra functionality, I personally like the following feature implementations in it: - - * Live statistics – You can see all the live statistics all the time. The standard ping command will only shows the statistics after it ends. - * Compact – You can see a longer timespan at your terminal. - * Prettyping detects missing responses. - - - -If you’re ever looking for a way to visually display the output of the ping command, Prettyping will definitely help. Give it a try, you won’t be disappointed. - -And, that’s all for now. Hope this was useful. More good stuffs to come. Stay tuned! - - - --------------------------------------------------------------------------------- - -via: https://www.ostechnix.com/prettyping-make-the-output-of-ping-command-prettier-and-easier-to-read/ - -作者:[SK][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.ostechnix.com/author/sk/ diff --git a/translated/tech/20180924 Make The Output Of Ping Command Prettier And Easier To Read.md b/translated/tech/20180924 Make The Output Of Ping Command Prettier And Easier To Read.md new file mode 100644 index 0000000000..efca96da23 --- /dev/null +++ b/translated/tech/20180924 Make The Output Of Ping Command Prettier And Easier To Read.md @@ -0,0 +1,128 @@ +如何让 Ping 的输出更简单易读 +====== + +![](https://www.ostechnix.com/wp-content/uploads/2018/09/prettyping-720x340.png) + +众所周知,`ping` 命令可以用来检查目标主机是否可达。使用 `ping` 命令的时候,会发送一个 ICMP Echo 请求,通过目标主机的响应与否来确定目标主机的状态。如果你经常使用 `ping` 命令,你可以尝试一下 `prettyping`。Prettyping 只是将一个标准的 ping 工具增加了一层封装,在运行标准 ping 命令的同时添加了颜色和 unicode 字符解析输出,所以它的输出更漂亮紧凑、清晰易读。它是用 `bash` 和 `awk` 编写的免费开源工具,支持大部分类 Unix 操作系统,包括 GNU/Linux、FreeBSD 和 Mac OS X。Prettyping 除了美化 ping 命令的输出,还有很多值得注意的功能。 + + * 检测丢失的数据包并在输出中标记出来。 + * 显示实时数据。每次收到响应后,都会更新统计数据,而对于普通 ping 命令,只会在执行结束后统计。 + * 能够在输出结果不混乱的前提下灵活处理“未知信息”(例如错误信息)。 + * 能够避免输出重复的信息。 + * 兼容常用的 ping 工具命令参数。 + * 能够由普通用户执行。 + * 可以将输出重定向到文件中。 + * 不需要安装,只需要下载二进制文件,赋予可执行权限即可执行。 + * 快速且轻巧。 + * 输出结果清晰直观。 + + + +### 安装 Prettyping + +如上所述,Prettyping 是一个绿色软件,不需要任何安装,只要使用以下命令下载 Prettyping 二进制文件: + +``` +$ curl -O https://raw.githubusercontent.com/denilsonsa/prettyping/master/prettyping +``` + +将二进制文件放置到 `$PATH`(例如 `/usr/local/bin`)中: + +``` +$ sudo mv prettyping /usr/local/bin +``` + +然后对其赋予可执行权限: + +``` +$ sudo chmod +x /usr/local/bin/prettyping +``` + +就可以使用了。 + +### 让 ping 的输出清晰易读 + +安装完成后,通过 `prettyping` 来 ping 任何主机或 IP 地址,就可以以图形方式查看输出。 + +``` +$ prettyping ostechnix.com +``` + +输出效果大概会是这样: + +![](https://www.ostechnix.com/wp-content/uploads/2018/09/prettyping-in-action.gif) + +如果你不带任何参数执行 `prettyping`,它就会一直运行直到被 ctrl + c 中断。 + +由于 Prettyping 只是一个对普通 ping 命令的封装,所以常用的 ping 参数也是有效的。例如使用 `-c 5` 来指定 ping 一台主机的 5 次: + +``` +$ prettyping -c 5 ostechnix.com +``` + +Prettyping 默认会使用彩色输出,如果你不喜欢彩色的输出,可以加上 `--nocolor` 参数: + +``` +$ prettyping --nocolor ostechnix.com +``` + +同样的,也可以用 `--nomulticolor` 参数禁用多颜色支持: + +``` +$ prettyping --nomulticolor ostechnix.com +``` + +使用 `--nounicode` 参数禁用 unicode 字符: + +![](https://www.ostechnix.com/wp-content/uploads/2018/09/prettyping-without-unicode-support.png) + +如果你的终端不支持 **UTF-8**,或者无法修复系统中的 unicode 字体,只需要加上 `--nounicode` 参数就能轻松解决。 + +Prettyping 支持将输出的内容重定向到文件中,例如执行以下这个命令会将 `prettyping ostechnix.com` 的输出重定向到 `ostechnix.txt` 中: + +``` +$ prettyping ostechnix.com | tee ostechnix.txt +``` + +Prettyping 还有很多选项帮助你完成各种任务,例如: + + * 启用/禁用延时图例(默认启用) + * 强制按照终端的格式输出(默认自动) + * 在统计数据中统计最后的 n 次 ping(默认 60 次) + * 覆盖对终端尺寸的检测 + * 覆盖 awk 解释器(默认不覆盖) + * 覆盖 ping 工具(默认不覆盖) + + + +查看帮助文档可以了解更多: + +``` +$ prettyping --help +``` + +尽管 prettyping 没有添加任何额外功能,但我个人喜欢它的这些优点: + + * 实时统计 - 可以随时查看所有实时统计信息,标准 `ping` 命令只会在命令执行结束后才显示统计信息。 + * 紧凑的显示 - 可以在终端看到更长的时间跨度。 + * 检测丢失的数据包并显示出来。 + + + +如果你一直在寻找可视化显示 `ping` 命令输出的工具,那么 Prettyping 肯定会有所帮助。尝试一下,你不会失望的。 + + + +-------------------------------------------------------------------------------- + +via: https://www.ostechnix.com/prettyping-make-the-output-of-ping-command-prettier-and-easier-to-read/ + +作者:[SK][a] +选题:[lujun9972](https://github.com/lujun9972) +译者:[HankChow](https://github.com/HankChow) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: https://www.ostechnix.com/author/sk/ + From cef6b4d99f7e92f4c82a1b411db32b0072be16fa Mon Sep 17 00:00:00 2001 From: darksun Date: Thu, 27 Sep 2018 09:52:20 +0800 Subject: [PATCH 29/39] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Control=20your=20da?= =?UTF-8?q?ta=20with=20Syncthing:=20An=20open=20source=20synchronization?= =?UTF-8?q?=20tool?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ng- An open source synchronization tool.md | 108 ++++++++++++++++++ 1 file changed, 108 insertions(+) create mode 100644 sources/tech/20180921 Control your data with Syncthing- An open source synchronization tool.md diff --git a/sources/tech/20180921 Control your data with Syncthing- An open source synchronization tool.md b/sources/tech/20180921 Control your data with Syncthing- An open source synchronization tool.md new file mode 100644 index 0000000000..32be152b4c --- /dev/null +++ b/sources/tech/20180921 Control your data with Syncthing- An open source synchronization tool.md @@ -0,0 +1,108 @@ +Control your data with Syncthing: An open source synchronization tool +====== +Decide how to store and share your personal information. + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/bus_cloud_database.png?itok=lhhU42fg) + +These days, some of our most important possessions—from pictures and videos of family and friends to financial and medical documents—are data. And even as cloud storage services are booming, so there are concerns about privacy and lack of control over our personal data. From the PRISM surveillance program to Google [letting app developers scan your personal emails][1], the news is full of reports that should give us all pause regarding the security of our personal information. + +[Syncthing][2] can help put your mind at ease. An open source peer-to-peer file synchronization tool that runs on Linux, Windows, Mac, Android, and others (sorry, no iOS), Syncthing uses its own protocol, called [Block Exchange Protocol][3]. In brief, Syncthing lets you synchronize your data across many devices without owning a server. + +### Linux + +In this post, I will explain how to install and synchronize files between a Linux computer and an Android phone. + +Syncthing is readily available for most popular distributions. Fedora 28 includes the latest version. + +To install Syncthing in Fedora, you can either search for it in Software Center or execute the following command: + +``` +sudo dnf install syncthing syncthing-gtk + +``` + +Once it’s installed, open it. You’ll be welcomed by an assistant to help configure Syncthing. Click **Next** until it asks to configure the WebUI. The safest option is to keep the option **Listen on localhost**. That will disable the web interface and keep unauthorized users away. + +![Syncthing in Setup WebUI dialog box][5] + +Syncthing in Setup WebUI dialog box + +Close the dialog. Now that Syncthing is installed, it’s time to share a folder, connect a device, and start syncing. But first, let’s continue with your other client. + +### Android + +Syncthing is available in Google Play and in F-Droid app stores. + +![](https://opensource.com/sites/default/files/uploads/syncthing2.png) + +Once the application is installed, you’ll be welcomed by a wizard. Grant Syncthing permissions to your storage. You might be asked to disable battery optimization for this application. It is safe to do so as we will optimize the app to synchronize only when plugged in and connected to a wireless network. + +Click on the main menu icon and go to **Settings** , then **Run Conditions**. Tick **Always run in** **the background** , **Run only when charging** , and **Run only on wifi**. Now your Android client is ready to exchange files with your devices. + +There are two important concepts to remember in Syncthing: folders and devices. Folders are what you want to share, but you must have a device to share with. Syncthing allows you to share individual folders with different devices. Devices are added by exchanging device IDs. A device ID is a unique, cryptographically secure identifier that is created when Syncthing starts for the first time. + +### Connecting devices + +Now let’s connect your Linux machine and your Android client. + +In your Linux computer, open Syncthing, click on the **Settings** icon and click **Show ID**. A QR code will show up. + +In your Android mobile, open Syncthing. In the main screen, click the **Devices** tab and press the **+** symbol. In the first field, press the QR code symbol to open the QR scanner. + +Point your mobile camera to the computer QR code. The Device ID** **field will be populated with your desktop client Device ID. Give it a friendly name and save. Because adding a device goes two ways, you now need to confirm on the computer client that you want to add the Android mobile. It might take a couple of minutes for your computer client to ask for confirmation. When it does, click **Add**. + +![](https://opensource.com/sites/default/files/uploads/syncthing6.png) + +In the **New Device** window, you can verify and configure some options about your new device, like the **Device Name** and **Addresses**. If you keep dynamic, it will try to auto-discover the device IP, but if you want to force one, you can add it in this field. If you already created a folder (more on this later), you can also share it with this new device. + +![](https://opensource.com/sites/default/files/uploads/syncthing7.png) + +Your computer and Android are now paired and ready to exchange files. (If you have more than one computer or mobile phone, simply repeat these steps.) + +### Sharing folders + +Now that the devices you want to sync are already connected, it’s time to share a folder. You can share folders on your computer and the devices you add to that folder will get a copy. + +To share a folder, go to **Settings** and click **Add Shared Folder** : + +![](https://opensource.com/sites/default/files/uploads/syncthing8.png) + +In the next window, enter the information of the folder you want to share: + +![](https://opensource.com/sites/default/files/uploads/syncthing9.png) + +You can use any label you want. **Folder ID** will be generated randomly and will be used to identify the folder between the clients. In **Path** , click **Browse** and locate the folder you want to share. If you want Syncthing to monitor the folder for changes (such as deletes, new files, etc.), click **Monitor filesystem for changes**. + +Remember, when you share a folder, any change that happens on the other clients will be reflected on every single device. That means that if you share a folder containing pictures with other computers or mobile devices, changes in these other clients will be reflected everywhere. If this is not what you want, you can make your folder “Send Only” so it will send files to the clients, but the other clients’ changes won’t be synced. + +When this is done, go to **Share with Devices** and select the hosts you want to sync with your folder: + +All the devices you select will need to accept the share request; you will get a notification from the devices: + +Just as when you shared the folder, you must configure the new shared folder: + +![](https://opensource.com/sites/default/files/uploads/syncthing12.png) + +Again, here you can define any label, but the ID must match each client. In the folder option, select the destination for the folder and its files. Remember that any change done in this folder will be reflected with every device allowed in the folder. + +These are the steps to connect devices and share folders with Syncthing. It might take a few minutes to start copying, depending on your network settings or if you are not on the same network. + +Syncthing offers many more great features and options. Try it—and take control of your data. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/9/take-control-your-data-syncthing + +作者:[Michael Zamot][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://opensource.com/users/mzamot +[1]: https://gizmodo.com/google-says-it-doesnt-go-through-your-inbox-anymore-bu-1827299695 +[2]: https://syncthing.net/ +[3]: https://docs.syncthing.net/specs/bep-v1.html +[4]: /file/410191 +[5]: https://opensource.com/sites/default/files/uploads/syncthing1.png (Syncthing in Setup WebUI dialog box) From f068057d362c6ec76f86eeae022fa459306ae2a8 Mon Sep 17 00:00:00 2001 From: darksun Date: Thu, 27 Sep 2018 09:55:43 +0800 Subject: [PATCH 30/39] =?UTF-8?q?=E9=80=89=E9=A2=98:=20How=20to=20Install?= =?UTF-8?q?=20Cinnamon=20Desktop=20on=20Ubuntu?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...w to Install Cinnamon Desktop on Ubuntu.md | 80 +++++++++++++++++++ 1 file changed, 80 insertions(+) create mode 100644 sources/tech/20140805 How to Install Cinnamon Desktop on Ubuntu.md 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 new file mode 100644 index 0000000000..78ba32e2a2 --- /dev/null +++ b/sources/tech/20140805 How to Install Cinnamon Desktop on Ubuntu.md @@ -0,0 +1,80 @@ +How to Install Cinnamon Desktop on Ubuntu +====== +**This tutorial shows you how to install Cinnamon desktop environment on Ubuntu.** + +[Cinnamon][1] is the default desktop environment of [Linux Mint][2]. Unlike Unity desktop environment in Ubuntu, Cinnamon is more traditional but elegant looking desktop environment with the bottom panel and app menu etc. Many Windows migrants [prefer Linux Mint over Ubuntu][3] because of Cinnamon desktop and its Windows-resembling user interface. + +Now, you don’t need to [install Linux Mint][4] just for trying Cinnamon. In this tutorial, I’ll show you **how to install Cinnamon in Ubuntu 18.04, 16.04 and 14.04**. + +You should note something before you install Cinnamon desktop on Ubuntu. Sometimes, installing additional desktop environments leads to conflict between the desktop environments. This may result in a broken session, broken applications and features etc. This is why you should be careful in making this choice. + +### How to Install Cinnamon on Ubuntu + +![How to install cinnamon desktop on Ubuntu Linux][5] + +There used to be a-sort-of official PPA from Cinnamon team for Ubuntu but it doesn’t exist anymore. Don’t lose heart. There is an unofficial PPA available and it works perfectly. This PPA consists of the latest Cinnamon version. + +Open a terminal and use the following commands: + +``` +sudo add-apt-repository ppa:embrosyn/cinnamon +sudo apt update && sudo apt install cinnamon + +``` + +It will download files of around 150 MB in size (if I remember correctly). This also provides you with Nemo (Nautilus fork) and Cinnamon Control Center. This bonus stuff gives a closer feel of Linux Mint. + +### Using Cinnamon desktop environment in Ubuntu + +Once you have installed Cinnamon, log out of the current session. At the login screen, click on the Ubuntu symbol beside the username: + +![](https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2014/08/Change_Desktop_Environment_Ubuntu.jpeg) + +When you do this, it will give you all the desktop environments available for your system. No need to tell you that you have to choose Cinnamon: + +![](https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2014/08/Install_Cinnamon_Ubuntu.jpeg) + +Now you should be logged in to Ubuntu with Cinnamon desktop environment. Remember, you can do the same to switch back to Unity. Here is a quick screenshot of what it looked like to run **Cinnamon in Ubuntu** : + +![](https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2014/08/Cinnamon_Ubuntu_1404.jpeg) + +Looks completely like Linux Mint, isn’t it? I didn’t find any compatibility issue between Cinnamon and Unity. I switched back and forth between Unity and Cinnamon and both worked perfectly. + +#### Remove Cinnamon from Ubuntu + +It is understandable that you might want to uninstall Cinnamon. We will use PPA Purge for this purpose. Let’s install PPA Purge first: + +``` +sudo apt-get install ppa-purge + +``` + +Afterward, use the following command to purge the PPA: + +``` +sudo ppa-purge ppa:embrosyn/cinnamon + +``` + +In related articles, I suggest you to read more about [how to remove PPA in Linux][6]. + +I hope this post helps you to **install Cinnamon in Ubuntu**. Do share your experience with Cinnamon. + +-------------------------------------------------------------------------------- + +via: https://itsfoss.com/install-cinnamon-on-ubuntu/ + +作者:[Abhishek Prakash][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/abhishek/ +[1]: http://cinnamon.linuxmint.com/ +[2]: http://www.linuxmint.com/ +[3]: https://itsfoss.com/linux-mint-vs-ubuntu/ +[4]: https://itsfoss.com/guide-install-linux-mint-16-dual-boot-windows/ +[5]: https://4bds6hergc-flywheel.netdna-ssl.com/wp-content/uploads/2018/09/install-cinnamon-ubuntu.png +[6]: https://itsfoss.com/how-to-remove-or-delete-ppas-quick-tip/ From 34d2cd8445f64a60f280c7577f5995cedb1f8ce6 Mon Sep 17 00:00:00 2001 From: darksun Date: Thu, 27 Sep 2018 10:01:51 +0800 Subject: [PATCH 31/39] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Distributed=20traci?= =?UTF-8?q?ng=20in=20a=20microservices=20world?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ibuted tracing in a microservices world.md | 113 ++++++++++++++++++ 1 file changed, 113 insertions(+) create mode 100644 sources/tech/20180920 Distributed tracing in a microservices world.md diff --git a/sources/tech/20180920 Distributed tracing in a microservices world.md b/sources/tech/20180920 Distributed tracing in a microservices world.md new file mode 100644 index 0000000000..1b39a5e30a --- /dev/null +++ b/sources/tech/20180920 Distributed tracing in a microservices world.md @@ -0,0 +1,113 @@ +Distributed tracing in a microservices world +====== +What is distributed tracing and why is it so important in a microservices environment? + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/pixelated-world.png?itok=fHjM6m53) + +[Microservices][1] have become the default choice for greenfield applications. After all, according to practitioners, microservices provide the type of decoupling required for a full digital transformation, allowing individual teams to innovate at a far greater speed than ever before. + +Microservices are nothing more than regular distributed systems, only at a larger scale. Therefore, they exacerbate the well-known problems that any distributed system faces, like lack of visibility into a business transaction across process boundaries. + +Given that it's extremely common to have multiple versions of a single service running in production at the same time—be it in a [A/B testing][2] scenario or as part of rolling out a new release following the [Canary release][3] technique—when we account for the fact that we are talking about hundreds of services, it's clear that what we have is chaos. It's almost impossible to map the interdependencies and understand the path of a business transaction across services and their versions. + +### Observability + +This chaos ends up being a good thing, as long as we can observe what's going on and diagnose the problems that will eventually occur. + +A system is said to be observable when we can understand its state based on the [metrics, logs, and traces][4] it emits. Given that we are talking about distributed systems, knowing the state of a single instance of a single service isn't enough; we need to be able to aggregate the metrics for all instances of a given service, perhaps grouped by version. Metrics solutions like [Prometheus][5] are very popular in tackling this aspect of the observability problem. Similarly, we need logs to be stored in a central location, as it's impossible to analyze the logs from the individual instances of each service. [Logstash][6] is usually applied here, in combination with a backing storage like [Elasticsearch][7]. And finally, we need to get end-to-end traces to understand the path a given transaction has taken. This is where distributed tracing solutions come into play. + +### Distributed tracing + +In monolithic web applications, logging frameworks provide enough capabilities to do a basic root-cause analysis when something fails. A developer just needs to place log statements in the code. Information like "context" (usually "thread") and "timestamp" are automatically added to the log entry, making it easier to understand the execution of a given request and correlate the entries. + +``` +Thread-1 2018-09-03T15:52:54+02:00 Request started +Thread-2 2018-09-03T15:52:55+02:00 Charging credit card x321 +Thread-1 2018-09-03T15:52:55+02:00 Order submitted +Thread-1 2018-09-03T15:52:56+02:00 Charging credit card x123 +Thread-1 2018-09-03T15:52:57+02:00 Changing order status +Thread-1 2018-09-03T15:52:58+02:00 Dispatching event to inventory +Thread-1 2018-09-03T15:52:59+02:00 Request finished +``` + +We can safely say that the second log entry above is not related to the other entries, as it's being executed in a different thread. + +In microservices architectures, logging alone fails to deliver the complete picture. Is this service the first one in the call chain? And what happened at the inventory service (where we apparently dispatched an event)? + +A common strategy to answer this question is creating an identifier at the very first building block of our transaction and propagating this identifier across all the calls, probably by sending it as an HTTP header whenever a remote call is made. + +In a central log collector, we could then see entries like the ones below. Note how we could log the correlation ID (the first column in our example), so we know that the second entry is not related to the other entries. + +``` +abc123 Order     2018-09-03T15:52:58+02:00 Dispatching event to inventory +def456 Order     2018-09-03T15:52:58+02:00 Dispatching event to inventory +abc123 Inventory 2018-09-03T15:52:59+02:00 Received `order-submitted` event +abc123 Inventory 2018-09-03T15:53:00+02:00 Checking inventory status +abc123 Inventory 2018-09-03T15:53:01+02:00 Updating inventory +abc123 Inventory 2018-09-03T15:53:02+02:00 Preparing order manifest +``` + +This technique is one of the concepts at the core of any modern distributed tracing solution, but it's not really new; correlating log entries is decades old, probably as old as "distributed systems" itself. + +What sets distributed tracing apart from regular logging is that the data structure that holds tracing data is more specialized, so we can also identify causality. Looking at the log entries above, it's hard to tell if the last step was caused by the previous entry, if they were performed concurrently, or if they share the same caller. Having a dedicated data structure also allows distributed tracing to record not only a message in a single point in time but also the start and end time of a given procedure. + +![Trace showing spans][9] + +Trace showing spans similar to the logs described above + +[Click to enlarge][10] + +Most of the modern distributed tracing tools are inspired by a 2010 [paper about Dapper][11], the distributed tracing solution used at Google. In that paper, the data structure described above was called a span, and you can see nine of them in the image above. This particular "forest" of spans is called a trace and is equivalent to the correlated log entries we've seen before. + +The image above is a screenshot of a trace displayed in [Jaeger][12], an open source distributed tracing solution hosted by the [Cloud Native Computing Foundation (CNCF)][13]. It marks each service with a color to make it easier to see the process boundaries. Timing information can be easily visualized, both by looking at the macro timeline at the top of the screen or at the individual spans, giving a sense of how long each span takes and how impactful it is in this particular execution. It's also easy to observe when processes are asynchronous and therefore may outlive the initial request. + +Like with logging, we need to annotate or instrument our code with the data we want to record. Unlike logging, we record spans instead of messages and do some demarcation to know when the span starts and finishes so we can get accurate timing information. As we would probably like to have our business code independent from a specific distributed tracing implementation, we can use an API such as [OpenTracing][14], leaving the decision about the concrete implementation as a packaging or runtime concern. Following is pseudo-Java code showing such demarcation. + +``` +try (Scope scope = tracer.buildSpan("submitOrder").startActive(true)) { +    scope.span().setTag("order-id", "c85b7644b6b5"); +    chargeCreditCard(); +    changeOrderStatus(); +    dispatchEventToInventory(); +} +``` + +Given the nature of the distributed tracing concept, it's clear the code executed "between" our business services can also be part of the trace. For instance, we could [turn on][15] the distributed tracing integration for [Istio][16], a service mesh solution that helps in the communication between microservices, and we'll suddenly have a better picture about the network latency and routing decisions made at this layer. Another example is the work done in the OpenTracing community to provide instrumentation for popular stacks, frameworks, and APIs, such as Java's [JAX-RS][17], [Spring Cloud][18], or [JDBC][19]. This enables us to see how our business code interacts with the rest of the middleware, understand where a potential problem might be happening, and identify the best areas to improve. In fact, today's middleware instrumentation is so rich that it's common to get started with distributed tracing by using only the so-called "framework instrumentation," leaving the business code free from any tracing-related code. + +While a microservices architecture is almost unavoidable nowadays for established companies to innovate faster and for ambitious startups to achieve web scale, it's easy to feel helpless while conducting a root cause analysis when something eventually fails and the right tools aren't available. The good news is tools like Prometheus, Logstash, OpenTracing, and Jaeger provide the pieces to bring observability to your application. + +Juraci Paixão Kröhling will present [What are My Microservices Doing?][20] at [Open Source Summit Europe][21], October 22-24 in Edinburgh, Scotland. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/9/distributed-tracing-microservices-world + +作者:[Juraci Paixão Kröhling][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://opensource.com/users/jpkroehling +[1]: https://en.wikipedia.org/wiki/Microservices +[2]: https://en.wikipedia.org/wiki/A/B_testing +[3]: https://martinfowler.com/bliki/CanaryRelease.html +[4]: https://blog.twitter.com/engineering/en_us/a/2016/observability-at-twitter-technical-overview-part-i.html +[5]: https://prometheus.io/ +[6]: https://github.com/elastic/logstash +[7]: https://github.com/elastic/elasticsearch +[8]: /file/409621 +[9]: https://opensource.com/sites/default/files/uploads/distributed-trace.png (Trace showing spans) +[10]: /sites/default/files/uploads/trace.png +[11]: https://ai.google/research/pubs/pub36356 +[12]: https://www.jaegertracing.io/ +[13]: https://www.cncf.io/ +[14]: http://opentracing.io/ +[15]: https://istio.io/docs/tasks/telemetry/distributed-tracing/ +[16]: https://istio.io/ +[17]: https://github.com/opentracing-contrib/java-jaxrs +[18]: https://github.com/opentracing-contrib/java-spring-cloud +[19]: https://github.com/opentracing-contrib/java-jdbc +[20]: https://osseu18.sched.com/event/FxW3/what-are-my-microservices-doing-juraci-paixao-krohling-red-hat# +[21]: https://osseu18.sched.com/ From 5e8fd9321d044fb0d573b835cfec1124215130ca Mon Sep 17 00:00:00 2001 From: HankChow <280630620@qq.com> Date: Thu, 27 Sep 2018 10:08:24 +0800 Subject: [PATCH 32/39] hankchow translating --- ...To Find Out Which Port Number A Process Is Using In Linux.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sources/tech/20180924 How To Find Out Which Port Number A Process Is Using In Linux.md b/sources/tech/20180924 How To Find Out Which Port Number A Process Is Using In Linux.md index 21b6633730..add3ce719e 100644 --- a/sources/tech/20180924 How To Find Out Which Port Number A Process Is Using In Linux.md +++ b/sources/tech/20180924 How To Find Out Which Port Number A Process Is Using In Linux.md @@ -1,3 +1,5 @@ +HankChow translating + How To Find Out Which Port Number A Process Is Using In Linux ====== As a Linux administrator, you should know whether the corresponding service is binding/listening with correct port or not. From 5adaffeea5ff72b674b3bfcb52fbd2f59413ff98 Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 27 Sep 2018 10:28:38 +0800 Subject: [PATCH 33/39] PRF:20180910 13 Keyboard Shortcut Every Ubuntu 18.04 User Should Know.md @XiatianSummer --- ...cut Every Ubuntu 18.04 User Should Know.md | 97 ++++++++++--------- 1 file changed, 49 insertions(+), 48 deletions(-) diff --git a/translated/tech/20180910 13 Keyboard Shortcut Every Ubuntu 18.04 User Should Know.md b/translated/tech/20180910 13 Keyboard Shortcut Every Ubuntu 18.04 User Should Know.md index c946493a6c..461e586b2d 100644 --- a/translated/tech/20180910 13 Keyboard Shortcut Every Ubuntu 18.04 User Should Know.md +++ b/translated/tech/20180910 13 Keyboard Shortcut Every Ubuntu 18.04 User Should Know.md @@ -1,82 +1,83 @@ 每位 Ubuntu 18.04 用户都应该知道的快捷键 ====== + 了解快捷键能够提升您的生产力。这里有一些实用的 Ubuntu 快捷键助您像专业人士一样使用 Ubuntu。 -您可以使用有键盘和鼠标组合的操作系统。 +您可以用键盘和鼠标组合来使用操作系统。 -注意:本文中提到的键盘快捷键适用于 Ubuntu 18.04 GNOME 版。 通常,它们中的大多数(或者全部)也适用于其他的 Ubuntu 版本,但我不能够保证。 +> 注意:本文中提到的键盘快捷键适用于 Ubuntu 18.04 GNOME 版。 通常,它们中的大多数(或者全部)也适用于其他的 Ubuntu 版本,但我不能够保证。 ![Ubuntu keyboard shortcuts][1] ### 实用的 Ubuntu 快捷键 -让我们来看一看 Ubuntu GNOME 必备的快捷键吧!通用的快捷键如 Ctrl+C(复制),Ctrl+V(粘贴)或者 Ctrl+S(保存)不再赘述。 +让我们来看一看 Ubuntu GNOME 必备的快捷键吧!通用的快捷键如 `Ctrl+C`(复制)、`Ctrl+V`(粘贴)或者 `Ctrl+S`(保存)不再赘述。 -注意:Linux 中的 Super 键即键盘上带有 Windows 图标的键,本文中我使用了大写字母,但这不代表你需要按下 shift 键,比如,T 代表键盘上的‘t’键,而不代表 Shift+t。 +注意:Linux 中的 Super 键即键盘上带有 Windows 图标的键,本文中我使用了大写字母,但这不代表你需要按下 `shift` 键,比如,`T` 代表键盘上的 ‘t’ 键,而不代表 `Shift+t`。 -#### 1\. Super 键:打开活动搜索界面 +#### 1、 Super 键:打开活动搜索界面 -使用 Super 键可以打开活动菜单。如果你只能在 Ubuntu 上使用一个快捷键,那只能是 Super 键。 +使用 `Super` 键可以打开活动菜单。如果你只能在 Ubuntu 上使用一个快捷键,那只能是 `Super` 键。 -想要打开一个应用程序?按下 Super 键然后搜索应用程序。如果搜索的应用程序未安装,它会推荐来自应用中心的应用程序。 +想要打开一个应用程序?按下 `Super` 键然后搜索应用程序。如果搜索的应用程序未安装,它会推荐来自应用中心的应用程序。 -想要看看有哪些正在运行的程序?按下 Super 键,屏幕上就会显示所有正在运行的 GUI 应用程序。 +想要看看有哪些正在运行的程序?按下 `Super` 键,屏幕上就会显示所有正在运行的 GUI 应用程序。 -想要使用工作区吗?只需按下 Super 键,您就可以在屏幕右侧看到工作区选项。 +想要使用工作区吗?只需按下 `Super` 键,您就可以在屏幕右侧看到工作区选项。 -#### 2\. Ctrl+Alt+T:打开 Ubuntu 终端窗口 +#### 2、 Ctrl+Alt+T:打开 Ubuntu 终端窗口 ![Ubuntu Terminal Shortcut][2] *使用 Ctrl+alt+T 来打开终端窗口* -想要打开一个新的终端,您只需使用快捷键 Ctrl+Alt+T。这是我在 Ubuntu 中最喜欢的键盘快捷键。 甚至在我的许多 FOSS 教程中,当需要打开终端窗口是,我都会提到这个快捷键。 +想要打开一个新的终端,您只需使用快捷键 `Ctrl+Alt+T`。这是我在 Ubuntu 中最喜欢的键盘快捷键。 甚至在我的许多 FOSS 教程中,当需要打开终端窗口是,我都会提到这个快捷键。 -#### 3\. Super+L 或 Ctrl——Alt+L:锁屏 +#### 3、 Super+L 或 Ctrl+Alt+L:锁屏 -当您离开电脑时锁定屏幕,是最基本的安全习惯之一。您可以使用 Super + L 快捷键,而不是繁琐地点击屏幕右上角然后选择锁定屏幕选项。 +当您离开电脑时锁定屏幕,是最基本的安全习惯之一。您可以使用 `Super+L` 快捷键,而不是繁琐地点击屏幕右上角然后选择锁定屏幕选项。 -有些系统也会使用 Ctrl+Alt+L 键锁定屏幕。 +有些系统也会使用 `Ctrl+Alt+L` 键锁定屏幕。 -#### 4\. Super+D or Ctrl+Alt+D:显示桌面 +#### 4、 Super+D or Ctrl+Alt+D:显示桌面 -按下 Super + D 可以最小化所有正在运行的应用程序窗口并显示桌面。 +按下 `Super+D` 可以最小化所有正在运行的应用程序窗口并显示桌面。 -再次按 Super + D 将重新打开所有正在运行的应用程序窗口,像之前一样。 +再次按 `Super+D` 将重新打开所有正在运行的应用程序窗口,像之前一样。 -您也可以使用 Ctrl + Alt + D 来实现此目的。 +您也可以使用 `Ctrl+Alt+D` 来实现此目的。 -#### 5\. Super+A:显示应用程序菜单 +#### 5、 Super+A:显示应用程序菜单 -您可以通过单击屏幕左下角的 9个点打开 Ubuntu 18.04 GNOME 中的应用程序菜单。 但是一个更快捷的方法是使用 Super + A 快捷键。 +您可以通过单击屏幕左下角的 9 个点打开 Ubuntu 18.04 GNOME 中的应用程序菜单。 但是一个更快捷的方法是使用 `Super+A` 快捷键。 它将显示应用程序菜单,您可以在其中查看或搜索系统上已安装的应用程序。 -您可以使用 Esc 键退出应用程序菜单界面。 +您可以使用 `Esc` 键退出应用程序菜单界面。 -#### 6\. Super+Tab or Alt+Tab:在运行中的应用程序间切换 +#### 6、 Super+Tab 或 Alt+Tab:在运行中的应用程序间切换 -如果您运行的应用程序不止一个,则可以使用 Super + Tab 或 Alt + Tab 快捷键在应用程序之间切换。 +如果您运行的应用程序不止一个,则可以使用 `Super+Tab` 或 `Alt+Tab` 快捷键在应用程序之间切换。 -按住 Super 键同时按下 Tab 键,即可显示应用程序切换器。 按住 Super 的同时,继续点击 Tab 键在应用程序之间进行选择。 当光标在所需的应用程序上时,松开 Super 和 Tab 键。 +按住 `Super` 键同时按下 `Tab` 键,即可显示应用程序切换器。 按住 `Super` 的同时,继续按下 `Tab` 键在应用程序之间进行选择。 当光标在所需的应用程序上时,松开 `Super` 和 `Tab` 键。 -默认情况下,应用程序切换器从左向右移动。 如果要从右向左移动,可使用 Super + Shift + Tab 快捷键。 +默认情况下,应用程序切换器从左向右移动。 如果要从右向左移动,可使用 `Super+Shift+Tab` 快捷键。 -在这里您也可以用 Alt 键代替 Super 键。 +在这里您也可以用 `Alt` 键代替 `Super` 键。 -提示:如果有多个应用程序实例,您可以使用 Super + \` 快捷键在这些实例之间切换。 +> 提示:如果有多个应用程序实例,您可以使用 Super+` 快捷键在这些实例之间切换。 -#### 7\. Super+Arrow keys: 移动窗口位置 +#### 7、 Super+箭头:移动窗口位置 -这个快捷键也适用于 Windows 系统。 使用应用程序时,按下 Super 和左箭头键,应用程序将贴合屏幕的左边缘,占用屏幕的左半边。 +这个快捷键也适用于 Windows 系统。 使用应用程序时,按下 `Super+左箭头`,应用程序将贴合屏幕的左边缘,占用屏幕的左半边。 -同样,按下 Super 和右箭头键会使应用程序贴合右边缘。 +同样,按下 `Super+右箭头`会使应用程序贴合右边缘。 -按下 Super 和上箭头键将最大化应用程序窗口,超级和下箭头将使应用程序恢复到其正常的大小。 +按下 `Super+上箭头`将最大化应用程序窗口,`Super+下箭头`将使应用程序恢复到其正常的大小。 -#### 8\. Super+M: 切换到通知栏 +#### 8、 Super+M:切换到通知栏 GNOME 中有一个通知栏,您可以在其中查看系统和应用程序活动的通知,这里也有一个日历。 @@ -84,19 +85,19 @@ GNOME 中有一个通知栏,您可以在其中查看系统和应用程序活 *通知栏* -使用 Super + M 快捷键,您可以打开此通知栏。 如果再次按这些键,将关闭打开的通知托盘。 +使用 `Super+M` 快捷键,您可以打开此通知栏。 如果再次按这些键,将关闭打开的通知托盘。 -使用 Super+V 也可实现相同的功能。 +使用 `Super+V` 也可实现相同的功能。 -#### 9\. Super+Space:切换输入法(用于多语言设置) +#### 9、 Super+空格:切换输入法(用于多语言设置) 如果您使用多种语言,可能您的系统上安装了多个输入法。 例如,我需要在 Ubuntu 上同时使用[印地语] [4]和英语,所以我安装了印地语(梵文)输入法以及默认的英语输入法。 -如果您也使用多语言设置,则可以使用 Super + Space 快捷键快速更改输入法。 +如果您也使用多语言设置,则可以使用 `Super+空格` 快捷键快速更改输入法。 -#### 10\. Alt+F2:运行控制台 +#### 10、 Alt+F2:运行控制台 -这适用于高级用户。 如果要运行快速命令,而不是打开终端并在其中运行命令,则可以使用 Alt + F2 运行控制台。 +这适用于高级用户。 如果要运行快速命令,而不是打开终端并在其中运行命令,则可以使用 `Alt+F2` 运行控制台。 ![Alt+F2 to run commands in Ubuntu][5] @@ -104,31 +105,31 @@ GNOME 中有一个通知栏,您可以在其中查看系统和应用程序活 当您使用只能在终端运行的应用程序时,这尤其有用。 -#### 11\. Ctrl+Q:关闭应用程序窗口 +#### 11、 Ctrl+Q:关闭应用程序窗口 -如果您有正在运行的应用程序,可以使用 Ctrl + Q 快捷键关闭应用程序窗口。您也可以使用 Ctrl + W 来实现此目的。 +如果您有正在运行的应用程序,可以使用 `Ctrl+Q` 快捷键关闭应用程序窗口。您也可以使用 `Ctrl+W` 来实现此目的。 -Alt + F4 是关闭应用程序窗口更“通用”的快捷方式。 +`Alt+F4` 是关闭应用程序窗口更“通用”的快捷方式。 它不适用于一些应用程序,如 Ubuntu 中的默认终端。 -#### 12\. Ctrl+Alt+arrow:切换工作区 +#### 12、 Ctrl+Alt+箭头:切换工作区 ![Workspace switching][6] *切换工作区* -如果您是使用工作区的重度用户,可以使用 Ctrl + Alt + 上箭头和 Ctrl + Alt + 下箭头键在工作区之间切换。 +如果您是使用工作区的重度用户,可以使用 `Ctrl+Alt+上箭头`和 `Ctrl+Alt+下箭头`在工作区之间切换。 -#### 13\. Ctrl+Alt+Del:注销 +#### 13、 Ctrl+Alt+Del:注销 -不会!在 Linux 中使用著名的快捷键 Ctrl+Alt+Del 并不会像在 Windows 中一样打开任务管理器(除非您使用自定义快捷键)。 +不!在 Linux 中使用著名的快捷键 `Ctrl+Alt+Del` 并不会像在 Windows 中一样打开任务管理器(除非您使用自定义快捷键)。 ![Log Out Ubuntu][7] *注销* -在普通的 GNOME 桌面环境中,您可以使用 Ctrl + Alt + Del 键打开关机菜单,但 Ubuntu 并不总是遵循此规范,因此当您在 Ubuntu 中使用 Ctrl + Alt + Del 键时,它会打开注销菜单。 +在普通的 GNOME 桌面环境中,您可以使用 `Ctrl+Alt+Del` 键打开关机菜单,但 Ubuntu 并不总是遵循此规范,因此当您在 Ubuntu 中使用 `Ctrl+Alt+Del` 键时,它会打开注销菜单。 ### 在 Ubuntu 中使用自定义键盘快捷键 @@ -142,7 +143,7 @@ Alt + F4 是关闭应用程序窗口更“通用”的快捷方式。 ### Ubuntu 中你最喜欢的键盘快捷键是什么? -快捷键永无止境。如果需要,你可以看一看所有可能的 [GNOME 快捷键][9],看其中有没有你需要用到的快捷键。 +快捷键无穷无尽。如果需要,你可以看一看所有可能的 [GNOME 快捷键][9],看其中有没有你需要用到的快捷键。 您可以学习使用您经常使用应用程序的快捷键,这是很有必要的。例如,我使用 Kazam 进行[屏幕录制][10],键盘快捷键帮助我方便地暂停和开始录像。 @@ -155,7 +156,7 @@ via: https://itsfoss.com/ubuntu-shortcuts/ 作者:[Abhishek Prakash][a] 选题:[lujun9972](https://github.com/lujun9972) 译者:[XiatianSummer](https://github.com/XiatianSummer) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 0df4be75d82336f5d52527caeed0bb6e0048a64e Mon Sep 17 00:00:00 2001 From: "Xingyu.Wang" Date: Thu, 27 Sep 2018 10:29:05 +0800 Subject: [PATCH 34/39] PUB: 20180910 13 Keyboard Shortcut Every Ubuntu 18.04 User Should Know.md @XiatianSummer https://linux.cn/article-10055-1.html --- ...10 13 Keyboard Shortcut Every Ubuntu 18.04 User Should Know.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20180910 13 Keyboard Shortcut Every Ubuntu 18.04 User Should Know.md (100%) diff --git a/translated/tech/20180910 13 Keyboard Shortcut Every Ubuntu 18.04 User Should Know.md b/published/20180910 13 Keyboard Shortcut Every Ubuntu 18.04 User Should Know.md similarity index 100% rename from translated/tech/20180910 13 Keyboard Shortcut Every Ubuntu 18.04 User Should Know.md rename to published/20180910 13 Keyboard Shortcut Every Ubuntu 18.04 User Should Know.md From 5adec56c31704b87574b79172f08a84067a47903 Mon Sep 17 00:00:00 2001 From: qhwdw <33189910+qhwdw@users.noreply.github.com> Date: Thu, 27 Sep 2018 11:02:04 +0800 Subject: [PATCH 35/39] Translating by qhwdw (#10386) --- ...jarne Stroustrup warns of dangerous future plans for his C.md | 1 + 1 file changed, 1 insertion(+) 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 index 04644aebb2..2f9a6636e7 100644 --- 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 @@ -1,3 +1,4 @@ +Translating by qhwdw What's all the C Plus Fuss? Bjarne Stroustrup warns of dangerous future plans for his C++ ====== From cd46ac6cdcad976bf41515ada5417effc6f328e8 Mon Sep 17 00:00:00 2001 From: MjSeven <33125422+MjSeven@users.noreply.github.com> Date: Thu, 27 Sep 2018 11:08:55 +0800 Subject: [PATCH 36/39] Update 20171129 How to Install and Use Wireshark on Debian and Ubuntu 16.04_17.10.md --- ...stall and Use Wireshark on Debian and Ubuntu 16.04_17.10.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sources/tech/20171129 How to Install and Use Wireshark on Debian and Ubuntu 16.04_17.10.md b/sources/tech/20171129 How to Install and Use Wireshark on Debian and Ubuntu 16.04_17.10.md index ce2ed658a4..05e441207f 100644 --- a/sources/tech/20171129 How to Install and Use Wireshark on Debian and Ubuntu 16.04_17.10.md +++ b/sources/tech/20171129 How to Install and Use Wireshark on Debian and Ubuntu 16.04_17.10.md @@ -1,3 +1,6 @@ +Translating by MjSeven + + How to Install and Use Wireshark on Debian 9 / Ubuntu 16.04 / 17.10 ============================================================ From c1072e3ab6e5cab92e016228e0b937ffa77f63d0 Mon Sep 17 00:00:00 2001 From: MjSeven <33125422+MjSeven@users.noreply.github.com> Date: Thu, 27 Sep 2018 15:52:30 +0800 Subject: [PATCH 37/39] =?UTF-8?q?=20=E7=BF=BB=E8=AF=91=E5=AE=8C=E6=AF=95?= =?UTF-8?q?=20(#10388)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * Delete 20171129 How to Install and Use Wireshark on Debian and Ubuntu 16.04_17.10.md * Create 20171129 How to Install and Use Wireshark on Debian and Ubuntu 16.04_17.10.md --- ...eshark on Debian and Ubuntu 16.04_17.10.md | 185 ------------------ ...eshark on Debian and Ubuntu 16.04_17.10.md | 183 +++++++++++++++++ 2 files changed, 183 insertions(+), 185 deletions(-) delete mode 100644 sources/tech/20171129 How to Install and Use Wireshark on Debian and Ubuntu 16.04_17.10.md create mode 100644 translated/tech/20171129 How to Install and Use Wireshark on Debian and Ubuntu 16.04_17.10.md diff --git a/sources/tech/20171129 How to Install and Use Wireshark on Debian and Ubuntu 16.04_17.10.md b/sources/tech/20171129 How to Install and Use Wireshark on Debian and Ubuntu 16.04_17.10.md deleted file mode 100644 index 05e441207f..0000000000 --- a/sources/tech/20171129 How to Install and Use Wireshark on Debian and Ubuntu 16.04_17.10.md +++ /dev/null @@ -1,185 +0,0 @@ -Translating by MjSeven - - -How to Install and Use Wireshark on Debian 9 / Ubuntu 16.04 / 17.10 -============================================================ - -by [Pradeep Kumar][1] · Published November 29, 2017 · Updated November 29, 2017 - - [![wireshark-Debian-9-Ubuntu 16.04 -17.10](https://www.linuxtechi.com/wp-content/uploads/2017/11/wireshark-Debian-9-Ubuntu-16.04-17.10.jpg)][2] - -Wireshark is free and open source, cross platform, GUI based Network packet analyzer that is available for Linux, Windows, MacOS, Solaris etc. It captures network packets in real time & presents them in human readable format. Wireshark allows us to monitor the network packets up to microscopic level. Wireshark also has a command line utility called ‘tshark‘ that performs the same functions as Wireshark but through terminal & not through GUI. - -Wireshark can be used for network troubleshooting, analyzing, software & communication protocol development & also for education purposed. Wireshark uses a library called ‘pcap‘ for capturing the network packets. - -Wireshark comes with a lot of features & some those features are; - -* Support for a hundreds of protocols for inspection, - -* Ability to capture packets in real time & save them for later offline analysis, - -* A number of filters to analyzing data, - -* Data captured can be compressed & uncompressed on the fly, - -* Various file formats for data analysis supported, output can also be saved to XML, CSV, plain text formats, - -* data can be captured from a number of interfaces like ethernet, wifi, bluetooth, USB, Frame relay , token rings etc. - -In this article, we will discuss how to install Wireshark on Ubuntu/Debain machines & will also learn to use Wireshark for capturing network packets. - -#### Installation of Wireshark on Ubuntu 16.04 / 17.10 - -Wireshark is available with default Ubuntu repositories & can be simply installed using the following command. But there might be chances that you will not get the latest version of wireshark. - -``` -linuxtechi@nixworld:~$ sudo apt-get update -linuxtechi@nixworld:~$ sudo apt-get install wireshark -y -``` - -So to install latest version of wireshark we have to enable or configure official wireshark repository. - -Use the beneath commands one after the another to configure repository and to install latest version of Wireshark utility - -``` -linuxtechi@nixworld:~$ sudo add-apt-repository ppa:wireshark-dev/stable -linuxtechi@nixworld:~$ sudo apt-get update -linuxtechi@nixworld:~$ sudo apt-get install wireshark -y -``` - -Once the Wireshark is installed execute the below command so that non-root users can capture live packets of interfaces, - -``` -linuxtechi@nixworld:~$ sudo setcap 'CAP_NET_RAW+eip CAP_NET_ADMIN+eip' /usr/bin/dumpcap -``` - -#### Installation of Wireshark on Debian 9 - -Wireshark package and its dependencies are already present in the default debian 9 repositories, so to install latest and stable version of Wireshark on Debian 9, use the following command: - -``` -linuxtechi@nixhome:~$ sudo apt-get update -linuxtechi@nixhome:~$ sudo apt-get install wireshark -y -``` - -During the installation, it will prompt us to configure dumpcap for non-superusers, - -Select ‘yes’ and then hit enter. - - [![Configure-Wireshark-Debian9](https://www.linuxtechi.com/wp-content/uploads/2017/11/Configure-Wireshark-Debian9-1024x542.jpg)][3] - -Once the Installation is completed, execute the below command so that non-root users can also capture the live packets of the interfaces. - -``` -linuxtechi@nixhome:~$ sudo chmod +x /usr/bin/dumpcap -``` - -We can also use the latest source package to install the wireshark on Ubuntu/Debain & many other Linux distributions. - -#### Installing Wireshark using source code on Debian / Ubuntu Systems - -Firstly download the latest source package (which is 2.4.2 at the time for writing this article), use the following command, - -``` -linuxtechi@nixhome:~$ wget https://1.as.dl.wireshark.org/src/wireshark-2.4.2.tar.xz -``` - -Next extract the package & enter into the extracted directory, - -``` -linuxtechi@nixhome:~$ tar -xf wireshark-2.4.2.tar.xz -C /tmp -linuxtechi@nixhome:~$ cd /tmp/wireshark-2.4.2 -``` - -Now we will compile the code with the following commands, - -``` -linuxtechi@nixhome:/tmp/wireshark-2.4.2$ ./configure --enable-setcap-install -linuxtechi@nixhome:/tmp/wireshark-2.4.2$ make -``` - -Lastly install the compiled packages to install Wireshark on the system, - -``` -linuxtechi@nixhome:/tmp/wireshark-2.4.2$ sudo make install -linuxtechi@nixhome:/tmp/wireshark-2.4.2$ sudo ldconfig -``` - -Upon installation a separate group for Wireshark will also be created, we will now add our user to the group so that it can work with wireshark otherwise you might get ‘permission denied‘ error when starting wireshark. - -To add the user to the wireshark group, execute the following command, - -``` -linuxtechi@nixhome:~$ sudo usermod -a -G wireshark linuxtechi -``` - -Now we can start wireshark either from GUI Menu or from terminal with this command, - -``` -linuxtechi@nixhome:~$ wireshark -``` - -#### Access Wireshark on Debian 9 System - - [![Access-wireshark-debian9](https://www.linuxtechi.com/wp-content/uploads/2017/11/Access-wireshark-debian9-1024x664.jpg)][4] - -Click on Wireshark icon - - [![Wireshark-window-debian9](https://www.linuxtechi.com/wp-content/uploads/2017/11/Wireshark-window-debian9-1024x664.jpg)][5] - -#### Access Wireshark on Ubuntu 16.04 / 17.10 - - [![Access-wireshark-Ubuntu](https://www.linuxtechi.com/wp-content/uploads/2017/11/Access-wireshark-Ubuntu-1024x664.jpg)][6] - -Click on Wireshark icon - - [![Wireshark-window-Ubuntu](https://www.linuxtechi.com/wp-content/uploads/2017/11/Wireshark-window-Ubuntu-1024x664.jpg)][7] - -#### Capturing and Analyzing packets - -Once the wireshark has been started, we should be presented with the wireshark window, example is shown above for Ubuntu and Debian system. - - [![wireshark-Linux-system](https://www.linuxtechi.com/wp-content/uploads/2017/11/wireshark-Linux-system.jpg)][8] - -All these are the interfaces from where we can capture the network packets. Based on the interfaces you have on your system, this screen might be different for you. - -We are selecting ‘enp0s3’ for capturing the network traffic for that inteface. After selecting the inteface, network packets for all the devices on our network start to populate (refer to screenshot below) - - [![Capturing-Packet-from-enp0s3-Ubuntu-Wireshark](https://www.linuxtechi.com/wp-content/uploads/2017/11/Capturing-Packet-from-enp0s3-Ubuntu-Wireshark-1024x727.jpg)][9] - -First time we see this screen we might get overwhelmed by the data that is presented in this screen & might have thought how to sort out this data but worry not, one the best features of Wireshark is its filters. - -We can sort/filter out the data based on IP address, Port number, can also used source & destination filters, packet size etc & can also combine 2 or more filters together to create more comprehensive searches. We can either write our filters in ‘Apply a Display Filter‘ tab , or we can also select one of already created rules. To select pre-built filter, click on ‘flag‘ icon , next to ‘Apply a Display Filter‘ tab, - - [![Filter-in-wireshark-Ubuntu](https://www.linuxtechi.com/wp-content/uploads/2017/11/Filter-in-wireshark-Ubuntu-1024x727.jpg)][10] - -We can also filter data based on the color coding, By default, light purple is TCP traffic, light blue is UDP traffic, and black identifies packets with errors , to see what these codes mean, click View -> Coloring Rules, also we can change these codes. - - [![Packet-Colouring-Wireshark](https://www.linuxtechi.com/wp-content/uploads/2017/11/Packet-Colouring-Wireshark-1024x682.jpg)][11] - -After we have the results that we need, we can then click on any of the captured packets to get more details about that packet, this will show all the data about that network packet. - -Wireshark is an extremely powerful tool takes some time to getting used to & make a command over it, this tutorial will help you get started. Please feel free to drop in your queries or suggestions in the comment box below. - --------------------------------------------------------------------------------- - -via: https://www.linuxtechi.com - -作者:[Pradeep Kumar][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://www.linuxtechi.com/author/pradeep/ -[1]:https://www.linuxtechi.com/author/pradeep/ -[2]:https://www.linuxtechi.com/wp-content/uploads/2017/11/wireshark-Debian-9-Ubuntu-16.04-17.10.jpg -[3]:https://www.linuxtechi.com/wp-content/uploads/2017/11/Configure-Wireshark-Debian9.jpg -[4]:https://www.linuxtechi.com/wp-content/uploads/2017/11/Access-wireshark-debian9.jpg -[5]:https://www.linuxtechi.com/wp-content/uploads/2017/11/Wireshark-window-debian9.jpg -[6]:https://www.linuxtechi.com/wp-content/uploads/2017/11/Access-wireshark-Ubuntu.jpg -[7]:https://www.linuxtechi.com/wp-content/uploads/2017/11/Wireshark-window-Ubuntu.jpg -[8]:https://www.linuxtechi.com/wp-content/uploads/2017/11/wireshark-Linux-system.jpg -[9]:https://www.linuxtechi.com/wp-content/uploads/2017/11/Capturing-Packet-from-enp0s3-Ubuntu-Wireshark.jpg -[10]:https://www.linuxtechi.com/wp-content/uploads/2017/11/Filter-in-wireshark-Ubuntu.jpg -[11]:https://www.linuxtechi.com/wp-content/uploads/2017/11/Packet-Colouring-Wireshark.jpg diff --git a/translated/tech/20171129 How to Install and Use Wireshark on Debian and Ubuntu 16.04_17.10.md b/translated/tech/20171129 How to Install and Use Wireshark on Debian and Ubuntu 16.04_17.10.md new file mode 100644 index 0000000000..0bcbe0d3e5 --- /dev/null +++ b/translated/tech/20171129 How to Install and Use Wireshark on Debian and Ubuntu 16.04_17.10.md @@ -0,0 +1,183 @@ +在 Debian 9 / Ubuntu 16.04 / 17.10 中如何安装并使用 Wireshark +====== + +作者 [Pradeep Kumar][1],首发于 2017 年 11 月 29 日,更新于 2017 年 11 月 29 日 + +[![wireshark-Debian-9-Ubuntu 16.04 -17.10](https://www.linuxtechi.com/wp-content/uploads/2017/11/wireshark-Debian-9-Ubuntu-16.04-17.10.jpg)][2] + +Wireshark 是免费的,开源的,跨平台的基于 GUI 的网络数据包分析器,可用于 Linux, Windows, MacOS, Solaris 等。它可以实时捕获网络数据包,并以人性化的格式呈现。Wireshark 允许我们监控网络数据包上升到微观层面。Wireshark 还有一个名为 `tshark` 的命令行实用程序,它与 Wireshark 执行相同的功能,但它是通过终端而不是 GUI。 + +Wireshark 可用于网络故障排除,分析,软件和通信协议开发以及用于教育目的。Wireshark 使用 `pcap` 库来捕获网络数据包。 + +Wireshark 具有许多功能: + +* 支持数百项协议检查 + +* 能够实时捕获数据包并保存,以便以后进行离线分析 + +* 许多用于分析数据的过滤器 + +* 捕获的数据可以被压缩和解压缩(to 校正:on the fly 什么意思?) + +* 支持各种文件格式的数据分析,输出也可以保存为 XML, CSV 和纯文本格式 + +* 数据可以从以太网,wifi,蓝牙,USB,帧中继,令牌环等多个接口中捕获 + +在本文中,我们将讨论如何在 Ubuntu/Debian 上安装 Wireshark,并将学习如何使用 Wireshark 捕获网络数据包。 + +#### 在 Ubuntu 16.04 / 17.10 上安装 Wireshark + +Wireshark 在 Ubuntu 默认仓库中可用,只需使用以下命令即可安装。但有可能得不到最新版本的 wireshark。 + +``` +linuxtechi@nixworld:~$ sudo apt-get update +linuxtechi@nixworld:~$ sudo apt-get install wireshark -y +``` + +因此,要安装最新版本的 wireshark,我们必须启用或配置官方 wireshark 仓库。 + +使用下面的命令来配置仓库并安装最新版本的 wireshark 实用程序。 + +``` +linuxtechi@nixworld:~$ sudo add-apt-repository ppa:wireshark-dev/stable +linuxtechi@nixworld:~$ sudo apt-get update +linuxtechi@nixworld:~$ sudo apt-get install wireshark -y +``` + +一旦安装了 wireshark,执行以下命令,以便非 root 用户也可以捕获接口的实时数据包。 + +``` +linuxtechi@nixworld:~$ sudo setcap 'CAP_NET_RAW+eip CAP_NET_ADMIN+eip' /usr/bin/dumpcap +``` + +#### 在 Debian 9 上安装 Wireshark + +Wireshark 包及其依赖项已存在于 debian 9 的默认仓库中,因此要在 Debian 9 上安装最新且稳定版本的 Wireshark,请使用以下命令: + +``` +linuxtechi@nixhome:~$ sudo apt-get update +linuxtechi@nixhome:~$ sudo apt-get install wireshark -y +``` + +在安装过程中,它会提示我们为非超级用户配置 dumpcap, + +选择 `yes` 并回车。 + +[![Configure-Wireshark-Debian9](https://www.linuxtechi.com/wp-content/uploads/2017/11/Configure-Wireshark-Debian9-1024x542.jpg)][3] + +安装完成后,执行以下命令,以便非 root 用户也可以捕获接口的实时数据包。 + +``` +linuxtechi@nixhome:~$ sudo chmod +x /usr/bin/dumpcap +``` + +我们还可以使用最新的源代码包在 Ubuntu/Debian 和其它 Linux 发行版上安装 wireshark。 + +#### 在 Debian / Ubuntu 系统上使用源代码安装 Wireshark + +首先下载最新的源代码包(写这篇文章时它的最新版本是 2.4.2),使用以下命令: + +``` +linuxtechi@nixhome:~$ wget https://1.as.dl.wireshark.org/src/wireshark-2.4.2.tar.xz +``` + +然后解压缩包,进入解压缩的目录: + +``` +linuxtechi@nixhome:~$ tar -xf wireshark-2.4.2.tar.xz -C /tmp +linuxtechi@nixhome:~$ cd /tmp/wireshark-2.4.2 +``` + +现在我们使用以下命令编译代码: + +``` +linuxtechi@nixhome:/tmp/wireshark-2.4.2$ ./configure --enable-setcap-install +linuxtechi@nixhome:/tmp/wireshark-2.4.2$ make +``` + +最后安装已编译的软件包以便在系统上安装 Wireshark: + +``` +linuxtechi@nixhome:/tmp/wireshark-2.4.2$ sudo make install +linuxtechi@nixhome:/tmp/wireshark-2.4.2$ sudo ldconfig +``` + +在安装后,它将创建一个单独的 Wireshark 组,我们现在将我们的用户添加到组中,以便它可以与 Wireshark 一起使用,否则在启动 wireshark 时可能会出现 `permission denied(权限被拒绝)`错误。 + +要将用户添加到 wireshark 组,执行以下命令: + +``` +linuxtechi@nixhome:~$ sudo usermod -a -G wireshark linuxtechi +``` + +现在我们可以使用以下命令从 GUI 菜单或终端启动 wireshark: + +``` +linuxtechi@nixhome:~$ wireshark +``` + +#### 在 Debian 9 系统上使用 Wireshark + +[![Access-wireshark-debian9](https://www.linuxtechi.com/wp-content/uploads/2017/11/Access-wireshark-debian9-1024x664.jpg)][4] + +点击 Wireshark 图标 + +[![Wireshark-window-debian9](https://www.linuxtechi.com/wp-content/uploads/2017/11/Wireshark-window-debian9-1024x664.jpg)][5] + +#### 在 Ubuntu 16.04 / 17.10 上使用 Wireshark + +[![Access-wireshark-Ubuntu](https://www.linuxtechi.com/wp-content/uploads/2017/11/Access-wireshark-Ubuntu-1024x664.jpg)][6] + +点击 Wireshark 图标 + +[![Wireshark-window-Ubuntu](https://www.linuxtechi.com/wp-content/uploads/2017/11/Wireshark-window-Ubuntu-1024x664.jpg)][7] + +#### 捕获并分析数据包 + +一旦 wireshark 启动,我们就会看到 wireshark 窗口,上面有 Ubuntu 和 Debian 系统的示例。 + +[![wireshark-Linux-system](https://www.linuxtechi.com/wp-content/uploads/2017/11/wireshark-Linux-system.jpg)][8] + +所有这些都是我们可以捕获网络数据包的接口。根据你系统上的界面,此屏幕可能与你的不同。 + +我们选择 `enp0s3` 来捕获该接口的网络流量。选择接口后,在我们网络上所有设备的网络数据包开始填充(参考下面的屏幕截图): + +[![Capturing-Packet-from-enp0s3-Ubuntu-Wireshark](https://www.linuxtechi.com/wp-content/uploads/2017/11/Capturing-Packet-from-enp0s3-Ubuntu-Wireshark-1024x727.jpg)][9] + +第一次看到这个屏幕,我们可能会被这个屏幕上显示的数据所淹没,并且可能已经想过如何整理这些数据,但不用担心,Wireshark 的最佳功能之一就是它的过滤器。 + +我们可以根据 IP 地址,端口号,也可以使用来源和目标过滤器,数据包大小等对数据进行排序和过滤,也可以将两个或多个过滤器组合在一起以创建更全面的搜索。我们也可以在 `Apply a Display Filter(应用显示过滤器)`选项卡中编写过滤规则,也可以选择已创建的规则。要选择之前构建的过滤器,请单击 `Apply a Display Filter(应用显示过滤器)`选项卡旁边的 `flag` 图标。 + +[![Filter-in-wireshark-Ubuntu](https://www.linuxtechi.com/wp-content/uploads/2017/11/Filter-in-wireshark-Ubuntu-1024x727.jpg)][10] + +我们还可以根据颜色编码过滤数据,默认情况下,浅紫色是 TCP 流量,浅蓝色是 UDP 流量,黑色标识有错误的数据包,看看这些编码是什么意思,点击 `View -> Coloring Rules`,我们也可以改变这些编码。 + +[![Packet-Colouring-Wireshark](https://www.linuxtechi.com/wp-content/uploads/2017/11/Packet-Colouring-Wireshark-1024x682.jpg)][11] + +在我们得到我们需要的结果之后,我们可以点击任何捕获的数据包以获得有关该数据包的更多详细信息,这将显示该网络数据包的所有数据。 + +Wireshark 是一个非常强大的工具,需要一些时间来习惯并对其进行命令操作,本教程将帮助你入门。请随时在下面的评论框中提出你的疑问或建议。 + + +-------------------------------------------------------------------------------- + +via: https://www.linuxtechi.com + +作者:[Pradeep Kumar][a] +译者:[MjSeven](https://github.com/MjSeven) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://www.linuxtechi.com/author/pradeep/ +[1]:https://www.linuxtechi.com/author/pradeep/ +[2]:https://www.linuxtechi.com/wp-content/uploads/2017/11/wireshark-Debian-9-Ubuntu-16.04-17.10.jpg +[3]:https://www.linuxtechi.com/wp-content/uploads/2017/11/Configure-Wireshark-Debian9.jpg +[4]:https://www.linuxtechi.com/wp-content/uploads/2017/11/Access-wireshark-debian9.jpg +[5]:https://www.linuxtechi.com/wp-content/uploads/2017/11/Wireshark-window-debian9.jpg +[6]:https://www.linuxtechi.com/wp-content/uploads/2017/11/Access-wireshark-Ubuntu.jpg +[7]:https://www.linuxtechi.com/wp-content/uploads/2017/11/Wireshark-window-Ubuntu.jpg +[8]:https://www.linuxtechi.com/wp-content/uploads/2017/11/wireshark-Linux-system.jpg +[9]:https://www.linuxtechi.com/wp-content/uploads/2017/11/Capturing-Packet-from-enp0s3-Ubuntu-Wireshark.jpg +[10]:https://www.linuxtechi.com/wp-content/uploads/2017/11/Filter-in-wireshark-Ubuntu.jpg +[11]:https://www.linuxtechi.com/wp-content/uploads/2017/11/Packet-Colouring-Wireshark.jpg From c53b2655fc156299aec7867641f7500f9863ab69 Mon Sep 17 00:00:00 2001 From: BayarHwasaii <20964952+bayar199468@users.noreply.github.com> Date: Thu, 27 Sep 2018 20:45:47 +0800 Subject: [PATCH 38/39] 7 Best eBook Readers for Linux (#10390) --- sources/tech/20171012 7 Best eBook Readers for Linux.md | 1 + 1 file changed, 1 insertion(+) diff --git a/sources/tech/20171012 7 Best eBook Readers for Linux.md b/sources/tech/20171012 7 Best eBook Readers for Linux.md index 5198f1bdc0..128c667d88 100644 --- a/sources/tech/20171012 7 Best eBook Readers for Linux.md +++ b/sources/tech/20171012 7 Best eBook Readers for Linux.md @@ -1,3 +1,4 @@ +Translating by bayar199468 7 Best eBook Readers for Linux ====== **Brief:** In this article, we are covering some of the best ebook readers for Linux. These apps give a better reading experience and some will even help in managing your ebooks. From 4dc49729c51ef9ef2e0cf59df3c82e8a5ed05586 Mon Sep 17 00:00:00 2001 From: MjSeven <33125422+MjSeven@users.noreply.github.com> Date: Thu, 27 Sep 2018 21:05:05 +0800 Subject: [PATCH 39/39] Update 20180816 An introduction to the Django Python web app framework.md (#10389) * Delete 20171129 How to Install and Use Wireshark on Debian and Ubuntu 16.04_17.10.md * Create 20171129 How to Install and Use Wireshark on Debian and Ubuntu 16.04_17.10.md * Update 20180816 An introduction to the Django Python web app framework.md --- ...6 An introduction to the Django Python web app framework.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/sources/tech/20180816 An introduction to the Django Python web app framework.md b/sources/tech/20180816 An introduction to the Django Python web app framework.md index 21ab9d21ae..ab7dba9526 100644 --- a/sources/tech/20180816 An introduction to the Django Python web app framework.md +++ b/sources/tech/20180816 An introduction to the Django Python web app framework.md @@ -1,3 +1,6 @@ +Translating by MjSeven + + An introduction to the Django Python web app framework ======