mirror of
https://github.com/LCTT/TranslateProject.git
synced 2025-03-12 01:40:10 +08:00
Merge remote-tracking branch 'LCTT/master'
This commit is contained in:
commit
3e995a8f2b
@ -1,8 +1,8 @@
|
|||||||
[#]: collector: (lujun9972)
|
[#]: collector: (lujun9972)
|
||||||
[#]: translator: (lnrCoder)
|
[#]: translator: (lnrCoder)
|
||||||
[#]: reviewer: ( )
|
[#]: reviewer: (wxy)
|
||||||
[#]: publisher: ( )
|
[#]: publisher: (wxy)
|
||||||
[#]: url: ( )
|
[#]: url: (https://linux.cn/article-11480-1.html)
|
||||||
[#]: subject: (How to Install and Configure PostgreSQL on Ubuntu)
|
[#]: subject: (How to Install and Configure PostgreSQL on Ubuntu)
|
||||||
[#]: via: (https://itsfoss.com/install-postgresql-ubuntu/)
|
[#]: via: (https://itsfoss.com/install-postgresql-ubuntu/)
|
||||||
[#]: author: (Sergiu https://itsfoss.com/author/sergiu/)
|
[#]: author: (Sergiu https://itsfoss.com/author/sergiu/)
|
||||||
@ -10,19 +10,19 @@
|
|||||||
如何在 Ubuntu 上安装和配置 PostgreSQL
|
如何在 Ubuntu 上安装和配置 PostgreSQL
|
||||||
======
|
======
|
||||||
|
|
||||||
_**本教程中,你将学习如何在 Ubuntu Linux 上安装和使用开源数据库 PostgreSQL。**_
|
> 本教程中,你将学习如何在 Ubuntu Linux 上安装和使用开源数据库 PostgreSQL。
|
||||||
|
|
||||||
[PostgreSQL][1] (又名 Postgres) 是一个功能强大的,免费的开源关系型数据库管理系统 ([RDBMS][2]) 其 在可靠性、稳定性、性能方面获得了业内极高的声誉 。它旨在处理各种规模的任务。它是跨平台的,而且是 [macOS Server][3] 的默认数据库。
|
[PostgreSQL][1] (又名 Postgres) 是一个功能强大的自由开源的关系型数据库管理系统 ([RDBMS][2]) ,其在可靠性、稳定性、性能方面获得了业内极高的声誉。它旨在处理各种规模的任务。它是跨平台的,而且是 [macOS Server][3] 的默认数据库。
|
||||||
|
|
||||||
如果你喜欢简单易用的 SQL 数据库管理器,那么 PostgreSQL 将是一个正确的选择。PostgreSQL 对标准的 SQL 兼容的同时提供了额外的附加特性,同时还可以被用户大量扩展,用户可以添加数据类型、函数并执行更多的操作。
|
如果你喜欢简单易用的 SQL 数据库管理器,那么 PostgreSQL 将是一个正确的选择。PostgreSQL 对标准的 SQL 兼容的同时提供了额外的附加特性,同时还可以被用户大量扩展,用户可以添加数据类型、函数并执行更多的操作。
|
||||||
|
|
||||||
之前我曾论述过 [在 Ubuntu 上安装 MySQL][4]。在本文中,我将向你展示如何安装和配置 PostgreSQL,以便你随时可以使用它来满足你的任何需求。
|
之前我曾论述过 [在 Ubuntu 上安装 MySQL][4]。在本文中,我将向你展示如何安装和配置 PostgreSQL,以便你随时可以使用它来满足你的任何需求。
|
||||||
|
|
||||||
![][5]
|
![][5]
|
||||||
|
|
||||||
### 在 Ubuntu 上安装 PostgreSQL
|
### 在 Ubuntu 上安装 PostgreSQL
|
||||||
|
|
||||||
PostgreSQL 可以从 Ubuntu 主存储库中获取。然而,和许多其他开发工具一样,它可能不是最新版本。
|
PostgreSQL 可以从 Ubuntu 主存储库中获取。然而,和许多其它开发工具一样,它可能不是最新版本。
|
||||||
|
|
||||||
首先在终端中使用 [apt 命令][7] 检查 [Ubuntu 存储库][6] 中可用的 PostgreSQL 版本:
|
首先在终端中使用 [apt 命令][7] 检查 [Ubuntu 存储库][6] 中可用的 PostgreSQL 版本:
|
||||||
|
|
||||||
@ -30,7 +30,7 @@ PostgreSQL 可以从 Ubuntu 主存储库中获取。然而,和许多其他开
|
|||||||
apt show postgresql
|
apt show postgresql
|
||||||
```
|
```
|
||||||
|
|
||||||
在我的 Ubuntu 18.04 中,它显示 PostgreSQL 的可用版本是 10 (10+190 表示版本 10) 而 PostgreSQL 版本 11 已经发布。
|
在我的 Ubuntu 18.04 中,它显示 PostgreSQL 的可用版本是 10(10+190 表示版本 10)而 PostgreSQL 版本 11 已经发布。
|
||||||
|
|
||||||
```
|
```
|
||||||
Package: postgresql
|
Package: postgresql
|
||||||
@ -47,24 +47,22 @@ Origin: Ubuntu
|
|||||||
|
|
||||||
#### 方法一:通过 Ubuntu 存储库安装 PostgreSQL
|
#### 方法一:通过 Ubuntu 存储库安装 PostgreSQL
|
||||||
|
|
||||||
在终端中,使用以下命令安装 PostgreSQL
|
在终端中,使用以下命令安装 PostgreSQL:
|
||||||
|
|
||||||
```
|
```
|
||||||
sudo apt update
|
sudo apt update
|
||||||
sudo apt install postgresql postgresql-contrib
|
sudo apt install postgresql postgresql-contrib
|
||||||
```
|
```
|
||||||
|
|
||||||
根据提示输入你的密码,依据于你的网速情况,程序将在几秒到几分钟安装完成。 说到这一点 ,随时检查 [Ubuntu 中的各种网络带宽][8]。
|
根据提示输入你的密码,依据于你的网速情况,程序将在几秒到几分钟安装完成。说到这一点,随时检查 [Ubuntu 中的各种网络带宽][8]。
|
||||||
|
|
||||||
什么是 postgresql-contrib?
|
> 什么是 postgresql-contrib?
|
||||||
|
|
||||||
postgresql-contrib 或者说 contrib 包,包含一些不属于 PostgreSQL 核心包的实用工具和功能。在大多数情况下,最好将 contrib 包与 PostgreSQL 核心一起安装。
|
> postgresql-contrib 或者说 contrib 包,包含一些不属于 PostgreSQL 核心包的实用工具和功能。在大多数情况下,最好将 contrib 包与 PostgreSQL 核心一起安装。
|
||||||
|
|
||||||
推荐阅读 [解决 gvfsd-smb-browser 在 Ubuntu 16.04 中占用 100% CPU][9]
|
|
||||||
|
|
||||||
#### 方法二:在 Ubuntu 中安装最新版本的 PostgreSQL 11
|
#### 方法二:在 Ubuntu 中安装最新版本的 PostgreSQL 11
|
||||||
|
|
||||||
要安装 PostgreSQL 11, 你需要在 sources.list 中添加官方 PostgreSQL 存储库和证书,然后从那里安装它。
|
要安装 PostgreSQL 11, 你需要在 `sources.list` 中添加官方 PostgreSQL 存储库和证书,然后从那里安装它。
|
||||||
|
|
||||||
不用担心,这并不复杂。 只需按照以下步骤。
|
不用担心,这并不复杂。 只需按照以下步骤。
|
||||||
|
|
||||||
@ -74,7 +72,7 @@ postgresql-contrib 或者说 contrib 包,包含一些不属于 PostgreSQL 核
|
|||||||
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
|
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | sudo apt-key add -
|
||||||
```
|
```
|
||||||
|
|
||||||
现在,使用以下命令添加存储库。如果你使用的是 Linux Mint,则必须手动替换你的 Mint 所基于的 Ubuntu 版本号
|
现在,使用以下命令添加存储库。如果你使用的是 Linux Mint,则必须手动替换你的 Mint 所基于的 Ubuntu 版本号:
|
||||||
|
|
||||||
```
|
```
|
||||||
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'
|
sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt/ `lsb_release -cs`-pgdg main" >> /etc/apt/sources.list.d/pgdg.list'
|
||||||
@ -87,47 +85,47 @@ sudo apt update
|
|||||||
sudo apt install postgresql postgresql-contrib
|
sudo apt install postgresql postgresql-contrib
|
||||||
```
|
```
|
||||||
|
|
||||||
PostgreSQL GUI 应用程序
|
> PostgreSQL GUI 应用程序
|
||||||
|
|
||||||
你也可以安装用于管理 PostgreSQL 数据库的 GUI 应用程序 (pgAdmin):
|
> 你也可以安装用于管理 PostgreSQL 数据库的 GUI 应用程序(pgAdmin):
|
||||||
|
|
||||||
_sudo apt install pgadmin4_
|
> `sudo apt install pgadmin4`
|
||||||
|
|
||||||
### PostgreSQL 配置
|
### PostgreSQL 配置
|
||||||
|
|
||||||
你可以通过执行以下命令来检查 **PostgreSQL** 是否正在运行:
|
你可以通过执行以下命令来检查 PostgreSQL 是否正在运行:
|
||||||
|
|
||||||
```
|
```
|
||||||
service postgresql status
|
service postgresql status
|
||||||
```
|
```
|
||||||
|
|
||||||
通过 **service** 命令,你可以 **启动**, **关闭** 或 **重启** **postgresql**。输入 **service postgresql** 并按 **回车** 将列出所有选项。现在,登录用户。
|
通过 `service` 命令,你可以启动、关闭或重启 `postgresql`。输入 `service postgresql` 并按回车将列出所有选项。现在,登录该用户。
|
||||||
|
|
||||||
默认情况下,PostgreSQL 会创建一个拥有所权限的特殊用户 postgres 。要实际使用 PostgreSQL,你必须先登录该账户:
|
默认情况下,PostgreSQL 会创建一个拥有所权限的特殊用户 `postgres`。要实际使用 PostgreSQL,你必须先登录该账户:
|
||||||
|
|
||||||
```
|
```
|
||||||
sudo su postgres
|
sudo su postgres
|
||||||
```
|
```
|
||||||
|
|
||||||
你的提示应更改为类似于以下的内容:
|
你的提示符会更改为类似于以下的内容:
|
||||||
|
|
||||||
```
|
```
|
||||||
postgres@ubuntu-VirtualBox:/home/ubuntu$
|
postgres@ubuntu-VirtualBox:/home/ubuntu$
|
||||||
```
|
```
|
||||||
|
|
||||||
现在,使用 **psql** 来启动 **PostgreSQL Shell** :
|
现在,使用 `psql` 来启动 PostgreSQL Shell:
|
||||||
|
|
||||||
```
|
```
|
||||||
psql
|
psql
|
||||||
```
|
```
|
||||||
|
|
||||||
你应该会收到如下提示:
|
你应该会看到如下提示符:
|
||||||
|
|
||||||
```
|
```
|
||||||
postgress=#
|
postgress=#
|
||||||
```
|
```
|
||||||
|
|
||||||
你可以输入 **\q** 以**退出**,输入 **\?** 获取**帮助**。
|
你可以输入 `\q` 以退出,输入 `\?` 获取帮助。
|
||||||
|
|
||||||
要查看现有的所有表,输入如下命令:
|
要查看现有的所有表,输入如下命令:
|
||||||
|
|
||||||
@ -135,59 +133,59 @@ postgress=#
|
|||||||
\l
|
\l
|
||||||
```
|
```
|
||||||
|
|
||||||
输出内容类似于下图所示 (单击 **q** 键退出该视图):
|
输出内容类似于下图所示(单击 `q` 键退出该视图):
|
||||||
|
|
||||||
![PostgreSQL Tables][10]
|
![PostgreSQL Tables][10]
|
||||||
|
|
||||||
使用 **\du** 命令,你可以查看 **PostgreSQL 用户**:
|
使用 `\du` 命令,你可以查看 PostgreSQL 用户:
|
||||||
|
|
||||||
![PostgreSQLUsers][11]
|
![PostgreSQLUsers][11]
|
||||||
|
|
||||||
你可以使用以下命令更改任何用户(包括 postgres)的密码:
|
你可以使用以下命令更改任何用户(包括 `postgres`)的密码:
|
||||||
|
|
||||||
```
|
```
|
||||||
ALTER USER postgres WITH PASSWORD 'my_password';
|
ALTER USER postgres WITH PASSWORD 'my_password';
|
||||||
```
|
```
|
||||||
|
|
||||||
**注意:** _将 **postgres** 替换为用户名 **my_password** 替换为所需要的密码。_ 另外,不要忘记每条命令后面的 **;** (分号)。
|
**注意:**将 `postgres` 替换为你要更改的用户名,`my_password` 替换为所需要的密码。另外,不要忘记每条命令后面的 `;`(分号)。
|
||||||
|
|
||||||
建议你另外创建一个用户(不建议使用默认的 **postgres** 用户)。为此,请使用一下命令:
|
建议你另外创建一个用户(不建议使用默认的 `postgres` 用户)。为此,请使用以下命令:
|
||||||
|
|
||||||
```
|
```
|
||||||
CREATE USER my_user WITH PASSWORD 'my_password';
|
CREATE USER my_user WITH PASSWORD 'my_password';
|
||||||
```
|
```
|
||||||
|
|
||||||
运行 **\du**,你将看到该用户,但是,**my_user** 用户没有任何的属性。来让我们将它添加到**超级用户**:
|
运行 `\du`,你将看到该用户,但是,`my_user` 用户没有任何的属性。来让我们给它添加超级用户权限:
|
||||||
|
|
||||||
```
|
```
|
||||||
ALTER USER my_user WITH SUPERUSER;
|
ALTER USER my_user WITH SUPERUSER;
|
||||||
```
|
```
|
||||||
|
|
||||||
你可以使用以下命令 **删除用户** :
|
你可以使用以下命令删除用户:
|
||||||
|
|
||||||
```
|
```
|
||||||
DROP USER my_user;
|
DROP USER my_user;
|
||||||
```
|
```
|
||||||
|
|
||||||
要使用其他用户登录,使用 **\q** 命令退出,然后使用以下命令登录:
|
要使用其他用户登录,使用 `\q` 命令退出,然后使用以下命令登录:
|
||||||
|
|
||||||
```
|
```
|
||||||
psql -U my_user
|
psql -U my_user
|
||||||
```
|
```
|
||||||
|
|
||||||
你可以使用 **-d** 参数直接连接数据库:
|
你可以使用 `-d` 参数直接连接数据库:
|
||||||
|
|
||||||
```
|
```
|
||||||
psql -U my_user -d my_db
|
psql -U my_user -d my_db
|
||||||
```
|
```
|
||||||
|
|
||||||
你可以使用其他已存在的用户调用 PostgreSQL。例如,我使用 **ubuntu**。要登录,从终端执行以下命名:
|
你可以使用其他已存在的用户调用 PostgreSQL。例如,我使用 `ubuntu`。要登录,从终端执行以下命名:
|
||||||
|
|
||||||
```
|
```
|
||||||
psql -U ubuntu -d postgres
|
psql -U ubuntu -d postgres
|
||||||
```
|
```
|
||||||
|
|
||||||
**注意:** _你必须指定一个数据库(默认情况下,它将尝试将你连接到与登录的用户名相同的数据库)。_
|
**注意:**你必须指定一个数据库(默认情况下,它将尝试将你连接到与登录的用户名相同的数据库)。
|
||||||
|
|
||||||
如果遇到如下错误:
|
如果遇到如下错误:
|
||||||
|
|
||||||
@ -195,13 +193,13 @@ psql -U ubuntu -d postgres
|
|||||||
psql: FATAL: Peer authentication failed for user "my_user"
|
psql: FATAL: Peer authentication failed for user "my_user"
|
||||||
```
|
```
|
||||||
|
|
||||||
确保以正确的用户身份登录,并使用管理员权限编辑 **/etc/postgresql/11/main/pg_hba.conf**
|
确保以正确的用户身份登录,并使用管理员权限编辑 `/etc/postgresql/11/main/pg_hba.conf`:
|
||||||
|
|
||||||
```
|
```
|
||||||
sudo vim /etc/postgresql/11/main/pg_hba.conf
|
sudo vim /etc/postgresql/11/main/pg_hba.conf
|
||||||
```
|
```
|
||||||
|
|
||||||
**注意:** _用你的版本替换 **11** (例如 **10**)._
|
**注意:**用你的版本替换 `11`(例如 `10`)。
|
||||||
|
|
||||||
对如下所示的一行进行替换:
|
对如下所示的一行进行替换:
|
||||||
|
|
||||||
@ -215,23 +213,19 @@ local all postgres peer
|
|||||||
local all postgres md5
|
local all postgres md5
|
||||||
```
|
```
|
||||||
|
|
||||||
然后重启 **PostgreSQL**:
|
然后重启 PostgreSQL:
|
||||||
|
|
||||||
```
|
```
|
||||||
sudo service postgresql restart
|
sudo service postgresql restart
|
||||||
```
|
```
|
||||||
|
|
||||||
使用 **PostgreSQL** 与使用其他 **SQL** 类型的数据库相同。由于本文旨在帮助你进行初步的设置,因此不涉及具体的命令。不过,这里有个 [非常有用的要点][12] 可供参考! 另外, 手册 (**man psql**) 和 [文档][13] 也非常有用。
|
使用 PostgreSQL 与使用其他 SQL 类型的数据库相同。由于本文旨在帮助你进行初步的设置,因此不涉及具体的命令。不过,这里有个 [非常有用的要点][12] 可供参考! 另外, 手册(`man psql`)和 [文档][13] 也非常有用。
|
||||||
|
|
||||||
建议阅读 [如何][14] 在 Ubuntu 中与 Dropbox 共享和同步任何文件夹。
|
### 总结
|
||||||
|
|
||||||
**总结**
|
阅读本文有望指导你完成在 Ubuntu 系统上安装和准备 PostgreSQL 的过程。如果你不熟悉 SQL,你应该阅读 [基本的 SQL 命令][15]。
|
||||||
|
|
||||||
阅读本文有望指导你完成在 Ubuntu 系统上安装和准备 PostgreSQL 的过程。如果你不熟悉 SQL,你应该阅读 [基本的 SQL 命令][15]
|
如果你有任何问题或疑惑,请随时在评论部分提出。
|
||||||
|
|
||||||
[基本的 SQL 命令][15]
|
|
||||||
|
|
||||||
如果您有任何问题或疑惑,请随时在评论部分提出。
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
@ -240,7 +234,7 @@ via: https://itsfoss.com/install-postgresql-ubuntu/
|
|||||||
作者:[Sergiu][a]
|
作者:[Sergiu][a]
|
||||||
选题:[lujun9972][b]
|
选题:[lujun9972][b]
|
||||||
译者:[lnrCoder](https://github.com/lnrCoder)
|
译者:[lnrCoder](https://github.com/lnrCoder)
|
||||||
校对:[校对者ID](https://github.com/校对者ID)
|
校对:[wxy](https://github.com/wxy)
|
||||||
|
|
||||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
@ -1,8 +1,8 @@
|
|||||||
[#]: collector: (lujun9972)
|
[#]: collector: (lujun9972)
|
||||||
[#]: translator: (geekpi)
|
[#]: translator: (geekpi)
|
||||||
[#]: reviewer: ( )
|
[#]: reviewer: (wxy)
|
||||||
[#]: publisher: ( )
|
[#]: publisher: (wxy)
|
||||||
[#]: url: ( )
|
[#]: url: (https://linux.cn/article-11481-1.html)
|
||||||
[#]: subject: (Top 10 open source video players for Linux)
|
[#]: subject: (Top 10 open source video players for Linux)
|
||||||
[#]: via: (https://opensourceforu.com/2019/10/top-10-open-source-video-players-for-linux/)
|
[#]: via: (https://opensourceforu.com/2019/10/top-10-open-source-video-players-for-linux/)
|
||||||
[#]: author: (Stella Aldridge https://opensourceforu.com/author/stella-aldridge/)
|
[#]: author: (Stella Aldridge https://opensourceforu.com/author/stella-aldridge/)
|
||||||
@ -10,15 +10,15 @@
|
|||||||
Linux 中的十大开源视频播放器
|
Linux 中的十大开源视频播放器
|
||||||
======
|
======
|
||||||
|
|
||||||
[![][1]][2]
|
![][1]
|
||||||
|
|
||||||
_选择合适的视频播放器有助于确保你获得最佳的观看体验,并为你提供[创建视频网站][3]的工具。你甚至可以根据个人喜好自定义正在观看的视频。_
|
> 选择合适的视频播放器有助于确保你获得最佳的观看体验,并为你提供[创建视频网站][3]的工具。你甚至可以根据个人喜好自定义正在观看的视频。
|
||||||
|
|
||||||
因此,为了帮助你挑选适合你需求的最佳播放器,我们列出了 Linux 中十大开源播放器。
|
因此,为了帮助你挑选适合你需求的最佳播放器,我们列出了 Linux 中的十大开源播放器。
|
||||||
|
|
||||||
让我们来看看:
|
让我们来看看:
|
||||||
|
|
||||||
**1\. XBMC – Kodi 媒体中心**
|
### 1、XBMC – Kodi 媒体中心
|
||||||
|
|
||||||
这是一个灵活的跨平台播放器,核心使用 C++ 编写,并提供 Python 脚本作为附加组件。使用 Kodi 的好处包括:
|
这是一个灵活的跨平台播放器,核心使用 C++ 编写,并提供 Python 脚本作为附加组件。使用 Kodi 的好处包括:
|
||||||
|
|
||||||
@ -28,11 +28,9 @@ _选择合适的视频播放器有助于确保你获得最佳的观看体验,
|
|||||||
* 有很多不错的附加组件,如视频和音频流插件、主题、屏幕保护程序等
|
* 有很多不错的附加组件,如视频和音频流插件、主题、屏幕保护程序等
|
||||||
* 它支持多种格式,如 MPEG-1、2、4、RealVideo、HVC、HEVC 等
|
* 它支持多种格式,如 MPEG-1、2、4、RealVideo、HVC、HEVC 等
|
||||||
|
|
||||||
|
### 2、VLC 媒体播放器
|
||||||
|
|
||||||
|
由于该播放器在一系列操作系统上具有令人印象深刻的功能和可用性,它出现在列表上是理所当然的。它使用 C、C++ 和 Objective C 编写,用户无需使用插件,这要归功于它对解码库的广泛支持。VLC 媒体播放器的优势包括:
|
||||||
**2\. VLC 媒体播放器**
|
|
||||||
|
|
||||||
由于该播放器在一系列操作系统上具有令人印象深刻的功能和可用性,他在列表上是理所当然的。它使用 C、C++ 和 Objective C 编写,用户无需使用插件,这要归功于它对解码库的广泛支持。VLC 媒体播放器的优势包括:
|
|
||||||
|
|
||||||
* 在 Linux 上支持 DVD 播放器
|
* 在 Linux 上支持 DVD 播放器
|
||||||
* 能够播放 .iso 文件
|
* 能够播放 .iso 文件
|
||||||
@ -40,54 +38,45 @@ _选择合适的视频播放器有助于确保你获得最佳的观看体验,
|
|||||||
* 可以直接从 U 盘或外部驱动器运行
|
* 可以直接从 U 盘或外部驱动器运行
|
||||||
* API 支持和浏览器支持(通过插件)
|
* API 支持和浏览器支持(通过插件)
|
||||||
|
|
||||||
|
### 3、Bomi(CMPlayer)
|
||||||
|
|
||||||
**3\. Bomi(CMPlayer)**
|
|
||||||
|
|
||||||
这个灵活和强大的播放器被许多普通用户选择,它的优势有:
|
这个灵活和强大的播放器被许多普通用户选择,它的优势有:
|
||||||
|
|
||||||
* 易于使用的图形用户界面 (GUI)
|
* 易于使用的图形用户界面(GUI)
|
||||||
* 令人印象深刻的播放能力
|
* 令人印象深刻的播放能力
|
||||||
* 恢复播放的选项
|
* 可以恢复播放
|
||||||
* 支持字幕,可以渲染多个字幕文件
|
* 支持字幕,可以渲染多个字幕文件
|
||||||
|
|
||||||
|
![][4]
|
||||||
|
|
||||||
|
### 4、Miro 音乐与视频播放器
|
||||||
|
|
||||||
**[![][4]][5]
|
以前被称为 Democracy Player(DTV),Miro 由<ruby>参与文化基金会<rt>Participatory Culture Foundation</rt></ruby>重新开发,是一个不错的跨平台音频视频播放器。令人印象深刻,因为:
|
||||||
4\. Miro Music and Video Player**
|
|
||||||
|
|
||||||
以前被称为 Democracy Player (DTV), Miro 由分享文化基金会(Participatory Culture Foundation)重新开发,是一个不错的跨平台音频视频播放器。令人印象深刻,因为:
|
|
||||||
|
|
||||||
* 支持一些高清音频和视频
|
* 支持一些高清音频和视频
|
||||||
* 提供超过 40 种语言版本
|
* 提供超过 40 种语言版本
|
||||||
* 可以播放多种文件格式,例如,QuickTime、WMV、MPEG 文件、音频视频接口 (AVI)、XVID
|
* 可以播放多种文件格式,例如,QuickTime、WMV、MPEG 文件、AVI、XVID
|
||||||
* 一旦可用,可以自动通知用户并下载视频
|
* 一旦可用,可以自动通知用户并下载视频
|
||||||
|
|
||||||
|
### 5、SMPlayer
|
||||||
|
|
||||||
|
这个跨平台的媒体播放器,只使用 C++ 的 Qt 库编写,它是一个强大的多功能播放器。我们喜欢它,因为:
|
||||||
**5\. SMPlayer**
|
|
||||||
|
|
||||||
这个跨平台的媒体播放器,只使用 C++ 的 Qt 库编写,它是一个强大的,多功能播放器。我们喜欢它,因为:
|
|
||||||
|
|
||||||
* 有多语言选择
|
* 有多语言选择
|
||||||
* 支持所有默认格式
|
* 支持所有默认格式
|
||||||
* 支持 EDL 文件,你可以配置从 Internet 获取的字幕
|
* 支持 EDL 文件,你可以配置从互联网获取的字幕
|
||||||
* 可从互联网下载的各种皮肤
|
* 可从互联网下载的各种皮肤
|
||||||
* 倍速播放
|
* 倍速播放
|
||||||
|
|
||||||
|
### 6、MPV 播放器
|
||||||
|
|
||||||
**6\. MPV Player**
|
|
||||||
|
|
||||||
它用 C、Objective-C、Lua 和 Python 编写,免费、易于使用,并且有许多新功能,便于使用。主要加分是:
|
它用 C、Objective-C、Lua 和 Python 编写,免费、易于使用,并且有许多新功能,便于使用。主要加分是:
|
||||||
|
|
||||||
* 可以编译为一个库,公开客户端 API,从而增强控制
|
* 可以编译为一个库,公开客户端 API,从而增强控制
|
||||||
* 允许媒体编码
|
* 允许媒体编码
|
||||||
* 平滑运动
|
* 平滑动画
|
||||||
|
|
||||||
|
### 7、Deepin Movie
|
||||||
|
|
||||||
**7\. Deepin Movie**
|
|
||||||
|
|
||||||
此播放器是开源媒体播放器的一个极好的例子,它有很多优势,包括:
|
此播放器是开源媒体播放器的一个极好的例子,它有很多优势,包括:
|
||||||
|
|
||||||
@ -95,45 +84,37 @@ _选择合适的视频播放器有助于确保你获得最佳的观看体验,
|
|||||||
* 各种格式的视频文件可以通过这个播放器轻松播放
|
* 各种格式的视频文件可以通过这个播放器轻松播放
|
||||||
* 流媒体功能能让用户享受许多在线视频资源
|
* 流媒体功能能让用户享受许多在线视频资源
|
||||||
|
|
||||||
|
### 8、Gnome 视频
|
||||||
|
|
||||||
|
以前称为 Totem,这是 Gnome 桌面环境的播放器。
|
||||||
|
|
||||||
**8\. Gnome Videos**
|
完全用 C 编写,使用 GStreamer 多媒体框架构建,高于 2.7.1 的版本使用 xine 作为后端。它是很棒的,因为:
|
||||||
|
|
||||||
以前称为 Totem,这是 Gnome 桌面环境选择的播放器。
|
|
||||||
完全用 C 编写,使用 GStreamer 多媒体框架构建,另外的版本(>2.7.1)使用 xine 作为后端。它是很棒的,因为:
|
|
||||||
|
|
||||||
它支持大量的格式,包括:
|
它支持大量的格式,包括:
|
||||||
|
|
||||||
* Supports for direct video playback from Internet channels such as Apple
|
|
||||||
* SHOUTcast、SMIL、M3U、Windows 媒体播放器格式等
|
* SHOUTcast、SMIL、M3U、Windows 媒体播放器格式等
|
||||||
* 你可以在播放过程中调整灯光设置,如亮度和对比度
|
* 你可以在播放过程中调整灯光设置,如亮度和对比度
|
||||||
* 加载 SubRip 字幕
|
* 加载 SubRip 字幕
|
||||||
* 支持从互联网频道(如 Apple)直接播放视频
|
* 支持从互联网频道(如 Apple)直接播放视频
|
||||||
|
|
||||||
|
### 9、Xine 多媒体播放器
|
||||||
|
|
||||||
**9\. Xine Multimedia Player**
|
|
||||||
|
|
||||||
我们列表中用 C 编写的另外一个跨平台多媒体播放器。这是一个全能播放器,因为:
|
我们列表中用 C 编写的另外一个跨平台多媒体播放器。这是一个全能播放器,因为:
|
||||||
|
|
||||||
* 它支持物理媒体以及视频设备。3gp, Matroska(MKV)、 MOV, Mp4、音频格式,
|
* 它支持物理媒体以及视频设备。3gp、MKV、 MOV、Mp4、音频格式
|
||||||
* 网络协议,V4L、DVB 和 PVR 等
|
* 网络协议,V4L、DVB 和 PVR 等
|
||||||
* 它可以手动校正音频和视频流的同步
|
* 它可以手动校正音频和视频流的同步
|
||||||
|
|
||||||
|
### 10、ExMPlayer
|
||||||
|
|
||||||
|
最后但同样重要的一个,ExMPlayer 是一个惊人的、强大的 MPlayer 的 GUI 前端。它的优点包括:
|
||||||
**10\. ExMPlayer**
|
|
||||||
|
|
||||||
最后单同样重要的一个,ExMPlayer 是一个惊人的、强大的 MPlayer 的 GUI 前端。它的优点包括:
|
|
||||||
|
|
||||||
* 可以播放任何媒体格式
|
* 可以播放任何媒体格式
|
||||||
* 支持网络流和字幕
|
* 支持网络流和字幕
|
||||||
* 易于使用的音频转换器
|
* 易于使用的音频转换器
|
||||||
* 高品质的音频提取,而不会影响音质
|
* 高品质的音频提取,而不会影响音质
|
||||||
|
|
||||||
|
上面这些视频播放器在 Linux 上工作得很好。我们建议你尝试一下,选择一个最适合你的播放器。
|
||||||
|
|
||||||
上面的视频播放器在 Linux 上工作得很好。我们建议你尝试一下,选择一个最适合你的播放器。
|
|
||||||
|
|
||||||
--------------------------------------------------------------------------------
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
@ -142,7 +123,7 @@ via: https://opensourceforu.com/2019/10/top-10-open-source-video-players-for-lin
|
|||||||
作者:[Stella Aldridge][a]
|
作者:[Stella Aldridge][a]
|
||||||
选题:[lujun9972][b]
|
选题:[lujun9972][b]
|
||||||
译者:[geekpi](https://github.com/geekpi)
|
译者:[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/) 荣誉推出
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
@ -0,0 +1,77 @@
|
|||||||
|
[#]: collector: (lujun9972)
|
||||||
|
[#]: translator: ( )
|
||||||
|
[#]: reviewer: ( )
|
||||||
|
[#]: publisher: ( )
|
||||||
|
[#]: url: ( )
|
||||||
|
[#]: subject: (To space and beyond with open source)
|
||||||
|
[#]: via: (https://opensource.com/article/19/10/open-source-space-exploration)
|
||||||
|
[#]: author: (Jaouhari Youssef https://opensource.com/users/jaouhari)
|
||||||
|
|
||||||
|
To space and beyond with open source
|
||||||
|
======
|
||||||
|
Open source projects are helping to satisfy our curiosity about what
|
||||||
|
lies far beyond Earth's atmosphere.
|
||||||
|
![Person looking up at the stars][1]
|
||||||
|
|
||||||
|
Carl Sagan once said, "The universe is a pretty big place. If it's just us, seems like an awful waste of space." In that vast desert of seeming nothingness hides some of the most mysterious and beautiful creations humankind ever has—or ever will—witness.
|
||||||
|
|
||||||
|
Our ancient ancestors looked up into the night sky and dreamed about space, just as we do today. Starting with simple, naked-eye observations of the sky and progressing to create [space telescopes][2] that uncover far reaches of the universe, we've come a long way toward understanding and redefining the concepts of time, space, and matter. Our exploration has provided some answers to humanity's enduring questions about the existence of extraterrestrial life, about the finite or infinite nature and origin of the universe, and so much more. And we still have so much to discover.
|
||||||
|
|
||||||
|
### Curiosity, a crucial component for space exploration
|
||||||
|
|
||||||
|
The Cambridge Dictionary defines [curiosity][3] as "an eager wish to know or learn about something." It's curiosity that fuels our drive to acquire knowledge about outer space, but what drives our curiosity, our "eager wish," in the first place?
|
||||||
|
|
||||||
|
I believe that our curiosity is driven by the desire to escape the unpleasant feeling of uncertainty that is triggered by acknowledging our lack of knowledge. The intrinsic reward that comes from escaping uncertainty pushes us to find a correct (or at least a less wrong) answer to whatever question is at hand.
|
||||||
|
|
||||||
|
If we want space discovery to advance at a faster pace, we need more people to become aware of the rewards that are waiting for them when they make the effort and discover answers for their questions about the universe. Space discovery is admittedly not an easy task, because finding correct answers requires following rigorous methods on a long-term scale.
|
||||||
|
|
||||||
|
Luckily, open source initiatives are emerging that make it easier for people to get started exploring and enjoying the beauty of outer space.
|
||||||
|
|
||||||
|
### Two open source initiatives for space discovery
|
||||||
|
|
||||||
|
#### OpenSpace Project
|
||||||
|
|
||||||
|
One of the most beautiful tools for exploring space is [OpenSpace][4], an open source visualization tool of the entire known universe. It is an incredible way to visualize the environment of other planets, such as Mars and Jupiter, galaxies, and more.
|
||||||
|
|
||||||
|
![The Moon visualized by the OpenSpace project][5]
|
||||||
|
|
||||||
|
To enjoy a smooth experience from the OpenSpace simulation (e.g., a minimum 30fps), you need a powerful GPU; check the [GitHub repository][6] for more information.
|
||||||
|
|
||||||
|
#### Libre Space Foundation
|
||||||
|
|
||||||
|
The [Libre Space Foundation][7]'s mission is "to promote, advance, and develop libre (free and open source) technologies and knowledge for space." Among other things, the project is working to create an open source network of satellite ground stations that can communicate with satellites, spaceships, and space stations. It also supports the [UPSat project][8], which aspires to be the first completely open source satellite launched.
|
||||||
|
|
||||||
|
### Advancing the human species
|
||||||
|
|
||||||
|
I believe that the efforts made by these open source initiatives are contributing to the advancement of the human species in space. By increasing our interest in space, we are creating opportunities to upgrade our civilization's technological level, moving further up on the [Kardashev scale][9] and possibly becoming a multi-planetary species. Maybe one day, we will build a [Dyson sphere][10] around the sun to capture energy emissions, thereby harnessing an energy resource that exceeds any found on Earth and opening up a whole new world of possibilities.
|
||||||
|
|
||||||
|
### Satisfy your curiosity
|
||||||
|
|
||||||
|
Our solar system is only a tiny dot swimming in a universe of gems, and the outer space environment has never stopped amazing and intriguing us.
|
||||||
|
|
||||||
|
If your curiosity is piqued and you want to learn more about outer space, check out [Kurzgesagt's][11] YouTube videos, which cover topics ranging from the origin of the universe to the strangest stars in a beautiful and concise manner.
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: https://opensource.com/article/19/10/open-source-space-exploration
|
||||||
|
|
||||||
|
作者:[Jaouhari Youssef][a]
|
||||||
|
选题:[lujun9972][b]
|
||||||
|
译者:[译者ID](https://github.com/译者ID)
|
||||||
|
校对:[校对者ID](https://github.com/校对者ID)
|
||||||
|
|
||||||
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
||||||
|
[a]: https://opensource.com/users/jaouhari
|
||||||
|
[b]: https://github.com/lujun9972
|
||||||
|
[1]: https://opensource.com/sites/default/files/styles/image-full-size/public/lead-images/space_stars_cosmos_person.jpg?itok=XUtz_LyY (Person looking up at the stars)
|
||||||
|
[2]: https://en.wikipedia.org/wiki/List_of_space_telescopes
|
||||||
|
[3]: https://dictionary.cambridge.org/us/dictionary/english/curiosity
|
||||||
|
[4]: https://www.openspaceproject.com/
|
||||||
|
[5]: https://opensource.com/sites/default/files/uploads/moon.png (The Moon visualized by the OpenSpace project)
|
||||||
|
[6]: https://github.com/OpenSpace/OpenSpace
|
||||||
|
[7]: https://libre.space/
|
||||||
|
[8]: https://upsat.gr/
|
||||||
|
[9]: https://en.wikipedia.org/wiki/Kardashev_scale
|
||||||
|
[10]: https://en.wikipedia.org/wiki/Dyson_sphere
|
||||||
|
[11]: https://kurzgesagt.org/
|
@ -0,0 +1,85 @@
|
|||||||
|
[#]: collector: (lujun9972)
|
||||||
|
[#]: translator: ( )
|
||||||
|
[#]: reviewer: ( )
|
||||||
|
[#]: publisher: ( )
|
||||||
|
[#]: url: ( )
|
||||||
|
[#]: subject: (Project Trident Ditches BSD for Linux)
|
||||||
|
[#]: via: (https://itsfoss.com/bsd-project-trident-linux/)
|
||||||
|
[#]: author: (John Paul https://itsfoss.com/author/john/)
|
||||||
|
|
||||||
|
Project Trident Ditches BSD for Linux
|
||||||
|
======
|
||||||
|
|
||||||
|
Recently a BSD distribution announced that it was going to rebase on Linux. Yep, you heard me correctly. Project Trident is moving to Void Linux.
|
||||||
|
|
||||||
|
### What is Going on with Project Trident?
|
||||||
|
|
||||||
|
Recently, Project Trident [announced][1] that they had been working behind the scenes to move away from FreeBSD. This is quite a surprising move (and an unprecedented one).
|
||||||
|
|
||||||
|
According to a [later post][2], the move was motivated by long-standing issues with FreeBSD. These issues include “hardware compatibility, communications standards, or package availability continue to limit Project Trident users”. According to a conversation on [Telegram][3], FreeBSD has just updated its build of the Telegram client and it was nine release behind everyone else.
|
||||||
|
|
||||||
|
The lead dev of Project Trident, [Ken Moore][4], is also the main developer of the Lumina Desktop. The [Lumina Desktop][5] has been on hold for a while because the [Project Trident][6] team had to do so much work just to keep their packages updated. (Once they complete the transition to Void Linux, Ken will start working on Lumina again.)
|
||||||
|
|
||||||
|
After much searching and testing, the Project Trident team decided to use [Void Linux][7] as their new base.
|
||||||
|
|
||||||
|
According to the Project Trident team, the move to Void Linux will have the [following benefits][2]:
|
||||||
|
|
||||||
|
* Better GPU support
|
||||||
|
* Better sound card and streaming support
|
||||||
|
* Better wireless support
|
||||||
|
* Bluetooth support for the first time
|
||||||
|
* Up to date versions of applications
|
||||||
|
* Faster boot times
|
||||||
|
* Hybrid EFI/Legacy installation and boot support
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
### Moving Plans
|
||||||
|
|
||||||
|
![][8]
|
||||||
|
|
||||||
|
Project Trident currently has two different versions available: Trident-stable and Trident-release. Trident-stable is based on FreeBSD 12 and will continue to get updates until January of 2020 with the ports repo being deleted in April of 2020. On the other hand, Trident-release (which is based on FreeBSD 13) will receive no further updates. That ports repo will be deleted in January of 2020.
|
||||||
|
|
||||||
|
The first Void Linux-based releases should be available in January of 2020. Ken said that they might issue an alpha iso or two to show off their progress, but they would be for testing purposes only.
|
||||||
|
|
||||||
|
Currently, Ken said that they are working to port all of their “in-house utilities over to work natively on Void Linux”. Void Linux does not support ZFS-on-root, which is a big part of the BSDs. However, Project Trident is planning to use their knowledge of ZFS to add support for it to Void.
|
||||||
|
|
||||||
|
There will not be a migration path from the FreeBSD-based version to the Void-based version. If you are currently using Project Trident, you will need to backup your `/home/*` directory before performing a clean install of the new version.
|
||||||
|
|
||||||
|
### Final Thoughts
|
||||||
|
|
||||||
|
I’m looking forward to trying out the new Void Linux-based Project Trident. I have installed and used Void Linux in the past. I have also tried out [TrueOS][9] (the precursor of Project Trident). However, I could never get Project Trident to work on my laptop.
|
||||||
|
|
||||||
|
When I was using Void Linux, I ran into two main issues: installing a desktop environment was a pain and the GUI package manager wasn’t that great. Project Trident plans to address these issues. Their original goal was to find an operating system that didn’t come with a desktop environment as default and their distro would add desktop support out-of-the-box. They won’t be able to port the AppCafe package manager to Void because it is a part of TrueOS’ SysAdm utility. They do plan to “develop a new graphical front-end to the XBPS package manager for Void Linux”.
|
||||||
|
|
||||||
|
Interestingly, Void Linux was created by a former NetBSD developer. I asked Ken if that fact influenced their decision. He said, “Actually none! I liked the way that Void Linux was set up and that most/all of the utilities were either MIT or BSD licensed, but I never guessed that it was created by a former NetBSD developer. That definitely helps to explain why Void Linux “feels” more comfortable to me since I have been using FreeBSD exclusively for the last 7 or more years.”
|
||||||
|
|
||||||
|
I’ve seen some people on the web speaking disparagingly of the move to Void Linux. They mentioned that the name changes (from PC-BSD to TrueOS to Project Trident) and the changes in architecture (from FreeBSD to TrueOS/FreeBSD to Void Linux) show that the developers don’t know what they are doing. On the other hand, I believe that Project Trident has finally found its niche where it will be able to grow and blossom. I will be watching the future of Project Trident with much anticipation. You will probably be reading a review of the new version when it is released.
|
||||||
|
|
||||||
|
Have you ever used Project Trident? What is your favorite BSD? Please let us know in the comments below.
|
||||||
|
|
||||||
|
If you found this article interesting, please take a minute to share it on social media, Hacker News or [Reddit][10].
|
||||||
|
|
||||||
|
--------------------------------------------------------------------------------
|
||||||
|
|
||||||
|
via: https://itsfoss.com/bsd-project-trident-linux/
|
||||||
|
|
||||||
|
作者:[John Paul][a]
|
||||||
|
选题:[lujun9972][b]
|
||||||
|
译者:[译者ID](https://github.com/译者ID)
|
||||||
|
校对:[校对者ID](https://github.com/校对者ID)
|
||||||
|
|
||||||
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
||||||
|
|
||||||
|
[a]: https://itsfoss.com/author/john/
|
||||||
|
[b]: https://github.com/lujun9972
|
||||||
|
[1]: https://project-trident.org/post/train_changes/
|
||||||
|
[2]: https://project-trident.org/post/os_migration/
|
||||||
|
[3]: https://t.me/ProjectTrident
|
||||||
|
[4]: https://github.com/beanpole135
|
||||||
|
[5]: https://lumina-desktop.org/
|
||||||
|
[6]: https://itsfoss.com/project-trident-interview/
|
||||||
|
[7]: https://voidlinux.org/
|
||||||
|
[8]: https://i1.wp.com/itsfoss.com/wp-content/uploads/2019/10/bsd-linux.jpg?resize=800%2C450&ssl=1
|
||||||
|
[9]: https://itsfoss.com/trueos-bsd-review/
|
||||||
|
[10]: https://reddit.com/r/linuxusersgroup
|
@ -1,34 +1,34 @@
|
|||||||
[#]: collector: (lujun9972)
|
[#]: collector: "lujun9972"
|
||||||
[#]: translator: (way-ww)
|
[#]: translator: "way-ww"
|
||||||
[#]: reviewer: ( )
|
[#]: reviewer: " "
|
||||||
[#]: publisher: ( )
|
[#]: publisher: " "
|
||||||
[#]: url: ( )
|
[#]: url: " "
|
||||||
[#]: subject: (How to Run the Top Command in Batch Mode)
|
[#]: subject: "How to Run the Top Command in Batch Mode"
|
||||||
[#]: via: (https://www.2daygeek.com/linux-run-execute-top-command-in-batch-mode/)
|
[#]: via: "https://www.2daygeek.com/linux-run-execute-top-command-in-batch-mode/"
|
||||||
[#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/)
|
[#]: author: "Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/"
|
||||||
|
|
||||||
How to Run the Top Command in Batch Mode
|
如何在批处理模式下运行 Top 命令
|
||||||
======
|
======
|
||||||
|
|
||||||
The **[Linux Top command][1]** is the best and most well known command that everyone uses to **[monitor Linux system performance][2]**.
|
**[Top 命令][1]** 是每个人都在使用的用于 **[监控 Linux 系统性能][2]** 的最好的命令。
|
||||||
|
|
||||||
You probably already know most of the options available, except for a few options, and if I’m not wrong, “batch more” is one of the options.
|
除了很少的几个操作, 你可能已经知道 top 命令的绝大部分操作, 如果我没错的话, 批处理模式就是其中之一。
|
||||||
|
|
||||||
Most script writer and developers know this because this option is mainly used when writing the script.
|
大部分的脚本编写者和开发人员都知道这个, 因为这个操作主要就是用来编写脚本。
|
||||||
|
|
||||||
If you’re not sure about this, don’t worry we’re here to explain this.
|
如果你不了解这个, 不用担心,我们将在这里介绍它。
|
||||||
|
|
||||||
### What is “Batch Mode” in the Top Command
|
### 什么是 Top 命令的批处理模式
|
||||||
|
|
||||||
The “Batch Mode” option allows you to send top command output to other programs or to a file.
|
批处理模式允许你将 top 命令的输出发送至其他程序或者文件中。
|
||||||
|
|
||||||
In this mode, top will not accept input and runs until the iterations limit you’ve set with the “-n” command-line option.
|
在这个模式中, top 命令将不会接收输入并且持续运行直到迭代次数达到你用 “-n” 选项指定的次数为止。
|
||||||
|
|
||||||
If you want to fix any performance issues on the Linux server, you need to **[understand the top command output][3]** correctly.
|
如果你想解决 Linux 服务器上的任何性能问题, 你需要正确的 **[理解 top 命令的输出][3]** 。
|
||||||
|
|
||||||
### 1) How to Run the Top Command in Batch Mode
|
### 1) 如何在批处理模式下运行 top 命令
|
||||||
|
|
||||||
By default, the top command sort the results based on CPU usage, so when you run the below top command in batch mode, it does the same and prints the first 35 lines.
|
默认地, top 命令按照 CPU 的使用率来排序输出结果, 所以当你在批处理模式中运行以下命令时, 它会执行同样的操作并打印前 35 行。
|
||||||
|
|
||||||
```
|
```
|
||||||
# top -bc | head -35
|
# top -bc | head -35
|
||||||
@ -70,9 +70,9 @@ PID USER PR NI VIRT RES SHR S %CPU %MEM TIME+ COMMAND
|
|||||||
46 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 [kmpath_rdacd]
|
46 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 [kmpath_rdacd]
|
||||||
```
|
```
|
||||||
|
|
||||||
### 2) How to Run the Top Command in Batch Mode and Sort the Output Based on Memory Usage
|
### 2) 如何在批处理模式下运行 top 命令并按内存使用率排序结果
|
||||||
|
|
||||||
Run the below top command to sort the results based on memory usage in batch mode.
|
在批处理模式中运行以下命令按内存使用率对结果进行排序
|
||||||
|
|
||||||
```
|
```
|
||||||
# top -bc -o +%MEM | head -n 20
|
# top -bc -o +%MEM | head -n 20
|
||||||
@ -99,19 +99,19 @@ KiB Swap: 1048572 total, 514640 free, 533932 used. 2475984 avail Mem
|
|||||||
8632 nobody 20 0 256844 25744 2216 S 0.0 0.7 0:00.03 /usr/sbin/httpd -k start
|
8632 nobody 20 0 256844 25744 2216 S 0.0 0.7 0:00.03 /usr/sbin/httpd -k start
|
||||||
```
|
```
|
||||||
|
|
||||||
**Details of the above command:**
|
**上面命令的详细信息:**
|
||||||
|
|
||||||
* **-b :** Batch mode operation
|
* **-b :** 批处理模式选项
|
||||||
* **-c :** To print the absolute path of the running process
|
* **-c :** 打印运行中的进程的绝对路径
|
||||||
* **-o :** To specify fields for sorting processes
|
* **-o :** 指定进行排序的字段
|
||||||
* **head :** Output the first part of files
|
* **head :** 输出文件的第一部分
|
||||||
* **-n :** To print the first “n” lines
|
* **-n :** 打印前 n 行
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
### 3) How to Run the Top Command in Batch Mode and Sort the Output Based on a Specific User Process
|
### 3) 如何在批处理模式下运行 top 命令并按照指定的用户进程对结果进行排序
|
||||||
|
|
||||||
If you want to sort results based on a specific user, run the below top command.
|
如果你想要按照指定用户进程对结果进行排序请运行以下命令
|
||||||
|
|
||||||
```
|
```
|
||||||
# top -bc -u mysql | head -n 10
|
# top -bc -u mysql | head -n 10
|
||||||
@ -126,13 +126,13 @@ KiB Swap: 1048572 total, 514640 free, 533932 used. 2649412 avail Mem
|
|||||||
18105 mysql 20 0 1453900 156888 8816 S 0.0 4.0 2:16.42 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid
|
18105 mysql 20 0 1453900 156888 8816 S 0.0 4.0 2:16.42 /usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid
|
||||||
```
|
```
|
||||||
|
|
||||||
### 4) How to Run the Top Command in Batch Mode and Sort the Output Based on the Process Age
|
### 4) 如何在批处理模式下运行 top 命令并按照处理时间进行排序
|
||||||
|
|
||||||
Use the below top command to sort the results based on the age of the process in batch mode. It shows the total CPU time the task has used since it started.
|
在批处理模式中使用以下 top 命令按照处理时间对结果进行排序。 这展示了任务从启动以来已使用的总 CPU 时间
|
||||||
|
|
||||||
But if you want to check how long a process has been running on Linux, go to the following article.
|
但是如果你想要检查一个进程在 Linux 上运行了多长时间请看接下来的文章。
|
||||||
|
|
||||||
* **[Five Ways to Check How Long a Process Has Been Running in Linux][4]**
|
* **[检查 Linux 中进程运行时间的五种方法][4]**
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@ -161,9 +161,9 @@ KiB Swap: 1048572 total, 514640 free, 533932 used. 2440332 avail Mem
|
|||||||
342 root 20 0 39472 2940 2752 S 0.0 0.1 1:18.17 /usr/lib/systemd/systemd-journald
|
342 root 20 0 39472 2940 2752 S 0.0 0.1 1:18.17 /usr/lib/systemd/systemd-journald
|
||||||
```
|
```
|
||||||
|
|
||||||
### 5) How to Run the Top Command in Batch Mode and Save the Output to a File
|
### 5) 如何在批处理模式下运行 top 命令并将结果保存到文件中
|
||||||
|
|
||||||
If you want to share the output of the top command to someone for troubleshooting purposes, redirect the output to a file using the following command.
|
如果出于解决问题的目的, 你想要和别人分享 top 命令的输出, 请使用以下命令重定向输出到文件中
|
||||||
|
|
||||||
```
|
```
|
||||||
# top -bc | head -35 > top-report.txt
|
# top -bc | head -35 > top-report.txt
|
||||||
@ -207,11 +207,11 @@ KiB Swap: 1048572 total, 514640 free, 533932 used. 2659084 avail Mem
|
|||||||
36 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 [crypto]
|
36 root 0 -20 0 0 0 S 0.0 0.0 0:00.00 [crypto]
|
||||||
```
|
```
|
||||||
|
|
||||||
### How to Sort Output Based on Specific Fields
|
### 如何按照指定字段对结果进行排序
|
||||||
|
|
||||||
In the latest version of the top command release, press the **“f”** key to sort the fields via the field letter.
|
在 top 命令的最新版本中, 按下 **“f”** 键进入字段管理界面。
|
||||||
|
|
||||||
To sort with a new field, use the **“up/down”** arrow to select the correct selection, and then press **“s”** to sort it. Finally press **“q”** to exit from this window.
|
要使用新字段进行排序, 请使用 **“up/down”** 箭头选择正确的选项, 然后再按下 **“s”** 键进行排序。 最后按 **“q”** 键退出此窗口。
|
||||||
|
|
||||||
```
|
```
|
||||||
Fields Management for window 1:Def, whose current sort field is %CPU
|
Fields Management for window 1:Def, whose current sort field is %CPU
|
||||||
@ -269,9 +269,9 @@ Fields Management for window 1:Def, whose current sort field is %CPU
|
|||||||
nsUSER = USER namespace Inode
|
nsUSER = USER namespace Inode
|
||||||
```
|
```
|
||||||
|
|
||||||
For older version of the top command, press the **“shift+f”** or **“shift+o”** key to sort the fields via the field letter.
|
对 top 命令的旧版本, 请按 **“shift+f”** 或 **“shift+o”** 键进入字段管理界面进行排序。
|
||||||
|
|
||||||
To sort with a new field, select the corresponding sort **field letter**, and then press **“Enter”** to sort it.
|
要使用新字段进行排序, 请选择相应的排序字段字母, 然后按下 **“Enter”** 排序。
|
||||||
|
|
||||||
```
|
```
|
||||||
Current Sort Field: N for window 1:Def
|
Current Sort Field: N for window 1:Def
|
||||||
@ -322,7 +322,7 @@ via: https://www.2daygeek.com/linux-run-execute-top-command-in-batch-mode/
|
|||||||
|
|
||||||
作者:[Magesh Maruthamuthu][a]
|
作者:[Magesh Maruthamuthu][a]
|
||||||
选题:[lujun9972][b]
|
选题:[lujun9972][b]
|
||||||
译者:[译者ID](https://github.com/译者ID)
|
译者:[way-ww](https://github.com/way-ww)
|
||||||
校对:[校对者ID](https://github.com/校对者ID)
|
校对:[校对者ID](https://github.com/校对者ID)
|
||||||
|
|
||||||
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
本文由 [LCTT](https://github.com/LCTT/TranslateProject) 原创编译,[Linux中国](https://linux.cn/) 荣誉推出
|
Loading…
Reference in New Issue
Block a user