Merge pull request #63 from LCTT/master

update
This commit is contained in:
MjSeven 2018-07-31 21:44:04 +08:00 committed by GitHub
commit 171d62a905
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 445 additions and 493 deletions

View File

@ -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/) 荣誉推出

View File

@ -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 youre 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, Ill demonstrate these tools. Ill be using [Elementary OS][1], which also includes a GUI option, but were 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, lets 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. Its 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. Lets 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
Lets 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 dont know the source of the output, so wed 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, youll want to know the names of directories to be checked. Lets 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, Id 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 isnt 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

View File

@ -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.
Its 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 users 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 users 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 users 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/

View File

@ -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

View File

@ -1,3 +1,5 @@
translating---geekpi
4 cool apps for your terminal
======

View File

@ -0,0 +1,138 @@
如何使用命令行检查 Linux 上的磁盘空间
========
>通过使用 `df` 命令和 `du` 命令查看 Linux 系统上挂载的驱动器的空间使用情况
![](https://camo.githubusercontent.com/9e87938753101d1aad089c55f3793b6f0ce8158f/68747470733a2f2f7777772e6c696e75782e636f6d2f73697465732f6c636f6d2f66696c65732f7374796c65732f72656e64657265645f66696c652f7075626c69632f6469736b73706163652d6d61696e2e6a70673f69746f6b3d74394f7878633958)
-----------------------------
*** 快速提问: ***你的驱动器剩余多少剩余空间?一点点还是很多?接下来的提问是:你知道如何找出这些剩余空间吗?如果你使用的是 GUI 桌面( 例如 GNOMEKDEMatePantheon 等 ),则任务可能非常简单。但是,当你要在一个没有 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)
图 1Elementary 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中国 荣誉推出

View File

@ -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/

View File

@ -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