Linux根据进程名称获取pid的方法

Linux系统调用:获取进程PID 得到的ppid是一个正整数,在我的机器上是24176.在/proc目录下可以看到很多进程的信息。(版权归原文作者所有,侵权留言联系删除) 阅读详情

以下通过两种方法来根据进程名称获取pid

 

方法一

最简单的方法是使用 pidof 命令

用法:pidof  process_name

 

示例

官网的详细用法如下:

NAME
       pidof -- find the process ID of a running program.

SYNOPSIS
       pidof [-s] [-c] [-n] [-x] [-m] [-o omitpid[,omitpid..]]  [-o omitpid[,omitpid..]..]  program [program..]

DESCRIPTION
       Pidof finds the process id's (pids) of the named programs. It prints those id's on the standard output. This program is on some systems used in run-level change scripts, especially when
       the system has a System-V like rc structure. In that case these scripts are located in /etc/rc?.d, where ? is the runlevel. If the system has a start-stop-daemon (8) program that should
       be used instead.

OPTIONS
       -s     Single shot - this instructs the program to only return one pid.

       -c     Only  return  process ids that are running with the same root directory.  This option is ignored for non-root users, as they will be unable to check the current root directory of
              processes they do not own.

       -n     Avoid stat(2) system function call on all binaries which are located on network based file systems like NFS.  Instead of using this option the the variable PIDOF_NETFS may be set
              and exported.

       -x     Scripts too - this causes the program to also return process id's of shells running the named scripts.

       -o omitpid
              Tells  pidof  to omit processes with that process id. The special pid %PPID can be used to name the parent process of the pidof program, in other words the calling shell or shell
              script.

       -m     When used with -o, will also omit any processes that have the same argv[0] and argv[1] as any explicitly omitted process ids. This can be used to  avoid  multiple  shell  scripts
              concurrently calling pidof returning each other's pids.

EXIT STATUS
       0      At least one program was found with the requested name.

       1      No program was found with the requested name.

NOTES
       pidof is actually the same program as killall5; the program behaves according to the name under which it is called.

       When pidof is invoked with a full pathname to the program it should find the pid of, it is reasonably safe. Otherwise it is possible that it returns pids of running programs that happen
       to have the same name as the program you're after but are actually other programs. Note that that the executable name of running processes is calculated with  readlink(2),  so  symbolic
       links to executables will also match.

 

方法二

可以使用ps命令

ps -fC process_name

 

过滤出pid

ps -fC process_name | sed '1d' | awk '{print $2}'

 

 

一个简单的脚本测试一下一上两种方法【脚本名称:pid.sh】

#!/bin/bash


