diff --git a/translated/tech/20180607 GitLab-s Ultimate - Gold Plans Are Now Free For Open-Source Projects.md b/published/20180607 GitLab-s Ultimate - Gold Plans Are Now Free For Open-Source Projects.md similarity index 50% rename from translated/tech/20180607 GitLab-s Ultimate - Gold Plans Are Now Free For Open-Source Projects.md rename to published/20180607 GitLab-s Ultimate - Gold Plans Are Now Free For Open-Source Projects.md index a56558ab8a..fb1f925c0a 100644 --- a/translated/tech/20180607 GitLab-s Ultimate - Gold Plans Are Now Free For Open-Source Projects.md +++ b/published/20180607 GitLab-s Ultimate - Gold Plans Are Now Free For Open-Source Projects.md @@ -1,20 +1,21 @@ -GitLab 的旗舰和黄金计划现在可以免费用于开源项目 +GitLab 的付费套餐现在可以免费用于开源项目 ====== -最近在开源社区发生了很多事情。首先,[微软收购了GitHub][1],然后人们开始寻找[ GitHub 替代方案][2],甚至在 Linus Torvalds 发布 [Linux Kernel 4.17][3] 时没有花一点时间考虑它。好吧,如果你一直关注我们,我认为你知道这一切。 -但是,今天,GitLab 做出了一个明智的举措,为教育机构和开源项目免费提供高级计划。当许多开发人员有兴趣将他们的开源项目迁移到 GitLab 时,没有更好的时机来提供这些了。 +最近在开源社区发生了很多事情。首先,[微软收购了 GitHub][1],然后人们开始寻找 [GitHub 替代套餐][2],甚至在 Linus Torvalds 发布 [Linux Kernel 4.17][3] 时没有花一点时间考虑它。好吧,如果你一直关注我们,我认为你知道这一切。 -### GitLab 的高级计划现在对开源项目和教育机构免费 +但是,如今,GitLab 做出了一个明智的举措,为教育机构和开源项目免费提供高级套餐。当许多开发人员有兴趣将他们的开源项目迁移到 GitLab 时,没有更好的时机来提供这些了。 + +### GitLab 的高级套餐现在对开源项目和教育机构免费 ![GitLab Logo][4] -在今天[发布的博客][5]中,GitLab 宣布**旗舰**和黄金计划现在对教育机构和开源项目免费。虽然我们已经知道为什么 GitLab 做出这个举动(一个完美的时机!),但他们还是解释了他们让它免费的动机: +在今天(2018/6/7)[发布的博客][5]中,GitLab 宣布其**旗舰**和黄金套餐现在对教育机构和开源项目免费。虽然我们已经知道为什么 GitLab 做出这个举动(一个完美的时机!),但他们还是解释了他们让它免费的动机: ->我们让 GitLab 对教育免费,因为我们希望学生使用我们最先进的功能。许多大学已经运行了 GitLab。如果学生使用 GitLab Ultimate 和 Gold 的高级功能,他们将把这些高级功能的经验带到他们的工作场所。 +> 我们让 GitLab 对教育机构免费,因为我们希望学生使用我们最先进的功能。许多大学已经运行了 GitLab。如果学生使用 GitLab 旗舰和黄金套餐的高级功能,他们将把这些高级功能的经验带到他们的工作场所。 > ->我们希望有更多的开源项目使用GitLab。GitLab.com 上的公共项目已经拥有 GitLab Ultimate 的所有功能。像 [Gnome][6] 和 [Debian][7] 这样的项目已经在自己的服务器运行开源版 GitLab 。随着今天的宣布,在专有软件上运行的开源项目可以使用 GitLab 提供的所有功能,同时我们通过向非开源组织收费来建立可持续的业务模式。 +> 我们希望有更多的开源项目使用 GitLab。GitLab.com 上的公共项目已经拥有 GitLab 旗舰套餐的所有功能。像 [Gnome][6] 和 [Debian][7] 这样的项目已经在自己的服务器运行开源版 GitLab 。随着今天的宣布,在专有软件上运行的开源项目可以使用 GitLab 提供的所有功能,同时我们通过向非开源组织收费来建立可持续的业务模式。 -### GitLab 提供的这些“免费”计划是什么? +### GitLab 提供的这些“免费”套餐是什么? ![GitLab Pricing][8] @@ -22,27 +23,25 @@ GitLab 有两类产品。一个是你可以在自己的云托管服务如 [Digit ![GitLab Pricing for hosted service][10] -Gold 是托管类别中最高的产品,而 Ultimate 是自托管类别中的最高产品。 +黄金套餐是托管类别中最高的产品,而旗舰套餐是自托管类别中的最高产品。 -You can get more details about their features on GitLab pricing page. Do note that the support is not included in this offer. You have to purchase it separately. -你可以在 GitLab 定价页面上获得有关其功能的更多详细信息。请注意,支持不在计划中。你必须单独购买。 +你可以在 GitLab 定价页面上获得有关其功能的更多详细信息。请注意,支持服务不包括在套餐中。你必须单独购买。 ### 你必须符合某些条件才能使用此优惠 -GitLab 还提到 - 该优惠对谁有效。以下是他们在博客文章中写的内容: +GitLab 还提到 —— 该优惠对谁有效。以下是他们在博客文章中写的内容: > 1. **教育机构:**任何为了学习、教育的机构,并且/或者由合格的教育机构、教职人员、学生训练。教育目的不包括商业,专业或任何其他营利目的。 > > 2. **开源项目:**任何使用[标准开源许可证][11]且非商业性的项目。它不应该有付费支持或付费贡献者。 > -> -虽然免费计划不包括支持,但是当你迫切需要专家帮助解决问题时,你仍然可以支付每用户每月 4.95 美元的额外费用 - 当你特别需要一个专家来解决问题时,这是一个非常合理的价格。 +虽然免费套餐不包括支持,但是当你迫切需要专家帮助解决问题时,你仍然可以支付每用户每月 4.95 美元的额外费用 —— 当你特别需要一个专家来解决问题时,这是一个非常合理的价格。 GitLab 还为学生们添加了一条说明: ->为减轻 GitLab 的管理负担,只有教育机构才能代表学生申请。如果你是学生并且你的教育机构不申请,你可以在 GitLab.com 上使用公共项目的所有功能,使用私人项目的免费功能,或者自己付费。 +> 为减轻 GitLab 的管理负担,只有教育机构才能代表学生申请。如果你是学生并且你的教育机构不申请,你可以在 GitLab.com 上使用公共项目的所有功能,使用私人项目的免费功能,或者自己付费。 ### 总结 @@ -59,7 +58,7 @@ via: https://itsfoss.com/gitlab-free-open-source/ 作者:[Ankush Das][a] 选题:[lujun9972](https://github.com/lujun9972) 译者:[geekpi](https://github.com/geekpi) -校对:[校对者ID](https://github.com/校对者ID) +校对:[wxy](https://github.com/wxy) 本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 diff --git a/sources/tech/20180508 UKTools - Easy Way To Install Latest Linux Kernel.md b/sources/tech/20180508 UKTools - Easy Way To Install Latest Linux Kernel.md index c85d9c35d4..dc0963d132 100644 --- a/sources/tech/20180508 UKTools - Easy Way To Install Latest Linux Kernel.md +++ b/sources/tech/20180508 UKTools - Easy Way To Install Latest Linux Kernel.md @@ -1,3 +1,6 @@ +Translating by MjSeven + + UKTools - Easy Way To Install Latest Linux Kernel ====== There are multiple utilities is available for Ubuntu to upgrade Linux kernel to latest stable version. We had already wrote about those utility in the past such as Linux Kernel Utilities (LKU), Ubuntu Kernel Upgrade Utility (UKUU) and Ubunsys. diff --git a/sources/tech/20180615 5 Commands for Checking Memory Usage in Linux.md b/sources/tech/20180615 5 Commands for Checking Memory Usage in Linux.md deleted file mode 100644 index d4b88d6559..0000000000 --- a/sources/tech/20180615 5 Commands for Checking Memory Usage in Linux.md +++ /dev/null @@ -1,198 +0,0 @@ -Translating by MjSeven - - -5 Commands for Checking Memory Usage in Linux -====== - -![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/top-main.jpg?itok=WYAw6yJ1) -The Linux operating system includes a plethora of tools, all of which are ready to help you administer your systems. From simple file and directory tools to very complex security commands, there’s not much you can’t do on Linux. And, although regular desktop users may not need to become familiar with these tools at the command line, they’re mandatory for Linux admins. Why? First, you will have to work with a GUI-less Linux server at some point. Second, command-line tools often offer far more power and flexibility than their GUI alternative. - -Determining memory usage is a skill you might need should a particular app go rogue and commandeer system memory. When that happens, it’s handy to know you have a variety of tools available to help you troubleshoot. Or, maybe you need to gather information about a Linux swap partition or detailed information about your installed RAM? There are commands for that as well. Let’s dig into the various Linux command-line tools to help you check into system memory usage. These tools aren’t terribly hard to use, and in this article, I’ll show you five different ways to approach the problem. - -I’ll be demonstrating on the [Ubuntu Server 18.04 platform][1]. You should, however, find all of these commands available on your distribution of choice. Even better, you shouldn’t need to install a single thing (as most of these tools are included). - -With that said, let’s get to work. - -### top - -I want to start out with the most obvious tool. The top command provides a dynamic, real-time view of a running system. Included in that system summary is the ability to check memory usage on a per-process basis. That’s very important, as you could easily have multiple iterations of the same command consuming different amounts of memory. Although you won’t find this on a headless server, say you’ve opened Chrome and noticed your system slowing down. Issue the top command to see that Chrome has numerous processes running (one per tab - Figure 1). - -![top][3] - -Figure 1: Multiple instances of Chrome appearing in the top command. - -[Used with permission][4] - -Chrome isn’t the only app to show multiple processes. You see the Firefox entry in Figure 1? That’s the primary process for Firefox, whereas the Web Content processes are the open tabs. At the top of the output, you’ll see the system statistics. On my machine (a [System76 Leopard Extreme][5]), I have a total of 16GB of RAM available, of which just over 10GB is in use. You can then comb through the list and see what percentage of memory each process is using. - -One of the things top is very good for is discovering Process ID (PID) numbers of services that might have gotten out of hand. With those PIDs, you can then set about to troubleshoot (or kill) the offending tasks. - -If you want to make top a bit more memory-friendly, issue the command top -o %MEM, which will cause top to sort all processes by memory used (Figure 2). - -![top][7] - -Figure 2: Sorting process by memory used in top. - -[Used with permission][4] - -The top command also gives you a real-time update on how much of your swap space is being used. - -### free - -Sometimes, however, top can be a bit much for your needs. You may only need to see the amount of free and used memory on your system. For that, there is the free command. The free command displays: - - * Total amount of free and used physical memory - - * Total amount of swap memory in the system - - * Buffers and caches used by the kernel - - - - -From your terminal window, issue the command free. The output of this command is not in real time. Instead, what you’ll get is an instant snapshot of the free and used memory in that moment (Figure 3). - -![free][9] - -Figure 3: The output of the free command is simple and clear. - -[Used with permission][4] - -You can, of course, make free a bit more user-friendly by adding the -m option, like so: free -m. This will report the memory usage in MB (Figure 4). - -![free][11] - -Figure 4: The output of the free command in a more human-readable form. - -[Used with permission][4] - -Of course, if your system is even remotely modern, you’ll want to use the -g option (gigabytes), as in free -g. - -If you need memory totals, you can add the t option like so: free -mt. This will simply total the amount of memory in columns (Figure 5). - -![total][13] - -Figure 5: Having free total your memory columns for you. - -[Used with permission][4] - -### vmstat - -Another very handy tool to have at your disposal is vmstat. This particular command is a one-trick pony that reports virtual memory statistics. The vmstat command will report stats on: - - * Processes - - * Memory - - * Paging - - * Block IO - - * Traps - - * Disks - - * CPU - - - - -The best way to issue vmstat is by using the -s switch, like vmstat -s. This will report your stats in a single column (which is so much easier to read than the default report). The vmstat command will give you more information than you need (Figure 6), but more is always better (in such cases). - -![vmstat][15] - -Figure 6: Using the vmstat command to check memory usage. - -[Used with permission][4] - -### dmidecode - -What if you want to find out detailed information about your installed system RAM? For that, you could use the dmidecode command. This particular tool is the DMI table decoder, which dumps a system’s DMI table contents into a human-readable format. If you’re unsure as to what the DMI table is, it’s a means to describe what a system is made of (as well as possible evolutions for a system). - -To run the dmidecode command, you do need sudo privileges. So issue the command sudo dmidecode -t 17. The output of the command (Figure 7) can be lengthy, as it displays information for all memory-type devices. So if you don’t have the ability to scroll, you might want to send the output of that command to a file, like so: sudo dmidecode -t 17 > dmi_infoI, or pipe it to the less command, as in sudo dmidecode | less. - -![dmidecode][17] - -Figure 7: The output of the dmidecode command. - -[Used with permission][4] - -### /proc/meminfo - -You might be asking yourself, “Where do these commands get this information from?”. In some cases, they get it from the /proc/meminfo file. Guess what? You can read that file directly with the command less /proc/meminfo. By using the less command, you can scroll up and down through that lengthy output to find exactly what you need (Figure 8). - -![/proc/meminfo][19] - -Figure 8: The output of the less /proc/meminfo command. - -[Used with permission][4] - -One thing you should know about /proc/meminfo: This is not a real file. Instead /pro/meminfo is a virtual file that contains real-time, dynamic information about the system. In particular, you’ll want to check the values for: - - * MemTotal - - * MemFree - - * MemAvailable - - * Buffers - - * Cached - - * SwapCached - - * SwapTotal - - * SwapFree - - - - -If you want to get fancy with /proc/meminfo you can use it in conjunction with the egrep command like so: egrep --color 'Mem|Cache|Swap' /proc/meminfo. This will produce an easy to read listing of all entries that contain Mem, Cache, and Swap ... with a splash of color (Figure 9). - -![/proc/meminfo][21] - -Figure 9: Making /proc/meminfo easier to read. - -[Used with permission][4] - -### Keep learning - -One of the first things you should do is read the manual pages for each of these commands (so man top, man free, man vmstat, man dmidecode). Starting with the man pages for commands is always a great way to learn so much more about how a tool works on Linux. - -Learn more about Linux through the free ["Introduction to Linux" ][22]course from The Linux Foundation and edX. - --------------------------------------------------------------------------------- - -via: https://www.linux.com/learn/5-commands-checking-memory-usage-linux - -作者:[Jack Wallen][a] -选题:[lujun9972](https://github.com/lujun9972) -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://www.linux.com/users/jlwallen -[1]:https://www.ubuntu.com/download/server -[2]:/files/images/memory1jpg -[3]:https://www.linux.com/sites/lcom/files/styles/rendered_file/public/memory_1.jpg?itok=fhhhUL_l (top) -[4]:/licenses/category/used-permission -[5]:https://system76.com/desktops/leopard -[6]:/files/images/memory2jpg -[7]:https://www.linux.com/sites/lcom/files/styles/rendered_file/public/memory_2.jpg?itok=zuVkQfvv (top) -[8]:/files/images/memory3jpg -[9]:https://www.linux.com/sites/lcom/files/styles/rendered_file/public/memory_3.jpg?itok=rvuQp3t0 (free) -[10]:/files/images/memory4jpg -[11]:https://www.linux.com/sites/lcom/files/styles/rendered_file/public/memory_4.jpg?itok=K_luLLPt (free) -[12]:/files/images/memory5jpg -[13]:https://www.linux.com/sites/lcom/files/styles/rendered_file/public/memory_5.jpg?itok=q50atcsX (total) -[14]:/files/images/memory6jpg -[15]:https://www.linux.com/sites/lcom/files/styles/rendered_file/public/memory_6.jpg?itok=bwFnUVmy (vmstat) -[16]:/files/images/memory7jpg -[17]:https://www.linux.com/sites/lcom/files/styles/rendered_file/public/memory_7.jpg?itok=UNHIT_P6 (dmidecode) -[18]:/files/images/memory8jpg -[19]:https://www.linux.com/sites/lcom/files/styles/rendered_file/public/memory_8.jpg?itok=t87jvmJJ (/proc/meminfo) -[20]:/files/images/memory9jpg -[21]:https://www.linux.com/sites/lcom/files/styles/rendered_file/public/memory_9.jpg?itok=t-iSMEKq (/proc/meminfo) -[22]:https://training.linuxfoundation.org/linux-courses/system-administration-training/introduction-to-linux diff --git a/sources/tech/20180622 How to Check Disk Space on Linux from the Command Line.md b/sources/tech/20180622 How to Check Disk Space on Linux from the Command Line.md deleted file mode 100644 index e6db9ec09d..0000000000 --- a/sources/tech/20180622 How to Check Disk Space on Linux from the Command Line.md +++ /dev/null @@ -1,183 +0,0 @@ -Translating...by SunWave - -How to Check Disk Space on Linux from the Command Line -====== - -![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/diskspace-main.jpg?itok=t9Oxxc9X) - -Quick question: How much space do you have left on your drives? A little or a lot? Follow up question: Do you know how to find out? If you happen to use a GUI desktop (e.g., GNOME, KDE, Mate, Pantheon, etc.), the task is probably pretty simple. But what if you’re looking at a headless server, with no GUI? Do you need to install tools for the task? The answer is a resounding no. All the necessary bits are already in place to help you find out exactly how much space remains on your drives. In fact, you have two very easy-to-use options at the ready. - -In this article, I’ll demonstrate these tools. I’ll be using [Elementary OS][1], which also includes a GUI option, but we’re going to limit ourselves to the command line. The good news is these command-line tools are readily available for every Linux distribution. On my testing system, there are a number of attached drives (both internal and external). The commands used are agnostic to where a drive is plugged in; they only care that the drive is mounted and visible to the operating system. - -With that said, let’s take a look at the tools. - -### df - -The df command is the tool I first used to discover drive space on Linux, way back in the 1990s. It’s very simple in both usage and reporting. To this day, df is my go-to command for this task. This command has a few switches but, for basic reporting, you really only need one. That command is df -H. The -H switch is for human-readable format. The output of df -H will report how much space is used, available, percentage used, and the mount point of every disk attached to your system (Figure 1). - - -![df output][3] - -Figure 1: The output of df -H on my Elementary OS system. - -[Used with permission][4] - -What if your list of drives is exceedingly long and you just want to view the space used on a single drive? With df, that is possible. Let’s take a look at how much space has been used up on our primary drive, located at /dev/sda1. To do that, issue the command: -``` -df -H /dev/sda1 - -``` - -The output will be limited to that one drive (Figure 2). - - -![disk usage][6] - -Figure 2: How much space is on one particular drive? - -[Used with permission][4] - -You can also limit the reported fields shown in the df output. Available fields are: - - * source — the file system source - - * size — total number of blocks - - * used — spaced used on a drive - - * avail — space available on a drive - - * pcent — percent of used space, divided by total size - - * target — mount point of a drive - - - - -Let’s display the output of all our drives, showing only the size, used, and avail (or availability) fields. The command for this would be: -``` -df -H --output=size,used,avail - -``` - -The output of this command is quite easy to read (Figure 3). - - -![output][8] - -Figure 3: Specifying what output to display for our drives. - -[Used with permission][4] - -The only caveat here is that we don’t know the source of the output, so we’d want to include source like so: -``` -df -H --output=source,size,used,avail - -``` - -Now the output makes more sense (Figure 4). - -![source][10] - -Figure 4: We now know the source of our disk usage. - -[Used with permission][4] - -### du - -Our next command is du. As you might expect, that stands for disk usage. The du command is quite different to the df command, in that it reports on directories and not drives. Because of this, you’ll want to know the names of directories to be checked. Let’s say I have a directory containing virtual machine files on my machine. That directory is /media/jack/HALEY/VIRTUALBOX. If I want to find out how much space is used by that particular directory, I’d issue the command: -``` -du -h /media/jack/HALEY/VIRTUALBOX - -``` - -The output of the above command will display the size of every file in the directory (Figure 5). - -![du command][12] - -Figure 5: The output of the du command on a specific directory. - -[Used with permission][4] - -So far, this command isn’t all that helpful. What if we want to know the total usage of a particular directory? Fortunately, du can handle that task. On the same directory, the command would be: -``` -du -sh /media/jack/HALEY/VIRTUALBOX/ - -``` - -Now we know how much total space the files are using up in that directory (Figure 6). - -![space used][14] - -Figure 6: My virtual machine files are using 559GB of space. - -[Used with permission][4] - -You can also use this command to see how much space is being used on all child directories of a parent, like so: -``` -du -h /media/jack/HALEY - -``` - -The output of this command (Figure 7) is a good way to find out what subdirectories are hogging up space on a drive. - -![directories][16] - -Figure 7: How much space are my subdirectories using? - -[Used with permission][4] - -The du command is also a great tool to use in order to see a list of directories that are using the most disk space on your system. The way to do this is by piping the output of du to two other commands: sort and head. The command to find out the top 10 directories eating space on a drive would look something like this: -``` -du -a /media/jack | sort -n -r | head -n 10 - -``` - -The output would list out those directories, from largest to least offender (Figure 8). - -![top users][18] - -Figure 8: Our top ten directories using up space on a drive. - -[Used with permission][4] - -### Not as hard as you thought - -Finding out how much space is being used on your Linux-attached drives is quite simple. As long as your drives are mounted to the Linux system, both df and du will do an outstanding job of reporting the necessary information. With df you can quickly see an overview of how much space is used on a disk and with du you can discover how much space is being used by specific directories. These two tools in combination should be considered must-know for every Linux administrator. - -And, in case you missed it, I recently showed how to [determine your memory usage on Linux][19]. Together, these tips will go a long way toward helping you successfully manage your Linux servers. - -Learn more about Linux through the free ["Introduction to Linux"][20]course from The Linux Foundation and edX. - --------------------------------------------------------------------------------- - -via: https://www.linux.com/learn/intro-to-linux/2018/6how-check-disk-space-linux-command-line - -作者:[Jack Wallen][a] -选题:[lujun9972](https://github.com/lujun9972) -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://www.linux.com/users/jlwallen -[1]:https://elementary.io/ -[2]:/files/images/diskspace1jpg -[3]:https://www.linux.com/sites/lcom/files/styles/rendered_file/public/diskspace_1.jpg?itok=aJa8AZAM (df output) -[4]:https://www.linux.com/licenses/category/used-permission -[5]:/files/images/diskspace2jpg -[6]:https://www.linux.com/sites/lcom/files/styles/rendered_file/public/diskspace_2.jpg?itok=_PAq3kxC (disk usage) -[7]:/files/images/diskspace3jpg -[8]:https://www.linux.com/sites/lcom/files/styles/rendered_file/public/diskspace_3.jpg?itok=51m8I-Vu (output) -[9]:/files/images/diskspace4jpg -[10]:https://www.linux.com/sites/lcom/files/styles/rendered_file/public/diskspace_4.jpg?itok=SuwgueN3 (source) -[11]:/files/images/diskspace5jpg -[12]:https://www.linux.com/sites/lcom/files/styles/rendered_file/public/diskspace_5.jpg?itok=XfS4s7Zq (du command) -[13]:/files/images/diskspace6jpg -[14]:https://www.linux.com/sites/lcom/files/styles/rendered_file/public/diskspace_6.jpg?itok=r71qICyG (space used) -[15]:/files/images/diskspace7jpg -[16]:https://www.linux.com/sites/lcom/files/styles/rendered_file/public/diskspace_7.jpg?itok=PtDe4q5y (directories) -[17]:/files/images/diskspace8jpg -[18]:https://www.linux.com/sites/lcom/files/styles/rendered_file/public/diskspace_8.jpg?itok=v9E1SFcC (top users) -[19]:https://www.linux.com/learn/5-commands-checking-memory-usage-linux -[20]:https://training.linuxfoundation.org/linux-courses/system-administration-training/introduction-to-linux diff --git a/sources/tech/20180720 3 Methods to List All The Users in Linux System.md b/sources/tech/20180720 3 Methods to List All The Users in Linux System.md deleted file mode 100644 index 5106bdfb76..0000000000 --- a/sources/tech/20180720 3 Methods to List All The Users in Linux System.md +++ /dev/null @@ -1,237 +0,0 @@ -Translating... by SunWave - -3 Methods to List All The Users in Linux System -====== -Everyone knows user information was residing in `/etc/passwd` file. - -It’s a text file that contains the essential information about each user. - -When we create a new user, the new user details will be appended into this file. - -The /etc/passwd file contains each user essential information as a single line with seven fields. - -Each line in /etc/passwd represents a single user. This file keep the user’s information in three parts. - - * `Part-1:` root user information - * `Part-2:` system-defined accounts information - * `Part-3:` Real user information - - - -**Suggested Read :** -**(#)** [How To Check User Created Date On Linux][1] -**(#)** [How To Check Which Groups A User Belongs To On Linux][2] -**(#)** [How To Force User To Change Password On Next Login In Linux][3] - -The first part is the root account, which is administrator account has complete power over every aspect of the system. - -The second part is followed by system-defined groups and accounts that are required for proper installation and update of system software. - -The third part at the end represent real people who use the system. - -While creating a new users the below four files will be modified. - - * `/etc/passwd:` User details will be updated in this file. - * `/etc/shadow:` User password info will be updated in this file. - * `/etc/group:` Group details will be updated of the new user in this file. - * `/etc/gshadow:` Group password info will be updated of the new user in the file. - - - -### Method-1: Using /etc/passwd file - -Use any of the file manipulation command such as cat, more, less, etc to print the list of users were created on your Linux system. - -The `/etc/passwd` is a text file that contains each user information, which is necessary to login Linux system. It maintain useful information about users such as username, password, user ID, group ID, user ID info, home directory and shell. - -The /etc/passwd file contain every user details as a single line with seven fields as described below, each fields separated by colon “:” -``` -# cat /etc/passwd -root:x:0:0:root:/root:/bin/bash -bin:x:1:1:bin:/bin:/sbin/nologin -daemon:x:2:2:daemon:/sbin:/sbin/nologin -adm:x:3:4:adm:/var/adm:/sbin/nologin -lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin -sync:x:5:0:sync:/sbin:/bin/sync -shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown -halt:x:7:0:halt:/sbin:/sbin/halt -mail:x:8:12:mail:/var/spool/mail:/sbin/nologin -ftp:x:14:50:FTP User:/var/ftp:/sbin/nologin -postfix:x:89:89::/var/spool/postfix:/sbin/nologin -sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin -tcpdump:x:72:72::/:/sbin/nologin -2gadmin:x:500:10::/home/viadmin:/bin/bash -apache:x:48:48:Apache:/var/www:/sbin/nologin -zabbix:x:498:499:Zabbix Monitoring System:/var/lib/zabbix:/sbin/nologin -mysql:x:497:502::/home/mysql:/bin/bash -zend:x:502:503::/u01/zend/zend/gui/lighttpd:/sbin/nologin -rpc:x:32:32:Rpcbind Daemon:/var/cache/rpcbind:/sbin/nologin -2daygeek:x:503:504::/home/2daygeek:/bin/bash -named:x:25:25:Named:/var/named:/sbin/nologin -mageshm:x:506:507:2g Admin - Magesh M:/home/mageshm:/bin/bash - -``` - -Below are the detailed information about seven fields. - - * **`Username (magesh):`** Username of created user. Characters length should be between 1 to 32. - * **`Password (x):`** It indicates that encrypted password is stored at /etc/shadow file. - * **`User ID (UID-506):`** It indicates the user ID (UID) each user should be contain unique UID. UID (0-Zero) is reserved for root, UID (1-99) reserved for system users and UID (100-999) reserved for system accounts/groups - * **`Group ID (GID-507):`** It indicates the group ID (GID) each group should be contain unique GID is stored at /etc/group file. - * **`User ID Info (2g Admin - Magesh M):`** It indicates the command field. This field can be used to describe the user information. - * **`Home Directory (/home/mageshm):`** It indicates the user home directory. - * **`shell (/bin/bash):`** It indicates the user’s bash shell. - - - -You can use the **awk** or **cut** command to print only the user names list on your Linux system. Both are showing the same results. -``` -# awk -F':' '{ print $1}' /etc/passwd -or -# cut -d: -f1 /etc/passwd -root -bin -daemon -adm -lp -sync -shutdown -halt -mail -ftp -postfix -sshd -tcpdump -2gadmin -apache -zabbix -mysql -zend -rpc -2daygeek -named -mageshm - -``` - -### Method-2: Using getent Command - -The getent command displays entries from databases supported by the Name Service Switch libraries, which are configured in /etc/nsswitch.conf. - -getent command shows user details similar to /etc/passwd file, it shows every user details as a single line with seven fields. -``` -# getent passwd -root:x:0:0:root:/root:/bin/bash -bin:x:1:1:bin:/bin:/sbin/nologin -daemon:x:2:2:daemon:/sbin:/sbin/nologin -adm:x:3:4:adm:/var/adm:/sbin/nologin -lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin -sync:x:5:0:sync:/sbin:/bin/sync -shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown -halt:x:7:0:halt:/sbin:/sbin/halt -mail:x:8:12:mail:/var/spool/mail:/sbin/nologin -ftp:x:14:50:FTP User:/var/ftp:/sbin/nologin -postfix:x:89:89::/var/spool/postfix:/sbin/nologin -sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin -tcpdump:x:72:72::/:/sbin/nologin -2gadmin:x:500:10::/home/viadmin:/bin/bash -apache:x:48:48:Apache:/var/www:/sbin/nologin -zabbix:x:498:499:Zabbix Monitoring System:/var/lib/zabbix:/sbin/nologin -mysql:x:497:502::/home/mysql:/bin/bash -zend:x:502:503::/u01/zend/zend/gui/lighttpd:/sbin/nologin -rpc:x:32:32:Rpcbind Daemon:/var/cache/rpcbind:/sbin/nologin -2daygeek:x:503:504::/home/2daygeek:/bin/bash -named:x:25:25:Named:/var/named:/sbin/nologin -mageshm:x:506:507:2g Admin - Magesh M:/home/mageshm:/bin/bash - -``` - -Below are the detailed information about seven fields. - - * **`Username (magesh):`** Username of created user. Characters length should be between 1 to 32. - * **`Password (x):`** It indicates that encrypted password is stored at /etc/shadow file. - * **`User ID (UID-506):`** It indicates the user ID (UID) each user should be contain unique UID. UID (0-Zero) is reserved for root, UID (1-99) reserved for system users and UID (100-999) reserved for system accounts/groups - * **`Group ID (GID-507):`** It indicates the group ID (GID) each group should be contain unique GID is stored at /etc/group file. - * **`User ID Info (2g Admin - Magesh M):`** It indicates the command field. This field can be used to describe the user information. - * **`Home Directory (/home/mageshm):`** It indicates the user home directory. - * **`shell (/bin/bash):`** It indicates the user’s bash shell. - - - -You can use the **awk** or **cut** command to print only the user names list on your Linux system. Both are showing the same results. -``` -# getent passwd | awk -F':' '{ print $1}' -or -# getent passwd | cut -d: -f1 -root -bin -daemon -adm -lp -sync -shutdown -halt -mail -ftp -postfix -sshd -tcpdump -2gadmin -apache -zabbix -mysql -zend -rpc -2daygeek -named -mageshm - -``` - -### Method-3: Using compgen Command - -compgen is bash built-in command and it will show all available commands, aliases, and functions for you. -``` -# compgen -u -root -bin -daemon -adm -lp -sync -shutdown -halt -mail -ftp -postfix -sshd -tcpdump -2gadmin -apache -zabbix -mysql -zend -rpc -2daygeek -named -mageshm - -``` - -Please comment your inputs into our comment section, so based on that we can improve our blog and make effective article. So, stay tune with us. - --------------------------------------------------------------------------------- - -via: https://www.2daygeek.com/3-methods-to-list-all-the-users-in-linux-system/ - -作者:[Magesh Maruthamuthu][a] -选题:[lujun9972](https://github.com/lujun9972) -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://www.2daygeek.com/author/magesh/ -[1]:https://www.2daygeek.com/how-to-check-user-created-date-on-linux/ -[2]:https://www.2daygeek.com/how-to-check-which-groups-a-user-belongs-to-on-linux/ -[3]:https://www.2daygeek.com/how-to-force-user-to-change-password-on-next-login-in-linux/ diff --git a/sources/tech/20180720 Convert video using Handbrake.md b/sources/tech/20180720 Convert video using Handbrake.md deleted file mode 100644 index 35855182dd..0000000000 --- a/sources/tech/20180720 Convert video using Handbrake.md +++ /dev/null @@ -1,57 +0,0 @@ -translating---geekpi - -Convert video using Handbrake -====== - -![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/OpenVideo.png?itok=jec9ibU5) - -Recently, when my son asked me to digitally convert some old DVDs of his high school basketball games, I immediately knew I would use [Handbrake][1]. It is an open source package that has all the tools necessary to easily convert video into formats that can be played on MacOS, Windows, Linux, iOS, Android, and other platforms. - -Handbrake is open source and distributable under the [GPLv2 license][2]. It's easy to install on MacOS, Windows, and Linux, including both [Fedora][3] and [Ubuntu][4]. In Linux, once it's installed, it can be launched from the command line with `$ handbrake` or selected from the graphical user interface. (In my case, that is GNOME 3.) - -![](https://opensource.com/sites/default/files/uploads/handbrake_1.png) - -Handbrake's menu system is easy to use. Click on **Open Source** to select the video source you want to convert. For my son's basketball videos, that is the DVD drive in my Linux laptop. After inserting the DVD into the drive, the software identifies the contents of the disk. -![](https://opensource.com/sites/default/files/uploads/handbrake_2.png) - -As you can see next to Source in the screenshot above, Handbrake recognizes it as a DVD with a 720x480 video in 4:3 aspect ratio, recorded at 29.97 frames per second, with one audio track. The software also previews the video. - -If the default conversion settings are acceptable, just press the **Start Encoding** button and (after a period of time, depending on the speed of your processor) the DVD's contents will be converted and saved in the default format, [M4V][5] (which can be changed). - -If you don't like the filename, it's easy to change it. - -![](https://opensource.com/sites/default/files/uploads/handbrake_3.png) - -Handbrake has a variety of output options for format, size, and disposition. For example, it can produce video optimized for YouTube, Vimeo, and other websites, as well as for devices including iPod, iPad, Apple TV, Amazon Fire TV, Roku, PlayStation, and more. - -![](https://opensource.com/sites/default/files/uploads/handbrake_4.png) - -You can change the video output size in the Dimensions menu tab. Other tabs allow you to apply filters, change video quality and encoding, add or modify an audio track, include subtitles, and modify chapters. The Tags menu tab lets you identify the author, actors, director, release date, and more on the output video file. - -![](https://opensource.com/sites/default/files/uploads/handbrake_5.png) - -If you want to set Handbrake to produce output for a specific platform, you can use the included presets. - -![](https://opensource.com/sites/default/files/uploads/handbrake_6.png) - -You can also use the menu options to create your own format, depending on the functionality you want. - -Handbrake is an incredibly powerful piece of software, but it's not the only open source video conversion tool out there. Do you have another favorite? If so, please share in the comments. - --------------------------------------------------------------------------------- - -via: https://opensource.com/article/18/7/handbrake - -作者:[Don Watkins][a] -选题:[lujun9972](https://github.com/lujun9972) -译者:[译者ID](https://github.com/译者ID) -校对:[校对者ID](https://github.com/校对者ID) - -本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 - -[a]:https://opensource.com/users/don-watkins -[1]:https://handbrake.fr/ -[2]:https://github.com/HandBrake/HandBrake/blob/master/LICENSE -[3]:https://fedora.pkgs.org/28/rpmfusion-free-x86_64/HandBrake-1.1.0-1.fc28.x86_64.rpm.html -[4]:https://launchpad.net/~stebbins/+archive/ubuntu/handbrake-releases -[5]:https://en.wikipedia.org/wiki/M4V diff --git a/sources/tech/20180726 4 cool apps for your terminal.md b/sources/tech/20180726 4 cool apps for your terminal.md index c54274d9c4..b86d47be79 100644 --- a/sources/tech/20180726 4 cool apps for your terminal.md +++ b/sources/tech/20180726 4 cool apps for your terminal.md @@ -1,3 +1,5 @@ +translating---geekpi + 4 cool apps for your terminal ====== diff --git a/translated/tech/20180615 5 Commands for Checking Memory Usage in Linux.md b/translated/tech/20180615 5 Commands for Checking Memory Usage in Linux.md new file mode 100644 index 0000000000..08cabe84c7 --- /dev/null +++ b/translated/tech/20180615 5 Commands for Checking Memory Usage in Linux.md @@ -0,0 +1,190 @@ +用以检查 Linux 内存使用的 5 个命令 +====== + +![](https://www.linux.com/sites/lcom/files/styles/rendered_file/public/top-main.jpg?itok=WYAw6yJ1) +Linux 操作系统包含大量工具,所有这些工具都可以帮助你管理系统。从简单的文件和目录工具到非常复杂的安全命令,在 Linux 中没有多少是你做不了的。而且,尽管普通桌面用户可能不需要在命令行熟悉这些工具,但对于 Linux 管理员来说,它们是必需的。为什么?首先,你在某些时候不得不使用没有 GUI 的 Linux 服务器。其次,命令行工具通常比 GUI 替代工具提供更多的功能和灵活性。 + +确定内存使用情况是你可能需要的技能,尤其是特定应用程序变为流氓和占用系统内存时。当发生这种情况时,知道有多种工具可以帮助你进行故障排除十分方便的。或者,你可能需要收集有关 Linux 交换分区的信息,或者有关安装的 RAM 的详细信息?对于这些也有相应的命令。让我们深入了解各种 Linux 命令行工具,以帮助你检查系统内存使用情况。这些工具并不是非常难以使用,在本文中,我将向你展示五种不同的方法来解决这个问题。 + +我将在 [Ubuntu 18.04 服务器平台][1]上进行演示,但是你应该在你选择的发行版中找到对应的所有命令。更妙的是,你不需要安装任何东西(因为大多数这些工具都包含 Linux 系统中)。 + +话虽如此,让我们开始工作吧。 + +### top + +我想从最明显的工具开始。top 命令提供正在运行的系统的动态实时视图,它检查每个进程的内存使用情况。这非常重要,因为你可以轻松地对同一命令的多次迭代消耗不同的内存量。虽然你无法在没有外设的服务器上找到它,但是你已经注意到打开 Chrome 使你的系统速度变慢了。发出 top 命令以查看 Chrome 有多个进程在运行(每个选项卡一个 - 图 1)。 + +![top][3] + +图1:top 命令中出现多个 Chrome 进程。 + +(to 校正者:不知道这句话什么意思,难道是是否允许转载的?) +[Used with permission][4] + +Chrome 并不是唯一显示多个进程的应用。你看到图 1 中的 Firefox 了吗?那是 Firefox 的主进程,而 Web Content 进程是其打开的选项卡。在输出的顶部,你将看到系统统计信息。在我的机器上([System76 Leopard Extreme][5]),我总共有 16GB 可用 RAM,其中只有超过 10GB 的 RAM 正在使用中。然后,你可以整理列表,查看每个进程使用的内存百分比。 + +top 最好的事情之一就是发现可能已经失控的进程 ID(PID)服务数量。有了这些 PID,你可以对有问题的任务进行故障排除(或 kill)。 + +如果你想让 top 显示更友好的内存信息,使用命令 top -o%MEM,这会使 top 按进程所用内存对所有进程进行排序(图 2)。 + + +![top][7] + +图 2:在 top 命令中按使用内存对进程排序 + +[Used with permission][4] + +top 命令还为你提供有关使用了多少交换空间的实时更新。 + +### free + +然而有时候,top 命令可能不会满足你的需求。你可能只需要查看系统的可用和已用内存。对此,Linux 还有 free 命令。free 命令显示: +(to 校正者:以下这种可能翻译得不太准确,望纠正) +* 可用和已使用的物理内存总量 + +* 系统中交换内存的总量 + +* 内核使用的缓冲区和缓存 + +在终端窗口中,输入 free 命令。它的输出不是实时的,相反,你将获得的是当前空闲和已用内存的即时快照(图 3)。 + +![free][9] + +图 3 :free 命令的输出简单明了。 + +[Used with permission][4] + +当然,你可以通过添加 -m 选项来让 free 显示得更友好一点,就像这样:free -m。这将显示内存的使用情况,以 MB 为单位(图 4)。 + +![free][11] + +图 4:free 命令以一种更易于阅读的形式输出。 + +[Used with permission][4] + +当然,如果你的系统是远程的,你将希望使用 -g 选项(以 GB 为单位),比如 free -g。 + +如果你需要内存总量,你可以添加 t 选项,比如:free -mt。这将简单地计算每列中的内存总量(图 5)。 + +![total][13] + +图 5:为你提供空闲的内存列。 + +[Used with permission][4] + +### vmstat + +另一个非常方便的工具是 vmstat。这个特殊的命令是一个报告虚拟内存统计信息的小技巧。vmstat 命令将报告关于: + +* 进程 + +* 内存 + +* 页 + +* 阻塞 IO + +* traps + +* 磁盘 + +* CPU + +使用 vmstat 的最佳方法是使用 -s 选项,如 vmstat -s。这将在单列中报告统计信息(这比默认报告更容易阅读)。vmstat 命令将提供比你需要的更多的信息(图 6),但更多的总是更好的(在这种情况下)。 + +![vmstat][15] + +图 6:使用 vmstat 命令来检查内存使用情况。 + +[Used with permission][4] + +### dmidecode + +如果你想找到关于已安装的系统 RAM 的详细信息,该怎么办?为此,你可以使用 dmidecode 命令。这个特殊的工具是 DMI 表解码器,它将系统的 DMI 表内容转储成人类可读的格式。如果你不清楚 DMI 表是什么,那么可以这样说,(to 校正者:这句话可以不加)它是可以用来描述系统的构成(以及系统的演变)。 + +要运行 dmidecode 命令,你需要 sudo 权限。因此输入命令 sudo dmidecode -t 17。该命令的输出(图 7)可能很长,因为它显示所有内存类型设备的信息。因此,如果你无法上下滚动,则可能需要将该命令的输出发送到一个文件中,比如:sudo dmidecode -t 17> dmi_infoI,或将其传递给 less 命令,如 sudo dmidecode | less。 + +![dmidecode][17] + +图 7:dmidecode 命令的输出。 + +[Used with permission][4] + +### /proc/meminfo + +你可能会问自己:“这些命令从哪里获取这些信息?”在某些情况下,它们从 /proc/meminfo 文件中获取。你猜猜?你可以使用命令 less /proc/meminfo 直接读取该文件。通过使用 less 命令,你可以在长长的输出中向上和向下滚动,以准确找到你需要的内容(图 8)。 + +![/proc/meminfo][19] + +图 8:less /proc/meminfo 命令的输出。 + +[Used with permission][4] + +关于 /proc/meminfo 你应该知道:这不是一个真实的文件。相反 /pro/meminfo 是一个虚拟文件,包含有关系统的实时动态信息。特别是,你需要检查以下值: + + * 全部内存 + + * 空闲内存 + + * 可用内存 + + * 缓冲区 + + * 文件缓存 + + * 交换缓存 + + * 全部交换区 + + * 空闲交换区 + +如果你想使用 /proc/meminfo,你可以用连词像 egrep 命令一样使用它:egrep --color'Mem | Cache | Swap'/proc/meminfo。这将生成一个易于阅读的列表,其中包含 Mem, Cache 和 Swap 等所有包含颜色的条目(图 9)。 + +![/proc/meminfo][21] + +图 9:让 /proc/meminfo 更容易阅读。 + +[Used with permission][4] + +### 继续学习 + +你要做的第一件事就是阅读每个命令的手册页(例如 man top, man free, man vmstat, man dmidecode)。从命令的手册页开始,对于如何在 Linux 上使用一个工具,它总是一个很好的学习方法。 + +通过 Linux 基金会和 edX 的免费 [“Linux 简介”][22]课程了解有关 Linux 的更多知识。 + + + +-------------------------------------------------------------------------------- + +via: https://www.linux.com/learn/5-commands-checking-memory-usage-linux + +作者:[Jack Wallen][a] +选题:[lujun9972](https://github.com/lujun9972) +译者:[MjSeven](https://github.com/MjSeven) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://www.linux.com/users/jlwallen +[1]:https://www.ubuntu.com/download/server +[2]:/files/images/memory1jpg +[3]:https://www.linux.com/sites/lcom/files/styles/rendered_file/public/memory_1.jpg?itok=fhhhUL_l (top) +[4]:/licenses/category/used-permission +[5]:https://system76.com/desktops/leopard +[6]:/files/images/memory2jpg +[7]:https://www.linux.com/sites/lcom/files/styles/rendered_file/public/memory_2.jpg?itok=zuVkQfvv (top) +[8]:/files/images/memory3jpg +[9]:https://www.linux.com/sites/lcom/files/styles/rendered_file/public/memory_3.jpg?itok=rvuQp3t0 (free) +[10]:/files/images/memory4jpg +[11]:https://www.linux.com/sites/lcom/files/styles/rendered_file/public/memory_4.jpg?itok=K_luLLPt (free) +[12]:/files/images/memory5jpg +[13]:https://www.linux.com/sites/lcom/files/styles/rendered_file/public/memory_5.jpg?itok=q50atcsX (total) +[14]:/files/images/memory6jpg +[15]:https://www.linux.com/sites/lcom/files/styles/rendered_file/public/memory_6.jpg?itok=bwFnUVmy (vmstat) +[16]:/files/images/memory7jpg +[17]:https://www.linux.com/sites/lcom/files/styles/rendered_file/public/memory_7.jpg?itok=UNHIT_P6 (dmidecode) +[18]:/files/images/memory8jpg +[19]:https://www.linux.com/sites/lcom/files/styles/rendered_file/public/memory_8.jpg?itok=t87jvmJJ (/proc/meminfo) +[20]:/files/images/memory9jpg +[21]:https://www.linux.com/sites/lcom/files/styles/rendered_file/public/memory_9.jpg?itok=t-iSMEKq (/proc/meminfo) +[22]:https://training.linuxfoundation.org/linux-courses/system-administration-training/introduction-to-linux diff --git a/translated/tech/20180622 How to Check Disk Space on Linux from the Command line.md b/translated/tech/20180622 How to Check Disk Space on Linux from the Command line.md new file mode 100644 index 0000000000..a872fb15cd --- /dev/null +++ b/translated/tech/20180622 How to Check Disk Space on Linux from the Command line.md @@ -0,0 +1,138 @@ +如何使用命令行检查 Linux 上的磁盘空间 +======== + +>通过使用 `df` 命令和 `du` 命令查看 Linux 系统上挂载的驱动器的空间使用情况 + +![](https://camo.githubusercontent.com/9e87938753101d1aad089c55f3793b6f0ce8158f/68747470733a2f2f7777772e6c696e75782e636f6d2f73697465732f6c636f6d2f66696c65732f7374796c65732f72656e64657265645f66696c652f7075626c69632f6469736b73706163652d6d61696e2e6a70673f69746f6b3d74394f7878633958) + +----------------------------- + +*** 快速提问: ***你的驱动器剩余多少剩余空间?一点点还是很多?接下来的提问是:你知道如何找出这些剩余空间吗?如果你使用的是 GUI 桌面( 例如 GNOME,KDE,Mate,Pantheon 等 ),则任务可能非常简单。但是,当你要在一个没有 GUI 桌面的服务器上查询剩余空间,你该如何去做呢?你是否要为这个任务安装相应的软件工具?答案是绝对不是。在 Linux 中,具备查找驱动器上的剩余磁盘空间的所有工具。事实上,有两个非常容易使用的工具。 + +在本文中,我将演示这些工具。我将使用 Elementary OS( LCTT译注:Elementary OS 是基于 Ubuntu 精心打磨美化的桌面 Linux 发行版 ),它还包括一个 GUI 选项,但我们将限制自己仅使用命令行。好消息是这些命令行工具随时可用于每个 Linux 发行版。在我的测试系统中,连接了许多的驱动器( 内部的和外部的 )。使用的命令与连接驱动器的位置无关,仅仅与驱动器是否已经挂载好并且对操作系统可见。 + +话虽如此,让我们来试试这些工具。 + +### df + +`df` 命令是我第一次用于在 Linux 上查询驱动器空间的工具,时间可以追溯到20世纪90年代。它的使用和报告结果非常简单。直到今天,`df` 还是我执行此任务的首选命令。此命令有几个选项开关,对于基本的报告,你实际上只需要一个选项。该命令是 `df -H` 。`-H` 选项开关用于将df的报告结果以人类可读的格式进行显示。`df -H` 的输出包括:已经使用了的空间量,可用空间,空间使用的百分比,以及每个磁盘连接到系统的挂载点( 图 1 )。 + +![](https://camo.githubusercontent.com/3e52d8b2ba349ecc8517b32080f18ec8216ca63c/68747470733a2f2f7777772e6c696e75782e636f6d2f73697465732f6c636f6d2f66696c65732f7374796c65732f72656e64657265645f66696c652f7075626c69632f6469736b73706163655f312e6a70673f69746f6b3d614a6138415a414d) + +图 1:Elementary OS 系统上 `df -H` 命令的输出结果 + +如果你的驱动器列表非常长并且你只想查看单个驱动器上使用的空间,该怎么办?有了 `df`,就可以做到。我们来看一下位于 `/dev/sda1` 的主驱动器已经使用了多少空间。为此,执行如下命令: +``` + df -H /dev/sda1 +``` +输出将限于该驱动器( 图 2 )。 +![](https://camo.githubusercontent.com/4bb588e30a52dff9b588b14e489eb5ffaae98862/68747470733a2f2f7777772e6c696e75782e636f6d2f73697465732f6c636f6d2f66696c65732f7374796c65732f72656e64657265645f66696c652f7075626c69632f6469736b73706163655f322e6a70673f69746f6b3d5f504171336b7843) + +图 2:一个单独驱动器空间情况 + +你还可以限制 `df` 命令结果报告中显示指定的字段。可用的字段包括: + +- source — 文件系统的来源( LCTT译注:通常为一个设备,如 `/dev/sda1` ) +- size — 块总数 +- used — 驱动器已使用的空间 +- avail — 可以使用的剩余空间 +- pcent — 驱动器已经使用的空间占驱动器总空间的百分比 +- target —驱动器的挂载点 + +让我们显示所有驱动器的输出,仅显示 `size` ,`used` ,`avail` 字段。对此的命令是: +``` + df -H --output=size,used,avail +``` +该命令的输出非常简单( 图 3 )。 +![](https://camo.githubusercontent.com/57dc803d72d6927b31e02b16e9cf695fec6b3a13/68747470733a2f2f7777772e6c696e75782e636f6d2f73697465732f6c636f6d2f66696c65732f7374796c65732f72656e64657265645f66696c652f7075626c69632f6469736b73706163655f332e6a70673f69746f6b3d35316d38492d5675) + +图 3:显示我们驱动器的指定输出 + +这里唯一需要注意的是我们不知道输出的来源,因此,我们要把来源加入命令中: +``` + df -H --output=source,size,used,avail +``` +现在输出的信息更加全面有意义( 图 4 )。 +![](https://camo.githubusercontent.com/e30919f4cce4655d1eee89c635b83fcf7e73e44e/68747470733a2f2f7777772e6c696e75782e636f6d2f73697465732f6c636f6d2f66696c65732f7374796c65732f72656e64657265645f66696c652f7075626c69632f6469736b73706163655f342e6a70673f69746f6b3d5375776775654e33) + +图 4:我们现在知道了磁盘使用情况的来源 + + +### du + +我们的下一个命令是 `du` 。 正如您所料,这代表磁盘使用情况( disk usage )。 `du` 命令与 `df` 命令完全不同,因为它报告目录而不是驱动器的空间使用情况。 因此,您需要知道要检查的目录的名称。 假设我的计算机上有一个包含虚拟机文件的目录。 那个目录是 `/media/jack/HALEY/VIRTUALBOX` 。 如果我想知道该特定目录使用了多少空间,我将运行如下命令: +``` + du -h /media/jack/HALEY/VIRTUALBOX +``` +上面命令的输出将显示目录中每个文件占用的空间( 图 5 )。 +![](https://camo.githubusercontent.com/7f7cc19851dfe98abaa782431c924e5a3d2061f7/68747470733a2f2f7777772e6c696e75782e636f6d2f73697465732f6c636f6d2f66696c65732f7374796c65732f72656e64657265645f66696c652f7075626c69632f6469736b73706163655f352e6a70673f69746f6b3d5866533473375a71) + +图 5 在特定目录上运行 `du` 命令的输出 + +到目前为止,这个命令并没有那么有用。如果我们想知道特定目录的总使用量怎么办?幸运的是,`du` 可以处理这项任务。对于同一目录,命令将是: +``` + du -sh /media/jack/HALEY/VIRTUALBOX/ +``` +现在我们知道了上述目录使用存储空间的总和( 图 6 )。 +![](https://camo.githubusercontent.com/13cc1575d0612367b86ada9250cc03adb84272c7/68747470733a2f2f7777772e6c696e75782e636f6d2f73697465732f6c636f6d2f66696c65732f7374796c65732f72656e64657265645f66696c652f7075626c69632f6469736b73706163655f362e6a70673f69746f6b3d7237317149437947) + +图 6:我的虚拟机文件使用存储空间的总和是 559GB + +您还可以使用此命令查看父项的所有子目录使用了多少空间,如下所示: +``` + du -h /media/jack/HALEY +``` +此命令的输出见( 图 7 ),是一个用于查看各子目录占用的驱动器空间的好方法。 +![](https://camo.githubusercontent.com/a59213db964bdeb8680e1b91f03fb6e631a58d8f/68747470733a2f2f7777772e6c696e75782e636f6d2f73697465732f6c636f6d2f66696c65732f7374796c65732f72656e64657265645f66696c652f7075626c69632f6469736b73706163655f372e6a70673f69746f6b3d5074446534713579) + +图 7:子目录的存储空间使用情况 + +`du` 命令也是一个很好的工具,用于查看使用系统磁盘空间最多的目录列表。执行此任务的方法是将 `du` 命令的输出通过管道传递给另外两个命令:`sort` 和 `head` 。下面的命令用于找出驱动器上占用存储空间最大的前10各目录: +``` + du -a /media/jack | sort -n -r |head -n 10 +``` +输出将以从大到小的顺序列出这些目录( 图 8 )。 +![](https://camo.githubusercontent.com/4ddae52f2bd56f9a9c161e82f095e0671133855e/68747470733a2f2f7777772e6c696e75782e636f6d2f73697465732f6c636f6d2f66696c65732f7374796c65732f72656e64657265645f66696c652f7075626c69632f6469736b73706163655f382e6a70673f69746f6b3d7639453153466343) + +图 8:使用驱动器空间最多的 10 个目录 + +### 没有你想像的那么难 + +查看 Linux 系统上挂载的驱动器的空间使用情况非常简单。只要你将你的驱动器挂载在 Linux 系统上,使用 `df` 命令或 `du` 命令在报告必要信息方面都会非常出色。使用 `df` 命令,您可以快速查看磁盘上总的空间使用量,使用 `du` 命令,可以查看特定目录的空间使用情况。对于每一个 Linux 系统的管理员来说,这两个命令的结合使用是必须掌握的。 + +而且,如果你不需要使用 `du` 或 `df` 命令查看驱动器空间的使用情况,我最近介绍了查看 Linux 上内存使用情况的方法。总之,这些技巧将大力帮助你成功管理 Linux 服务器。 + +通过 Linux Foundation 和 edX 免费提供的 “ Linux 简介 ” 课程,了解更多有关 Linux 的信息。 + +-------- + +via: https://www.linux.com/learn/intro-to-linux/2018/6how-check-disk-space-linux-command-line + +作者:Jack Wallen 选题:lujun9972 译者:SunWave 校对:校对者ID + +本文由 LCTT 原创编译,Linux中国 荣誉推出 + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/translated/tech/20180720 3 Methods to List All The Users in Linux System.md b/translated/tech/20180720 3 Methods to List All The Users in Linux System.md new file mode 100644 index 0000000000..b6974bfbd7 --- /dev/null +++ b/translated/tech/20180720 3 Methods to List All The Users in Linux System.md @@ -0,0 +1,234 @@ +列出 Linux 系统上所有用户的 3 种方法 +======= + +> 通过使用 `/etc/passwd` 文件,`getent` 命令,`compgen` 命令这三种方法查看系统中用户的信息 + +---------------- +大家都知道,Linux 系统中用户信息存放在 `/etc/passwd` 文件中。 + +这是一个包含每个用户基本信息的文本文件。 + +当我们在系统中创建一个用户,新用户的详细信息就会被添加到这个文件中。 + +`/etc/passwd` 文件将每个用户的基本信息记录为文件中的一行,一行中包含7个字段。 + +`/etc/passwd` 文件的一行代表一个单独的用户。该文件将用户的信息分为 3 个部分。 + + * 第 1 部分:`root` 用户信息 + * 第 2 部分:系统定义的账号信息 + * 第 3 部分:真实用户的账户信息 + +** 建议阅读 : ** +**( # )** [ 如何在 Linux 上查看创建用户的日期 ][1] +**( # )** [ 如何在 Linux 上查看 A 用户所属的群组 ][2] +**( # )** [ 如何强制用户在下一次登录 Linux 系统时修改密码 ][3] + +第一部分是 `root` 账户,这代表管理员账户,对系统的每个方面都有完全的权力。 + +第二部分是系统定义的群组和账户,这些群组和账号是正确安装和更新系统软件所必需的。 + +第三部分在最后,代表一个使用系统的真实用户。 + +在创建新用户时,将修改以下 4 个文件。 + + * `/etc/passwd:` 用户账户的详细信息在此文件中更新。 + * `/etc/shadow:` 用户账户密码在此文件中更新。 + * `/etc/group:` 新用户群组的详细信息在此文件中更新。 + * `/etc/gshadow:` 新用户群组密码在此文件中更新。 + +### 方法 1 :使用 `/etc/passwd` 文件 + +使用任何一个像 `cat`,`more`,`less` 等文件操作命令来打印 Linux 系统上创建的用户列表。 + +`/etc/passwd` 是一个文本文件,其中包含了登录 Linux 系统所必需的每个用户的信息。它保存用户的有用信息,如用户名,密码,用户 ID,群组 ID,用户 ID 信息,用户的家目录和 Shell 。 + +`/etc/passwd` 文件将每个用户的详细信息写为一行,其中包含七个字段,每个字段之间用冒号 “ :” 分隔: + +``` +# cat /etc/passwd +root:x:0:0:root:/root:/bin/bash +bin:x:1:1:bin:/bin:/sbin/nologin +daemon:x:2:2:daemon:/sbin:/sbin/nologin +adm:x:3:4:adm:/var/adm:/sbin/nologin +lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin +sync:x:5:0:sync:/sbin:/bin/sync +shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown +halt:x:7:0:halt:/sbin:/sbin/halt +mail:x:8:12:mail:/var/spool/mail:/sbin/nologin +ftp:x:14:50:FTP User:/var/ftp:/sbin/nologin +postfix:x:89:89::/var/spool/postfix:/sbin/nologin +sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin +tcpdump:x:72:72::/:/sbin/nologin +2gadmin:x:500:10::/home/viadmin:/bin/bash +apache:x:48:48:Apache:/var/www:/sbin/nologin +zabbix:x:498:499:Zabbix Monitoring System:/var/lib/zabbix:/sbin/nologin +mysql:x:497:502::/home/mysql:/bin/bash +zend:x:502:503::/u01/zend/zend/gui/lighttpd:/sbin/nologin +rpc:x:32:32:Rpcbind Daemon:/var/cache/rpcbind:/sbin/nologin +2daygeek:x:503:504::/home/2daygeek:/bin/bash +named:x:25:25:Named:/var/named:/sbin/nologin +mageshm:x:506:507:2g Admin - Magesh M:/home/mageshm:/bin/bash + +``` +7 个字段的详细信息如下。 + +* **`Username ( magesh ):`** 已创建用户的用户名,字符长度 1 个到 12 个字符。 +* **`Password ( x ):`** 代表加密密码保存在 `/etc/shadow 文件中。 +* **`User ID ( UID-506 ):`** 代表用户 ID ,每个用户都要有一个唯一的 ID 。UID 号为 0 的是为 `root` 用户保留的,UID 号 1 到 99 是为系统用户保留的,UID 号100-999 是为系统账户和群组保留的。 +* **`Group ID ( GID-507 ):`** 代表组 ID ,每个群组都要有一个唯一的 GID ,保存在 `/etc/group` 文件中。 +* **`User ID Info ( 2g Admin - Magesh M):`** 代表命名字段,可以用来描述用户的信息。 +* **`Home Directory ( /home/mageshm ):`** 代表用户的家目录。 +* **`shell ( /bin/bash ):`** 代表用户使用的 shell种类。 + +你可以使用 **`awk`** 或 **`cut`** 命令仅打印出 Linux 系统中所有用户的用户名列表。显示的结果是相同的。 + +``` +# awk -F':' '{ print $1}' /etc/passwd +or +# cut -d: -f1 /etc/passwd +root +bin +daemon +adm +lp +sync +shutdown +halt +mail +ftp +postfix +sshd +tcpdump +2gadmin +apache +zabbix +mysql +zend +rpc +2daygeek +named +mageshm + +``` +### 方法 2 :使用 `getent` 命令 + +`getent` 命令显示 `Name Service Switch` 库支持的数据库中的条目。这些库的配置文件为 `/etc/nsswitch.conf`。 + +`getent` 命令显示类似于 `/etc/passwd` 文件的用户详细信息,它将每个用户详细信息显示为包含七个字段的单行。 + +``` +# getent passwd +root:x:0:0:root:/root:/bin/bash +bin:x:1:1:bin:/bin:/sbin/nologin +daemon:x:2:2:daemon:/sbin:/sbin/nologin +adm:x:3:4:adm:/var/adm:/sbin/nologin +lp:x:4:7:lp:/var/spool/lpd:/sbin/nologin +sync:x:5:0:sync:/sbin:/bin/sync +shutdown:x:6:0:shutdown:/sbin:/sbin/shutdown +halt:x:7:0:halt:/sbin:/sbin/halt +mail:x:8:12:mail:/var/spool/mail:/sbin/nologin +ftp:x:14:50:FTP User:/var/ftp:/sbin/nologin +postfix:x:89:89::/var/spool/postfix:/sbin/nologin +sshd:x:74:74:Privilege-separated SSH:/var/empty/sshd:/sbin/nologin +tcpdump:x:72:72::/:/sbin/nologin +2gadmin:x:500:10::/home/viadmin:/bin/bash +apache:x:48:48:Apache:/var/www:/sbin/nologin +zabbix:x:498:499:Zabbix Monitoring System:/var/lib/zabbix:/sbin/nologin +mysql:x:497:502::/home/mysql:/bin/bash +zend:x:502:503::/u01/zend/zend/gui/lighttpd:/sbin/nologin +rpc:x:32:32:Rpcbind Daemon:/var/cache/rpcbind:/sbin/nologin +2daygeek:x:503:504::/home/2daygeek:/bin/bash +named:x:25:25:Named:/var/named:/sbin/nologin +mageshm:x:506:507:2g Admin - Magesh M:/home/mageshm:/bin/bash + +``` + +7 个字段的详细信息如下。 + +* **`Username ( magesh ):`** 已创建用户的用户名,字符长度 1 个到 12 个字符。 +* **`Password ( x ):` 代表加密密码保存在 `/etc/shadow 文件中。 +* **`User ID ( UID-506 ):`** 代表用户 ID ,每个用户都要有一个唯一的 ID 。UID 号为 0 的是为 `root` 用户保留的,UID 号 1 到 99 是为系统用户保留的,UID 号100-999 是为系统账户和群组保留的。 +* **`Group ID ( GID-507 ):`** 代表组 ID ,每个群组都要有一个唯一的 GID ,保存在 `/etc/group` 文件中。 +* **`User ID Info ( 2g Admin - Magesh M):`** 代表命名字段,可以用来描述用户的信息。 +* **`Home Directory ( /home/mageshm ):`** 代表用户的家目录。 +* **`shell ( /bin/bash ):`** 代表用户使用的 shell种类。 + +你可以使用 **`awk`** 或 **`cut`** 命令仅打印出 Linux 系统中所有用户的用户名列表。显示的结果是相同的。 + +``` +# getent passwd | awk -F':' '{ print $1}' +or +# getent passwd | cut -d: -f1 +root +bin +daemon +adm +lp +sync +shutdown +halt +mail +ftp +postfix +sshd +tcpdump +2gadmin +apache +zabbix +mysql +zend +rpc +2daygeek +named +mageshm + +``` + +### 方法 3 :使用 `compgen` 命令 + +`compgen` 是 `bash` 的内置命令,它将显示所有可用的命令,别名和函数。 + +``` +# compgen -u +root +bin +daemon +adm +lp +sync +shutdown +halt +mail +ftp +postfix +sshd +tcpdump +2gadmin +apache +zabbix +mysql +zend +rpc +2daygeek +named +mageshm + +``` + +------------------------ + +via: https://www.2daygeek.com/3-methods-to-list-all-the-users-in-linux-system/ + +作者:[Magesh Maruthamuthu][a] +选题:[lujun9972](https://github.com/lujun9972) +译者:[SunWave](https://github.com/SunWave) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://www.2daygeek.com/author/magesh/ +[1]:https://www.2daygeek.com/how-to-check-user-created-date-on-linux/ +[2]:https://www.2daygeek.com/how-to-check-which-groups-a-user-belongs-to-on-linux/ +[3]:https://www.2daygeek.com/how-to-force-user-to-change-password-on-next-login-in-linux/ + + diff --git a/translated/tech/20180720 Convert video using Handbrake.md b/translated/tech/20180720 Convert video using Handbrake.md new file mode 100644 index 0000000000..422226261a --- /dev/null +++ b/translated/tech/20180720 Convert video using Handbrake.md @@ -0,0 +1,56 @@ +使用 Handbrake 转换视频 +====== + +![](https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/OpenVideo.png?itok=jec9ibU5) + +最近,当我的儿子让我数字化他的高中篮球比赛的一些旧 DVD 时,我立刻知道我会使用 [Handbrake][1]。它是一个开源软件包,可轻松将视频转换为可在 MacOS、Windows、Linux、iOS、Android 和其他平台上播放的格式所需的所有工具。 + +Handbrake 是开源的,并在[ GPLv2 许可证][2]下分发。它很容易在 MacOS、Windows 和 Linux 包括 [Fedora][3] 和 [Ubuntu][4] 上安装。在 Linux 中,安装后就可以从命令行使用 `$ handbrake` 或从图形用户界面中选择它。(在我的例子中,是 GNOME 3) + + +![](https://opensource.com/sites/default/files/uploads/handbrake_1.png) + +Handbrake 的菜单系统易于使用。单击 **Open Source** 选择要转换的视频源。对于我儿子的篮球视频,它是我的 Linux 笔记本中的 DVD 驱动器。将 DVD 插入驱动器后,软件会识别磁盘的内容。 +![](https://opensource.com/sites/default/files/uploads/handbrake_2.png) + +正如你在上面截图中的 Source 旁边看到的那样,Handbrake 将其识别为 720x480 的 DVD,宽高比为 4:3,以每秒 29.97 帧的速度录制,有一个音轨。该软件还能预览视频。 + +如果默认转换设置可以接受,只需按下 **Start Encoding** 按钮(一段时间后,根据处理器的速度),DVD 的内容将被转换并以默认格式 [M4V][5] 保存(可以改变)。 + +如果你不喜欢文件名,很容易改变它。 + +![](https://opensource.com/sites/default/files/uploads/handbrake_3.png) + +Handbrake 有各种格式、大小和配置的输出选项。例如,它可以生成针对 YouTube、Vimeo 和其他网站以及 iPod、iPad、Apple TV、Amazon Fire TV、Roku、PlayStation 等设备优化的视频。 + +![](https://opensource.com/sites/default/files/uploads/handbrake_4.png) + +你可以在 ”Dimensions“ 选项卡中更改视频输出大小。其他选项卡允许你应用过滤器、更改视频质量和编码、添加或修改音轨,包括字幕和修改章节。“Tags” 选项卡可让你识别输出视频文件中的作者、演员、导演、发布日期等。 + +![](https://opensource.com/sites/default/files/uploads/handbrake_5.png) + +如果使用 Handbrake 为特定平台输出,可以使用包含的预设。 + +![](https://opensource.com/sites/default/files/uploads/handbrake_6.png) + +你还可以使用菜单选项创建自己的格式,具体取决于你需要的功能。 + +Handbrake 是一款非常强大的软件,但它并不是唯一的开源视频转换工具。你有其他喜欢的吗?如果有,请分享评论。 + +-------------------------------------------------------------------------------- + +via: https://opensource.com/article/18/7/handbrake + +作者:[Don Watkins][a] +选题:[lujun9972](https://github.com/lujun9972) +译者:[geekpi](https://github.com/geekpi) +校对:[校对者ID](https://github.com/校对者ID) + +本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出 + +[a]:https://opensource.com/users/don-watkins +[1]:https://handbrake.fr/ +[2]:https://github.com/HandBrake/HandBrake/blob/master/LICENSE +[3]:https://fedora.pkgs.org/28/rpmfusion-free-x86_64/HandBrake-1.1.0-1.fc28.x86_64.rpm.html +[4]:https://launchpad.net/~stebbins/+archive/ubuntu/handbrake-releases +[5]:https://en.wikipedia.org/wiki/M4V