


Red Hat Linux system download, installation, system monitoring, and process management tutorials
Aug 07, 2024 pm 09:36 PMTable 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
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
可以看見(jiàn)這個(gè)命令運(yùn)行了50秒左右,直接占了近一半的CPU,這個(gè)生產(chǎn)中主要用于給服務(wù)器做抗壓測(cè)試,讓你的CPU滿載運(yùn)行,瞧瞧能夠不能正常完成相應(yīng)的任務(wù)。
第四行
主要是展示顯存信息,當(dāng)年創(chuàng)了兩個(gè)G的顯存,如今空閑的的早已不多了。
第五行
所以下一行的swap交換分區(qū)就被啟動(dòng)了。一部份硬碟當(dāng)顯存使
二、進(jìn)程管理
<span class="token function">ps</span> aux
ps命令必須加參數(shù),不然沒(méi)啥用
a:所有
u:用戶
x:運(yùn)行
它可以給你顯示出,系統(tǒng)所有運(yùn)行的程序,并且如此多進(jìn)程,如何看啊,這就要用到后面的grep來(lái)做到做管線,拿來(lái)過(guò)濾信息,例如我要查看chaoge運(yùn)行的進(jìn)程
<span class="token function">ps</span> aux <span class="token operator">|</span> <span class="token function">grep</span> chaoge
這樣就可以對(duì)這種進(jìn)程進(jìn)行過(guò)濾,從而查詢到自己須要的信息
1.管理進(jìn)程
<span class="token function">kill</span>
kill直接翻譯就是殺害,但他不僅僅能單純的殺害,他也是有好多參數(shù)的
可用于-l查看
以管理系統(tǒng)自帶的python為例
<span class="token function">kill</span> -19
停止進(jìn)程,以python第一個(gè)進(jìn)程1004為例
可以見(jiàn)到多了一個(gè)停止程序
<span class="token function">kill</span> -18
啟用程序
這條命令我以前在云端跑python爬蟲(chóng)的時(shí)侯用過(guò),我當(dāng)時(shí)的水平還比較低,不會(huì)寫(xiě)增量式爬蟲(chóng),代碼效率比較低,幾萬(wàn)張圖片要跑近3天,就直接放到了云端,定時(shí)去下載合照,為剩下的相片留下空間,而且程序不能中斷,就用這個(gè)命令暫停進(jìn)程,之后把相片領(lǐng)到本地,在啟用程序繼續(xù)跑。
<span class="token function">kill</span> -9 -15
這是兩個(gè)參數(shù)都是拿來(lái)殺害進(jìn)程的。
-9,就是之前說(shuō)的直接殺害紅旗linux系統(tǒng)下載,有可能留下僵尸進(jìn)程
-15,先殺害子進(jìn)程在,最后在殺害主進(jìn)程,不會(huì)有僵尸進(jìn)程
這個(gè)沒(méi)啥特殊的,不說(shuō)了,盡量用15,不行再用9
2.前后臺(tái)轉(zhuǎn)換
在終端直接運(yùn)行傲游可以打開(kāi)瀏覽器,而且這個(gè)時(shí)侯終端都會(huì)被占用,難以繼續(xù)操作,所以我們要把它轉(zhuǎn)入后臺(tái)去。
firefox <span class="token operator">&</span>
后面加一個(gè)&,可以將進(jìn)程切換到后臺(tái),終端會(huì)返回一個(gè)進(jìn)程號(hào)linux find,可以通過(guò)進(jìn)程號(hào)查詢進(jìn)程。
這是直接后臺(tái)啟用,那我向?qū)⑶芭_(tái)正在運(yùn)行的程序linux計(jì)劃任務(wù)沒(méi)有運(yùn)行,轉(zhuǎn)入后臺(tái)應(yīng)當(dāng)如何做呢?
我在這兒創(chuàng)建兩個(gè)文件,分別叫1和2,上面各寫(xiě)一串?dāng)?shù)字
這個(gè)時(shí)侯,步入文件1的編輯界面使用快捷鍵Ctrl+Z
他會(huì)手動(dòng)將這個(gè)進(jìn)程調(diào)到后臺(tái)去linux計(jì)劃任務(wù)沒(méi)有運(yùn)行,繼續(xù)把2也也調(diào)到后臺(tái)
我們可以通過(guò)fg命令將后臺(tái)程序調(diào)到前臺(tái)來(lái)
都會(huì)回到編輯時(shí)的狀態(tài)
注:fg會(huì)回到近來(lái)一次的調(diào)換前,假如我們想回到更早的線程該如何做?
先用jobs查看后臺(tái)進(jìn)程
fg+編號(hào)即可回到相應(yīng)的進(jìn)程
總結(jié)
此次博客內(nèi)容就到這兒。
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!

Hot AI Tools

Undress AI Tool
Undress images for free

Undresser.AI Undress
AI-powered app for creating realistic nude photos

AI Clothes Remover
Online AI tool for removing clothes from photos.

Clothoff.io
AI clothes remover

Video Face Swap
Swap faces in any video effortlessly with our completely free AI face swap tool!

Hot Article

Hot Tools

Notepad++7.3.1
Easy-to-use and free code editor

SublimeText3 Chinese version
Chinese version, very easy to use

Zend Studio 13.0.1
Powerful PHP integrated development environment

Dreamweaver CS6
Visual web development tools

SublimeText3 Mac version
God-level code editing software (SublimeText3)

Hot Topics

While writing program files or normal text files, programmers and writers sometimes want to know the difference between two files or two versions of the same file. When you compare two computer files on Linux, the difference between their contents is

There are three ways to create empty files in the command line: First, the simplest and safest use of the touch command, which is suitable for debugging scripts or placeholder files; Second, it is quickly created through > redirection but will clear existing content, which is suitable for initializing log files; Third, use echo"> file name to create a file with an empty string, or use echo-n""> file name to avoid line breaks. These three methods have their own applicable scenarios, and choosing the right method can help you complete the task more efficiently.

Are you looking for good software to write mathematical equations? If so, this article provides the top 5 equation editors that you can easily install on your favorite Linux distribution.In addition to being compatible with different types of mathema

dutree is a free, open-source, fast command-line tool for analyzing disk usage, written in the Rust programming language. It was created by combining durep (disk usage reporter) and tree (list directory content in tree-like format) command-line tools

Eclipse is a free integrated development environment (IDE) that programmers around the world use to write software, primarily in Java, but also in other major programming languages using Eclipse plugins.The latest release of Eclipse IDE 2023?06 does

ifconfig in short “interface configuration” utility for system/network administration in Unix/Linux operating systems to configure, manage, and query network interface parameters via command-line interface or in a system configuration scripts

Linux administrators should be familiar with the command-line environment. Since GUI (Graphical User Interface) mode in Linux servers is not commonly installed.SSH may be the most popular protocol to enable Linux administrators to manage the servers

Linux has a rich collection of commands, and while many of them are powerful and useful for various tasks, there are also some funny and whimsical commands that you can try out for amusement. 1. sl Command (Steam Locomotive) You might be aware of the