if [ $# -ne 1 ]
then
        echo "Usage : sh pid.sh  process_name"
        exit 1
fi

PID=`pidof $1`

if [ -n "$PID" ]
then
        echo "$1 pid is $PID"
else
        echo "$1 process is not running!"
fi


echo "======================================="


PID=`ps -fC $1 | sed '1d' | awk '{print $2}'`

if [ -n "$PID" ]
then
        echo "$1 pid is $PID"
else
        echo "$1 process is not running!"
fi

exit 0

 

sh pid.sh mysqld

材料仿真软件:LAMMPS_(8).温度和压力控制 在 LAMMPS 中,温度和压力的控制是通过多种恒温器和恒压器实现的。Nose-Hoover 恒温器和恒压器因其准确性和广泛适用性而被经常使用,而 Berendsen 恒温器和恒压器则因其计算效率高而适用于初步仿真或粗粒化模型。温度重标和压力重标方法虽然简单,但在某些情况下可以快速调整系统的温度和压力。通过选择合适的控制方法,可以根据具体的需求和系统特性来设计和运行分子动力学仿真,从而获得准确和可靠的结果。在实际应用中,建议先进行初步的仿真以确定合适的控制参数,然后再进行细致的仿真以验证结果的稳定性。 阅读详情

相关推荐

IEC61850实战:从ICD文件解析到模型构建

本文深入解析IEC61850标准中的ICD文件结构,从Header、IED到DataTypeTemplates部分,详细介绍了如何构建电力自动化设备的数据模型。通过实战案例展示ICD文件的创建过程,并分享常见问题的调试技巧,帮助工程师快速掌握IEC61850建模方法,提升电力系统自动化项目的实施效率。

weixin_26841743的博客 497

根据进程名字查找pid

Liunx中通过进程名查找进程PID可以通过 pidof [进程名] 来查找。反过来 ,相同通过PID查找进程名则没有相关命令。在linux根目录中,有一个/proc的VFS(虚拟文件系统),系统当前运行的所有进程都对应于该目录下的一个以进程PID命名的文件夹,其中存放进程运行的N多信息。其中有一个status文件,cat显示该文件, 第一行的Name即为进程名。 打开stardict程序,

aa787282301的博客 8295

[c语言]用辗转相除法求最大公约数,递归和不递归两种

在c语言的学习中必然会遇到求两个数之间的最大公约数的题目,那么对于其他经典方法,最简便快捷的方式就是利用辗转相除法 辗转相除法又叫做欧几里得算法,目的是为了求两个正整数的最大公约数 定理:gcd(a,b) = gcd(b ,a%b) //在这里用(a,b)表示a和b的最大公约数证明:a可以表示成a = kb + r,则r = a %b 假设d是a,b的一个公约数,则有 d|a, d|b,而r = a - kb,因此d|r //这里的"|"的意思是 :d是b的因数 ,d是a的因数 因此d...

ZZRBlogger的博客 1万+

根据进程名查找进程PID

#include using namespace std; //#include #include #include"tlhelp32.h" DWORD CheckModule(char* ProcessName) {//传入的参数是要搜索的进程名 HANDLE hSnapshot; PROCESSENTRY32 lppe; BOOL Find; BOOL Found; hSn

lingxiu0613的专栏 4911

KingSCADA实现按钮点击效果

哈喽,你好啊,我是雷工!在做SCADA项目的时候,按钮是不可缺少的功能,但软件自带的按钮太丑,已经无法满足现如今客户对界面美观度的要求。这时候就需要UI小姐姐设计美观大气的SCADA界面,但UI设计的按钮切图放到程序中只是图片素材,当添加了按钮功能时,虽然能实现按钮功能,但没有任何点击效果;当遇到有需要连锁条件才能点击的按钮时,操作员无法区分是有连锁点击了没反应,还是系统界面卡死了导致的没点击成功,这时候有点击效果就能很好的区分这种问题。本篇介绍一种实现按钮点击效果的方法,以下为操作过程。

做有价值的事,积累有价值的笔记! 2768

【图像去噪】论文精读:AKDT: Adaptive Kernel Dilation Transformer for Effective Image Denoising

论文题目:AKDT: Adaptive Kernel Dilation Transformer for Effective Image Denoising —— AKDT:用于有效图像去噪的自适应核膨胀Transformer图像去噪是一项基本但具有挑战性的任务,特别是在处理高分辨率图像和复杂的噪声模式时。大多数现有方法依赖于标准的 Transformer 架构,该架构通常计算复杂度高,并且对不同噪声水平的适应性有限。在本文中,我们介绍了自适应核膨胀Transformer(AKDT)

主要更新底层视觉(去噪、超分等)相关的科研内容,形式为【论文精读】+【论文复现】 1050

linux c语言中如何通过进程名获取进程PID(awk命令行指令)popen、pclose(popen获取当前路径pwd函数)

参考文章:Linux下C语言开发(已知进程名得到其PID号) 不唯一匹配(包含字符的全都匹配上)(而且进程名最多为15个字符?) ubuntu上 ps -e | grep 'receive' | awk '{print $1}' arm摄像头上 ps -e | grep 'ky_ai_camera_en' | awk '{print $1}' 等等再弄 ......

Dontla的博客 5318

WinClaw安全实战 02|五层纵深防护体系全解析:从原理到实操,打造零风险AI智能体

2026年AI智能体爆发式普及,OpenClaw以27.3万GitHub星标成为现象级工具,但恶意Skill投毒、提示词注入、数据外泄等安全事故频发,国家互联网应急中心、工信部等多部门接连发布风险警示。威努特基于国家关键信息基础设施安全防护经验,打造WinClaw安全版AI智能体,其核心竞争力在于**五层纵深防护体系**。本文从安全痛点切入,通过真实事故案例揭示风险本质,全景解构五层防护的架构设计与技术原理,逐层拆解身份认证、安装审查、消息拦截、执行约束、监控审计的实现逻辑,搭配20+实操演示、对比表格

专注于人工智能、软件开发、工控自动化、工厂数字化及智能化等领域,希望和大家共同进步! 500

Linux查看进程PID的方法(linux查进程的pid)附带自动kill 掉

Linux查看进程PID的方法 Linux作为一款多用户、多任务的操作系统,可以同时处理多个任务,每个任务的执行都由进程来实现。在每个进程执行的过程中,都会有一个唯一标识符,即称为PID(Process Identifier)进程ID。Linux系统有很多命令用来查看进程PID,下面介绍几种常用的查看进程PID的方法。 #### 一、ps命令 ps命令可以查看linux系统当前账号运行的所有进程,查看进程PID的命令格式为: ps aux | grep 其中,aux参数表示列出系统所有用户的所有进程

李逍遥 6万+

ESP32学习笔记03-日志打印

日志分为5个等级。

Car12 1416

三维重建(十八)——colmap的使用(粗浅)

三维重建(十八)——colmap的使用(粗浅)

河海大学研究生在读的学习笔记 1378

多个同名进程linux获取对应pid,Linux根据进程名称获取pid的方法-Go语言中文社区...

以下通过两种方法来根据进程名称获取pid方法一最简单的方法是使用pidof命令用法:pidof process_name示例官网的详细用法如下:NAMEpidof -- find the process ID of a running program.SYNOPSISpidof [-s] [-c] [-n] [-x] [-m] [-o omitpid[,omitpid..]] [-o omit...

weixin_35075655的博客 888

AgentScope实战训练营- Java从零开始快速构建Agent完整教程

本文基于阿里巴巴开源的 AgentScope Java 框架,从零开始手把手带你构建 AI 智能体应用。内容涵盖环境搭建、基础对话、工具调用、结构化输出、多Agent流水线、Hook可观测性、会话持久化、MCP协议、RAG知识库集成、多模态工具、技能系统、Spring Boot Web部署等21个核心模块,附带完整可运行代码示例,帮助Java开发者快速掌握Agent开发全流程。

program哲学 868

Linux 终止进程

在 Linux 中,如果你需要终止正在运行的 进程,可以使用以下几种方法,以。命令可以根据进程名称直接终止进程,无需知道具体的 PID(进程 ID)。)运行的,普通用户可能没有权限终止它。进程的 PID(进程 ID),可以直接使用。信号(信号编号 9),强制立即终止进程。👍 种一棵树最好的时间是十年前,其次是现在。信号(信号编号 15),请求进程终止。通过以上方法,你可以灵活地根据需求终止。如果不想手动查找 PID,可以结合。命令也可以通过进程名称终止进程。命令自动获取并终止进程。进程,则表示已成功终止。

关注我学习编程不迷路 804

LinePhone3.2.7(android端最新版本) sip客户端

SIP客户端For android:LinePhone3.2.7(最新版本),官网地址:http://www.linphone.org/

华为的C语言编程规范.pdf

华为技术有限公司内部技术规范。本规范制定了编写C语言程序的基本原则、规则和建议。从代码的清晰、简洁、可测试、安全、程序效率、可移植各个方面对C语言编程作出了具体指导。

linux实用小程序,[原]Linux进程控制实用小程序(更新中)

Linux环境下编程,经常会遇到进程控制的问题,例如fork,exec以及查找,杀死进程。下面是一些比较实用的进程控制小程序:1.根据名称查找返回进程PID#define PS_COMMAND "ps|grep "//注意:不是所有平台都支持"ps -ax" 因此这里使用比较通用的"ps"#define SCAN(buf) (sscanf(buf,"%d %s %s %s %s",pid,s[0]...

weixin_35417196的博客 249

pscad IEEE标准系统搭建说明

pscad IEEE标准系统搭建说明,包含典型的IEEE 9节点、14节点、30节点、39节点和118节点系统。内含标准测试系统的原始数据和潮流结果。

查看进程及结束进程命令

win和linux系统中查看并杀死进程

m0_59119256的博客 6526

深度学习工具包 DeepLearningToolbox

深度学习工具包Deprecation notice.-----This toolbox is outdated and no longer maintained.There are much better tools available for deep learning than this toolbox, e.g. [Theano](http://deeplearning.net/software/theano/), [torch](http://torch.ch/) or [tensorflow](http://www.tensorflow.org/)I would suggest you use one of the tools mentioned above rather than use this toolbox.Best, Rasmus.DeepLearnToolbox================A Matlab toolbox for Deep Learning.Deep Learning is a new subfield of machine learning that focuses on learning deep hierarchical models of data.It is inspired by the human brain's apparent deep (layered, hierarchical) architecture.A good overview of the theory of Deep Learning theory is[Learning Deep Architectures for AI](http://www.iro.umontreal.ca/~bengioy/papers/ftml_book.pdf)For a more informal introduction, see the following videos by Geoffrey Hinton and Andrew Ng.* [The Next Generation of Neural Networks](http://www.youtube.com/watch?v=AyzOUbkUf3M) (Hinton, 2007)* [Recent Developments in Deep Learning](http://www.youtube.com/watch?v=VdIURAu1-aU) (Hinton, 2010)* [Unsupervised Feature Learning and Deep Learning](http://www.youtube.com/watch?v=ZmNOAtZIgIk) (Ng, 2011)If you use this toolbox in your research please cite [Prediction as a candidate for learning deep hierarchical models of data](http://www2.imm.dtu.dk/pubdb/views/publication_details.php?id=6284)```@MASTERSTHESIS\{IMM2012-06284, author = "R. B. Palm", title = "Prediction as a candidate for learning deep hierarchical models of data", year = "2012",}```Contact: rasmusbergpalm at gmail dot comDirectories included in the toolbox-----------------------------------`NN/` - A library for Feedforward Backpropagation Neural Networks`CNN/` - A library for Convolutional Neural Networks`DBN/` - A library for Deep Belief Networks`SAE/` - A library for Stacked Auto-Encoders`CAE/` - A library for Convolutional Auto-Encoders`util/` - Utility functions used by the libraries`data/` - Data used by the examples`tests/` - unit tests to verify toolbox is workingFor references on each library check REFS.mdSetup-----1. Download.2. addpath(genpath('DeepLearnToolbox'));Example: Deep Belief Network---------------------```matlabfunction test_example_DBNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit RBM and visualize its weightsrand('state',0)dbn.sizes = [100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);figure; visualize(dbn.rbm{1}.W'); % Visualize the RBM weights%% ex2 train a 100-100 hidden unit DBN and use its weights to initialize a NNrand('state',0)%train dbndbn.sizes = [100 100];opts.numepochs = 1;opts.batchsize = 100;opts.momentum = 0;opts.alpha = 1;dbn = dbnsetup(dbn, train_x, opts);dbn = dbntrain(dbn, train_x, opts);%unfold dbn to nnnn = dbnunfoldtonn(dbn, 10);nn.activation_function = 'sigm';%train nnopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.10, 'Too big error');```Example: Stacked Auto-Encoders---------------------```matlabfunction test_example_SAEload mnist_uint8;train_x = double(train_x)/255;test_x = double(test_x)/255;train_y = double(train_y);test_y = double(test_y);%% ex1 train a 100 hidden unit SDAE and use it to initialize a FFNN% Setup and train a stacked denoising autoencoder (SDAE)rand('state',0)sae = saesetup([784 100]);sae.ae{1}.activation_function = 'sigm';sae.ae{1}.learningRate = 1;sae.ae{1}.inputZeroMaskedFraction = 0.5;opts.numepochs = 1;opts.batchsize = 100;sae = saetrain(sae, train_x, opts);visualize(sae.ae{1}.W{1}(:,2:end)')% Use the SDAE to initialize a FFNNnn = nnsetup([784 100 10]);nn.activation_function = 'sigm';nn.learningRate = 1;nn.W{1} = sae.ae{1}.W{1};% Train the FFNNopts.numepochs = 1;opts.batchsize = 100;nn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.16, 'Too big error');```Example: Convolutional Neural Nets---------------------```matlabfunction test_example_CNNload mnist_uint8;train_x = double(reshape(train_x',28,28,60000))/255;test_x = double(reshape(test_x',28,28,10000))/255;train_y = double(train_y');test_y = double(test_y');%% ex1 Train a 6c-2s-12c-2s Convolutional neural network %will run 1 epoch in about 200 second and get around 11% error. %With 100 epochs you'll get around 1.2% errorrand('state',0)cnn.layers = { struct('type', 'i') %input layer struct('type', 'c', 'outputmaps', 6, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %sub sampling layer struct('type', 'c', 'outputmaps', 12, 'kernelsize', 5) %convolution layer struct('type', 's', 'scale', 2) %subsampling layer};cnn = cnnsetup(cnn, train_x, train_y);opts.alpha = 1;opts.batchsize = 50;opts.numepochs = 1;cnn = cnntrain(cnn, train_x, train_y, opts);[er, bad] = cnntest(cnn, test_x, test_y);%plot mean squared errorfigure; plot(cnn.rL);assert(er<0.12, 'Too big error');```Example: Neural Networks---------------------```matlabfunction test_example_NNload mnist_uint8;train_x = double(train_x) / 255;test_x = double(test_x) / 255;train_y = double(train_y);test_y = double(test_y);% normalize[train_x, mu, sigma] = zscore(train_x);test_x = normalize(test_x, mu, sigma);%% ex1 vanilla neural netrand('state',0)nn = nnsetup([784 100 10]);opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samples[nn, L] = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.08, 'Too big error');%% ex2 neural net with L2 weight decayrand('state',0)nn = nnsetup([784 100 10]);nn.weightPenaltyL2 = 1e-4; % L2 weight decayopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex3 neural net with dropoutrand('state',0)nn = nnsetup([784 100 10]);nn.dropoutFraction = 0.5; % Dropout fraction opts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex4 neural net with sigmoid activation functionrand('state',0)nn = nnsetup([784 100 10]);nn.activation_function = 'sigm'; % Sigmoid activation functionnn.learningRate = 1; % Sigm require a lower learning rateopts.numepochs = 1; % Number of full sweeps through dataopts.batchsize = 100; % Take a mean gradient step over this many samplesnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex5 plotting functionalityrand('state',0)nn = nnsetup([784 20 10]);opts.numepochs = 5; % Number of full sweeps through datann.output = 'softmax'; % use softmax outputopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, train_x, train_y, opts);[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');%% ex6 neural net with sigmoid activation and plotting of validation and training error% split training data into training and validation datavx = train_x(1:10000,:);tx = train_x(10001:end,:);vy = train_y(1:10000,:);ty = train_y(10001:end,:);rand('state',0)nn = nnsetup([784 20 10]); nn.output = 'softmax'; % use softmax outputopts.numepochs = 5; % Number of full sweeps through dataopts.batchsize = 1000; % Take a mean gradient step over this many samplesopts.plot = 1; % enable plottingnn = nntrain(nn, tx, ty, opts, vx, vy); % nntrain takes validation set as last two arguments (optionally)[er, bad] = nntest(nn, test_x, test_y);assert(er < 0.1, 'Too big error');```[![Bitdeli Badge](https://d2weczhvl823v0.cloudfront.net/rasmusbergpalm/deeplearntoolbox/trend.png)](https://bitdeli.com/free "Bitdeli Badge")

[c] find_pid_by_name

extern pid_t find_pid_by_name( char* pidName) { DIR *dir; struct dirent *next; pid_t pid; if ( strcmp(pidName, "init")==0) return 1; dir = opendir("/proc"); if (!dir) { printf("Cannot ope...

u012335044的博客 561

HoRain云--Linux运维:快速从PID查进程名

本文介绍了Linux系统中通过PID查找进程名称的4种实用方法:1)使用ps命令快速查询进程名;2)直接读取/proc文件系统;3)通过top命令交互查看;4)利用pgrep反向验证。文章详细说明了每种方法的命令格式和使用场景,并针对故障排查、资源监控等实际应用提供了最佳实践建议,包括权限处理、进程状态判断等注意事项。这些方法适用于所有主流Linux发行版,能有效提升系统运维效率。

sinat_57153473的博客 658

Linux常用的几个杀死进程方式

今天在玩linux的时候,需要用根据端口杀死进程,自己写了一个,如果有需要的也拿去用吧。 #根据端口号杀死进程 #原理:主要是用netstat查询并过滤指定的进程,然后通过awk分割变量提取pid号 kill -9 $(netstat -lnpt|grep :3306 |awk '{print $7}'|awk -F "/" '{print $1}') #通过进程名杀死进程 #原理:使用shell内置的命令获取进程名,然后直接杀死 pkill "java" ...

黑鹰No龙少的博客 496

根据PID获取进程名&根据进程名获取PID

通过进程名获得进程号 通过进程号获得进程名 #include <sys/types.h> #include <dirent.h> #include <stdio.h> #include <string.h> #define BUF_SIZE 1024 void getPidByName(pid_t *pid, char *task_name) ...

JaweG 4879

linux根据pid查看进程,linux根据pid获取进程名和获取进程pid(c语言获取pid)

2013Liunx中通过进程名查找进程PID可以通过 pidof [进程名] 来查找。反过来 ,相同通过PID查找进程名则没有相关命令。在linux根目录中,有一个/proc的VFS(虚拟文件系统),系统当前运行的所有进程都对应于该目录下的一个以进程PID命名的文件夹,其中存放进程运行的N多信息。其中有一个status文件,cat显示该文件, 第一行的Name即为进程名。打开stardict程序,...

weixin_33472998的博客 4399

Linux 进程 ID(PID)| 查看 / 获取

……

u013669912的博客 1万+

linux shell 获取进程pid,linux shell 根据进程名获取pid的实现方法

导读Linux 的交互式 Shell 与 Shell 脚本存在一定的差异,主要是由于后者存在一个独立的运行进程,因此在获取进程 pid 上二者也有所区别。交互式 Bash Shell 获取进程 pid在已知进程名(name)的前提下,交互式 Shell 获取进程 pid 有很多种方法,典型的通过 grep 获取 pid 的方法为(这里添加 -v grep是为了避免匹配到 grep 进程):ps -...

weixin_29957761的博客 5193

Linux下列表所有进程、根据进程名得到pid和根据pid得到进程名

Linux下的当前正在运行的进程信息均存放在/proc目录下,有一系列以数字为名的子目录,每一个子目录对应一个进程,子目录名就是进程的pid。子目录下的status文件内容就是进程的基本信息,包括进程名、pid、ppid等。因此,若要扫描系统当前正在运行的所有进程,只需要遍历/proc目录下所有以数字为名的子目录下的status即可。据此,可得到获取当前系统所有进程快照、根据pid获得进程名和根据...

kingfox的专栏 1733

根据 PID 获取 K8S Pod名称 - 反之 POD名称 获取 PID

背景随着 Kubernetes 越来越火爆,运维人员排查问题难度越来越大。比如我们收到监控报警,某台 Kubernetes Node 节点负载高。通过 top 或者 pidstat 命令...

qq_24794401的博客 3383

linux命令获取进程pid_linux shell 根据进程名获取pid的实现方法

导读Linux 的交互式 Shell 与 Shell 脚本存在一定的差异,主要是由于后者存在一个独立的运行进程,因此在获取进程 pid 上二者也有所区别。交互式 Bash Shell 获取进程 pid在已知进程名(name)的前提下,交互式 Shell 获取进程 pid 有很多种方法,典型的通过 grep 获取 pid 的方法为(这里添加 -v grep是为了避免匹配到 grep 进程):ps -...

weixin_39983912的博客 1125
上一篇: Linux配置静态ip
下一篇: mysql常用错误总结
思维的深度
博客等级 码龄11年 2万+粉丝 391原创
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

个

红包个数最小为10个

元

红包金额最低5元

当前余额3.43元 前往充值 >
需支付:10.00元
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付元
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值