Home  >  Article  >  System Tutorial  >  Red Hat Linux system download, installation, system monitoring, and process management tutorials

Red Hat Linux system download, installation, system monitoring, and process management tutorials

PHPz
PHPzOriginal
2024-08-07 21:36:43663browse

Red Hat Linux 系统下载安装及系统监控、进程管理教程

Table of Contents of Series Articles

Chapter 1: Download and install redhatlinux system

Chapter 2: Linux Users and Groups

Chapter 3: Linux File Management

Chapter 4: Linux Directory Management

Chapter 5: Linux Text Editor

Chapter 6: Linux file search and management

Chapter 7: Linux input, output redirection and pipeline

Chapter 8: Linux Package Management

Chapter 9: Linux system monitoring and process management

Article Directory

Preface

The main content of this blog is about system monitoring and process management. It is still focused on experiments. As a rule, remember to take a snapshot in advance.

1. System monitoring and query information

<span class="token function">uname</span> -r
<span class="token function">uname</span> -a

linux计划任务没有运行_linux任务计划_linux任务计划不生效

lscpu

在这里插入图片描述

<span class="token function">hostname</span>

<span class="token function">top</span>

The top command can check the running status of each process, the allocation of system resources, etc., so I will briefly talk about it here

The above content is mainly about the allocation of system resources, talking about some common and simple ones.

Second line

From left to right, it represents the total number of processes, the number of running processes, the number of dormant processes, the number of stopped processes, and the last one, nicknamed zombie process.

The following are very simple. Let’s talk about the last one. As we all know, each program will use many sub-processes to complete tasks separately. If the main process is violently killed, such as forced suspension of Windows or the kill command of Linux, it may If its child processes have no time to stop, the main process will disappear. This kind of process is called a zombie process. It is of no use, but it will occupy resources.

The most commonly used one is the id value in the third line. There are more than 90 in the picture, which means that most of the cups are not running. Now we open a program to run it and see the effect.

Open another terminal and run the following command

linux任务计划不生效_linux计划任务没有运行_linux任务计划

可以看见这个命令运行了50秒左右,直接占了近一半的CPU,这个生产中主要用于给服务器做抗压测试,让你的CPU满载运行,瞧瞧能够不能正常完成相应的任务。

第四行

主要是展示显存信息,当年创了两个G的显存,如今空闲的的早已不多了。

第五行

所以下一行的swap交换分区就被启动了。一部份硬碟当显存使

二、进程管理

<span class="token function">ps</span> aux

ps命令必须加参数,不然没啥用

a:所有

u:用户

x:运行

它可以给你显示出,系统所有运行的程序,并且如此多进程,如何看啊,这就要用到后面的grep来做到做管线,拿来过滤信息,例如我要查看chaoge运行的进程

<span class="token function">ps</span> aux <span class="token operator">|</span> <span class="token function">grep</span> chaoge

这样就可以对这种进程进行过滤,从而查询到自己须要的信息

1.管理进程

<span class="token function">kill</span>

kill直接翻译就是杀害,但他不仅仅能单纯的杀害,他也是有好多参数的

可用于-l查看

在这里插入图片描述

以管理系统自带的python为例

在这里插入图片描述

<span class="token function">kill</span> -19

停止进程,以python第一个进程1004为例

可以见到多了一个停止程序

<span class="token function">kill</span> -18

启用程序

linux计划任务没有运行_linux任务计划不生效_linux任务计划

这条命令我以前在云端跑python爬虫的时侯用过,我当时的水平还比较低,不会写增量式爬虫,代码效率比较低,几万张图片要跑近3天,就直接放到了云端,定时去下载合照,为剩下的相片留下空间,而且程序不能中断,就用这个命令暂停进程,之后把相片领到本地,在启用程序继续跑。

<span class="token function">kill</span> -9 -15

这是两个参数都是拿来杀害进程的。

-9,就是之前说的直接杀害红旗linux系统下载,有可能留下僵尸进程

-15,先杀害子进程在,最后在杀害主进程,不会有僵尸进程

这个没啥特殊的,不说了,尽量用15,不行再用9

2.前后台转换

在这里插入图片描述

在终端直接运行傲游可以打开浏览器,而且这个时侯终端都会被占用,难以继续操作,所以我们要把它转入后台去。

firefox <span class="token operator">&</span>

后面加一个&,可以将进程切换到后台,终端会返回一个进程号linux find,可以通过进程号查询进程。

在这里插入图片描述

这是直接后台启用,那我向将前台正在运行的程序linux计划任务没有运行,转入后台应当如何做呢?

我在这儿创建两个文件,分别叫1和2,上面各写一串数字

linux任务计划_linux任务计划不生效_linux计划任务没有运行

在这里插入图片描述

这个时侯,步入文件1的编辑界面使用快捷键Ctrl+Z

在这里插入图片描述

他会手动将这个进程调到后台去linux计划任务没有运行,继续把2也也调到后台

在这里插入图片描述

我们可以通过fg命令将后台程序调到前台来

在这里插入图片描述

都会回到编辑时的状态

注:fg会回到近来一次的调换前,假如我们想回到更早的线程该如何做?

先用jobs查看后台进程

在这里插入图片描述

fg+编号即可回到相应的进程

在这里插入图片描述

总结

此次博客内容就到这儿。

The above is the detailed content of Red Hat Linux system download, installation, system monitoring, and process management tutorials. For more information, please follow other related articles on the PHP Chinese website!

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn