diff --git a/translated/tech/20200107 Bash Script to Check How Long the High CPU-Memory Consumption Processes Runs on Linux.md b/translated/tech/20200107 Bash Script to Check How Long the High CPU-Memory Consumption Processes Runs on Linux.md index f6771dd3a1..7387b589d9 100644 --- a/translated/tech/20200107 Bash Script to Check How Long the High CPU-Memory Consumption Processes Runs on Linux.md +++ b/translated/tech/20200107 Bash Script to Check How Long the High CPU-Memory Consumption Processes Runs on Linux.md @@ -1,40 +1,36 @@ [#]: collector: (lujun9972) [#]: translator: (geekpi) -[#]: reviewer: ( ) +[#]: reviewer: (wxy) [#]: publisher: ( ) [#]: url: ( ) [#]: subject: (Bash Script to Check How Long the High CPU/Memory Consumption Processes Runs on Linux) [#]: via: (https://www.2daygeek.com/bash-script-to-check-how-long-the-high-cpu-memory-consumption-processes-runs-on-linux/) [#]: author: (Magesh Maruthamuthu https://www.2daygeek.com/author/magesh/) -在 Linux 中运行 Bash 脚本检查高 CPU/内存消耗进程 +实用脚本:检查高 CPU / 内存消耗进程 ====== -过去,我们写了三篇不同的文章来使用 Linux 命令来识别。 +![](https://img.linux.net.cn/data/attachment/album/202008/01/205420jllu1nsngu9qszu5.jpg) -你可以通过下面相关的 URL 立即访问。 - - * **[如何在 Linux 中查找高 CPU 消耗进程][1]** - * **[如何找出 Linux 中的高内存消耗进程][2]** - * **[检查进程在 Linux 中运行了多长时间的五种方法][3]** +过去,我们写了三篇不同的文章来使用 Linux 命令来识别这些进程。 +你可以通过下面相关的 URL 立即访问: + * [如何在 Linux 中找出 CPU 占用高的进程][1] + * [如何在 Linux 中找出内存消耗最大的进程][2] + * [在 Linux 中如何查找一个命令或进程的执行时间][3] 本教程中包含两个脚本,它们可以帮助你确定 Linux 上高 CPU/内存消耗进程的运行时间。 -该脚本将显示进程 ID,进程的所有者,进程的名称以及进程的运行时间。 - -这将帮助你确定哪些(必须事先完成)作业正在超时运行。 - -在可以使用 ps 命令来实现。 +该脚本将显示进程 ID、进程的所有者、进程的名称以及进程的运行时间。这将帮助你确定哪些(必须事先完成)作业正在超时运行。这可以使用 `ps` 命令来实现。 ### 什么是 ps 命令 -ps 代表进程状态,它显示有关系统上活动/正在运行的进程的信息。 +`ps` 是进程状态processes status,它显示有关系统上活动/正在运行的进程的信息。 它提供了当前进程的快照以及详细信息,例如用户名、用户 ID、CPU 使用率、内存使用率、进程开始日期和时间等。 -### 1)Bash 脚本检查高 CPU 消耗进程在 Linux 上运行了多长时间 +#### 1)检查高 CPU 消耗进程在 Linux 上运行了多长时间的 Bash 脚本 该脚本将帮助你确定高 CPU 消耗进程在 Linux 上运行了多长时间。 @@ -56,13 +52,13 @@ done | column -t echo "--------------------------------------------------" ``` -给 **”long-running-cpu-proc.sh“** 设置可执行**[Linux 文件权限][4]**。 +给 `long-running-cpu-proc.sh` 设置可执行的 [Linux 文件权限][4]。 ``` # chmod +x /opt/scripts/long-running-cpu-proc.sh ``` -运行此脚本时,你将获得类似以下的输出。 +运行此脚本时,你将获得类似以下的输出: ``` # sh /opt/scripts/long-running-cpu-proc.sh @@ -82,7 +78,7 @@ daygeek 6301 Web 57:40 ---------------------------------------------------- ``` -### 2)Bash 脚本检查高内存消耗进程在 Linux 上运行了多长时间 +#### 2)检查高内存消耗进程在 Linux 上运行了多长时间的 Bash 脚本 该脚本将帮助你确定最大的内存消耗进程在 Linux 上运行了多长时间。 @@ -104,13 +100,13 @@ done | column -t echo "--------------------------------------------------" ``` -给 **”long-running-memory-proc.sh“** 设置可执行 Linux 文件权限。 +给 `long-running-memory-proc.sh` 设置可执行的 Linux 文件权限。 ``` # chmod +x /opt/scripts/long-running-memory-proc.sh ``` -运行此脚本时,你将获得类似以下的输出。 +运行此脚本时,你将获得类似以下的输出: ``` # sh /opt/scripts/long-running-memory-proc.sh @@ -137,13 +133,13 @@ via: https://www.2daygeek.com/bash-script-to-check-how-long-the-high-cpu-memory- 作者:[Magesh Maruthamuthu][a] 选题:[lujun9972][b] 译者:[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/) 荣誉推出 [a]: https://www.2daygeek.com/author/magesh/ [b]: https://github.com/lujun9972 -[1]: https://www.2daygeek.com/how-to-find-high-cpu-consumption-processes-in-linux/ -[2]: https://www.2daygeek.com/linux-find-top-memory-consuming-processes/ -[3]: https://www.2daygeek.com/how-to-check-how-long-a-process-has-been-running-in-linux/ +[1]: https://linux.cn/article-11678-1.html +[2]: https://linux.cn/article-11542-1.html +[3]: https://linux.cn/article-10261-1.html [4]: https://www.2daygeek.com/understanding-linux-file-permissions/