linnux 3
kill [信号代码] 进程ID
以优雅的方式结束进程
# kill -l PID
-l选项告诉kill命令用好像启动进程的用户已注销的方式结束进程。当使用该选项时,kill命令也试图杀死所留下的子进程。但这个命令也不是总能成功--或许仍然需要先手工杀死子进程,然后再杀死父进程。
# kill -HUP PID
该命令让Linux和缓的执行进程关闭,然后立即重启。在配置应用程序的时候,这个命令很方便,在对配置文件修改后需要重启进程时就可以执行此命令。
TERM信号
给父进程发送一个TERM信号,试图杀死它和它的子进程。
# kill -TERM PPID
对于僵尸进程,可以用kill -9 来强制终止退出;
比如一个程序已经彻底死掉,如果kill 不加信号强度是没有办法退出,最好的办法就是加信号强度 -9
pkill
pkill 和killall 应用方法差不多,也是直接杀死运行中的程序;如果您想杀掉单个进程,请用kill 来杀掉。
pkill -kill -t 踢人。。。
xkill 是在桌面用的杀死图形界面的程序 ?
pgrep 有点像是 ps+grep的缩写 pgrep相当于 ps –eo pid,cmd | awk ‘{print $1,$2}’ | grep KeyWord
pgrep查找的是程序名,不包括其参数
如下,参数里包括要查找的参数,而程序名中不包括,所有没查找到。
ps ps的参数实在太多,man ps一下,初学的时候也看不明白。没时间仔细去看。
每天用的ps -ef 中的ef 分别是什么意思?
e everything
f full msg
# ps zxvqwe
ERROR: Unsupported option (BSD syntax)
********* simple selection ********* ********* selection by list *********
-A all processes -C by command name
-N negate selection -G by real group ID (supports names)
-a all w/ tty except session leaders -U by real user ID (supports names)
-d all except session leaders -g by session OR by effective group name
-e all processes -p by process ID
T all processes on this terminal -s processes in the sessions given
a all w/ tty, including other users -t by tty
g OBSOLETE -- DO NOT USE -u by effective user ID (supports names)
r only running processes U processes for specified users
x processes w/o controlling ttys t by tty
*********** output format ********** *********** long options ***********
-o,o user-defined -f full --Group --User --pid --cols --ppid
-j,j job control s signal --group --user --sid --rows --info
-O,O preloaded -o v virtual memory --cumulative --format --deselect
-l,l long u user-oriented --sort --tty --forest --version
-F extra full X registers --heading --no-heading --context
********* misc options *********
-V,V show version L list format codes f ASCII art forest
-m,m,-L,-T,H threads S children in sum -y change -l format
-M,Z security data c true command name -c scheduling class
-w,w wide output n numeric WCHAN,UID -H process hierarchy
Usage: pgrep [-cflvx] [-d DELIM] [-n|-o] [-P PPIDLIST] [-g PGRPLIST] [-s SIDLIST] v reverse的意思, x 正则匹配 c count l list pid u user d delimiter for delimit
[-u EUIDLIST] [-U UIDLIST] [-G GIDLIST] [-t TERMLIST] [PATTERN]
# pgrep -l java --- 加l参数看起来比较友好
31409 java
31447 java
# pgrep java
31409
31447
# pgrep -d ZZZ java 以ZZZ分隔
23095ZZZ23947
http://www.cnblogs.com/lwgdream/p/3407821.html
-l 同时显示进程名和PID
-o 当匹配多个进程时,显示进程号最小的那个
-n 当匹配多个进程时,显示进程号最大的那个
注:进程号越大,并不一定意味着进程的启动时间越晚
NAME
regcomp, regexec, regerror, regfree - POSIX regex functions c函数都会有帮助文档的。。
SYNOPSIS
#include <sys/types.h>
#include <regex.h>
int regcomp(regex_t *preg, const char *regex, int cflags);
int regexec(const regex_t *preg, const char *string, size_t nmatch,
regmatch_t pmatch[], int eflags);
size_t regerror(int errcode, const regex_t *preg, char *errbuf,
size_t errbuf_size);
void regfree(regex_t *preg);
STRING(3) Linux Programmer's Manual STRING(3)
NAME
strcasecmp, strcat, strchr, strcmp, strcoll, strcpy, strcspn, strdup, strfry, strlen, strncat, strncmp, strncpy, strncasecmp, strpbrk, strrchr, strsep, strspn, strstr, strtok, strxfrm, index, rindex - string operations
SYNOPSIS
#include <strings.h>
int strcasecmp(const char *s1, const char *s2);
int strncasecmp(const char *s1, const char *s2, size_t n);
char *index(const char *s, int c);
char *rindex(const char *s, int c);
#include <string.h>
char *strcat(char *dest, const char *src);
char *strchr(const char *s, int c)
。。。。
一个是 Linux User's Manual 一个是 Linux Programmer's Manual
pstree 这是一个神奇的命令,不过,我现在还不能完全看懂。
树状显示进程信息,相当于 ps -H
-a 显示完整命令及参数
-c 重复进程分别显示
-c 显示进程ID PID
-n 按 PID 排列进程
nohup <命令>
将任务提交到后台,输出附加到 ~/nohup.out 文件。即便用户退出登录,提交的命令仍继续执行。
<命令> &
背景执行此命令,如果用户退出登录,则命令停止执行
<命令1> ; <命令2> ; ......
命令队列,从左向右,依次执行以 ; 分隔的命令
<命令1> && <命令2> && ......
命令队列,从左向右,依次执行以 && 分隔的命令。前一个命令执行成功,后一个命令才能执行
linnux 3的更多相关文章
- 在linnux下,配置自动备份oacle
以oracle身份登录到linux,在oracle home目录下创建目录 shell $ mkdir shell 创建自动备份脚本 $ cd shell $ touch expdp.sh $ chm ...
- Linnux入门之简介
一.Linux简介 Minix(教授实验) -> Linux(大三学生Linus)企鹅作为吉祥物 linux主要分为内核版本和发行版本 linux 内核版本 :官网下载:https://www. ...
- 网页转图片,html生成图片,网页生成图片(基于linnux+phantomjs)和wkhtmltoimage
安装扩展: (1)下面是我在linux上的安装过程,如果没有安装git请先yum install git 安装casperjs cd / git clone git://githu ...
- Linnux命令大全(vim)
vim复制和粘贴的基本命令(注:需先退出编辑模式) yy复制游标所在行整行.或大写一个Y. (常用) 2yy或y2y复制两行. (常用) y^复制至行首,或y0.不含游标所在处字元. ...
- linnux安装多台redis
安装: 1.获取redis资源 wget http://download.redis.io/releases/redis-4.0.8.tar.gz 2.解压 tar xzvf redis-4.0.8. ...
- linnux命令 - brctl和ifconfig
1.安装brctl centos7.6安装使用 yum install bridge-utils ubuntu使用 apt-get install bridge-utils 什么是网桥 网桥是一种在链 ...
- RabbitMQ在window的搭建
RabbitMq window 搭建设置过程,网上有些说的不太明白,所以亲自操刀测试过程,参考了很多人的资料,多谢各位大神的宝贵资料第一步:装RabbitMq运行环境,类似一个虚拟机的东东 1.otp ...
- Druid 基础使用-操作篇(Imply )
一.Imply Druid 原生的配置较麻烦,在上一篇单机版安装中有所涉及 Imply 基于Druid 进行了一些组件的开发,提供开源社区版本和商业版,简化了部署,开发了一些应用.https:// ...
- Django开发博客 入门篇
Django是神马? Django是一个开源免费的Web框架,使用Python编写.能够让你快速写出一个Web应用, 因为它包含了绝大部分的组件,比如认证,表单,ORM,Session,安全,文件上传 ...
随机推荐
- android六大框架
-LinearLayout线性布局 垂直排序,每行仅包含一个界面元素 水平排序,每列仅包含一个界面元素 orientation,Layout-weight,Layout-margin(外边距,与屏幕) ...
- css3选择器总结
1.p[class^/$/*=td]所有p标签的前面带有td/后面带有td/所有带有td的类的三种样式. 2.div:first-child/last-child/nth-child()在父元素下的第 ...
- C# 有关打印机的连接判断...随便看看
各位coder手下留情 /// <summary> /// 判断是否连接打印机 /// </summary> public bool CheckPrinter() { //取得 ...
- JAVA SSH 框架介绍
SSH 为 struts+spring+hibernate 的一个集成框架,是目前较流行的一种JAVA Web应用程序开源框架. Struts Struts是一个基于Sun J2EE平台的MVC框架, ...
- CodeForces 742A Arpa’s hard exam and Mehrdad’s naive cheat
题意:求1378 n次幂的最后一位. 析:两种方法,第一种,就是快速幂,第二种找循环节,也很好找,求一下前几个数就好. 代码如下: #pragma comment(linker, "/STA ...
- SQL Server 查出未提交事务(长事务)SQL
),value )); INSERT INTO @tab EXEC('DBCC OPENTRAN WITH TABLERESULTS'); SELECT name,CAST(value AS DATE ...
- Evaluation Clustering methods
There are many evaluation measures available like entropy, recall, precision, F-measure, silhouette ...
- MVC4相关Razor语法浅谈
1._LayOut.cshtml 文件为mvc的布局文件,里面包函的是htm的静态文件,作为mvc其他view的基础母版使用,子视图要不想想调用它只需在页面设置@{Layout=null;}即可,现对 ...
- 写在学AngularJS之前
近来从不同途径听说AngularJS和MEAN stack,感觉很有趣的样子,于是准备抽时间来学习一下.在这里记录学习过程中的笔记. 简单整理一下先: 1. 我的学习资料: a) 官网 b) wiki ...
- shell循环
for循环 for循环一般格式为: for 变量 in 列表 do command1 command2 ... commandN done 列表是一组值(数字.字符串等)组成的序列,每个值通过空格分隔 ...