From e2a632597379de5f5d99b106a128f91e4a26f084 Mon Sep 17 00:00:00 2001 From: darksun Date: Thu, 18 Jan 2018 14:58:09 +0800 Subject: [PATCH 01/23] =?UTF-8?q?=E9=80=89=E9=A2=98:=208=20KDE=20Plasma=20?= =?UTF-8?q?Tips=20and=20Tricks=20to=20Improve=20Your=20Productivity?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...and Tricks to Improve Your Productivity.md | 96 +++++++++++++++++++ 1 file changed, 96 insertions(+) create mode 100644 sources/tech/20180112 8 KDE Plasma Tips and Tricks to Improve Your Productivity.md diff --git a/sources/tech/20180112 8 KDE Plasma Tips and Tricks to Improve Your Productivity.md b/sources/tech/20180112 8 KDE Plasma Tips and Tricks to Improve Your Productivity.md new file mode 100644 index 0000000000..66e96549c7 --- /dev/null +++ b/sources/tech/20180112 8 KDE Plasma Tips and Tricks to Improve Your Productivity.md @@ -0,0 +1,96 @@ +8 KDE Plasma Tips and Tricks to Improve Your Productivity +====== + +![](https://www.maketecheasier.com/assets/uploads/2018/01/kde-plasma-desktop-featured.jpg) + +KDE's Plasma is easily one of the most powerful desktop environments available for Linux. It's highly configurable, and it looks pretty good, too. That doesn't amount to a whole lot unless you can actually get things done. + +You can easily configure Plasma and make use of a lot of its convenient and time-saving features to boost your productivity and have a desktop that empowers you, rather than getting in your way. + +These tips aren't in any particular order, so you don't need to prioritize. Pick the ones that best fit your workflow. + + **Related** : [10 of the Best KDE Plasma Applications You Should Try][1] + +### 1. Multimedia Controls + +This isn't so much of a tip as it is something that's good to keep in mind. Plasma keeps multimedia controls everywhere. You don't need to open your media player every time you need to pause, resume, or skip a song; you can mouse over the minimized window or even control it via the lock screen. There's no need to scramble to log in to change a song or because you forgot to pause one. + +### 2. KRunner + +![KDE Plasma KRunner][2] + +KRunner is an often under-appreciated feature of the Plasma desktop. Most people are used to digging through the application launcher menu to find the program that they're looking to launch. That's not necessary with KRunner. + +To use KRunner, make sure that your focus is on the desktop itself. (Click on it instead of a window.) Then, start typing the name of the program that you want. KRunner will automatically drop down from the top of your screen with suggestions. Click or press Enter on the one you're looking for. It's much faster than remembering which category your program is under. + +### 3. Jump Lists + +![KDE Plasma Jump Lists][3] + +Jump lists are a fairly recent addition to the Plasma desktop. They allow you to launch an application directly to a specific section or feature. + +So if you have a launcher on a menu bar, you can right-click and get a list of places to jump to. Select where you want to go, and you're off. + +### 4. KDE Connect + +![KDE Connect Menu Android][4] + +[KDE Connect][5] is a massive help if you have an Android phone. It connects the phone to your desktop so you can share things seamlessly between the devices. + +With KDE Connect, you can see your [Android device's notification][6] on your desktop in real time. It also enables you to send and receive text messages from Plasma without ever picking up your phone. + +KDE Connect also lets you send files and share web pages between your phone and your computer. You can easily move from one device to the other without a lot of hassle or losing your train of thought. + +### 5. Plasma Vaults + +![KDE Plasma Vault][7] + +Plasma Vaults are another new addition to the Plasma desktop. They are KDE's simple solution to encrypted files and folders. If you don't work with encrypted files, this one won't really save you any time. If you do, though, vaults are a much simpler approach. + +Plasma Vaults let you create encrypted directories as a regular user without root and manage them from your task bar. You can mount and unmount the directories on the fly without the need for external programs or additional privileges. + +### 6. Pager Widget + +![KDE Plasma Pager][8] + +Configure your desktop with the pager widget. It allows you to easily access three additional workspaces for even more screen room. + +Add the widget to your menu bar, and you can slide between multiple workspaces. These are all the size of your screen, so you gain multiple times the total screen space. That lets you lay out more windows without getting confused by a minimized mess or disorganization. + +### 7. Create a Dock + +![KDE Plasma Dock][9] + +Plasma is known for its flexibility and the room it allows for configuration. Use that to your advantage. If you have programs that you're always using, consider setting up an OS X style dock with your most used applications. You'll be able to get them with a single click rather than going through a menu or typing in their name. + +### 8. Add a File Tree to Dolphin + +![Plasma Dolphin Directory][10] + +It's much easier to navigate folders in a directory tree. Dolphin, Plasma's default file manager, has built-in functionality to display a directory listing in the form of a tree on the side of the folder window. + +To enable the directory tree, click on the "Control" tab, then "Configure Dolphin," "View Modes," and "Details." Finally, select "Expandable Folders." + +Remember that these tips are just tips. Don't try to force yourself to do something that's getting in your way. You may hate using file trees in Dolphin. You may never use Pager. That's alright. There may even be something that you personally like that's not listed here. Do what works for you. That said, at least a few of these should shave some serious time out of your work day. + +-------------------------------------------------------------------------------- + +via: https://www.maketecheasier.com/kde-plasma-tips-tricks-improve-productivity/ + +作者:[Nick Congleton][a] +译者:[译者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/nickcongleton/ +[1]:https://www.maketecheasier.com/10-best-kde-plasma-applications/ (10 of the Best KDE Plasma Applications You Should Try) +[2]:https://www.maketecheasier.com/assets/uploads/2017/10/pe-krunner.jpg (KDE Plasma KRunner) +[3]:https://www.maketecheasier.com/assets/uploads/2017/10/pe-jumplist.jpg (KDE Plasma Jump Lists) +[4]:https://www.maketecheasier.com/assets/uploads/2017/05/kde-connect-menu-e1494899929112.jpg (KDE Connect Menu Android) +[5]:https://www.maketecheasier.com/send-receive-sms-linux-kde-connect/ +[6]:https://www.maketecheasier.com/android-notifications-ubuntu-kde-connect/ +[7]:https://www.maketecheasier.com/assets/uploads/2017/10/pe-vault.jpg (KDE Plasma Vault) +[8]:https://www.maketecheasier.com/assets/uploads/2017/10/pe-pager.jpg (KDE Plasma Pager) +[9]:https://www.maketecheasier.com/assets/uploads/2017/10/pe-dock.jpg (KDE Plasma Dock) +[10]:https://www.maketecheasier.com/assets/uploads/2017/10/pe-dolphin.jpg (Plasma Dolphin Directory) From 51e7225e44a6f5b7c4134264baa2b40cb2a23f21 Mon Sep 17 00:00:00 2001 From: darksun Date: Thu, 18 Jan 2018 17:53:42 +0800 Subject: [PATCH 02/23] =?UTF-8?q?=E9=80=89=E9=A2=98:=202=20scientific=20ca?= =?UTF-8?q?lculators=20for=20the=20Linux=20desktop?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...tific calculators for the Linux desktop.md | 111 ++++++++++++++++++ 1 file changed, 111 insertions(+) create mode 100644 sources/tech/20180115 2 scientific calculators for the Linux desktop.md diff --git a/sources/tech/20180115 2 scientific calculators for the Linux desktop.md b/sources/tech/20180115 2 scientific calculators for the Linux desktop.md new file mode 100644 index 0000000000..f91450b383 --- /dev/null +++ b/sources/tech/20180115 2 scientific calculators for the Linux desktop.md @@ -0,0 +1,111 @@ +2 scientific calculators for the Linux desktop +====== + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/osdc_OpenData_CityNumbers.png?itok=lC03ce76) + +Image by : opensource.com + +Every Linux desktop environment comes with at least a simple desktop calculator, but most of those simple calculators are just that: a simple tool for simple calculations. + +Fortunately, there are exceptions; programs that go far beyond square roots and a couple of trigonometric functions, yet are still easy to use. Here are two powerful calculator tools for Linux, plus a couple of bonus options. + +### SpeedCrunch + +[SpeedCrunch][1] is a high-precision scientific calculator with a simple Qt5 graphical interface and strong focus on the keyboard. + +![SpeedCrunch graphical interface][3] + + +SpeedCrunch at work + +It supports working with units and comes loaded with all kinds of functions. + +For example, by writing: +`2 * 10^6 newton / (meter^2)` + +you get: +`= 2000000 pascal` + +By default, SpeedCrunch delivers its results in the international unit system, but units can be transformed with the "in" instruction. + +For example: +`3*10^8 meter / second in kilo meter / hour` + +produces: +`= 1080000000 kilo meter / hour` + +With the `F5` key, all results will turn into scientific notation (`1.08e9 kilo meter / hour`), while with `F2` only numbers that are small enough or big enough will change. More options are available on the Configuration menu. + +The list of available functions is really impressive. It works on Linux, Windows, and MacOS, and it's licensed under GPLv2; you can access its source code on [Bitbucket][4]. + +### Qalculate! + +[Qalculate!][5] (with the exclamation point) has a long and complex history. + +The project offers a powerful library that can be used by other programs (the Plasma desktop can use it to perform calculations from krunner) and a graphical interface built on GTK3. It allows you to work with units, handle physical constants, create graphics, use complex numbers, matrices, and vectors, choose arbitrary precision, and more. + + +![Qalculate! Interface][7] + + +Looking for some physical constants on Qalculate! + +Its use of units is far more intuitive than SpeedCrunch's and it understands common prefixes without problem. Have you heard of an exapascal pressure? I hadn't (the Sun's core stops at `~26 PPa`), but Qalculate! has no problem understanding the meaning of `1 EPa`. Also, Qalculate! is more flexible with syntax errors, so you don't need to worry about closing all those parentheses: if there is no ambiguity, Qalculate! will give you the right answer. + +After a long period on which the project seemed orphaned, it came back to life in 2016 and has been going strong since, with more than 10 versions in just one year. It's licensed under GPLv2 (with source code on [GitHub][8]) and offers versions for Linux and Windows, as well as a MacOS port. + +### Bonus calculators + +#### ConvertAll + +OK, it's not a "calculator," yet this simple application is incredibly useful. + +Most unit converters stop at a long list of basic units and a bunch of common combinations, but not [ConvertAll][9]. Trying to convert from astronomical units per year into inches per second? It doesn't matter if it makes sense or not, if you need to transform a unit of any kind, ConvertAll is the tool for you. + +Just write the starting unit and the final unit in the corresponding boxes; if the units are compatible, you'll get the transformation without protest. + +The main application is written in PyQt5, but there is also an [online version written in JavaScript][10]. + +#### (wx)Maxima with the units package + +Sometimes (OK, many times) a desktop calculator is not enough and you need more raw power. + +[Maxima][11] is a computer algebra system (CAS) with which you can do derivatives, integrals, series, equations, eigenvectors and eigenvalues, Taylor series, Laplace and Fourier transformations, as well as numerical calculations with arbitrary precision, graph on two and three dimensions… we could fill several pages just listing its capabilities. + +[wxMaxima][12] is a well-designed graphical frontend for Maxima that simplifies the use of many Maxima options without compromising others. On top of the full power of Maxima, wxMaxima allows you to create "notebooks" on which you write comments, keep your graphics with your math, etc. One of the (wx)Maxima combo's most impressive features is that it works with dimension units. + +On the prompt, just type: +`load("unit")` + +press Shift+Enter, wait a few seconds, and you'll be ready to work. + +By default, the unit package works with the basic MKS units, but if you prefer, for instance, to get `N` instead of `kg*m/s2`, you just need to type: +`setunits(N)` + +Maxima's help (which is also available from wxMaxima's help menu) will give you more information. + +Do you use these programs? Do you know another great desktop calculator for scientists and engineers or another related tool? Tell us about them in the comments! + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/1/scientific-calculators-linux + +作者:[Ricardo Berlasso][a] +译者:[译者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/rgb-es +[1]:http://speedcrunch.org/index.html +[2]:/file/382511 +[3]:https://opensource.com/sites/default/files/u128651/speedcrunch.png (SpeedCrunch graphical interface) +[4]:https://bitbucket.org/heldercorreia/speedcrunch +[5]:https://qalculate.github.io/ +[6]:/file/382506 +[7]:https://opensource.com/sites/default/files/u128651/qalculate-600.png (Qalculate! Interface) +[8]:https://github.com/Qalculate +[9]:http://convertall.bellz.org/ +[10]:http://convertall.bellz.org/js/ +[11]:http://maxima.sourceforge.net/ +[12]:https://andrejv.github.io/wxmaxima/ From 51f8159ea6266019b6325fbe31a68b13fcb7622d Mon Sep 17 00:00:00 2001 From: XYenChi <466530436@qq.com> Date: Thu, 18 Jan 2018 18:02:10 +0800 Subject: [PATCH 03/23] XYenChi is translating --- sources/tech/20171231 Why You Should Still Love Telnet.md | 1 + 1 file changed, 1 insertion(+) diff --git a/sources/tech/20171231 Why You Should Still Love Telnet.md b/sources/tech/20171231 Why You Should Still Love Telnet.md index 6e6976fda4..201ee91bd4 100644 --- a/sources/tech/20171231 Why You Should Still Love Telnet.md +++ b/sources/tech/20171231 Why You Should Still Love Telnet.md @@ -1,3 +1,4 @@ +XYenChi is translating Why You Should Still Love Telnet ====== Telnet, the protocol and the command line tool, were how system administrators used to log into remote servers. However, due to the fact that there is no encryption all communication, including passwords, are sent in plaintext meant that Telnet was abandoned in favour of SSH almost as soon as SSH was created. From 2e21cd06892ab6397b31826e14e22a467d5efe44 Mon Sep 17 00:00:00 2001 From: darksun Date: Thu, 18 Jan 2018 18:02:23 +0800 Subject: [PATCH 04/23] =?UTF-8?q?=E9=80=89=E9=A2=98:=20How=20To=20Create?= =?UTF-8?q?=20A=20Bootable=20Zorin=20OS=20USB=20Drive?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...To Create A Bootable Zorin OS USB Drive.md | 315 ++++++++++++++++++ 1 file changed, 315 insertions(+) create mode 100644 sources/tech/20180116 How To Create A Bootable Zorin OS USB Drive.md diff --git a/sources/tech/20180116 How To Create A Bootable Zorin OS USB Drive.md b/sources/tech/20180116 How To Create A Bootable Zorin OS USB Drive.md new file mode 100644 index 0000000000..4ab7fea3f6 --- /dev/null +++ b/sources/tech/20180116 How To Create A Bootable Zorin OS USB Drive.md @@ -0,0 +1,315 @@ +How To Create A Bootable Zorin OS USB Drive +====== +![Zorin OS][17] + +### Introduction + +In this guide I will show you how to create a bootable Zorin OS USB Drive. + +To be able to follow this guide you will need the following: + + * A blank USB drive + * An internet connection + + + +### What Is Zorin OS? + +Zorin OS is a Linux based operating system. + +If you are a Windows user you might wonder why you would bother with Zorin OS. If you are a Linux user then you might also wonder why you would use Zorin OS over other distributions such as Linux Mint or Ubuntu. + +If you are using an older version of Windows and you can't afford to upgrade to Windows 10 or your computer doesn't have the right specifications for running Windows 10 then Zorin OS provides a free (or cheap, depending how much you choose to donate) upgrade path allowing you to continue to use your computer in a much more secure environment. + +If your current operating system is Windows XP or Windows Vista then you might consider using Zorin OS Lite as opposed to Zorin OS Core. + +The features of Zorin OS Lite are generally the same as the Zorin OS Core product but some of the applications installed and the desktop environment used for displaying menus and icons and other Windowsy features take up much less memory and processing power. + +If you are running Windows 7 then your operating system is coming towards the end of its life. You could probably upgrade to Windows 10 but at a hefty price. + +Not everybody has the finances to pay for a new Windows license and not everybody has the money to buy a brand new computer. + +Zorin OS will help you extend the life of your computer and you will still feel you are using a premium product and that is because you will be. The product with the highest price doesn't always provide the best value. + +Whilst we are talking about value for money, Zorin OS allows you to install the best free and open source software available and comes with a good selection of packages pre-installed. + +For the home user, using Zorin OS doesn't have to feel any different to running Windows. You can browse the web using the browser of your choice, you can listen to music and watch videos. There are mail clients and other productivity tools. + +Talking of productivity there is LibreOffice. LibreOffice has everything the average home user requires from an office suite with a word processor, spreadsheet and presentations package. + +If you want to run Windows software then you can use the pre-installed PlayOnLinux and WINE packages to install and run all manner of packages including Microsoft Office. + +By running Zorin OS you will get the extra security benefits of running a Linux based operating system. + +Are you fed up with Windows updates stalling your productivity? When Windows wants to install updates it requires a reboot and then a long wait whilst it proceeds to install update after update. Sometimes it even forces a reboot whilst you are busy working. + +Zorin OS is different. Updates download and install themselves whilst you are using the computer. You won't even need to know it is happening. + +Why Zorin over Mint or Ubuntu? Zorin is the happy stepping stone between Windows and Linux. It is Linux but you don't need to care that it is Linux. If you decide later on to move to something different then so be it but there really is no need. + +### The Zorin OS Website + +![](http://dailylinuxuser.com/wp-content/uploads/2018/01/zorinwebsite1-678x381.png) + +You can visit the Zorin OS website by visiting [www.zorinos.com][18]. + +The homepage of the Zorin OS website tells you everything you need to know. + +"Zorin OS is an alternative to Windows and macOX, designed to make your computer faster, more powerful and secure". + +There is nothing that tells you that Zorin OS is based on Linux. There is no need for Zorin to tell you that because even though Windows used to be heavily based on DOS you didn't need to know DOS commands to use it. Likewise you don't necessarily need to know Linux commands to use Zorin. + +If you scroll down the page you will see a slide show highlighting the way the desktop looks and feels under Zorin. + +The good thing is that you can customise the user interface so that if you prefer a Windows layout you can use a Windows style layout but if you prefer a Mac style layout you can go for that as well. + +Zorin OS is based on Ubuntu Linux and the website uses this fact to highlight that underneath it has a stable base and it highlights the security benefits provided by Linux. + +If you want to see what applications are available for Zorin then there is a link to do that and Zorin never sells your data and protects your privacy. + +### What Are The Different Versions Of Zorin OS + +#### Zorin OS Ultimate + +The ultimate edition takes the core edition and adds other features such as different layouts, more applications pre-installed and extra games. + +The ultimate edition comes at a price of 19 euros which is a bargain compared to other operating systems. + +#### Zorin OS Core + +The core version is the standard edition and comes with everything the average person could need from the outset. + +This is the version I will show you how to download and install in this guide. + +#### Zorin OS Lite + +Zorin OS Lite also has an ultimate version available and a core version. Zorin OS Lite is perfect for older computers and the main difference is the desktop environments used to display menus and handle screen elements such as icons and panels. + +Zorin OS Lite is less memory intensive than Zorin OS. + +#### Zorin OS Business + +Zorin OS Business comes with business applications installed as standard such as finance applications and office applications. + +### How To Get Zorin OS + +To download Zorin OS visit . + +To get the core version scroll past the Zorin Ultimate section until you get to the Zorin Core section. + +You will see a small pay panel which allows you to choose how much you wish to pay for Zorin Core with a purchase now button underneath. + +#### How To Pay For Zorin OS + +![](http://dailylinuxuser.com/wp-content/uploads/2018/01/zorinwebsite1-678x381.png) + +You can choose from the three preset amounts or enter an amount of your choice in the "Custom" box. + +When you click "Purchase Zorin OS Core" the following window will appear: + +![](http://dailylinuxuser.com/wp-content/uploads/2018/01/payforzorin.png) + +You can now enter your email and credit card information. + +When you click the "pay" button a window will appear with a download link. + +#### How To Get Zorin OS For Free + +If you don't wish to pay anything at all you can enter zero (0) into the custom box. The button will change and will show the words "Download Zorin OS Core". + +#### How To Download Zorin OS + +![](http://dailylinuxuser.com/wp-content/uploads/2018/01/downloadzorin.png) + +Whether you have bought Zorin or have chosen to download for free, a window will appear with the option to download a 64 bit or 32 bit version of Zorin. + +Most modern computers are capable of running 64 bit operating systems but in order to check within Windows click the "start" button and type "system information". + +![](http://dailylinuxuser.com/wp-content/uploads/2018/01/systeminfo.png) + +Click on the "System Information" desktop app and halfway down the right panel you will see the words "system type". If you see the words "x64 based PC" then the system is capable of running 64-bit operating systems. + +If your computer is capable of running 64-bit operating systems click on the "Download 64 bit" button otherwise click on "Download 32 bit". + +The ISO image file for Zorin will now start to download to your computer. + +### How To Verify If The Zorin OS Download Is Valid + +It is important to check whether the download is valid for many reasons. + +If the file has only partially downloaded or there were interruptions whilst downloading and you had to resume then the image might not be perfect and it should be downloaded again. + +More importantly you should check the validity to make sure the version you downloaded is genuine and wasn't uploaded by a hacker. + +In order to check the validity of the ISO image you should download a piece of software called QuickHash for Windows from . + +Click the "download" link and when the file has downloaded double click on it. + +Click on the relevant application file within the zip file. If you have a 32-bit system click "Quickhash-v2.8.4-32bit" or for a 64-bit system click "Quickhash-v2.8.4-64bit". + +Click on the "Run" button. + +![](http://dailylinuxuser.com/wp-content/uploads/2018/01/zorinhash.png) + +Click the SHA256 radio button on the left side of the screen and then click on the file tab. + +Click "Select File" and navigate to the downloads folder. + +Choose the Zorin ISO image downloaded previously. + +A progress bar will now work out the hash value for the ISO image. + +To compare this with the valid keys available for Zorin visit and scroll down until you see the list of checksums as follows: + +![](http://dailylinuxuser.com/wp-content/uploads/2018/01/zorinhashcodes.png) + +Select the long list of scrambled characters next to the version of Zorin OS that you downloaded and press CTRL and C to copy. + +Go back to the Quickhash screen and paste the value into the "Expected hash value" box by pressing CTRL and V. + +You should see the words "Expected hash matches the computed file hash, OK". + +If the values do not match you will see the words "Expected hash DOES NOT match the computed file hash" and you should download the ISO image again. + +### How To Create A Bootable Zorin OS USB Drive + +In order to be able to install Zorin you will need to install a piece of software called Etcher. You will also need a blank USB drive. + +You can download Etcher from . + +![](http://dailylinuxuser.com/wp-content/uploads/2018/01/downloadetcher.png) + +If you are using a 64 bit computer click on the "Download for Windows x64" link otherwise click on the little arrow and choose "Etcher for Windows x86 (32-bit) (Installer)". + +Insert the USB drive into your computer and double click on the "Etcher" setup executable file. + +![](http://dailylinuxuser.com/wp-content/uploads/2018/01/etcherlicense.png) + +When the license screen appears click "I Agree". + +Etcher should start automatically after the installation completes but if it doesn't you can press the Windows key or click the start button and search for "Etcher". + +![](http://dailylinuxuser.com/wp-content/uploads/2018/01/etcherscreen.png) + +Click on "Select Image" and select the "Zorin" ISO image downloaded previously. + +Click "Flash". + +Windows will ask for your permission to continue. Click "Yes" to accept. + +After a while a window will appear with the words "Flash Complete". + +### How To Buy A Zorin OS USB Drive + +If the above instructions seem too much like hard work then you can order a Zorin USB Drive by clicking one of the following links: + +* [Zorin OS Core – 32-bit DVD][1] + +* [Zorin OS Core – 64-bit DVD][2] + +* [Zorin OS Core – 16 gigabyte USB drive (32-bit)][3] + +* [Zorin OS Core – 32 gigabyte USB drive (32-bit)][4] + +* [Zorin OS Core – 64 gigabyte USB drive (32-bit)][5] + +* [Zorin OS Core – 16 gigabyte USB drive (64-bit)][6] + +* [Zorin OS Core – 32 gigabyte USB drive (64-bit)][7] + +* [Zorin OS Core – 64 gigabyte USB drive (64-bit)][8] + +* [Zorin OS Lite – 32-bit DVD][9] + +* [Zorin OS Lite – 64-bit DVD][10] + +* [Zorin OS Lite – 16 gigabyte USB drive (32-bit)][11] + +* [Zorin OS Lite – 32 gigabyte USB drive (32-bit)][12] + +* [Zorin OS Lite – 64 gigabyte USB drive (32-bit)][13] + +* [Zorin OS Lite – 16 gigabyte USB drive (64-bit)][14] + +* [Zorin OS Lite – 32 gigabyte USB drive (64-bit)][15] + +* [Zorin OS Lite – 64 gigabyte USB drive (64-bit)][16] + + +### How To Boot Into Zorin OS Live + +On older computers simply insert the USB drive and restart the computer. The boot menu for Zorin should appear straight away. + +On modern computers insert the USB drive, restart the computer and before Windows loads press the appropriate function key to bring up the boot menu. + +The following list shows the key or keys you can press for the most popular computer manufacturers. + + * Acer - Escape, F12, F9 + * Asus - Escape, F8 + * Compaq - Escape, F9 + * Dell - F12 + * Emachines - F12 + * HP - Escape, F9 + * Intel - F10 + * Lenovo - F8, F10, F12 + * Packard Bell - F8 + * Samsung - Escape, F12 + * Sony - F10, F11 + * Toshiba - F12 + + + +Check the manufacturer's website to find the key for your computer if it isn't listed or keep trying different function keys or the escape key. + +A screen will appear with the following three options: + + 1. Try Zorin OS without Installing + 2. Install Zorin OS + 3. Check disc for defects + + + +Choose "Try Zorin OS without Installing" by pressing enter with that option selected. + +### Summary + +You can now try Zorin OS without damaging your current operating system. + +To get back to your original operating system reboot and remove the USB drive. + +### How To Remove Zorin OS From The USB Drive + +If you have decided that Zorin OS is not for you and you want to get the USB drive back into its pre-Zorin state follow this guide: + +[How To Fix A USB Drive After Linux Has Been Installed On It][19] + +-------------------------------------------------------------------------------- + +via: http://dailylinuxuser.com/2018/01/how-to-create-a-bootable-zorin-os-usb-drive.html + +作者:[admin][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: +[1]:https://www.osdisc.com/products/zorinos/zorin-os-122-core-install-live-dvd-32bit.html?affiliate=everydaylinuxuser +[2]:https://www.osdisc.com/products/zorinos/zorin-os-122-core-install-live-dvd-64bit.html?affiliate=everydaylinuxuser +[3]:https://www.osdisc.com/products/zorinos/zorin-os-122-core-16gb-usb-flash-drive-32bit.html?affiliate=everydaylinuxuser +[4]:https://www.osdisc.com/products/zorinos/zorin-os-122-core-32gb-usb-flash-drive-32bit.html?affiliate=everydaylinuxuser +[5]:https://www.osdisc.com/products/zorinos/zorin-os-122-core-64gb-usb-flash-drive-32bit.html?affiliate=everydaylinuxuser +[6]:https://www.osdisc.com/products/zorinos/zorin-os-122-core-16gb-usb-flash-drive-64bit.html?affiliate=everydaylinuxuser +[7]:https://www.osdisc.com/products/zorinos/zorin-os-122-core-32gb-usb-flash-drive-64bit.html?affiliate=everydaylinuxuser +[8]:https://www.osdisc.com/products/zorinos/zorin-os-122-core-64gb-usb-flash-drive-64bit.html?affiliate=everydaylinuxuser +[9]:https://www.osdisc.com/products/zorinos/zorin-os-122-lite-install-live-dvd-32bit.html?affiliate=everydaylinuxuser +[10]:https://www.osdisc.com/products/zorinos/zorin-os-122-lite-install-live-dvd-64bit.html?affiliate=everydaylinuxuser +[11]:https://www.osdisc.com/products/zorinos/zorin-os-122-lite-16gb-usb-flash-drive-32bit.html?affiliate=everydaylinuxuser +[12]:https://www.osdisc.com/products/zorinos/zorin-os-122-lite-32gb-usb-flash-drive-32bit.html?affiliate=everydaylinuxuser +[13]:https://www.osdisc.com/products/zorinos/zorin-os-122-lite-64gb-usb-flash-drive-32bit.html?affiliate=everydaylinuxuser +[14]:https://www.osdisc.com/products/zorinos/zorin-os-122-lite-16gb-usb-flash-drive-64bit.html?affiliate=everydaylinuxuser +[15]:https://www.osdisc.com/products/zorinos/zorin-os-122-lite-32gb-usb-flash-drive-64bit.html?affiliate=everydaylinuxuser +[16]:https://www.osdisc.com/products/zorinos/zorin-os-122-lite-64gb-usb-flash-drive-64bit.html?affiliate=everydaylinuxuser +[17]:http://dailylinuxuser.com/wp-content/uploads/2018/01/zorindesktop-678x381.png (Zorin OS) +[18]:http://www.zorinos.com +[19]:http://dailylinuxuser.com/2016/04/how-to-fix-usb-drive-after-linux-has.html From b418f5933868634dab980fdc0b23709e87c55c56 Mon Sep 17 00:00:00 2001 From: darksun Date: Thu, 18 Jan 2018 18:10:14 +0800 Subject: [PATCH 05/23] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Why=20building=20a?= =?UTF-8?q?=20community=20is=20worth=20the=20extra=20effort?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...g a community is worth the extra effort.md | 66 +++++++++++++++++++ 1 file changed, 66 insertions(+) create mode 100644 sources/tech/20180116 Why building a community is worth the extra effort.md diff --git a/sources/tech/20180116 Why building a community is worth the extra effort.md b/sources/tech/20180116 Why building a community is worth the extra effort.md new file mode 100644 index 0000000000..ec971e84eb --- /dev/null +++ b/sources/tech/20180116 Why building a community is worth the extra effort.md @@ -0,0 +1,66 @@ +Why building a community is worth the extra effort +====== + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/BUSINESS_brandbalance.png?itok=XSQ1OU16) + +When we launched [Nethesis][1] in 2003, we were just system integrators. We only used existing open source projects. Our business model was clear: Add multiople forms of value to those projects: know-how, documentation for the Italian market, extra modules, professional support, and training courses. We gave back to upstream projects as well, through upstream code contributions and by participating in their communities. + +Times were different then. We couldn't use the term "open source" too loudly. People associated it with words like: "nerdy," "no value" and, worst of all, "free." Not too good for a business. + +On a Saturday in 2010, with pasties and espresso in hand, the Nethesis staff were discussing how to move things forward (hey, we like to eat and drink while we innovate!). In spite of the momentum working against us, we decided not to change course. In fact, we decided to push harder--to make open source, and an open way of working, a successful model for running a business. + +Over the years, we've proven that model's potential. And one thing has been key to our success: community. + +In this three-part series, I'll explain the important role community plays in an open organization's existence. I'll explore why an organization would want to build a community, and discuss how to build one--because I really do believe it's the best way to generate new innovations today. + +### The crazy idea + +Together with the Nethesis guys, we decided to build our own open source project: our own operating system, built on top of CentOS (because we didn't want to reinvent the wheel). We assumed that we had the experience, know-how, and workforce to achieve it. We felt brave. + +And we very much wanted to build an operating system called [NethServer][2] with one mission: making a sysadmin's life easier with open source. We knew we could create a Linux distribution for a server that would be more accessible, easier to adopt, and simpler to understand than anything currently offered. + +Above all, though, we decided to create a real, 100% open project with three primary rules: + + * completely free to download, + * openly developed, and + * community-driven + + + +That last one is important. We were a company; we were able to develop it by ourselves. We would have been more effective (and made quicker decisions) if we'd done the work in-house. It would be so simple, like any other company in Italy. + +But we were so deeply into open source culture culture that we chose a different path. + +We really wanted as many people as possible around us, around the product, and around the company. We wanted as many perspectives on the work as possible. We realized: Alone, you can go fast--but if you want to go far, you need to go together. + +So we decided to build a community instead. + +### What next? + +We realized that creating a community has so many benefits. For example, if the people who use your product are really involved in the project, they will provide feedback and use cases, write documentation, catch bugs, compare with other products, suggest features, and contribute to development. All of this generates innovations, attracts contributors and customers, and expands your product's user base. + +But quicky the question arose: How can we build a community? We didn't know how to achieve that. We'd participated in many communities, but we'd never built one. + +We were good at code--not with people. And we were a company, an organization with very specific priorities. So how were we going to build a community and a foster good relationships between the company and the community itself? + +We did the first thing you had to do: study. We learned from experts, blogs, and lots of books. We experimented. We failed many times, collected data from the outcomes, and tested them again. + +Eventually we learned the golden rule of the community management: There is no golden rule of community management. + +People are too complex and communities are too different to have one rule "to rule them all," + +One thing I can say, however, is that an healthy relationship between a community and a company is always a process of give and take. In my next article, I'll discuss what your organization should expect to give if it wants a flourishing and innovating community. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/open-organization/18/1/why-build-community-1 + +作者:[Alessio Fattorini][a] +译者:[译者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/alefattorini +[1]:http://www.nethesis.it/ +[2]:http://www.nethserver.org/ From d487bb0197f2c7618e0cfa17d20761bc2db8876b Mon Sep 17 00:00:00 2001 From: wxy Date: Thu, 18 Jan 2018 18:50:27 +0800 Subject: [PATCH 06/23] PRF:20090127 Anatomy of a Program in Memory.md @qhwdw --- translated/tech/20090127 Anatomy of a Program in Memory.md | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/translated/tech/20090127 Anatomy of a Program in Memory.md b/translated/tech/20090127 Anatomy of a Program in Memory.md index e185881262..4a08caa4be 100644 --- a/translated/tech/20090127 Anatomy of a Program in Memory.md +++ b/translated/tech/20090127 Anatomy of a Program in Memory.md @@ -15,7 +15,7 @@ ![Flexible Process Address Space Layout In Linux](http://static.duartes.org/img/blogPosts/linuxFlexibleAddressSpaceLayout.png) -当计算机还是快乐、安全的时代时,在机器中的几乎每个进程上,那些段的起始虚拟地址都是**完全相同**的。这将使远程挖掘安全漏洞变得容易。漏洞利用经常需要去引用绝对内存位置:比如在栈中的一个地址,一个库函数的地址,等等。远程攻击闭着眼睛也会选择这个地址,因为地址空间都是相同的。当攻击者们这样做的时候,人们就会受到伤害。因此,地址空间随机化开始流行起来。Linux 会通过在其起始地址上增加偏移量来随机化[栈][3]、[内存映射段][4]、以及[堆][5]。不幸的是,32 位的地址空间是非常拥挤的,为地址空间随机化留下的空间不多,因此 [妨碍了地址空间随机化的效果][6]。 +当计算机还是快乐、安全的时代时,在机器中的几乎每个进程上,那些段的起始虚拟地址都是**完全相同**的。这将使远程挖掘安全漏洞变得容易。漏洞利用经常需要去引用绝对内存位置:比如在栈中的一个地址,一个库函数的地址,等等。远程攻击可以闭着眼睛选择这个地址,因为地址空间都是相同的。当攻击者们这样做的时候,人们就会受到伤害。因此,地址空间随机化开始流行起来。Linux 会通过在其起始地址上增加偏移量来随机化[栈][3]、[内存映射段][4]、以及[堆][5]。不幸的是,32 位的地址空间是非常拥挤的,为地址空间随机化留下的空间不多,因此 [妨碍了地址空间随机化的效果][6]。 在进程地址空间中最高的段是栈,在大多数编程语言中它存储本地变量和函数参数。调用一个方法或者函数将推送一个新的栈帧stack frame到这个栈。当函数返回时这个栈帧被删除。这个简单的设计,可能是因为数据严格遵循 [后进先出(LIFO)][7] 的次序,这意味着跟踪栈内容时不需要复杂的数据结构 —— 一个指向栈顶的简单指针就可以做到。推入和弹出也因此而非常快且准确。也可能是,持续的栈区重用往往会在 [CPU 缓存][8] 中保持活跃的栈内存,这样可以加快访问速度。进程中的每个线程都有它自己的栈。 @@ -25,7 +25,7 @@ 在栈的下面,有内存映射段。在这里,内核将文件内容直接映射到内存。任何应用程序都可以通过 Linux 的 [`mmap()`][12] 系统调用( [代码实现][13])或者 Windows 的 [`CreateFileMapping()`][14] / [`MapViewOfFile()`][15] 来请求一个映射。内存映射是实现文件 I/O 的方便高效的方式。因此,它经常被用于加载动态库。有时候,也被用于去创建一个并不匹配任何文件的匿名内存映射,这种映射经常被用做程序数据的替代。在 Linux 中,如果你通过 [`malloc()`][16] 去请求一个大的内存块,C 库将会创建这样一个匿名映射而不是使用堆内存。这里所谓的“大”表示是超过了`MMAP_THRESHOLD` 设置的字节数,它的缺省值是 128 kB,可以通过 [`mallopt()`][17] 去调整这个设置值。 -接下来讲的是“堆”,就在我们接下来的地址空间中,堆提供运行时内存分配,像栈一样,但又不同于栈的是,它分配的数据生存期要长于分配它的函数。大多数编程语言都为程序提供了堆管理支持。因此,满足内存需要是编程语言运行时和内核共同来做的事情。在 C 中,堆分配的接口是 [`malloc()`][18] 一族,然而在垃圾回收式编程语言中,像 C#,这个接口使用 `new` 关键字。 +接下来讲的是“堆”,就在我们接下来的地址空间中,堆提供运行时内存分配,像栈一样,但又不同于栈的是,它分配的数据生存期要长于分配它的函数。大多数编程语言都为程序提供了堆管理支持。因此,满足内存需要是编程语言运行时和内核共同来做的事情。在 C 中,堆分配的接口是 [`malloc()`][18] 一族,然而在支持垃圾回收的编程语言中,像 C#,这个接口使用 `new` 关键字。 如果在堆中有足够的空间可以满足内存请求,它可以由编程语言运行时来处理内存分配请求,而无需内核参与。否则将通过 [`brk()`][19] 系统调用([代码实现][20])来扩大堆以满足内存请求所需的大小。堆管理是比较 [复杂的][21],在面对我们程序的混乱分配模式时,它通过复杂的算法,努力在速度和内存使用效率之间取得一种平衡。服务一个堆请求所需要的时间可能是非常可观的。实时系统有一个 [特定用途的分配器][22] 去处理这个问题。堆也会出现  _碎片化_ ,如下图所示: @@ -51,7 +51,7 @@ via: http://duartes.org/gustavo/blog/post/anatomy-of-a-program-in-memory/ -作者:[gustavo][a] +作者:[Gustavo Duarte][a] 译者:[qhwdw](https://github.com/qhwdw) 校对:[wxy](https://github.com/wxy) From d5eec05b521f820487477dff10805416f87665c2 Mon Sep 17 00:00:00 2001 From: wxy Date: Thu, 18 Jan 2018 18:50:47 +0800 Subject: [PATCH 07/23] PUB:20090127 Anatomy of a Program in Memory.md @qhwdw https://linux.cn/article-9255-1.html --- .../tech => published}/20090127 Anatomy of a Program in Memory.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20090127 Anatomy of a Program in Memory.md (100%) diff --git a/translated/tech/20090127 Anatomy of a Program in Memory.md b/published/20090127 Anatomy of a Program in Memory.md similarity index 100% rename from translated/tech/20090127 Anatomy of a Program in Memory.md rename to published/20090127 Anatomy of a Program in Memory.md From 3d36e3d24dc80b033b845de6eab6d52e665392db Mon Sep 17 00:00:00 2001 From: darksun Date: Thu, 18 Jan 2018 20:41:27 +0800 Subject: [PATCH 08/23] translate done: 20180109 Linux size Command Tutorial for Beginners (6 Examples).md --- ...and Tutorial for Beginners (6 Examples).md | 143 ------------------ ...and Tutorial for Beginners (6 Examples).md | 137 +++++++++++++++++ 2 files changed, 137 insertions(+), 143 deletions(-) delete mode 100644 sources/tech/20180109 Linux size Command Tutorial for Beginners (6 Examples).md create mode 100644 translated/tech/20180109 Linux size Command Tutorial for Beginners (6 Examples).md diff --git a/sources/tech/20180109 Linux size Command Tutorial for Beginners (6 Examples).md b/sources/tech/20180109 Linux size Command Tutorial for Beginners (6 Examples).md deleted file mode 100644 index 4467e442c5..0000000000 --- a/sources/tech/20180109 Linux size Command Tutorial for Beginners (6 Examples).md +++ /dev/null @@ -1,143 +0,0 @@ -translating by lujun9972 -Linux size Command Tutorial for Beginners (6 Examples) -====== - -As some of you might already know, an object or executable file in Linux consists of several sections (like txt and data). In case you want to know the size of each section, there exists a command line utility - dubbed **size** \- that provides you this information. In this tutorial, we will discuss the basics of this tool using some easy to understand examples. - -But before we do that, it's worth mentioning that all examples mentioned in this article have been tested on Ubuntu 16.04LTS. - -## Linux size command - -The size command basically lists section sizes as well as total size for the input object file(s). Here's the syntax for the command: -``` -size [-A|-B|--format=compatibility] -            [--help] -            [-d|-o|-x|--radix=number] -            [--common] -            [-t|--totals] -            [--target=bfdname] [-V|--version] -            [objfile...] -``` - -And here's how the man page describes this utility: -``` -The GNU size utility lists the section sizes---and the total size---for each of the object or archive files objfile in its argument list. By default, one line of output is generated for each object file or each module in an archive. - -objfile... are the object files to be examined. If none are specified, the file "a.out" will be used. -``` - -Following are some Q&A-styled examples that'll give you a better idea about how the size command works. - -## Q1. How to use size command? - -Basic usage of size is very simple. All you have to do is to pass the object/executable file name as input to the tool. Following is an example: - -``` -size apl -``` - -Following is the output the above command produced on our system: - -[![How to use size command][1]][2] - -The first three entries are for text, data, and bss sections, with their corresponding sizes. Then comes the total in decimal and hexadecimal formats. And finally, the last entry is for the filename. - -## Q2. How to switch between different output formats? - -The default output format, the man page for size says, is similar to the Berkeley's format. However, if you want, you can go for System V convention as well. For this, you'll have to use the **\--format** option with SysV as value. - -``` -size apl --format=SysV -``` - -Here's the output in this case: - -[![How to switch between different output formats][3]][4] - -## Q3. How to switch between different size units? - -By default, the size of sections is displayed in decimal. However, if you want, you can have this information on octal as well as hexadecimal. For this, use the **-o** and **-x** command line options. - -[![How to switch between different size units][5]][6] - -Here's what the man page says about these options: -``` --d --o --x ---radix=number - -Using one of these options, you can control whether the size of each section is given in decimal -(-d, or --radix=10); octal (-o, or --radix=8); or hexadecimal (-x, or --radix=16).  In ---radix=number, only the three values (8, 10, 16) are supported. The total size is always given in -two radices; decimal and hexadecimal for -d or -x output, or octal and hexadecimal if you're using --o. -``` - -## Q4. How to make size command show totals of all object files? - -If you are using size to find out section sizes for multiple files in one go, then if you want, you can also have the tool provide totals of all column values. You can enable this feature using the **-t** command line option. - -``` -size -t [file1] [file2] ... -``` - -The following screenshot shows this command line option in action: - -[![How to make size command show totals of all object files][7]][8] - -The last row in the output has been added by the **-t** command line option. - -## Q5. How to make size print total size of common symbols in each file? - -If you are running the size command with multiple input files, and want the command to display common symbols in each file, then you can do this with the **\--common** command line option. - -``` -size --common [file1] [file2] ... -``` - -It's also worth mentioning that when using Berkeley format these are included in the bss size. - -## Q6. What are the other available command line options? - -Aside from the ones discussed until now, size also offers some generic command line options like **-v** (for version info) and **-h** (for summary of eligible arguments and options) - -[![What are the other available command line options][9]][10] - -In addition, you can also make size read command-line options from a file. This you can do using the **@file** option. Following are some details related to this option: -``` -The options read are inserted in place of the original @file option. If file does not exist, or - cannot be read, then the option will be treated literally, and not removed. Options in file are -separated by whitespace. A whitespace character may be included in an option by surrounding the -entire option in either single or double quotes. Any character (including a backslash) may be -included by prefixing the character to be included with a backslash. The file may itself contain -additional @file options; any such options will be processed recursively. -``` - -## Conclusion - -One thing is clear, the size command isn't for everybody. It's aimed at only those who deal with the structure of object/executable files in Linux. So if you are among the target audience, practice the options we've discussed here, and you should be ready to use the tool on daily basis. For more information on size, head to its [man page][11]. - - --------------------------------------------------------------------------------- - -via: https://www.howtoforge.com/linux-size-command/ - -作者:[Himanshu Arora][a] -译者:[lujun9972](https://github.com/lujun9972) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://www.howtoforge.com -[1]:https://www.howtoforge.com/images/command-tutorial/size-basic-usage.png -[2]:https://www.howtoforge.com/images/command-tutorial/big/size-basic-usage.png -[3]:https://www.howtoforge.com/images/command-tutorial/size-format-option.png -[4]:https://www.howtoforge.com/images/command-tutorial/big/size-format-option.png -[5]:https://www.howtoforge.com/images/command-tutorial/size-o-x-options.png -[6]:https://www.howtoforge.com/images/command-tutorial/big/size-o-x-options.png -[7]:https://www.howtoforge.com/images/command-tutorial/size-t-option.png -[8]:https://www.howtoforge.com/images/command-tutorial/big/size-t-option.png -[9]:https://www.howtoforge.com/images/command-tutorial/size-v-x1.png -[10]:https://www.howtoforge.com/images/command-tutorial/big/size-v-x1.png -[11]:https://linux.die.net/man/1/size diff --git a/translated/tech/20180109 Linux size Command Tutorial for Beginners (6 Examples).md b/translated/tech/20180109 Linux size Command Tutorial for Beginners (6 Examples).md new file mode 100644 index 0000000000..3681dfa3c6 --- /dev/null +++ b/translated/tech/20180109 Linux size Command Tutorial for Beginners (6 Examples).md @@ -0,0 +1,137 @@ +六个例子带你入门 size 命令 +====== + +正如你所知道的那样,Linux 中的目标文件或着说可执行文件由多个段组成(比如 txt 和 data)。若你想知道每个段的大小,那么确实存在这么一个命令行工具 - 那就是 `size`。在本教程中,我们将会用几个简单易懂的案例来讲解该工具的基本用法。 + +在我们开始前,有必要先声明一下,本文的所有案例都在 Ubuntu 16.04LTS 中测试过了 .04LTS。 + +## Linux size 命令 + +size 命令基本上就是输出指定木比奥文件各段及其总和的大小。下面是该命令的语法: +``` +size [-A|-B|--format=compatibility] +            [--help] +            [-d|-o|-x|--radix=number] +            [--common] +            [-t|--totals] +            [--target=bfdname] [-V|--version] +            [objfile...] +``` + +man 页是这样描述它的: +``` +GNU的size程序列出参数列表objfile中,各目标文件(object)或存档库文件(archive)的段节(section)大小 — 以及总大小.默认情况下,对每目标文件或存档库中的每个模块都会产生一行输出. + +objfile... 是待检查的目标文件(object). 如果没有指定, 则默认为文件 "a.out". +``` + +下面是一些问答方式的案例,希望能让你对 size 命令有所了解。 + +## Q1。如何使用 size 命令? + +size 的基本用法很简单。你只需要将目标文件/可执行文件名称作为输入就行了。下面是一个例子: + +``` +size apl +``` + +该命令在我的系统中的输出如下: + +[![How to use size command][1]][2] + +前三部分的内容是 text,data,和 bss 段及其相应的大小。然后是十进制格式和十六进制格式的总大小。最后是文件名。 + +## Q2。如何切换不同的输出格式? + +根据 man 页的说法,size 的默认输出格式类似于 Berkeley 的格式。然而,如果你想的话,你也可以使用 System V 规范。要做到这一点,你可以使用 `--format` 选项加上 `SysV` 值。 + +``` +size apl --format=SysV +``` + +下面是它的输出: + +[![How to switch between different output formats][3]][4] + +## Q3。如何切换使用其他的单位? + +默认情况下,段的大小是以十进制的方式来展示。然而,如果你想的话,也可以使用八进制或十六进制来表示。对应的命令行参数分别为 `o` 和 `-x`。 + +[![How to switch between different size units][5]][6] + +关于这些参数,man 页是这么说的: +``` +-d +-o +-x +--radix=number + +使用这几个选项,你可以让各个段节的大小以十进制(`-d',或`--radix 10');八进制(`-o',或`--radix 8');或十六进制(`-x',或`--radix 16')数字的格式显示.`--radix number' 只支持三个数值参数 (8, 10, 16).总共大小以两种进制给出; `-d'或`-x'的十进制和十六进制输出,或`-o'的 八进制和 十六进制 输出. +``` + +## Q4。如何让 size 命令显示所有对象文件的总大小? + +如果你用 size 一次性查找多个文件的段大小,则通过使用 `-t` 选项还可以让它显示各列值的总和。 + +``` +size -t [file1] [file2] ... +``` + +下面是该命令的执行的截屏: + +[![How to make size command show totals of all object files][7]][8] + +`-t` 选项让它多加了最后那一行。 + +## Q5。如何让 size 输出每个文件中公共符号的总大小? + +若你为 size 提供多个输入文件作为参数,而且想让它显示每个文件中公共符号(指 common segment 中的 symbol) 的大小,则你可以带上 `--common` 选项。 + +``` +size --common [file1] [file2] ... +``` + +另外需要指出的是,当使用 Berkeley 格式时,和谐公共符号的大小被纳入了 bss 大小中。 + +## Q6。还有什么其他的选项? + +除了刚才提到的那些选项外,size 还有一些一般性的命令行选项,比如 `v` (显示版本信息) 和 `-h` (可选参数和选项的 summary) + +[![What are the other available command line options][9]][10] + +除此之外,你也可以使用 `@file` 选项来让 size 从文件中读取命令行选项。下面是详细的相关说明: +``` +读出来的选项会插入并替代原来的@file选项。若文件不存在或着无法读取,则该选项不会被删除,而是会以字面意义来解释该选项。 + +文件中的选项以空格分隔。当选项中要包含空格时需要用单引号或双引号将整个选项包起来。 +通过在字符前面添加一个反斜杠可以将任何字符(包括反斜杠本身)纳入到选项中。 +文件本身也能包含其他的@file选项;任何这样的选项都会被递归处理。 +``` + +## 结论 + +很明显,size 命令并不适用于所有人。它的目标群体是那些需要处理 Linux 中目标文件/可执行文件结构的人。因此,如果你刚好是目标受众,那么多试试我们这里提到的那些选项,你应该做好每天都使用这个工具的准备。想了解关于 size 的更多信息,请阅读它的 [man 页 ][11]。 + + +-------------------------------------------------------------------------------- + +via: https://www.howtoforge.com/linux-size-command/ + +作者:[Himanshu Arora][a] +译者:[lujun9972](https://github.com/lujun9972) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://www.howtoforge.com +[1]:https://www.howtoforge.com/images/command-tutorial/size-basic-usage.png +[2]:https://www.howtoforge.com/images/command-tutorial/big/size-basic-usage.png +[3]:https://www.howtoforge.com/images/command-tutorial/size-format-option.png +[4]:https://www.howtoforge.com/images/command-tutorial/big/size-format-option.png +[5]:https://www.howtoforge.com/images/command-tutorial/size-o-x-options.png +[6]:https://www.howtoforge.com/images/command-tutorial/big/size-o-x-options.png +[7]:https://www.howtoforge.com/images/command-tutorial/size-t-option.png +[8]:https://www.howtoforge.com/images/command-tutorial/big/size-t-option.png +[9]:https://www.howtoforge.com/images/command-tutorial/size-v-x1.png +[10]:https://www.howtoforge.com/images/command-tutorial/big/size-v-x1.png +[11]:https://linux.die.net/man/1/size From 9f3cd21f7d683210edd50b8fd7cc0ffdd85e2c9e Mon Sep 17 00:00:00 2001 From: darksun Date: Thu, 18 Jan 2018 21:02:12 +0800 Subject: [PATCH 09/23] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Linux/Unix=20App=20?= =?UTF-8?q?For=20Prevention=20Of=20RSI=20(Repetitive=20Strain=20Injury)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ntion Of RSI (Repetitive Strain Injury).md | 140 ++++++++++++++++++ 1 file changed, 140 insertions(+) create mode 100644 sources/tech/20091104 Linux-Unix App For Prevention Of RSI (Repetitive Strain Injury).md diff --git a/sources/tech/20091104 Linux-Unix App For Prevention Of RSI (Repetitive Strain Injury).md b/sources/tech/20091104 Linux-Unix App For Prevention Of RSI (Repetitive Strain Injury).md new file mode 100644 index 0000000000..0adea8a54c --- /dev/null +++ b/sources/tech/20091104 Linux-Unix App For Prevention Of RSI (Repetitive Strain Injury).md @@ -0,0 +1,140 @@ +Linux/Unix App For Prevention Of RSI (Repetitive Strain Injury) +====== +![workrave-image][1] + +[A repetitive strain injury][2] (RSI) is occupational overuse syndrome, non-specific arm pain or work related upper limb disorder. RSI caused from overusing the hands to perform a repetitive task, such as typing, writing, or clicking a mouse. Unfortunately, most people do not understand what RSI is or how dangerous it can be. You can easily prevent RSI using open source software called Workrave. + + +### What are the symptoms of RSI? + +I'm quoting from this [page][3]. Do you experience: + + 1. Fatigue or lack of endurance? + 2. Weakness in the hands or forearms? + 3. Tingling, numbness, or loss of sensation? + 4. Heaviness: Do your hands feel like dead weight? + 5. Clumsiness: Do you keep dropping things? + 6. Lack of strength in your hands? Is it harder to open jars? Cut vegetables? + 7. Lack of control or coordination? + 8. Chronically cold hands? + 9. Heightened awareness? Just being slightly more aware of a body part can be a clue that something is wrong. + 10. Hypersensitivity? + 11. Frequent self-massage (subconsciously)? + 12. Sympathy pains? Do your hands hurt when someone else talks about their hand pain? + + + +### How to reduce your risk of Developing RSI + + * Take breaks, when using your computer, every 30 minutes or so. Use software such as workrave to prevent RSI. + * Regular exercise can prevent all sort of injuries including RSI. + * Use good posture. Adjust your computer desk and chair to support muscles necessary for good posture. + + + +### Workrave + +Workrave is a free open source software application intended to prevent computer users from developing RSI or myopia. The software periodically locks the screen while an animated character, "Miss Workrave," walks the user through various stretching exercises and urges them to take a coffee break. The program frequently alerts you to take micro-pauses, rest breaks and restricts you to your daily limit. The program works under MS-Windows and Linux, UNIX-like operating systems. + +#### Install workrave + +Type the following [apt command][4]/[apt-get command][5] under a Debian / Ubuntu Linux: +`$ sudo apt-get install workrave` +Fedora Linux user should type the following dnf command: +`$ sudo dnf install workrave` +RHEL/CentOS Linux user should enable EPEL repo and install it using [yum command][6]: +``` +### [ **tested on a CentOS/RHEL 7.x and clones** ] ### +$ sudo yum install epel-release +$ sudo yum install https://rpms.remirepo.net/enterprise/remi-release-7.rpm +$ sudo yum install workrave +``` +Arch Linux user type the following pacman command to install it: +`$ sudo pacman -S workrave` +FreeBSD user can install it using the following pkg command: +`# pkg install workrave` +OpenBSD user can install it using the following pkg_add command +``` +$ doas pkg_add workrave +``` + +#### How to configure workrave + +Workrave works as an applet which is a small application whose user interface resides within a panel. You need to add workrave to panel to control behavior and appearance of the software. + +##### Adding a New Workrave Object To Panel + + * Right-click on a vacant space on a panel to open the panel popup menu. + * Choose Add to Panel. + * The Add to Panel dialog opens.The available panel objects are listed alphabetically, with launchers at the top. Select workrave applet and click on Add button. + +![Fig.01: Adding an Object \(Workrave\) to a Panel][7] +Fig.01: Adding an Object (Workrave) to a Panel + +##### How Do I Modify Properties Of Workrave Software? + +To modify the properties of an object workrave, perform the following steps: + + * Right-click on the workrave object to open the panel object popup. + * Choose Preference. Use the Properties dialog to modify the properties as required. + +![](https://www.cyberciti.biz/media/new/tips/2009/11/linux-gnome-workwave-preferences-.png) +Fig.02: Modifying the Properties of The Workrave Software + +#### Workrave in Action + +The main window shows the time remaining until it suggests a pause. The windows can be closed and you will the time remaining on the panel itself: +![Fig.03: Time reaming counter ][8] +Fig.03: Time reaming counter + +![Fig.04: Miss Workrave - an animated character walks you through various stretching exercises][9] +Fig.04: Miss Workrave - an animated character walks you through various stretching exercises + +The break prelude window, bugging you to take a micro-pause: +![Fig.05: Time for a micro-pause remainder ][10] +Fig.05: Time for a micro-pause remainder + +![Fig.06: You can skip Micro-break ][11] +Fig.06: You can skip Micro-break + +##### References: + + 1. [Workrave project][12] home page. + 2. [pokoy][13] lightweight daemon that helps prevent RSI and other computer related stress. + 3. [A Pomodoro][14] timer for GNOME 3. + 4. [RSI][2] from the wikipedia. + + + +### about the author + +The author is the creator of nixCraft and a seasoned sysadmin and a trainer for the Linux operating system/Unix shell scripting. He has worked with global clients and in various industries, including IT, education, defense and space research, and the nonprofit sector. Follow him on [Twitter][15], [Facebook][16], [Google+][17]. + +-------------------------------------------------------------------------------- + +via: https://www.cyberciti.biz/tips/repetitive-strain-injury-prevention-software.html + +作者:[Vivek Gite][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://www.cyberciti.biz/ +[1]:https://www.cyberciti.biz/media/new/tips/2009/11/workrave-image.jpg (workrave-image) +[2]:https://en.wikipedia.org/wiki/Repetitive_strain_injury +[3]:https://web.eecs.umich.edu/~cscott/rsi.html##symptoms +[4]:https://www.cyberciti.biz/faq/ubuntu-lts-debian-linux-apt-command-examples/ (See Linux/Unix apt command examples for more info) +[5]:https://www.cyberciti.biz/tips/linux-debian-package-management-cheat-sheet.html (See Linux/Unix apt-get command examples for more info) +[6]:https://www.cyberciti.biz/faq/rhel-centos-fedora-linux-yum-command-howto/ (See Linux/Unix yum command examples for more info) +[7]:https://www.cyberciti.biz/media/new/tips/2009/11/add-workwave-to-panel.png (Adding an Object (Workrave) to a Gnome Panel) +[8]:https://www.cyberciti.biz/media/new/tips/2009/11/screenshot-workrave.png (Workrave main window shows the time remaining until it suggests a pause.) +[9]:https://www.cyberciti.biz/media/new/tips/2009/11/miss-workrave.png (Miss Workrave Sofrware character walks you through various RSI stretching exercises ) +[10]:https://www.cyberciti.biz/media/new/tips/2009/11/time-for-micro-pause.gif (Workrave RSI Software Time for a micro-pause remainder ) +[11]:https://www.cyberciti.biz/media/new/tips/2009/11/Micro-break.png (Workrave RSI Software Micro-break ) +[12]:http://www.workrave.org/ +[13]:https://github.com/ttygde/pokoy +[14]:http://gnomepomodoro.org +[15]:https://twitter.com/nixcraft +[16]:https://facebook.com/nixcraft +[17]:https://plus.google.com/+CybercitiBiz From a1fd7ca41ef8446fccd7c23f8b42a3974d305ba9 Mon Sep 17 00:00:00 2001 From: Locez Date: Fri, 19 Jan 2018 00:51:42 +0800 Subject: [PATCH 10/23] Reviewed by Locez --- ...1016 Using the Linux find command with caution.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/translated/tech/20171016 Using the Linux find command with caution.md b/translated/tech/20171016 Using the Linux find command with caution.md index 552d1738f7..e0b8b49763 100644 --- a/translated/tech/20171016 Using the Linux find command with caution.md +++ b/translated/tech/20171016 Using the Linux find command with caution.md @@ -1,7 +1,7 @@ 谨慎使用 Linux find 命令 ====== ![](https://images.idgesg.net/images/article/2017/10/caution-sign-100738884-large.jpg) -最近有朋友提醒我在运行 find 命令的时候可以添加一个有用的选项来增加一些谨慎。它是 -ok,除了一个重要的区别之外,它的工作方式与 -exec 相似,它使 find 命令在执行指定的操作之前请求权限。 +最近有朋友提醒我可以添加一个有用的选项来更加谨慎地运行 find 命令,它是 -ok。除了一个重要的区别之外,它的工作方式与 -exec 相似,它使 find 命令在执行指定的操作之前请求权限。 这有一个例子。如果你使用 find 命令查找文件并删除它们,则可以运行下面的命令: ``` @@ -9,7 +9,7 @@ $ find . -name runme -exec rm {} \; ``` -在当前目录及其子目录中中任何名为 “runme” 的文件都将被立即删除 - 当然,你要有权删除它们。改用 -ok 选项,你会看到类似这样的东西。find 命令将在删除文件之前会请求权限。回答 **y** 代表 “yes” 将允许 find 命令继续并逐个删除文件。 +在当前目录及其子目录中中任何名为 “runme” 的文件都将被立即删除 - 当然,你要有权删除它们。改用 -ok 选项,你会看到类似这样的东西,find 命令将在删除文件之前会请求权限。回答 **y** 代表 “yes” 将允许 find 命令继续并逐个删除文件。 ``` $ find . -name runme -ok rm {} \; < rm ... ./bin/runme > ? @@ -18,7 +18,7 @@ $ find . -name runme -ok rm {} \; ### -exedir 命令也是一个选项 -另一个可以用来修改 find​​ 命令行为并可能使其更可控的选项是 -execdir 命令。其中 -exec 运行指定的任何命令,-execdir 从文件所在的目录运行指定的命令,而不是运行 find 命令所在的目录。这是一个它的例子: +另一个可以用来修改 find 命令行为并可能使其更可控的选项是 -execdir 。其中 -exec 运行指定的任何命令,-execdir 从文件所在的目录运行指定的命令,而不是在运行 find 命令的目录运行。这是一个它的例子: ``` $ pwd /home/shs @@ -32,7 +32,7 @@ ls rm runme ``` -到现在为止还挺好。但要记住的是,-execdir 也会在匹配文件的目录中执行命令。如果运行下面的命令,并且目录包含一个名为 “ls” 的文件,那么即使该文件_没有_执行权限,它也将运行该文件。使用 **-exec** 或 **-execdir** 类似于通过 source 来运行命令。 +到现在为止还挺好。但要记住的是,-execdir 也会在匹配文件的目录中执行命令。如果运行下面的命令,并且目录包含一个名为 “ls” 的文件,那么即使该文件没有_执行权限,它也将运行该文件。使用 **-exec** 或 **-execdir** 类似于通过 source 来运行命令。 ``` $ find . -name runme -execdir ls \; Running the /home/shs/bin/ls file @@ -61,7 +61,7 @@ echo This is an imposter rm command ### -okdir 选项也会请求权限 -要更谨慎,可以使用 **-okdir** 选项。类似 **-ok**,该选项将要求权限来运行该命令。 +要更谨慎,可以使用 **-okdir** 选项。类似 **-ok**,该选项将请求权限来运行该命令。 ``` $ find . -name runme -okdir rm {} \; < rm ... ./bin/runme > ? @@ -74,7 +74,7 @@ $ find . -name runme -execdir /bin/rm {} \; ``` -find 命令除了默认打印之外还有很多选项。有些可以使你的文件搜索更精确,但一点小心总是一个好主意。 +find 命令除了默认打印之外还有很多选项,有些可以使你的文件搜索更精确,但谨慎一点总是好的。 在 [Facebook][1] 和 [LinkedIn][2] 上加入网络世界社区来进行评论。 From 65e4969a9e89a3eac7b0244e9992902c225031d5 Mon Sep 17 00:00:00 2001 From: Locez Date: Fri, 19 Jan 2018 00:52:46 +0800 Subject: [PATCH 11/23] Reviewed by Locez --- .../tech/20171016 Using the Linux find command with caution.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/translated/tech/20171016 Using the Linux find command with caution.md b/translated/tech/20171016 Using the Linux find command with caution.md index e0b8b49763..a72ff48c11 100644 --- a/translated/tech/20171016 Using the Linux find command with caution.md +++ b/translated/tech/20171016 Using the Linux find command with caution.md @@ -84,7 +84,7 @@ via: https://www.networkworld.com/article/3233305/linux/using-the-linux-find-com 作者:[Sandra Henry-Stocker][a] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[Locez](https://github.com/locez) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From bd93ad3285ee1e4d61a83fa5e71661548c930f7e Mon Sep 17 00:00:00 2001 From: Locez Date: Fri, 19 Jan 2018 01:33:17 +0800 Subject: [PATCH 12/23] Reviewed by Locez --- ...up Japanese Language Environment In Arch Linux.md | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/translated/tech/20171108 How To Setup Japanese Language Environment In Arch Linux.md b/translated/tech/20171108 How To Setup Japanese Language Environment In Arch Linux.md index e924dcbf28..97bbfe6fb6 100644 --- a/translated/tech/20171108 How To Setup Japanese Language Environment In Arch Linux.md +++ b/translated/tech/20171108 How To Setup Japanese Language Environment In Arch Linux.md @@ -7,7 +7,7 @@ ### 在Arch Linux中设置日语环境 -首先,安装必要的日语字体,以正确查看日语 ASCII 格式: +首先,为了正确查看日语 ASCII 格式,先安装必要的日语字体: ``` sudo pacman -S adobe-source-han-sans-jp-fonts otf-ipafont ``` @@ -27,7 +27,7 @@ pacaur -S ttf-monapo sudo pacman -S ibus ibus-anthy ``` -在 **~/.xprofile** 中添加以下行(如果不存在,创建一个): +在 **~/.xprofile** 中添加以下几行(如果不存在,创建一个): ``` # Settings for Japanese input export GTK_IM_MODULE='ibus' @@ -38,7 +38,7 @@ export XMODIFIERS=@im='ibus' ibus-daemon -drx ``` -~/.xprofile 允许我们在窗口管理器启动之前在 X 用户会话开始时执行命令。 +~/.xprofile 允许我们在 X 用户会话开始时且在窗口管理器启动之前执行命令。 保存并关闭文件。重启 Arch Linux 系统以使更改生效。 @@ -72,9 +72,9 @@ ibus-setup [![][2]][8] -你还可以在键盘绑定中编辑默认的快捷键。完成所有更改后,单击应用并确定。就是这样。从任务栏中的 iBus 图标中选择日语,或者按下**Command/Window 键+空格键**来在日语和英语(或者系统中的其他默认语言)之间切换。你可以从 iBus 首选项窗口更改键盘快捷键。 +你还可以在键盘绑定中编辑默认的快捷键。完成所有更改后,点击应用并确定。就是这样。从任务栏中的 iBus 图标中选择日语,或者按下**SUPER 键+空格键**(LCTT译注:SUPER KEY 通常为 Command/Window KEY)来在日语和英语(或者系统中的其他默认语言)之间切换。你可以从 iBus 首选项窗口更改键盘快捷键。 -你现在知道如何在 Arch Linux 及其衍生版中使用日语了。如果你发现我们的指南很有用,那么请您在社交、专业网络上分享,并支持 OSTechNix。 +现在你知道如何在 Arch Linux 及其衍生版中使用日语了。如果你发现我们的指南很有用,那么请您在社交、专业网络上分享,并支持 OSTechNix。 @@ -84,7 +84,7 @@ via: https://www.ostechnix.com/setup-japanese-language-environment-arch-linux/ 作者:[][a] 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[Locez](https://github.com/locez) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From 6df56b99aa629f42e752ccf34a040242e64911e8 Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 19 Jan 2018 09:00:01 +0800 Subject: [PATCH 13/23] translated --- ... with Vi-Vim Editor - Advanced concepts.md | 119 ------------------ ... with Vi-Vim Editor - Advanced concepts.md | 116 +++++++++++++++++ 2 files changed, 116 insertions(+), 119 deletions(-) delete mode 100644 sources/tech/20170524 Working with Vi-Vim Editor - Advanced concepts.md create mode 100644 translated/tech/20170524 Working with Vi-Vim Editor - Advanced concepts.md diff --git a/sources/tech/20170524 Working with Vi-Vim Editor - Advanced concepts.md b/sources/tech/20170524 Working with Vi-Vim Editor - Advanced concepts.md deleted file mode 100644 index a12c95e409..0000000000 --- a/sources/tech/20170524 Working with Vi-Vim Editor - Advanced concepts.md +++ /dev/null @@ -1,119 +0,0 @@ -translating---geekpi - - -Working with Vi/Vim Editor : Advanced concepts -====== -Earlier we have discussed some basics about VI/VIM editor but VI & VIM are both very powerful editors and there are many other functionalities that can be used with these editors. In this tutorial, we are going to learn some advanced uses of VI/VIM editor. - -( **Recommended Read** : [Working with VI editor : The Basics ][1]) - -## Opening multiple files with VI/VIM editor - -To open multiple files, command would be same as is for a single file; we just add the file name for second file as well. - -``` - $ vi file1 file2 file 3 -``` - -Now to browse to next file, we can use - -``` -$ :n -``` - -or we can also use - -``` -$ :e filename -``` - -## Run external commands inside the editor - -We can run external Linux/Unix commands from inside the vi editor, i.e. without exiting the editor. To issue a command from editor, go back to Command Mode if in Insert mode & we use the BANG i.e. '!' followed by the command that needs to be used. Syntax for running a command is, - -``` -$ :! command -``` - -An example for this would be - -``` -$ :! df -H -``` - -## Searching for a pattern - -To search for a word or pattern in the text file, we use following two commands in command mode, - - * command '/' searches the pattern in forward direction - - * command '?' searched the pattern in backward direction - - -Both of these commands are used for same purpose, only difference being the direction they search in. An example would be, - - `$ :/ search pattern` (If at beginning of the file) - - `$ :/ search pattern` (If at the end of the file) - -## Searching & replacing a pattern - -We might be required to search & replace a word or a pattern from our text files. So rather than finding the occurrence of word from whole text file & replace it, we can issue a command from the command mode to replace the word automatically. Syntax for using search & replacement is, - -``` -$ :s/pattern_to_be_found/New_pattern/g -``` - -Suppose we want to find word "alpha" & replace it with word "beta", the command would be - -``` -$ :s/alpha/beta/g -``` - -If we want to only replace the first occurrence of word "alpha", then the command would be - -``` -$ :s/alpha/beta/ -``` - -## Using Set commands - -We can also customize the behaviour, the and feel of the vi/vim editor by using the set command. Here is a list of some options that can be use set command to modify the behaviour of vi/vim editor, - - `$ :set ic ` ignores cases while searching - - `$ :set smartcase ` enforce case sensitive search - - `$ :set nu` display line number at the begining of the line - - `$ :set hlsearch ` highlights the matching words - - `$ : set ro ` change the file type to read only - - `$ : set term ` prints the terminal type - - `$ : set ai ` sets auto-indent - - `$ :set noai ` unsets the auto-indent - -Some other commands to modify vi editors are, - - `$ :colorscheme ` its used to change the color scheme for the editor. (for VIM editor only) - - `$ :syntax on ` will turn on the color syntax for .xml, .html files etc. (for VIM editor only) - -This complete our tutorial, do mention your queries/questions or suggestions in the comment box below. - - --------------------------------------------------------------------------------- - -via: http://linuxtechlab.com/working-vivim-editor-advanced-concepts/ - -作者:[Shusain][a] -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:http://linuxtechlab.com/author/shsuain/ -[1]:http://linuxtechlab.com/working-vi-editor-basics/ diff --git a/translated/tech/20170524 Working with Vi-Vim Editor - Advanced concepts.md b/translated/tech/20170524 Working with Vi-Vim Editor - Advanced concepts.md new file mode 100644 index 0000000000..d31527b055 --- /dev/null +++ b/translated/tech/20170524 Working with Vi-Vim Editor - Advanced concepts.md @@ -0,0 +1,116 @@ +使用 Vi/Vim 编辑器:高级概念 +====== +早些时候我们已经讨论了一些关于 VI/VIM 编辑器的基础知识,但是 VI 和 VIM 都是非常强大的编辑器,还有很多其他的功能可以和编辑器一起使用。在本教程中,我们将学习 VI/VIM 编辑器的一些高级用法。 + +(**推荐阅读**:[使用 VI 编辑器:基础知识] [1]) + +## 使用 VI/VIM 编辑器打开多个文件 + +要打开多个文件,命令将与打开单个文件相同。我们只要添加第二个文件的名称。 + +``` + $ vi file1 file2 file 3 +``` + +要浏览到下一个文件,我们可以使用 + +``` +$ :n +``` + +或者我们也可以使用 + +``` +$ :e filename +``` + +## 在编辑器中运行外部命令 + +我们可以在 vi 编辑器内部运行外部的 Linux/Unix 命令,也就是说不需要退出编辑器。要在编辑器中运行命令,如果在插入模式下,先返回到命令模式,我们使用 BANG 也就是 “!” 接着是需要使用的命令。运行命令的语法是: + +``` +$ :! command +``` + +这是一个例子 + +``` +$ :! df -H +``` + +## 根据模板搜索 + +要在文本文件中搜索一个单词或模板,我们在命令模式下使用以下两个命令: + + * 命令 “/” 代表正向搜索模板 + + * 命令 “?” 代表正向搜索模板 + + +这两个命令都用于相同的目的,唯一不同的是它们搜索的方向。一个例子是: + + `$ :/ search pattern` (如果在文件的开头) + + `$ :? search pattern` (如果在文件末尾) + +## 搜索并替换一个模板 + +我们可能需要搜索和替换我们的文本中的单词或模板。我们不是从整个文本中找到单词的出现的地方并替换它,我们可以在命令模式中使用命令来自动替换单词。使用搜索和替换的语法是: + +``` +$ :s/pattern_to_be_found/New_pattern/g +``` + +假设我们想要将单词 “alpha” 用单词 “beta” 代替,命令就是这样: + +``` +$ :s/alpha/beta/g +``` + +如果我们只想替换第一个出现的 “alpha”,那么命令就是: + +``` +$ :s/alpha/beta/ +``` + +## 使用 set 命令 + +我们也可以使用 set 命令自定义 vi/vim 编辑器的行为和外观。下面是一些可以使用 set 命令修改 vi/vim 编辑器行为的选项列表: + + `$ :set ic ` 在搜索时忽略大小写 + + `$ :set smartcase ` 搜索强制区分大小写 + + `$ :set nu` 在每行开始显示行号 + + `$ :set hlsearch ` 高亮显示匹配的单词 + + `$ : set ro ` 将文件类型更改为只读 + + `$ : set term ` 打印终端类型 + + `$ : set ai ` 设置自动缩进 + + `$ :set noai ` 取消自动缩进 + +其他一些修改 vi 编辑器的命令是: + + `$ :colorscheme ` 用来改变编辑器的配色方案 。(仅适用于 VIM 编辑器) + + `$ :syntax on ` 为 .xml、.html 等文件打开颜色方案。(仅适用于VIM编辑器) + +这篇结束了本系列教程,请在下面的评论栏中提出你的疑问/问题或建议。 + + +-------------------------------------------------------------------------------- + +via: http://linuxtechlab.com/working-vivim-editor-advanced-concepts/ + +作者:[Shusain][a] +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:http://linuxtechlab.com/author/shsuain/ +[1]:http://linuxtechlab.com/working-vi-editor-basics/ From 11785596f67f9e5a60561bed02691441981e5f9c Mon Sep 17 00:00:00 2001 From: geekpi Date: Fri, 19 Jan 2018 09:16:23 +0800 Subject: [PATCH 14/23] translating --- ...71027 Easy guide to secure VNC server with TLS encryption.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/sources/tech/20171027 Easy guide to secure VNC server with TLS encryption.md b/sources/tech/20171027 Easy guide to secure VNC server with TLS encryption.md index 189e57535f..7548991798 100644 --- a/sources/tech/20171027 Easy guide to secure VNC server with TLS encryption.md +++ b/sources/tech/20171027 Easy guide to secure VNC server with TLS encryption.md @@ -1,3 +1,5 @@ +translating---geekpi + Easy guide to secure VNC server with TLS encryption ====== In this tutorial, we will learn to install VNC server & secure VNC server sessions with TLS encryption. From a78ef7c5023ded21775f823a530b4f47c53169a4 Mon Sep 17 00:00:00 2001 From: darksun Date: Fri, 19 Jan 2018 11:22:37 +0800 Subject: [PATCH 15/23] =?UTF-8?q?=E9=80=89=E9=A2=98:=20How=20debuggers=20r?= =?UTF-8?q?eally=20work?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../20180115 How debuggers really work.md | 99 +++++++++++++++++++ 1 file changed, 99 insertions(+) create mode 100644 sources/tech/20180115 How debuggers really work.md diff --git a/sources/tech/20180115 How debuggers really work.md b/sources/tech/20180115 How debuggers really work.md new file mode 100644 index 0000000000..452bc67823 --- /dev/null +++ b/sources/tech/20180115 How debuggers really work.md @@ -0,0 +1,99 @@ +How debuggers really work +====== + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/annoyingbugs.png?itok=ywFZ99Gs) + +Image by : opensource.com + +A debugger is one of those pieces of software that most, if not every, developer uses at least once during their software engineering career, but how many of you know how they actually work? During my talk at [linux.conf.au 2018][1] in Sydney, I will be talking about writing a debugger from scratch... in [Rust][2]! + +In this article, the terms debugger/tracer are interchangeably. "Tracee" refers to the process being traced by the tracer. + +### The ptrace system call + +Most debuggers heavily rely on a system call known as `ptrace(2)`, which has the prototype: +``` + + +long ptrace(enum __ptrace_request request, pid_t pid, void *addr, void *data); +``` + +This is a system call that can manipulate almost all aspects of a process; however, before the debugger can attach to a process, the "tracee" has to call `ptrace` with the request `PTRACE_TRACEME`. This tells Linux that it is legitimate for the parent to attach via `ptrace` to this process. But... how do we coerce a process into calling `ptrace`? Easy-peasy! `fork/execve` provides an easy way of calling `ptrace` after `fork` but before the tracee really starts using `execve`. Conveniently, `fork` will also return the `pid` of the tracee, which is required for using `ptrace` later. + +Now that the tracee can be traced by the debugger, important changes take place: + + * Every time a signal is delivered to the tracee, it stops and a wait-event is delivered to the tracer that can be captured by the `wait` family of system calls. + * Each `execve` system call will cause a `SIGTRAP` to be delivered to the tracee. (Combined with the previous item, this means the tracee is stopped before an `execve` can fully take place.) + + + +This means that, once we issue the `PTRACE_TRACEME` request and call the `execve` system call to actually start the program in the tracee, the tracee will immediately stop, since `execve` delivers a `SIGTRAP`, and that is caught by a wait-event in the tracer. How do we continue? As one would expect, `ptrace` has a number of requests that can be used for telling the tracee it's fine to continue: + + * `PTRACE_CONT`: This is the simplest. The tracee runs until it receives a signal, at which point a wait-event is delivered to the tracer. This is most commonly used to implement "continue-until-breakpoint" and "continue-forever" options of a real-world debugger. Breakpoints will be covered below. + * `PTRACE_SYSCALL`: Very similar to `PTRACE_CONT`, but stops before a system call is entered and also before a system call returns to userspace. It can be used in combination with other requests (which we will cover later in this article) to monitor and modify a system call's arguments or return value. `strace`, the system call tracer, uses this request heavily to figure out what system calls are made by a process. + * `PTRACE_SINGLESTEP`: This one is pretty self-explanatory. If you used a debugger before, this request executes the next instruction, but stops immediately after. + + + +We can stop the process with a variety of requests, but how do we get the state of the tracee? The state of a process is mostly captured by its registers, so of course `ptrace` has a request to get (or modify!) the registers: + + * `PTRACE_GETREGS`: This request will give the registers' state as it was when a tracee was stopped. + * `PTRACE_SETREGS`: If the tracer has the values of registers from a previous call to `PTRACE_GETREGS`, it can modify the values in that structure and set the registers to the new values via this request. + * `PTRACE_PEEKUSER` and `PTRACE_POKEUSER`: These allow reading from the tracee's `USER` area, which holds the registers and other useful information. This can be used to modify a single register, without the more heavyweight `PTRACE_{GET,SET}REGS`. + + + +Modifying the registers isn't always sufficient in a debugger. A debugger will sometimes need to read some parts of the memory or even modify it. The GNU Project Debugger (GDB) can use `print` to get the value of a memory location or a variable. `ptrace` has the functionality to implement this: + + * `PTRACE_PEEKTEXT` and `PTRACE_POKETEXT`: These allow reading and writing a word in the address space of the tracee. Of course, the tracee has to be stopped for this to work. + + + +Real-world debuggers also have features like breakpoints and watchpoints. In the next section, I'll dive into the architectural details of debugging support. For the purposes of clarity and conciseness, this article will consider x86 only. + +### Architectural support + +`ptrace` is all cool, but how does it work? In the previous section, we've seen that `ptrace` has quite a bit to do with signals: `SIGTRAP` can be delivered during single-stepping, before `execve` and before or after system calls. Signals can be generated a number of ways, but we will look at two specific examples that can be used by debuggers to stop a program (effectively creating a breakpoint!) at a given location: + + * **Undefined instructions:** When a process tries to execute an undefined instruction, an exception is raised by the CPU. This exception is handled via a CPU interrupt, and a handler corresponding to the interrupt in the kernel is called. This will result in a `SIGILL` being sent to the process. This, in turn, causes the process to stop, and the tracer is notified via a wait-event. It can then decide what to do. On x86, an instruction `ud2` is guaranteed to be always undefined. + + * **Debugging interrupt:** The problem with the previous approach is that the `ud2` instruction takes two bytes of machine code. A special instruction exists that takes one byte and raises an interrupt. It's `int $3` and the machine code is `0xCC`. When this interrupt is raised, the kernel sends a `SIGTRAP` to the process and, just as before, the tracer is notified. + + + + +This is fine, but how do we coerce the tracee to execute these instructions? Easy: `ptrace` has `PTRACE_POKETEXT`, which can override a word at a memory location. A debugger would read the original word at the location using `PTRACE_PEEKTEXT` and replace it with `0xCC`, remembering the original byte and the fact that it is a breakpoint in its internal state. The next time the tracee executes at the location, it is automatically stopped by the virtue of a `SIGTRAP`. The debugger's end user can then decide how to continue (for instance, inspect the registers). + +Okay, we've covered breakpoints, but what about watchpoints? How does a debugger stop a program when a certain memory location is read or written? Surely you wouldn't just overwrite every instruction with `int $3` that could read or write some memory location. Meet debug registers, a set of registers designed to fulfill this goal more efficiently: + + * `DR0` to `DR3`: Each of these registers contains an address (a memory location), where the debugger wants the tracee to stop for some reason. The reason is specified as a bitmask in `DR7`. + * `DR4` and `DR5`: These obsolete aliases to `DR6` and `DR7`, respectively. + * `DR6`: Debug status. Contains information about which `DR0` to `DR3` caused the debugging exception to be raised. This is used by Linux to figure out the information passed along with the `SIGTRAP` to the tracee. + * `DR7`: Debug control. Using the bits in these registers, the debugger can control how the addresses specified in `DR0` to `DR3` are interpreted. A bitmask controls the size of the watchpoint (whether 1, 2, 4, or 8 bytes are monitored) and whether to raise an exception on execution, reading, writing, or either of reading and writing. + + + +Because the debug registers form part of the `USER` area of a process, the debugger can use `PTRACE_POKEUSER` to write values into the debug registers. The debug registers are only relevant to a specific process and are thus restored to the value at preemption before the process regains control of the CPU. + +### Tip of the iceberg + +We've glanced at the iceberg a debugger is: we've covered `ptrace`, went over some of its functionality, then we had a look at how `ptrace` is implemented. Some parts of `ptrace` can be implemented in software, but other parts have to be implemented in hardware, otherwise they'd be very expensive or even impossible. + +There's plenty that we didn't cover, of course. Questions, like "how does a debugger know where a variable is in memory?" remain open due to space and time constraints, but I hope you've learned something from this article; if it piqued your interest, there are plenty of resources available online to learn more. + +For more, attend Levente Kurusa's talk, [Let's Write a Debugger!][3], at [linux.conf.au][1], which will be held January 22-26 in Sydney. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/1/how-debuggers-really-work + +作者:[Levente Kurusa][a] +译者:[译者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/lkurusa +[1]:https://linux.conf.au/index.html +[2]:https://www.rust-lang.org +[3]:https://rego.linux.conf.au/schedule/presentation/91/ From 75808cb1e84a08ebe2f14dad1b0886c184ec7870 Mon Sep 17 00:00:00 2001 From: wxy Date: Fri, 19 Jan 2018 11:25:42 +0800 Subject: [PATCH 16/23] PRF:20161004 What happens when you start a process on Linux.md @jessie-pang --- ...ppens when you start a process on Linux.md | 56 +++++++------------ 1 file changed, 19 insertions(+), 37 deletions(-) diff --git a/translated/tech/20161004 What happens when you start a process on Linux.md b/translated/tech/20161004 What happens when you start a process on Linux.md index 5c97fe7dc4..952405c3e1 100644 --- a/translated/tech/20161004 What happens when you start a process on Linux.md +++ b/translated/tech/20161004 What happens when you start a process on Linux.md @@ -1,52 +1,47 @@ 当你在 Linux 上启动一个进程时会发生什么? =========================================================== - 本文是关于 fork 和 exec 是如何在 Unix 上工作的。你或许已经知道,也有人还不知道。几年前当我了解到这些时,我惊叹不已。 我们要做的是启动一个进程。我们已经在博客上讨论了很多关于**系统调用**的问题,每当你启动一个进程或者打开一个文件,这都是一个系统调用。所以你可能会认为有这样的系统调用: ``` start_process(["ls", "-l", "my_cool_directory"]) - ``` 这是一个合理的想法,显然这是它在 DOS 或 Windows 中的工作原理。我想说的是,这并不是 Linux 上的工作原理。但是,我查阅了文档,确实有一个 [posix_spawn][2] 的系统调用基本上是这样做的,不过这不在本文的讨论范围内。 ### fork 和 exec -Linux 上的 `posix_spawn` 是通过两个系统调用实现的,分别是 `fork` 和 `exec`(实际上是 execve),这些都是人们常常使用的。尽管在 OS X 上,人们使用 `posix_spawn`,而 fork 和 exec 是不提倡的,但我们将讨论的是 Linux。 +Linux 上的 `posix_spawn` 是通过两个系统调用实现的,分别是 `fork` 和 `exec`(实际上是 `execve`),这些都是人们常常使用的。尽管在 OS X 上,人们使用 `posix_spawn`,而 `fork` 和 `exec` 是不提倡的,但我们将讨论的是 Linux。 -Linux 中的每个进程都存在于“进程树”中。你可以通过运行 `pstree` 命令查看进程树。树的根是 `init`,进程号是 1。每个进程(init 除外)都有一个父进程,一个进程都可以有很多子进程。 +Linux 中的每个进程都存在于“进程树”中。你可以通过运行 `pstree` 命令查看进程树。树的根是 `init`,进程号是 1。每个进程(`init` 除外)都有一个父进程,一个进程都可以有很多子进程。 所以,假设我要启动一个名为 `ls` 的进程来列出一个目录。我是不是只要发起一个进程 `ls` 就好了呢?不是的。 -我要做的是,创建一个子进程,这个子进程是我本身的一个克隆,然后这个子进程的“大脑”被替代,变成 `ls`。 +我要做的是,创建一个子进程,这个子进程是我(`me`)本身的一个克隆,然后这个子进程的“脑子”被吃掉了,变成 `ls`。 开始是这样的: ``` my parent |- me - ``` -然后运行 `fork()`,生成一个子进程,是我自己的一份克隆: +然后运行 `fork()`,生成一个子进程,是我(`me`)自己的一份克隆: ``` my parent |- me |-- clone of me - ``` -然后我让子进程运行 `exec("ls")`,变成这样: +然后我让该子进程运行 `exec("ls")`,变成这样: ``` my parent |- me |-- ls - ``` 当 ls 命令结束后,我几乎又变回了我自己: @@ -55,24 +50,22 @@ my parent my parent |- me |-- ls (zombie) - ``` -在这时 ls 其实是一个僵尸进程。这意味着它已经死了,但它还在等我,以防我需要检查它的返回值(使用 `wait` 系统调用)。一旦我获得了它的返回值,我将再次恢复独自一人的状态。 +在这时 `ls` 其实是一个僵尸进程。这意味着它已经死了,但它还在等我,以防我需要检查它的返回值(使用 `wait` 系统调用)。一旦我获得了它的返回值,我将再次恢复独自一人的状态。 ``` my parent |- me - ``` ### fork 和 exec 的代码实现 -如果你要编写一个 shell,这是你必须做的一个练习(这是一个非常有趣和有启发性的项目。Kamal 在 Github 上有一个很棒的研讨会:[https://github.com/kamalmarhubi/shell-workshop][3]) +如果你要编写一个 shell,这是你必须做的一个练习(这是一个非常有趣和有启发性的项目。Kamal 在 Github 上有一个很棒的研讨会:[https://github.com/kamalmarhubi/shell-workshop][3])。 -事实证明,有了 C 或 Python 的技能,你可以在几个小时内编写一个非常简单的 shell,例如 bash。(至少如果你旁边能有个人多少懂一点,如果没有的话用时会久一点。)我已经完成啦,真的很棒。 +事实证明,有了 C 或 Python 的技能,你可以在几个小时内编写一个非常简单的 shell,像 bash 一样。(至少如果你旁边能有个人多少懂一点,如果没有的话用时会久一点。)我已经完成啦,真的很棒。 -这就是 fork 和 exec 在程序中的实现。我写了一段 C 的伪代码。请记住,[fork 也可能会失败哦。][4] +这就是 `fork` 和 `exec` 在程序中的实现。我写了一段 C 的伪代码。请记住,[fork 也可能会失败哦。][4] ``` int pid = fork(); @@ -80,7 +73,7 @@ int pid = fork(); // “我”是谁呢?可能是子进程也可能是父进程 if (pid == 0) { // 我现在是子进程 - // 我的大脑将被替代,然后变成一个完全不一样的进程“ls” + // “ls” 吃掉了我脑子,然后变成一个完全不一样的进程 exec(["ls"]) } else if (pid == -1) { // 天啊,fork 失败了,简直是灾难! @@ -89,59 +82,48 @@ if (pid == 0) { // 继续做一个酷酷的美男子吧 // 需要的话,我可以等待子进程结束 } - ``` -### 上文提到的“大脑被替代“是什么意思呢? +### 上文提到的“脑子被吃掉”是什么意思呢? 进程有很多属性: * 打开的文件(包括打开的网络连接) - * 环境变量 - * 信号处理程序(在程序上运行 Ctrl + C 时会发生什么?) - * 内存(你的“地址空间”) - * 寄存器 - -* 可执行文件(/proc/$pid/exe) - +* 可执行文件(`/proc/$pid/exe`) * cgroups 和命名空间(与 Linux 容器相关) - * 当前的工作目录 - * 运行程序的用户 - * 其他我还没想到的 -当你运行 `execve` 并让另一个程序替代你的时候,实际上几乎所有东西都是相同的! 你们有相同的环境变量、信号处理程序和打开的文件等等。 +当你运行 `execve` 并让另一个程序吃掉你的脑子的时候,实际上几乎所有东西都是相同的! 你们有相同的环境变量、信号处理程序和打开的文件等等。 唯一改变的是,内存、寄存器以及正在运行的程序,这可是件大事。 ### 为何 fork 并非那么耗费资源(写入时复制) -你可能会问:“如果我有一个使用了 2 GB 内存的进程,这是否意味着每次我启动一个子进程,所有 2 GB 的内存都要被复制一次?这听起来要耗费很多资源!“ +你可能会问:“如果我有一个使用了 2GB 内存的进程,这是否意味着每次我启动一个子进程,所有 2 GB 的内存都要被复制一次?这听起来要耗费很多资源!” -事实上,Linux 为 fork() 调用实现了写入时复制(copy on write),对于新进程的 2 GB 内存来说,就像是“看看旧的进程就好了,是一样的!”。然后,当如果任一进程试图写入内存,此时系统才真正地复制一个内存的副本给该进程。如果两个进程的内存是相同的,就不需要复制了。 +事实上,Linux 为 `fork()` 调用实现了写时复制copy on write,对于新进程的 2GB 内存来说,就像是“看看旧的进程就好了,是一样的!”。然后,当如果任一进程试图写入内存,此时系统才真正地复制一个内存的副本给该进程。如果两个进程的内存是相同的,就不需要复制了。 ### 为什么你需要知道这么多 -你可能会说,好吧,这些琐事听起来很厉害,但为什么这么重要?关于信号处理程序或环境变量的细节会被继承吗?这对我的日常编程有什么实际影响呢? +你可能会说,好吧,这些细节听起来很厉害,但为什么这么重要?关于信号处理程序或环境变量的细节会被继承吗?这对我的日常编程有什么实际影响呢? -有可能哦!比如说,在 Kamal 的博客上有一个很有意思的 [bug][5]。它讨论了 Python 如何使信号处理程序忽略了 SIGPIPE。也就是说,如果你从 Python 里运行一个程序,默认情况下它会忽略 SIGPIPE!这意味着,程序从 Python 脚本和从 shell 启动的表现会**有所不同**。在这种情况下,它会造成一个奇怪的问题。 +有可能哦!比如说,在 Kamal 的博客上有一个很有意思的 [bug][5]。它讨论了 Python 如何使信号处理程序忽略了 `SIGPIPE`。也就是说,如果你从 Python 里运行一个程序,默认情况下它会忽略 `SIGPIPE`!这意味着,程序从 Python 脚本和从 shell 启动的表现会**有所不同**。在这种情况下,它会造成一个奇怪的问题。 所以,你的程序的环境(环境变量、信号处理程序等)可能很重要,都是从父进程继承来的。知道这些,在调试时是很有用的。 - -------------------------------------------------------------------------------- via: https://jvns.ca/blog/2016/10/04/exec-will-eat-your-brain/ -作者:[ Julia Evans][a] +作者:[Julia Evans][a] 译者:[jessie-pang](https://github.com/jessie-pang) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 From b28957e19a947e9062ad076d9051805f3ea7e427 Mon Sep 17 00:00:00 2001 From: darksun Date: Fri, 19 Jan 2018 11:31:47 +0800 Subject: [PATCH 17/23] =?UTF-8?q?=E9=80=89=E9=A2=98:=20How=20to=20Install?= =?UTF-8?q?=20and=20Optimize=20Apache=20on=20Ubuntu=20=E2=80=93=20ThisHost?= =?UTF-8?q?ing.Rocks?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...ze Apache on Ubuntu - ThisHosting.Rocks.md | 267 ++++++++++++++++++ 1 file changed, 267 insertions(+) create mode 100644 sources/tech/20180116 How to Install and Optimize Apache on Ubuntu - ThisHosting.Rocks.md diff --git a/sources/tech/20180116 How to Install and Optimize Apache on Ubuntu - ThisHosting.Rocks.md b/sources/tech/20180116 How to Install and Optimize Apache on Ubuntu - ThisHosting.Rocks.md new file mode 100644 index 0000000000..eba7ce9c54 --- /dev/null +++ b/sources/tech/20180116 How to Install and Optimize Apache on Ubuntu - ThisHosting.Rocks.md @@ -0,0 +1,267 @@ +How to Install and Optimize Apache on Ubuntu +====== + +This is the beginning of our LAMP tutorial series: how to install the Apache web server on Ubuntu. + +These instructions should work on any Ubuntu-based distro, including Ubuntu 14.04, Ubuntu 16.04, [Ubuntu 18.04][1], and even non-LTS Ubuntu releases like 17.10. They were tested and written for Ubuntu 16.04. + +Apache (aka httpd) is the most popular and most widely used web server, so this should be useful for everyone. + +### Before we begin installing Apache + +Some requirements and notes before we begin: + + * Apache may already be installed on your server, so check if it is first. You can do so with the "apachectl -V" command that outputs the Apache version you're using and some other information. + * You'll need an Ubuntu server. You can buy one from [Vultr][2], they're one of the [best and cheapest cloud hosting providers][3]. Their servers start from $2.5 per month. + * You'll need the root user or a user with sudo access. All commands below are executed by the root user so we didn't have to append 'sudo' to each command. + * You'll need [SSH enabled][4] if you use Ubuntu or an SSH client like [MobaXterm][5] if you use Windows. + + + +That's most of it. Let's move onto the installation. + + + + + +### Install Apache on Ubuntu + +The first thing you always need to do is update Ubuntu before you do anything else. You can do so by running: +``` +apt-get update && apt-get upgrade +``` + +Next, to install Apache, run the following command: +``` +apt-get install apache2 +``` + +If you want to, you can also install the Apache documentation and some Apache utilities. You'll need the Apache utilities for some of the modules we'll install later. +``` +apt-get install apache2-doc apache2-utils +``` + +**And that 's it. You've successfully installed Apache.** + +You'll still need to configure it. + +### Configure and Optimize Apache on Ubuntu + +There are various configs you can do on Apache, but the main and most common ones are explained below. + +#### Check if Apache is running + +By default, Apache is configured to start automatically on boot, so you don't have to enable it. You can check if it's running and other relevant information with the following command: +``` +systemctl status apache2 +``` + +[![check if apache is running][6]][6] + +And you can check what version you're using with +``` +apachectl -V +``` + +A simpler way of checking this is by visiting your server's IP address. If you get the default Apache page, then everything's working fine. + +#### Update your firewall + +If you use a firewall (which you should), you'll probably need to update your firewall rules and allow access to the default ports. The most common firewall used on Ubuntu is UFW, so the instructions below are for UFW. + +To allow traffic through both the 80 (http) and 443 (https) ports, run the following command: +``` +ufw allow 'Apache Full' +``` + +#### Install common Apache modules + +Some modules are frequently recommended and you should install them. We'll include instructions for the most common ones: + +##### Speed up your website with the PageSpeed module + +The PageSpeed module will optimize and speed up your Apache server automatically. + +First, go to the [PageSpeed download page][7] and choose the file you need. We're using a 64-bit Ubuntu server and we'll install the latest stable version. Download it using wget: +``` +wget https://dl-ssl.google.com/dl/linux/direct/mod-pagespeed-stable_current_amd64.deb +``` + +Then, install it with the following commands: +``` +dpkg -i mod-pagespeed-stable_current_amd64.deb +apt-get -f install +``` + +Restart Apache for the changes to take effect: +``` +systemctl restart apache2 +``` + +##### Enable rewrites/redirects using the mod_rewrite module + +This module is used for rewrites (redirects), as the name suggests. You'll need it if you use WordPress or any other CMS for that matter. To install it, just run: +``` +a2enmod rewrite +``` + +And restart Apache again. You may need some extra configurations depending on what CMS you're using, if any. Google it for specific instructions for your setup. + +##### Secure your Apache with the ModSecurity module + +ModSecurity is a module used for security, again, as the name suggests. It basically acts as a firewall, and it monitors your traffic. To install it, run the following command: +``` +apt-get install libapache2-modsecurity +``` + +And restart Apache again: +``` +systemctl restart apache2 +``` + +ModSecurity comes with a default setup that's enough by itself, but if you want to extend it, you can use the [OWASP rule set][8]. + +##### Block DDoS attacks using the mod_evasive module + +You can use the mod_evasive module to block and prevent DDoS attacks on your server, though it's debatable how useful it is in preventing attacks. To install it, use the following command: +``` +apt-get install libapache2-mod-evasive +``` + +By default, mod_evasive is disabled, to enable it, edit the following file: +``` +nano /etc/apache2/mods-enabled/evasive.conf +``` + +And uncomment all the lines (remove #) and configure it per your requirements. You can leave everything as-is if you don't know what to edit. + +[![mod_evasive][9]][9] + +And create a log file: +``` +mkdir /var/log/mod_evasive +chown -R www-data:www-data /var/log/mod_evasive +``` + +That's it. Now restart Apache for the changes to take effect: +``` +systemctl restart apache2 +``` + +There are [additional modules][10] you can install and configure, but it's all up to you and the software you're using. They're usually not required. Even the 4 modules we included are not required. If a module is required for a specific application, then they'll probably note that. + +#### Optimize Apache with the Apache2Buddy script + +Apache2Buddy is a script that will automatically fine-tune your Apache configuration. The only thing you need to do is run the following command and the script does the rest automatically: +``` +curl -sL https://raw.githubusercontent.com/richardforth/apache2buddy/master/apache2buddy.pl | perl +``` + +You may need to install curl if you don't have it already installed. Use the following command to install curl: +``` +apt-get install curl +``` + +#### Additional configurations + +There's some extra stuff you can do with Apache, but we'll leave them for another tutorial. Stuff like enabling http/2 support, turning off (or on) KeepAlive, tuning your Apache even more. You don't have to do any of this, but you can find tutorials online and do it if you can't wait for our tutorials. + +### Create your first website with Apache + +Now that we're done with all the tuning, let's move onto creating an actual website. Follow our instructions to create a simple HTML page and a virtual host that's going to run on Apache. + +The first thing you need to do is create a new directory for your website. Run the following command to do so: +``` +mkdir -p /var/www/example.com/public_html +``` + +Of course, replace example.com with your desired domain. You can get a cheap domain name from [Namecheap][11]. + +Don't forget to replace example.com in all of the commands below. + +Next, create a simple, static web page. Create the HTML file: +``` +nano /var/www/example.com/public_html/index.html +``` + +And paste this: +``` + +     +       Simple Page +     +     +      

If you're seeing this in your browser then everything works.

+     + +``` + +Save and close the file. + +Configure the permissions of the directory: +``` +chown -R www-data:www-data /var/www/example.com +chmod -R og-r /var/www/example.com +``` + +Create a new virtual host for your site: +``` +nano /etc/apache2/sites-available/example.com.conf +``` + +And paste the following: +``` + +     ServerAdmin admin@example.com +     ServerName example.com +     ServerAlias www.example.com +    +     DocumentRoot /var/www/example.com/public_html +     +     ErrorLog ${APACHE_LOG_DIR}/error.log +     CustomLog ${APACHE_LOG_DIR}/access.log combined + +``` + +This is a basic virtual host. You may need a more advanced .conf file depending on your setup. + +Save and close the file after updating everything accordingly. + +Now, enable the virtual host with the following command: +``` +a2ensite example.com.conf +``` + +And finally, restart Apache for the changes to take effect: +``` +systemctl restart apache2 +``` + +That's it. You're done. Now you can visit example.com and view your page. + + + +-------------------------------------------------------------------------------- + +via: https://thishosting.rocks/how-to-install-optimize-apache-ubuntu/ + +作者:[ThisHosting][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://thishosting.rocks +[1]:https://thishosting.rocks/ubuntu-18-04-new-features-release-date/ +[2]:https://thishosting.rocks/go/vultr/ +[3]:https://thishosting.rocks/cheap-cloud-hosting-providers-comparison/ +[4]:https://thishosting.rocks/how-to-enable-ssh-on-ubuntu/ +[5]:https://mobaxterm.mobatek.net/ +[6]:https://thishosting.rocks/wp-content/uploads/2018/01/apache-running.jpg +[7]:https://www.modpagespeed.com/doc/download +[8]:https://www.owasp.org/index.php/Category:OWASP_ModSecurity_Core_Rule_Set_Project +[9]:https://thishosting.rocks/wp-content/uploads/2018/01/mod_evasive.jpg +[10]:https://httpd.apache.org/docs/2.4/mod/ +[11]:https://thishosting.rocks/neamcheap-review-cheap-domains-cool-names +[12]:https://thishosting.rocks/wp-content/plugins/patron-button-and-widgets-by-codebard/images/become_a_patron_button.png +[13]:https://www.patreon.com/thishostingrocks From b31876664610f1764d7bdf4108632acc7ae217f0 Mon Sep 17 00:00:00 2001 From: wxy Date: Fri, 19 Jan 2018 11:33:22 +0800 Subject: [PATCH 18/23] PUB:20161004 What happens when you start a process on Linux.md @jessie-pang https://linux.cn/article-9256-1.html --- .../20161004 What happens when you start a process on Linux.md | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename {translated/tech => published}/20161004 What happens when you start a process on Linux.md (100%) diff --git a/translated/tech/20161004 What happens when you start a process on Linux.md b/published/20161004 What happens when you start a process on Linux.md similarity index 100% rename from translated/tech/20161004 What happens when you start a process on Linux.md rename to published/20161004 What happens when you start a process on Linux.md From d858f7b1634002f429148c99e27a34c3a28ccea2 Mon Sep 17 00:00:00 2001 From: darksun Date: Fri, 19 Jan 2018 11:42:16 +0800 Subject: [PATCH 19/23] =?UTF-8?q?=E9=80=89=E9=A2=98:=20A=20Versatile=20Fre?= =?UTF-8?q?e=20Software=20for=20Partition=20Imaging=20and=20Cloning?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...tware for Partition Imaging and Cloning.md | 97 +++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 sources/tech/20180116 A Versatile Free Software for Partition Imaging and Cloning.md diff --git a/sources/tech/20180116 A Versatile Free Software for Partition Imaging and Cloning.md b/sources/tech/20180116 A Versatile Free Software for Partition Imaging and Cloning.md new file mode 100644 index 0000000000..d5cf47b45e --- /dev/null +++ b/sources/tech/20180116 A Versatile Free Software for Partition Imaging and Cloning.md @@ -0,0 +1,97 @@ +Partclone – A Versatile Free Software for Partition Imaging and Cloning +====== + +![](https://www.fossmint.com/wp-content/uploads/2018/01/Partclone-Backup-Tool-For-Linux.png) + +**[Partclone][1]** is a free and open-source tool for creating and cloning partition images brought to you by the developers of **Clonezilla**. In fact, **Partclone** is one of the tools that **Clonezilla** is based on. + +It provides users with the tools required to backup and restores used partition blocks along with high compatibility with several file systems thanks to its ability to use existing libraries like **e2fslibs** to read and write partitions e.g. **ext2**. + +Its best stronghold is the variety of formats it supports including ext2, ext3, ext4, hfs+, reiserfs, reiser4, btrfs, vmfs3, vmfs5, xfs, jfs, ufs, ntfs, fat(12/16/32), exfat, f2fs, and nilfs. + +It also has a plethora of available programs including **partclone.ext2** (ext3 & ext4), partclone.ntfs, partclone.exfat, partclone.hfsp, and partclone.vmfs (v3 and v5), among others. + +### Features in Partclone + + * **Freeware:** **Partclone** is free for everyone to download and use. + * **Open Source:** **Partclone** is released under the GNU GPL license and is open to contribution on [GitHub][2]. + * **Cross-Platform** : Available on Linux, Windows, MAC, ESX file system backup/restore, and FreeBSD. + * An online [Documentation page][3] from where you can view help docs and track its GitHub issues. + * An online [user manual][4] for beginners and pros alike. + * Rescue support. + * Clone partitions to image files. + * Restore image files to partitions. + * Duplicate partitions quickly. + * Support for raw clone. + * Displays transfer rate and elapsed time. + * Supports piping. + * Support for crc32. + * Supports vmfs for ESX vmware server and ufs for FreeBSD file system. + + + +There are a lot more features bundled in **Partclone** and you can see the rest of them [here][5]. + +[__Download Partclone for Linux][6] + +### How to Install and Use Partclone + +To install Partclone on Linux. +``` +$ sudo apt install partclone [On Debian/Ubuntu] +$ sudo yum install partclone [On CentOS/RHEL/Fedora] + +``` + +Clone partition to image. +``` +# partclone.ext4 -d -c -s /dev/sda1 -o sda1.img + +``` + +Restore image to partition. +``` +# partclone.ext4 -d -r -s sda1.img -o /dev/sda1 + +``` + +Partition to partition clone. +``` +# partclone.ext4 -d -b -s /dev/sda1 -o /dev/sdb1 + +``` + +Display image information. +``` +# partclone.info -s sda1.img + +``` + +Check image. +``` +# partclone.chkimg -s sda1.img + +``` + +Are you a **Partclone** user? I wrote on [**Deepin Clone**][7] just recently and apparently, there are certain tasks Partclone is better at handling. What has been your experience with other backup and restore utility tools? + +Do share your thoughts and suggestions with us in the comments section below. + +-------------------------------------------------------------------------------- + +via: https://www.fossmint.com/partclone-linux-backup-clone-tool/ + +作者:[Martins D. Okoi;View All Posts;Peter Beck;Martins Divine Okoi][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]: +[1]:https://partclone.org/ +[2]:https://github.com/Thomas-Tsai/partclone +[3]:https://partclone.org/help/ +[4]:https://partclone.org/usage/ +[5]:https://partclone.org/features/ +[6]:https://partclone.org/download/ +[7]:https://www.fossmint.com/deepin-clone-system-backup-restore-for-deepin-users/ From efa3610c0bd56eac4f3a9623fe9b5d7b7a10bc84 Mon Sep 17 00:00:00 2001 From: wxy Date: Fri, 19 Jan 2018 11:46:56 +0800 Subject: [PATCH 20/23] PRF&PUB:20170927 How To Easily Find Awesome Projects And Resources Hosted In GitHub.md @lujun9972 https://linux.cn/article-9257-1.html --- ...Projects And Resources Hosted In GitHub.md | 83 ++++++++++--------- 1 file changed, 44 insertions(+), 39 deletions(-) rename {translated/tech => published}/20170927 How To Easily Find Awesome Projects And Resources Hosted In GitHub.md (58%) diff --git a/translated/tech/20170927 How To Easily Find Awesome Projects And Resources Hosted In GitHub.md b/published/20170927 How To Easily Find Awesome Projects And Resources Hosted In GitHub.md similarity index 58% rename from translated/tech/20170927 How To Easily Find Awesome Projects And Resources Hosted In GitHub.md rename to published/20170927 How To Easily Find Awesome Projects And Resources Hosted In GitHub.md index 80566a8ae0..c8129ee61e 100644 --- a/translated/tech/20170927 How To Easily Find Awesome Projects And Resources Hosted In GitHub.md +++ b/published/20170927 How To Easily Find Awesome Projects And Resources Hosted In GitHub.md @@ -1,8 +1,9 @@ -如何方便地寻找 GitHub 上超棒的项目和资源 +如何轻松地寻找 GitHub 上超棒的项目和资源 ====== -![](https://www.ostechnix.com/wp-content/uploads/2017/09/Awesome-finder-Find-Awesome-Projects-720x340.png) -在 **GitHub** 网站上每天都会新增上百个项目。由于 GitHub 上有成千上万的项目,要在上面搜索好的项目简直要累死人。好在,有那么一伙人已经创建了一些这样的列表。其中包含的类别五花八门,如编程,数据库,编辑器,游戏,娱乐等。这使得我们寻找在 GitHub 上托管的项目,软件,资源,裤,书籍等其他东西变得容易了很多。有一个 GitHub 用户更进了一步,创建了一个名叫 `Awesome-finder` 的命令行工具,用来在 awesome 系列的仓库中寻找超棒的项目和资源。该工具帮助我们不需要离开终端(当然也就不需要使用浏览器了)的情况下浏览 awesome 列表。 +![](https://www.ostechnix.com/wp-content/uploads/2017/09/Awesome-finder-Find-Awesome-Projects-720x340.png) + +在 GitHub 网站上每天都会新增上百个项目。由于 GitHub 上有成千上万的项目,要在上面搜索好的项目简直要累死人。好在,有那么一伙人已经创建了一些这样的列表。其中包含的类别五花八门,如编程、数据库、编辑器、游戏、娱乐等。这使得我们寻找在 GitHub 上托管的项目、软件、资源、库、书籍等其他东西变得容易了很多。有一个 GitHub 用户更进了一步,创建了一个名叫 `Awesome-finder` 的命令行工具,用来在 awesome 系列的仓库中寻找超棒的项目和资源。该工具可以让我们不需要离开终端(当然也就不需要使用浏览器了)的情况下浏览 awesome 列表。 在这篇简单的说明中,我会向你演示如何方便地在类 Unix 系统中浏览 awesome 列表。 @@ -12,12 +13,14 @@ 使用 `pip` 可以很方便地安装该工具,`pip` 是一个用来安装使用 Python 编程语言开发的程序的包管理器。 -在 **Arch Linux** 一起衍生发行版中(比如 **Antergos**,**Manjaro Linux**),你可以使用下面命令安装 `pip`: +在 Arch Linux 及其衍生发行版中(比如 Antergos,Manjaro Linux),你可以使用下面命令安装 `pip`: + ``` sudo pacman -S python-pip ``` -在 **RHEL**,**CentOS** 中: +在 RHEL,CentOS 中: + ``` sudo yum install epel-release ``` @@ -25,32 +28,33 @@ sudo yum install epel-release sudo yum install python-pip ``` -在 **Fedora** 上: +在 Fedora 上: + ``` sudo dnf install epel-release -``` -``` sudo dnf install python-pip ``` -在 **Debian**,**Ubuntu**,**Linux Mint** 上: +在 Debian,Ubuntu,Linux Mint 上: + ``` sudo apt-get install python-pip ``` -在 **SUSE**,**openSUSE** 上: +在 SUSE,openSUSE 上: ``` sudo zypper install python-pip ``` -PIP 安装好后,用下面命令来安装 'Awesome-finder'。 +`pip` 安装好后,用下面命令来安装 'Awesome-finder'。 + ``` sudo pip install awesome-finder ``` #### 用法 -Awesome-finder 会列出 GitHub 网站中如下这些主题(其实就是仓库)的内容: +Awesome-finder 会列出 GitHub 网站中如下这些主题(其实就是仓库)的内容: * awesome * awesome-android @@ -66,83 +70,84 @@ Awesome-finder 会列出 GitHub 网站中如下这些主题(其实就是仓库) * awesome-scala * awesome-swift - 该列表会定期更新。 比如,要查看 `awesome-go` 仓库中的列表,只需要输入: + ``` awesome go ``` 你就能看到用 “Go” 写的所有流行的东西了,而且这些东西按字母顺序进行了排列。 -[![][1]][2] +![][2] -你可以通过 **上/下** 箭头在列表中导航。一旦找到所需要的东西,只需要选中它,然后按下 **回车** 键就会用你默认的 web 浏览器打开相应的链接了。 +你可以通过 上/下 箭头在列表中导航。一旦找到所需要的东西,只需要选中它,然后按下回车键就会用你默认的 web 浏览器打开相应的链接了。 类似的, - * "awesome android" 命令会搜索 **awesome-android** 仓库。 - * "awesome awesome" 命令会搜索 **awesome** 仓库。 - * "awesome elixir" 命令会搜索 **awesome-elixir**。 - * "awesome go" 命令会搜索 **awesome-go**。 - * "awesome ios" 命令会搜索 **awesome-ios**。 - * "awesome java" 命令会搜索 **awesome-java**。 - * "awesome javascript" 命令会搜索 **awesome-javascript**。 - * "awesome php" 命令会搜索 **awesome-php**。 - * "awesome python" 命令会搜索 **awesome-python**。 - * "awesome ruby" 命令会搜索 **awesome-ruby**。 - * "awesome rust" 命令会搜索 **awesome-rust**。 - * "awesome scala" 命令会搜索 **awesome-scala**。 - * "awesome swift" 命令会搜索 **awesome-swift**。 + * `awesome android` 命令会搜索 awesome-android 仓库。 + * `awesome awesome` 命令会搜索 awesome 仓库。 + * `awesome elixir` 命令会搜索 awesome-elixir。 + * `awesome go` 命令会搜索 awesome-go。 + * `awesome ios` 命令会搜索 awesome-ios。 + * `awesome java` 命令会搜索 awesome-java。 + * `awesome javascript` 命令会搜索 awesome-javascript。 + * `awesome php` 命令会搜索 awesome-php。 + * `awesome python` 命令会搜索 awesome-python。 + * `awesome ruby` 命令会搜索 awesome-ruby。 + * `awesome rust` 命令会搜索 awesome-rust。 + * `awesome scala` 命令会搜索 awesome-scala。 + * `awesome swift` 命令会搜索 awesome-swift。 -而且,它还会随着你在提示符中输入的内容而自动进行筛选。比如,当我输入 "dj" 后,他会显示与 Django 相关的内容。 +而且,它还会随着你在提示符中输入的内容而自动进行筛选。比如,当我输入 `dj` 后,他会显示与 Django 相关的内容。 -[![][1]][3] +![][3] 若你想从最新的 `awesome-`( 而不是用缓存中的数据) 中搜索,使用 `-f` 或 `-force` 标志: + ``` awesome -f (--force) - ``` -**像这样:** +像这样: + ``` awesome python -f ``` 或, + ``` awesome python --force ``` -上面命令会显示 **awesome-python** GitHub 仓库中的列表。 +上面命令会显示 awesome-python GitHub 仓库中的列表。 很棒,对吧? -要退出这个工具的话,按下 **ESC** 键。要显示帮助信息,输入: +要退出这个工具的话,按下 ESC 键。要显示帮助信息,输入: + ``` awesome -h ``` 本文至此就结束了。希望本文能对你产生帮助。如果你觉得我们的文章对你有帮助,请将他们分享到你的社交网络中去,造福大众。我们马上还有其他好东西要来了。敬请期待! - - -------------------------------------------------------------------------------- via: https://www.ostechnix.com/easily-find-awesome-projects-resources-hosted-github/ 作者:[SK][a] 译者:[lujun9972](https://github.com/lujun9972) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 [a]:https://www.ostechnix.com/author/sk/ [1]:data:image/gif;base64,R0lGODlhAQABAIAAAAAAAP///yH5BAEAAAAALAAAAAABAAEAAAIBRAA7 -[2]:http://www.ostechnix.com/wp-content/uploads/2017/09/sk@sk_008-1.png () -[3]:http://www.ostechnix.com/wp-content/uploads/2017/09/sk@sk_009.png () +[2]:http://www.ostechnix.com/wp-content/uploads/2017/09/sk@sk_008-1.png +[3]:http://www.ostechnix.com/wp-content/uploads/2017/09/sk@sk_009.png [4]:https://www.ostechnix.com/easily-find-awesome-projects-resources-hosted-github/?share=reddit (Click to share on Reddit) [5]:https://www.ostechnix.com/easily-find-awesome-projects-resources-hosted-github/?share=twitter (Click to share on Twitter) [6]:https://www.ostechnix.com/easily-find-awesome-projects-resources-hosted-github/?share=facebook (Click to share on Facebook) From b7b1e736e7f8e40af1f1942ff586f71bb6cc8119 Mon Sep 17 00:00:00 2001 From: darksun Date: Fri, 19 Jan 2018 11:57:31 +0800 Subject: [PATCH 21/23] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Monitor=20your=20Ku?= =?UTF-8?q?bernetes=20Cluster?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...0180116 Monitor your Kubernetes Cluster.md | 264 ++++++++++++++++++ 1 file changed, 264 insertions(+) create mode 100644 sources/tech/20180116 Monitor your Kubernetes Cluster.md diff --git a/sources/tech/20180116 Monitor your Kubernetes Cluster.md b/sources/tech/20180116 Monitor your Kubernetes Cluster.md new file mode 100644 index 0000000000..f0ac585f6f --- /dev/null +++ b/sources/tech/20180116 Monitor your Kubernetes Cluster.md @@ -0,0 +1,264 @@ +Monitor your Kubernetes Cluster +====== +This article originally appeared on [Kevin Monroe's blog][1] + +Keeping an eye on logs and metrics is a necessary evil for cluster admins. The benefits are clear: metrics help you set reasonable performance goals, while log analysis can uncover issues that impact your workloads. The hard part, however, is getting a slew of applications to work together in a useful monitoring solution. + +In this post, I'll cover monitoring a Kubernetes cluster with [Graylog][2] (for logging) and [Prometheus][3] (for metrics). Of course that's not just wiring 3 things together. In fact, it'll end up looking like this: + +![][4] + +As you know, Kubernetes isn't just one thing -- it's a system of masters, workers, networking bits, etc(d). Similarly, Graylog comes with a supporting cast (apache2, mongodb, etc), as does Prometheus (telegraf, grafana, etc). Connecting the dots in a deployment like this may seem daunting, but the right tools can make all the difference. + +I'll walk through this using [conjure-up][5] and the [Canonical Distribution of Kubernetes][6] (CDK). I find the conjure-up interface really helpful for deploying big software, but I know some of you hate GUIs and TUIs and probably other UIs too. For those folks, I'll do the same deployment again from the command line. + +Before we jump in, note that Graylog and Prometheus will be deployed alongside Kubernetes and not in the cluster itself. Things like the Kubernetes Dashboard and Heapster are excellent sources of information from within a running cluster, but my objective is to provide a mechanism for log/metric analysis whether the cluster is running or not. + +### The Walk Through + +First things first, install conjure-up if you don't already have it. On Linux, that's simply: +``` +sudo snap install conjure-up --classic +``` + +There's also a brew package for macOS users: +``` +brew install conjure-up +``` + +You'll need at least version 2.5.2 to take advantage of the recent CDK spell additions, so be sure to `sudo snap refresh conjure-up` or `brew update && brew upgrade conjure-up` if you have an older version installed. + +Once installed, run it: +``` +conjure-up +``` + +![][7] + +You'll be presented with a list of various spells. Select CDK and press `Enter`. + +![][8] + +At this point, you'll see additional components that are available for the CDK spell. We're interested in Graylog and Prometheus, so check both of those and hit `Continue`. + +You'll be guided through various cloud choices to determine where you want your cluster to live. After that, you'll see options for post-deployment steps, followed by a review screen that lets you see what is about to be deployed: + +![][9] + +In addition to the typical K8s-related applications (etcd, flannel, load-balancer, master, and workers), you'll see additional applications related to our logging and metric selections. + +The Graylog stack includes the following: + + * apache2: reverse proxy for the graylog web interface + * elasticsearch: document database for the logs + * filebeat: forwards logs from K8s master/workers to graylog + * graylog: provides an api for log collection and an interface for analysis + * mongodb: database for graylog metadata + + + +The Prometheus stack includes the following: + + * grafana: web interface for metric-related dashboards + * prometheus: metric collector and time series database + * telegraf: sends host metrics to prometheus + + + +You can fine tune the deployment from this review screen, but the defaults will suite our needs. Click `Deploy all Remaining Applications` to get things going. + +The deployment will take a few minutes to settle as machines are brought online and applications are configured in your cloud. Once complete, conjure-up will show a summary screen that includes links to various interesting endpoints for you to browse: + +![][10] + +#### Exploring Logs + +Now that Graylog has been deployed and configured, let's take a look at some of the data we're gathering. By default, the filebeat application will send both syslog and container log events to graylog (that's `/var/log/*.log` and `/var/log/containers/*.log` from the kubernetes master and workers). + +Grab the apache2 address and graylog admin password as follows: +``` +juju status --format yaml apache2/0 | grep public-address + public-address: +juju run-action --wait graylog/0 show-admin-password + admin-password: +``` + +Browse to `http://` and login with admin as the username and as the password. **Note:** if the interface is not immediately available, please wait as the reverse proxy configuration may take up to 5 minutes to complete. + +Once logged in, head to the `Sources` tab to get an overview of the logs collected from our K8s master and workers: + +![][11] + +Drill into those logs by clicking the `System / Inputs` tab and selecting `Show received messages` for the filebeat input: + +![][12] + +From here, you may want to play around with various filters or setup Graylog dashboards to help identify the events that are most important to you. Check out the [Graylog Dashboard][13] docs for details on customizing your view. + +#### Exploring Metrics + +Our deployment exposes two types of metrics through our grafana dashboards: system metrics include things like cpu/memory/disk utilization for the K8s master and worker machines, and cluster metrics include container-level data scraped from the K8s cAdvisor endpoints. + +Grab the grafana address and admin password as follows: +``` +juju status --format yaml grafana/0 | grep public-address + public-address: +juju run-action --wait grafana/0 get-admin-password + password: +``` + +Browse to `http://:3000` and login with admin as the username and as the password. Once logged in, check out the cluster metric dashboard by clicking the `Home` drop-down box and selecting `Kubernetes Metrics (via Prometheus)`: + +![][14] + +We can also check out the system metrics of our K8s host machines by switching the drop-down box to `Node Metrics (via Telegraf) ` + +![][15] + + +### The Other Way + +As alluded to in the intro, I prefer the wizard-y feel of conjure-up to guide me through complex software deployments like Kubernetes. Now that we've seen the conjure-up way, some of you may want to see a command line approach to achieve the same results. Still others may have deployed CDK previously and want to extend it with the Graylog/Prometheus components described above. Regardless of why you've read this far, I've got you covered. + +The tool that underpins conjure-up is [Juju][16]. Everything that the CDK spell did behind the scenes can be done on the command line with Juju. Let's step through how that works. + +**Starting From Scratch** + +If you're on Linux, install Juju like this: +``` +sudo snap install juju --classic +``` + +For macOS, Juju is available from brew: +``` +brew install juju +``` + +Now setup a controller for your preferred cloud. You may be prompted for any required cloud credentials: +``` +juju bootstrap +``` + +We then need to deploy the base CDK bundle: +``` +juju deploy canonical-kubernetes +``` + +**Starting From CDK** + +With our Kubernetes cluster deployed, we need to add all the applications required for Graylog and Prometheus: +``` +## deploy graylog-related applications +juju deploy xenial/apache2 +juju deploy xenial/elasticsearch +juju deploy xenial/filebeat +juju deploy xenial/graylog +juju deploy xenial/mongodb +``` +``` +## deploy prometheus-related applications +juju deploy xenial/grafana +juju deploy xenial/prometheus +juju deploy xenial/telegraf +``` + +Now that the software is deployed, connect them together so they can communicate: +``` +## relate graylog applications +juju relate apache2:reverseproxy graylog:website +juju relate graylog:elasticsearch elasticsearch:client +juju relate graylog:mongodb mongodb:database +juju relate filebeat:beats-host kubernetes-master:juju-info +juju relate filebeat:beats-host kubernetes-worker:jujuu-info +``` +``` +## relate prometheus applications +juju relate prometheus:grafana-source grafana:grafana-source +juju relate telegraf:prometheus-client prometheus:target +juju relate kubernetes-master:juju-info telegraf:juju-info +juju relate kubernetes-worker:juju-info telegraf:juju-info +``` + +At this point, all the applications can communicate with each other, but we have a bit more configuration to do (e.g., setting up the apache2 reverse proxy, telling prometheus how to scrape k8s, importing our grafana dashboards, etc): +``` +## configure graylog applications +juju config apache2 enable_modules="headers proxy_html proxy_http" +juju config apache2 vhost_http_template="$(base64 )" +juju config elasticsearch firewall_enabled="false" +juju config filebeat \ + logpath="/var/log/*.log /var/log/containers/*.log" +juju config filebeat logstash_hosts=":5044" +juju config graylog elasticsearch_cluster_name="" +``` +``` +## configure prometheus applications +juju config prometheus scrape-jobs="" +juju run-action --wait grafana/0 import-dashboard \ + dashboard="$(base64 )" +``` + +Some of the above steps need values specific to your deployment. You can get these in the same way that conjure-up does: + + * : fetch our sample [template][17] from github + * : `juju run --unit graylog/0 'unit-get private-address'` + * : `juju config elasticsearch cluster-name` + * : fetch our sample [scraper][18] from github; [substitute][19]appropriate values for `[K8S_PASSWORD][20]` and `[K8S_API_ENDPOINT][21]` + * : fetch our [host][22] and [k8s][23] dashboards from github + + + +Finally, you'll want to expose the apache2 and grafana applications to make their web interfaces accessible: +``` +## expose relevant endpoints +juju expose apache2 +juju expose grafana +``` + +Now that we have everything deployed, related, configured, and exposed, you can login and poke around using the same steps from the **Exploring Logs** and **Exploring Metrics** sections above. + +### The Wrap Up + +My goal here was to show you how to deploy a Kubernetes cluster with rich monitoring capabilities for logs and metrics. Whether you prefer a guided approach or command line steps, I hope it's clear that monitoring complex deployments doesn't have to be a pipe dream. The trick is to figure out how all the moving parts work, make them work together repeatably, and then break/fix/repeat for a while until everyone can use it. + +This is where tools like conjure-up and Juju really shine. Leveraging the expertise of contributors to this ecosystem makes it easy to manage big software. Start with a solid set of apps, customize as needed, and get back to work! + +Give these bits a try and let me know how it goes. You can find enthusiasts like me on Freenode IRC in **#conjure-up** and **#juju**. Thanks for reading! + +### About the author + +Kevin joined Canonical in 2014 with his focus set on modeling complex software. He found his niche on the Juju Big Software team where his mission is to capture operational knowledge of Big Data and Machine Learning applications into repeatable (and reliable!) solutions. + +-------------------------------------------------------------------------------- + +via: https://insights.ubuntu.com/2018/01/16/monitor-your-kubernetes-cluster/ + +作者:[Kevin Monroe][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://insights.ubuntu.com/author/kwmonroe/ +[1]:https://medium.com/@kwmonroe/monitor-your-kubernetes-cluster-a856d2603ec3 +[2]:https://www.graylog.org/ +[3]:https://prometheus.io/ +[4]:https://insights.ubuntu.com/wp-content/uploads/706b/1_TAA57DGVDpe9KHIzOirrBA.png +[5]:https://conjure-up.io/ +[6]:https://jujucharms.com/canonical-kubernetes +[7]:https://insights.ubuntu.com/wp-content/uploads/98fd/1_o0UmYzYkFiHIs2sBgj7G9A.png +[8]:https://insights.ubuntu.com/wp-content/uploads/0351/1_pgVaO_ZlalrjvYd5pOMJMA.png +[9]:https://insights.ubuntu.com/wp-content/uploads/9977/1_WXKxMlml2DWA5Kj6wW9oXQ.png +[10]:https://insights.ubuntu.com/wp-content/uploads/8588/1_NWq7u6g6UAzyFxtbM-ipqg.png +[11]:https://insights.ubuntu.com/wp-content/uploads/a1c3/1_hHK5mSrRJQi6A6u0yPSGOA.png +[12]:https://insights.ubuntu.com/wp-content/uploads/937f/1_cP36lpmSwlsPXJyDUpFluQ.png +[13]:http://docs.graylog.org/en/2.3/pages/dashboards.html +[14]:https://insights.ubuntu.com/wp-content/uploads/9256/1_kskust3AOImIh18QxQPgRw.png +[15]:https://insights.ubuntu.com/wp-content/uploads/2037/1_qJpjPOTGMQbjFY5-cZsYrQ.png +[16]:https://jujucharms.com/ +[17]:https://raw.githubusercontent.com/conjure-up/spells/master/canonical-kubernetes/addons/graylog/steps/01_install-graylog/graylog-vhost.tmpl +[18]:https://raw.githubusercontent.com/conjure-up/spells/master/canonical-kubernetes/addons/prometheus/steps/01_install-prometheus/prometheus-scrape-k8s.yaml +[19]:https://github.com/conjure-up/spells/blob/master/canonical-kubernetes/addons/prometheus/steps/01_install-prometheus/after-deploy#L25 +[20]:https://github.com/conjure-up/spells/blob/master/canonical-kubernetes/addons/prometheus/steps/01_install-prometheus/after-deploy#L10 +[21]:https://github.com/conjure-up/spells/blob/master/canonical-kubernetes/addons/prometheus/steps/01_install-prometheus/after-deploy#L11 +[22]:https://raw.githubusercontent.com/conjure-up/spells/master/canonical-kubernetes/addons/prometheus/steps/01_install-prometheus/grafana-telegraf.json +[23]:https://raw.githubusercontent.com/conjure-up/spells/master/canonical-kubernetes/addons/prometheus/steps/01_install-prometheus/grafana-k8s.json From 7114a15e12262914d3e3ff16a32290b993dac567 Mon Sep 17 00:00:00 2001 From: darksun Date: Fri, 19 Jan 2018 12:57:26 +0800 Subject: [PATCH 22/23] =?UTF-8?q?=E9=80=89=E9=A2=98:=20Analyzing=20the=20L?= =?UTF-8?q?inux=20boot=20process?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...180116 Analyzing the Linux boot process.md | 251 ++++++++++++++++++ 1 file changed, 251 insertions(+) create mode 100644 sources/tech/20180116 Analyzing the Linux boot process.md diff --git a/sources/tech/20180116 Analyzing the Linux boot process.md b/sources/tech/20180116 Analyzing the Linux boot process.md new file mode 100644 index 0000000000..0bf807c6bb --- /dev/null +++ b/sources/tech/20180116 Analyzing the Linux boot process.md @@ -0,0 +1,251 @@ +Analyzing the Linux boot process +====== + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/linux_boot.png?itok=FUesnJQp) + +Image by : Penguin, Boot. Modified by Opensource.com. CC BY-SA 4.0. + +The oldest joke in open source software is the statement that "the code is self-documenting." Experience shows that reading the source is akin to listening to the weather forecast: sensible people still go outside and check the sky. What follows are some tips on how to inspect and observe Linux systems at boot by leveraging knowledge of familiar debugging tools. Analyzing the boot processes of systems that are functioning well prepares users and developers to deal with the inevitable failures. + +In some ways, the boot process is surprisingly simple. The kernel starts up single-threaded and synchronous on a single core and seems almost comprehensible to the pitiful human mind. But how does the kernel itself get started? What functions do [initial ramdisk][1] ) and bootloaders perform? And wait, why is the LED on the Ethernet port always on? + +Read on for answers to these and other questions; the [code for the described demos and exercises][2] is also available on GitHub. + +### The beginning of boot: the OFF state + +#### Wake-on-LAN + +The OFF state means that the system has no power, right? The apparent simplicity is deceptive. For example, the Ethernet LED is illuminated because wake-on-LAN (WOL) is enabled on your system. Check whether this is the case by typing: +``` + $# sudo ethtool +``` + +where `` might be, for example, `eth0`. (`ethtool` is found in Linux packages of the same name.) If "Wake-on" in the output shows `g`, remote hosts can boot the system by sending a [MagicPacket][3]. If you have no intention of waking up your system remotely and do not wish others to do so, turn WOL off either in the system BIOS menu, or via: +``` +$# sudo ethtool -s wol d +``` + +The processor that responds to the MagicPacket may be part of the network interface or it may be the [Baseboard Management Controller][4] (BMC). + +#### Intel Management Engine, Platform Controller Hub, and Minix + +The BMC is not the only microcontroller (MCU) that may be listening when the system is nominally off. x86_64 systems also include the Intel Management Engine (IME) software suite for remote management of systems. A wide variety of devices, from servers to laptops, includes this technology, [which enables functionality][5] such as KVM Remote Control and Intel Capability Licensing Service. The [IME has unpatched vulnerabilities][6], according to [Intel's own detection tool][7]. The bad news is, it's difficult to disable the IME. Trammell Hudson has created an [me_cleaner project][8] that wipes some of the more egregious IME components, like the embedded web server, but could also brick the system on which it is run. + +The IME firmware and the System Management Mode (SMM) software that follows it at boot are [based on the Minix operating system][9] and run on the separate Platform Controller Hub processor, not the main system CPU. The SMM then launches the Universal Extensible Firmware Interface (UEFI) software, about which much has [already been written][10], on the main processor. The Coreboot group at Google has started a breathtakingly ambitious [Non-Extensible Reduced Firmware][11] (NERF) project that aims to replace not only UEFI but early Linux userspace components such as systemd. While we await the outcome of these new efforts, Linux users may now purchase laptops from Purism, System76, or Dell [with IME disabled][12], plus we can hope for laptops [with ARM 64-bit processors][13]. + +#### Bootloaders + +Besides starting buggy spyware, what function does early boot firmware serve? The job of a bootloader is to make available to a newly powered processor the resources it needs to run a general-purpose operating system like Linux. At power-on, there not only is no virtual memory, but no DRAM until its controller is brought up. A bootloader then turns on power supplies and scans buses and interfaces in order to locate the kernel image and the root filesystem. Popular bootloaders like U-Boot and GRUB have support for familiar interfaces like USB, PCI, and NFS, as well as more embedded-specific devices like NOR- and NAND-flash. Bootloaders also interact with hardware security devices like [Trusted Platform Modules][14] (TPMs) to establish a chain of trust from earliest boot. + +![Running the U-boot bootloader][16] + +Running the U-boot bootloader in the sandbox on the build host. + +The open source, widely used [U-Boot ][17]bootloader is supported on systems ranging from Raspberry Pi to Nintendo devices to automotive boards to Chromebooks. There is no syslog, and when things go sideways, often not even any console output. To facilitate debugging, the U-Boot team offers a sandbox in which patches can be tested on the build-host, or even in a nightly Continuous Integration system. Playing with U-Boot's sandbox is relatively simple on a system where common development tools like Git and the GNU Compiler Collection (GCC) are installed: +``` + + +$# git clone git://git.denx.de/u-boot; cd u-boot + +$# make ARCH=sandbox defconfig + +$# make; ./u-boot + +=> printenv + +=> help +``` + +That's it: you're running U-Boot on x86_64 and can test tricky features like [mock storage device][2] repartitioning, TPM-based secret-key manipulation, and hotplug of USB devices. The U-Boot sandbox can even be single-stepped under the GDB debugger. Development using the sandbox is 10x faster than testing by reflashing the bootloader onto a board, and a "bricked" sandbox can be recovered with Ctrl+C. + +### Starting up the kernel + +#### Provisioning a booting kernel + +Upon completion of its tasks, the bootloader will execute a jump to kernel code that it has loaded into main memory and begin execution, passing along any command-line options that the user has specified. What kind of program is the kernel? `file /boot/vmlinuz` indicates that it is a bzImage, meaning a big compressed one. The Linux source tree contains an [extract-vmlinux tool][18] that can be used to uncompress the file: +``` + + +$# scripts/extract-vmlinux /boot/vmlinuz-$(uname -r) > vmlinux + +$# file vmlinux + +vmlinux: ELF 64-bit LSB executable, x86-64, version 1 (SYSV), statically + +linked, stripped +``` + +The kernel is an [Executable and Linking Format][19] (ELF) binary, like Linux userspace programs. That means we can use commands from the `binutils` package like `readelf` to inspect it. Compare the output of, for example: +``` + + +$# readelf -S /bin/date + +$# readelf -S vmlinux +``` + +The list of sections in the binaries is largely the same. + +So the kernel must start up something like other Linux ELF binaries ... but how do userspace programs actually start? In the `main()` function, right? Not precisely. + +Before the `main()` function can run, programs need an execution context that includes heap and stack memory plus file descriptors for `stdio`, `stdout`, and `stderr`. Userspace programs obtain these resources from the standard library, which is `glibc` on most Linux systems. Consider the following: +``` + + +$# file /bin/date + +/bin/date: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically + +linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 2.6.32, + +BuildID[sha1]=14e8563676febeb06d701dbee35d225c5a8e565a, + +stripped +``` + +ELF binaries have an interpreter, just as Bash and Python scripts do, but the interpreter need not be specified with `#!` as in scripts, as ELF is Linux's native format. The ELF interpreter [provisions a binary][20] with the needed resources by calling `_start()`, a function available from the `glibc` source package that can be [inspected via GDB][21]. The kernel obviously has no interpreter and must provision itself, but how? + +Inspecting the kernel's startup with GDB gives the answer. First install the debug package for the kernel that contains an unstripped version of `vmlinux`, for example `apt-get install linux-image-amd64-dbg`, or compile and install your own kernel from source, for example, by following instructions in the excellent [Debian Kernel Handbook][22]. `gdb vmlinux` followed by `info files` shows the ELF section `init.text`. List the start of program execution in `init.text` with `l *(address)`, where `address` is the hexadecimal start of `init.text`. GDB will indicate that the x86_64 kernel starts up in the kernel's file [arch/x86/kernel/head_64.S][23], where we find the assembly function `start_cpu0()` and code that explicitly creates a stack and decompresses the zImage before calling the `x86_64 start_kernel()` function. ARM 32-bit kernels have the similar [arch/arm/kernel/head.S][24]. `start_kernel()` is not architecture-specific, so the function lives in the kernel's [init/main.c][25]. `start_kernel()` is arguably Linux's true `main()` function. + +### From start_kernel() to PID 1 + +#### The kernel's hardware manifest: the device-tree and ACPI tables + +At boot, the kernel needs information about the hardware beyond the processor type for which it has been compiled. The instructions in the code are augmented by configuration data that is stored separately. There are two main methods of storing this data: [device-trees][26] and [ACPI tables][27]. The kernel learns what hardware it must run at each boot by reading these files. + +For embedded devices, the device-tree is a manifest of installed hardware. The device-tree is simply a file that is compiled at the same time as kernel source and is typically located in `/boot` alongside `vmlinux`. To see what's in the binary device-tree on an ARM device, just use the `strings` command from the `binutils` package on a file whose name matches `/boot/*.dtb`, as `dtb` refers to a device-tree binary. Clearly the device-tree can be modified simply by editing the JSON-like files that compose it and rerunning the special `dtc` compiler that is provided with the kernel source. While the device-tree is a static file whose file path is typically passed to the kernel by the bootloader on the command line, a [device-tree overlay][28] facility has been added in recent years, where the kernel can dynamically load additional fragments in response to hotplug events after boot. + +x86-family and many enterprise-grade ARM64 devices make use of the alternative Advanced Configuration and Power Interface ([ACPI][27]) mechanism. In contrast to the device-tree, the ACPI information is stored in the `/sys/firmware/acpi/tables` virtual filesystem that is created by the kernel at boot by accessing onboard ROM. The easy way to read the ACPI tables is with the `acpidump` command from the `acpica-tools` package. Here's an example: + +![ACPI tables on Lenovo laptops][30] + + +ACPI tables on Lenovo laptops are all set for Windows 2001. + +Yes, your Linux system is ready for Windows 2001, should you care to install it. ACPI has both methods and data, unlike the device-tree, which is more of a hardware-description language. ACPI methods continue to be active post-boot. For example, starting the command `acpi_listen` (from package `apcid`) and opening and closing the laptop lid will show that ACPI functionality is running all the time. While temporarily and dynamically [overwriting the ACPI tables][31] is possible, permanently changing them involves interacting with the BIOS menu at boot or reflashing the ROM. If you're going to that much trouble, perhaps you should just [install coreboot][32], the open source firmware replacement. + +#### From start_kernel() to userspace + +The code in [init/main.c][25] is surprisingly readable and, amusingly, still carries Linus Torvalds' original copyright from 1991-1992. The lines found in `dmesg | head` on a newly booted system originate mostly from this source file. The first CPU is registered with the system, global data structures are initialized, and the scheduler, interrupt handlers (IRQs), timers, and console are brought one-by-one, in strict order, online. Until the function `timekeeping_init()` runs, all timestamps are zero. This part of the kernel initialization is synchronous, meaning that execution occurs in precisely one thread, and no function is executed until the last one completes and returns. As a result, the `dmesg` output will be completely reproducible, even between two systems, as long as they have the same device-tree or ACPI tables. Linux is behaving like one of the RTOS (real-time operating systems) that runs on MCUs, for example QNX or VxWorks. The situation persists into the function `rest_init()`, which is called by `start_kernel()` at its termination. + +![Summary of early kernel boot process.][34] + +Summary of early kernel boot process. + +The rather humbly named `rest_init()` spawns a new thread that runs `kernel_init()`, which invokes `do_initcalls()`. Users can spy on `initcalls` in action by appending `initcall_debug` to the kernel command line, resulting in `dmesg` entries every time an `initcall` function runs. `initcalls` pass through seven sequential levels: early, core, postcore, arch, subsys, fs, device, and late. The most user-visible part of the `initcalls` is the probing and setup of all the processors' peripherals: buses, network, storage, displays, etc., accompanied by the loading of their kernel modules. `rest_init()` also spawns a second thread on the boot processor that begins by running `cpu_idle()` while it waits for the scheduler to assign it work. + +`kernel_init()` also [sets up symmetric multiprocessing][35] (SMP). With more recent kernels, find this point in `dmesg` output by looking for "Bringing up secondary CPUs..." SMP proceeds by "hotplugging" CPUs, meaning that it manages their lifecycle with a state machine that is notionally similar to that of devices like hotplugged USB sticks. The kernel's power-management system frequently takes individual cores offline, then wakes them as needed, so that the same CPU hotplug code is called over and over on a machine that is not busy. Observe the power-management system's invocation of CPU hotplug with the [BCC tool][36] called `offcputime.py`. + +Note that the code in `init/main.c` is nearly finished executing when `smp_init()` runs: The boot processor has completed most of the one-time initialization that the other cores need not repeat. Nonetheless, the per-CPU threads must be spawned for each core to manage interrupts (IRQs), workqueues, timers, and power events on each. For example, see the per-CPU threads that service softirqs and workqueues in action via the `ps -o psr` command. +``` + + +$\# ps -o pid,psr,comm $(pgrep ksoftirqd)   + + PID PSR COMMAND + +   7   0 ksoftirqd/0 + +  16   1 ksoftirqd/1 + +  22   2 ksoftirqd/2 + +  28   3 ksoftirqd/3 + + + +$\# ps -o pid,psr,comm $(pgrep kworker) + +PID  PSR COMMAND + +   4   0 kworker/0:0H + +  18   1 kworker/1:0H + +  24   2 kworker/2:0H + +  30   3 kworker/3:0H + +[ . .  . ] +``` + +where the PSR field stands for "processor." Each core must also host its own timers and `cpuhp` hotplug handlers. + +How is it, finally, that userspace starts? Near its end, `kernel_init()` looks for an `initrd` that can execute the `init` process on its behalf. If it finds none, the kernel directly executes `init` itself. Why then might one want an `initrd`? + +#### Early userspace: who ordered the initrd? + +Besides the device-tree, another file path that is optionally provided to the kernel at boot is that of the `initrd`. The `initrd` often lives in `/boot` alongside the bzImage file vmlinuz on x86, or alongside the similar uImage and device-tree for ARM. List the contents of the `initrd` with the `lsinitramfs` tool that is part of the `initramfs-tools-core` package. Distro `initrd` schemes contain minimal `/bin`, `/sbin`, and `/etc` directories along with kernel modules, plus some files in `/scripts`. All of these should look pretty familiar, as the `initrd` for the most part is simply a minimal Linux root filesystem. The apparent similarity is a bit deceptive, as nearly all the executables in `/bin` and `/sbin` inside the ramdisk are symlinks to the [BusyBox binary][37], resulting in `/bin` and `/sbin` directories that are 10x smaller than glibc's. + +Why bother to create an `initrd` if all it does is load some modules and then start `init` on the regular root filesystem? Consider an encrypted root filesystem. The decryption may rely on loading a kernel module that is stored in `/lib/modules` on the root filesystem ... and, unsurprisingly, in the `initrd` as well. The crypto module could be statically compiled into the kernel instead of loaded from a file, but there are various reasons for not wanting to do so. For example, statically compiling the kernel with modules could make it too large to fit on the available storage, or static compilation may violate the terms of a software license. Unsurprisingly, storage, network, and human input device (HID) drivers may also be present in the `initrd`--basically any code that is not part of the kernel proper that is needed to mount the root filesystem. The `initrd` is also a place where users can stash their own [custom ACPI][38] table code. + +![Rescue shell and a custom initrd.][40] + +Having some fun with the rescue shell and a custom `initrd`. + +`initrd`'s are also great for testing filesystems and data-storage devices themselves. Stash these test tools in the `initrd` and run your tests from memory rather than from the object under test. + +At last, when `init` runs, the system is up! Since the secondary processors are now running, the machine has become the asynchronous, preemptible, unpredictable, high-performance creature we know and love. Indeed, `ps -o pid,psr,comm -p 1` is liable to show that userspace's `init` process is no longer running on the boot processor. + +### Summary + +The Linux boot process sounds forbidding, considering the number of different pieces of software that participate even on simple embedded devices. Looked at differently, the boot process is rather simple, since the bewildering complexity caused by features like preemption, RCU, and race conditions are absent in boot. Focusing on just the kernel and PID 1 overlooks the large amount of work that bootloaders and subsidiary processors may do in preparing the platform for the kernel to run. While the kernel is certainly unique among Linux programs, some insight into its structure can be gleaned by applying to it some of the same tools used to inspect other ELF binaries. Studying the boot process while it's working well arms system maintainers for failures when they come. + +To learn more, attend Alison Chaiken's talk, [Linux: The first second][41], at [linux.conf.au][42], which will be held January 22-26 in Sydney. + +Thanks to [Akkana Peck][43] for originally suggesting this topic and for many corrections. + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/1/analyzing-linux-boot-process + +作者:[Alison Chaiken][a] +译者:[译者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/don-watkins +[1]:https://en.wikipedia.org/wiki/Initial_ramdisk +[2]:https://github.com/chaiken/LCA2018-Demo-Code +[3]:https://en.wikipedia.org/wiki/Wake-on-LAN +[4]:https://lwn.net/Articles/630778/ +[5]:https://www.youtube.com/watch?v=iffTJ1vPCSo&index=65&list=PLbzoR-pLrL6pISWAq-1cXP4_UZAyRtesk +[6]:https://security-center.intel.com/advisory.aspx?intelid=INTEL-SA-00086&languageid=en-fr +[7]:https://www.intel.com/content/www/us/en/support/articles/000025619/software.html +[8]:https://github.com/corna/me_cleaner +[9]:https://lwn.net/Articles/738649/ +[10]:https://lwn.net/Articles/699551/ +[11]:https://trmm.net/NERF +[12]:https://www.extremetech.com/computing/259879-dell-now-shipping-laptops-intels-management-engine-disabled +[13]:https://lwn.net/Articles/733837/ +[14]:https://linuxplumbersconf.org/2017/ocw/events/LPC2017/tracks/639 +[15]:/file/383501 +[16]:https://opensource.com/sites/default/files/u128651/linuxboot_1.png (Running the U-boot bootloader) +[17]:http://www.denx.de/wiki/DULG/Manual +[18]:https://github.com/torvalds/linux/blob/master/scripts/extract-vmlinux +[19]:http://man7.org/linux/man-pages/man5/elf.5.html +[20]:https://0xax.gitbooks.io/linux-insides/content/Misc/program_startup.html +[21]:https://github.com/chaiken/LCA2018-Demo-Code/commit/e543d9812058f2dd65f6aed45b09dda886c5fd4e +[22]:http://kernel-handbook.alioth.debian.org/ +[23]:https://github.com/torvalds/linux/blob/master/arch/x86/boot/compressed/head_64.S +[24]:https://github.com/torvalds/linux/blob/master/arch/arm/boot/compressed/head.S +[25]:https://github.com/torvalds/linux/blob/master/init/main.c +[26]:https://www.youtube.com/watch?v=m_NyYEBxfn8 +[27]:http://events.linuxfoundation.org/sites/events/files/slides/x86-platform.pdf +[28]:http://lwn.net/Articles/616859/ +[29]:/file/383506 +[30]:https://opensource.com/sites/default/files/u128651/linuxboot_2.png (ACPI tables on Lenovo laptops) +[31]:https://www.mjmwired.net/kernel/Documentation/acpi/method-customizing.txt +[32]:https://www.coreboot.org/Supported_Motherboards +[33]:/file/383511 +[34]:https://opensource.com/sites/default/files/u128651/linuxboot_3.png (Summary of early kernel boot process.) +[35]:http://free-electrons.com/pub/conferences/2014/elc/clement-smp-bring-up-on-arm-soc +[36]:http://www.brendangregg.com/ebpf.html +[37]:https://www.busybox.net/ +[38]:https://www.mjmwired.net/kernel/Documentation/acpi/initrd_table_override.txt +[39]:/file/383516 +[40]:https://opensource.com/sites/default/files/u128651/linuxboot_4.png (Rescue shell and a custom initrd.) +[41]:https://rego.linux.conf.au/schedule/presentation/16/ +[42]:https://linux.conf.au/index.html +[43]:http://shallowsky.com/ From ab54388ea83daeb37b4d267d8104ba88022ba222 Mon Sep 17 00:00:00 2001 From: darksun Date: Fri, 19 Jan 2018 13:02:08 +0800 Subject: [PATCH 23/23] =?UTF-8?q?=E9=80=89=E9=A2=98:=20How=20to=20Install?= =?UTF-8?q?=20and=20Use=20iostat=20on=20Ubuntu=2016.04=20LTS?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- ...tall and Use iostat on Ubuntu 16.04 LTS.md | 225 ++++++++++++++++++ 1 file changed, 225 insertions(+) create mode 100644 sources/tech/20180116 How to Install and Use iostat on Ubuntu 16.04 LTS.md diff --git a/sources/tech/20180116 How to Install and Use iostat on Ubuntu 16.04 LTS.md b/sources/tech/20180116 How to Install and Use iostat on Ubuntu 16.04 LTS.md new file mode 100644 index 0000000000..7ddb17eb68 --- /dev/null +++ b/sources/tech/20180116 How to Install and Use iostat on Ubuntu 16.04 LTS.md @@ -0,0 +1,225 @@ +How to Install and Use iostat on Ubuntu 16.04 LTS +====== + +iostat also known as input/output statistics is a popular Linux system monitoring tool that can be used to collect statistics of input and output devices. It allows users to identify performance issues of local disk, remote disk and system information. The iostat create reports, the CPU Utilization report, the Device Utilization report and the Network Filesystem report. + +In this tutorial, we will learn how to install iostat on Ubuntu 16.04 and how to use it. + +### Prerequisite + + * Ubuntu 16.04 desktop installed on your system. + * Non-root user with sudo privileges setup on your system + + + +### Install iostat + +By default, iostat is included with sysstat package in Ubuntu 16.04. You can easily install it by just running the following command: + +``` +sudo apt-get install sysstat -y +``` + +Once sysstat is installed, you can proceed to the next step. + +### iostat Basic Example + +Let's start by running the iostat command without any argument. This will displays information about the CPU usage, and I/O statistics of your system: + +``` +iostat +``` + +You should see the following output: +``` +Linux 3.19.0-25-generic (Ubuntu-PC) Saturday 16 December 2017 _x86_64_ (4 CPU) + +avg-cpu: %user %nice %system %iowait %steal %idle + 22.67 0.52 6.99 1.88 0.00 67.94 + +Device: tps kB_read/s kB_wrtn/s kB_read kB_wrtn +sda 15.15 449.15 119.01 771022 204292 + +``` + +In the above output, the first line display, Linux kernel version and hostname. Next two lines displays CPU statistics like, average CPU usage, percentage of time the CPU were idle and waited for I/O response, percentage of waiting time of virtual CPU and the percentage of time the CPU is idle. Next two lines displays the device utilization report like, number of blocks read and write per second and total block reads and write per second. + +By default iostat displays the report with current date. If you want to display the current time, run the following command: + +``` +iostat -t +``` + +You should see the following output: +``` +Linux 3.19.0-25-generic (Ubuntu-PC) Saturday 16 December 2017 _x86_64_ (4 CPU) + +Saturday 16 December 2017 09:44:55 IST +avg-cpu: %user %nice %system %iowait %steal %idle + 21.37 0.31 6.93 1.28 0.00 70.12 + +Device: tps kB_read/s kB_wrtn/s kB_read kB_wrtn +sda 9.48 267.80 79.69 771022 229424 + +``` + +To check the version of the iostat, run the following command: + +``` +iostat -V +``` + +Output: +``` +sysstat version 10.2.0 +(C) Sebastien Godard (sysstat orange.fr) + +``` + +You can listout all the options available with iostat command using the following command: + +``` +iostat --help +``` + +Output: +``` +Usage: iostat [ options ] [ [ ] ] +Options are: +[ -c ] [ -d ] [ -h ] [ -k | -m ] [ -N ] [ -t ] [ -V ] [ -x ] [ -y ] [ -z ] +[ -j { ID | LABEL | PATH | UUID | ... } ] +[ [ -T ] -g ] [ -p [ [,...] | ALL ] ] +[ [...] | ALL ] + +``` + +### iostat Advance Usage Example + +If you want to view only the device report only once, run the following command: + +``` +iostat -d +``` + +You should see the following output: +``` +Linux 3.19.0-25-generic (Ubuntu-PC) Saturday 16 December 2017 _x86_64_ (4 CPU) + +Device: tps kB_read/s kB_wrtn/s kB_read kB_wrtn +sda 12.18 353.66 102.44 771022 223320 + +``` + +To view the device report continuously for every 5 seconds, for 3 times: + +``` +iostat -d 5 3 +``` + +You should see the following output: +``` +Linux 3.19.0-25-generic (Ubuntu-PC) Saturday 16 December 2017 _x86_64_ (4 CPU) + +Device: tps kB_read/s kB_wrtn/s kB_read kB_wrtn +sda 11.77 340.71 98.95 771022 223928 + +Device: tps kB_read/s kB_wrtn/s kB_read kB_wrtn +sda 2.00 0.00 8.00 0 40 + +Device: tps kB_read/s kB_wrtn/s kB_read kB_wrtn +sda 0.60 0.00 3.20 0 16 + +``` + +If you want to view the statistics of specific devices, run the following command: + +``` +iostat -p sda +``` + +You should see the following output: +``` +Linux 3.19.0-25-generic (Ubuntu-PC) Saturday 16 December 2017 _x86_64_ (4 CPU) + +avg-cpu: %user %nice %system %iowait %steal %idle + 21.69 0.36 6.98 1.44 0.00 69.53 + +Device: tps kB_read/s kB_wrtn/s kB_read kB_wrtn +sda 11.00 316.91 92.38 771022 224744 +sda1 0.07 0.27 0.00 664 0 +sda2 0.01 0.05 0.00 128 0 +sda3 0.07 0.27 0.00 648 0 +sda4 10.56 315.21 92.35 766877 224692 +sda5 0.12 0.48 0.02 1165 52 +sda6 0.07 0.32 0.00 776 0 + +``` + +You can also view the statistics of multiple devices with the following command: + +``` +iostat -p sda, sdb, sdc +``` + +If you want to displays the device I/O statistics in MB/second, run the following command: + +``` +iostat -m +``` + +You should see the following output: +``` +Linux 3.19.0-25-generic (Ubuntu-PC) Saturday 16 December 2017 _x86_64_ (4 CPU) + +avg-cpu: %user %nice %system %iowait %steal %idle + 21.39 0.31 6.94 1.30 0.00 70.06 + +Device: tps MB_read/s MB_wrtn/s MB_read MB_wrtn +sda 9.67 0.27 0.08 752 223 + +``` + +If you want to view the extended information for a specific partition (sda4), run the following command: + +``` +iostat -x sda4 +``` + +You should see the following output: +``` +Linux 3.19.0-25-generic (Ubuntu-PC) Saturday 16 December 2017 _x86_64_ (4 CPU) + +avg-cpu: %user %nice %system %iowait %steal %idle + 21.26 0.28 6.87 1.19 0.00 70.39 + +Device: rrqm/s wrqm/s r/s w/s rkB/s wkB/s avgrq-sz avgqu-sz await r_await w_await svctm %util +sda4 0.79 4.65 5.71 2.68 242.76 73.28 75.32 0.35 41.80 43.66 37.84 4.55 3.82 + +``` + +If you want to displays only the CPU usage statistics, run the following command: + +``` +iostat -c +``` + +You should see the following output: +``` +Linux 3.19.0-25-generic (Ubuntu-PC) Saturday 16 December 2017 _x86_64_ (4 CPU) + +avg-cpu: %user %nice %system %iowait %steal %idle + 21.45 0.33 6.96 1.34 0.00 69.91 + +``` + +-------------------------------------------------------------------------------- + +via: https://www.howtoforge.com/tutorial/how-to-install-and-use-iostat-on-ubuntu-1604/ + +作者:[Hitesh Jethva][a] +译者:[译者ID](https://github.com/译者ID) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://www.howtoforge.com