进程和计划任务管理

一、查看进程的命令

1、ps

格式1:ps 查看当前用户在当前终端上运行的进程

格式2:ps aux:查看所有用户在所有终端上的进行

格式3:ps -eif:查看父子进程

2、top:动态显示进程信息,相当于Windows下的任务管理器

1)P:按CPU使用率排序

2)M:按内存使用率排序

3、pgrep:根据特定条件查询进程

格式1:pgrep -l '进程的关键字' 其中-l显示进程名

格式2:pgrep -U xiaoming -t pts/1其中-U显示特定用户运行进程,-t显示在特定终端上运行的进程

4、pstree:通过进程树的方式显示进程,可以看出进程启动的先后顺序

格式1:pstree

格式2:psree -aup    a列出完整信息   u列出用户名 pl列出pid

二、启动进程

1、手动启动

1)前台启动

2、后台启动:载明冷后加“&”符号

三、进成前后台调度

1、CTRL+z :将前台程序放入后台并停止运行

2、jobs:查看后台的进程

3、f&{后台进程标号}:将后台进程调入前台

4、bg:{后台进程标号}:让后台进程继续执行

四、终止进程的运行

1、CTRL+c:终止前台的运行

2、kill pid :结束指定的pid的进程 -9强制结束

3、killall  【-9】 进程名 :结束指定名称所有进程

4、pkill 【选项】 条件:根据指定条件结束进程

选项:

1、-9:强制结束

2、-U “用户名”:结束指定用户的所有进程

3、-t 终端:结束指定终端上的所有进程

at命令:

1、一次性计划任务

2、格式:at  小时:分钟  年-月-日

at>命令1

at>命令2

at>CTRL+d    提交任务

3、查看并设置好系统时间

1)date:查看时间

2)batae -s "年-月-日 小时:分钟:秒" :设置系统时间

atq:查看未执行的at任务

atrm编号:结束没有执行的at任务

管理周期性计划任务

1、编辑计划任务

crontab -c [-u用户名]

2、查看计划任务

crontab -l [-u用户名]

3、删除计划任务

crontab -r [-u用户名]

周期格式:

分钟 小时 日 月 星期  命令

时间数值的特殊表示方法

*  表示该范围内的任意时间

, 表示间隔的多个不连续时间点

-  表示一个连续的时间范围

/  指定间隔的时间频率

说明:周期性任务命令要写绝对路径

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
Paragraph grep tool. 进行段搜索的grep工具。默认以空行为段分隔符,并可以自己通过-p参数指定。使用方法与经典grep相同,只是从grep的行搜索变为段搜索。 此版本为Windows下的安装版本,安装后即可从命令行窗口中通过pgrep命令调用。附带源代码。 使用帮助 ------------------------------------ pgrep v1.00.x071127 by Programus (programus@gmail.com) ------------------------------------ An open source and free command line grep like tool. It prints out the paragraphs which contains the pattern instead of lines. Usage: pgrep [OPTION]... PATTERN [FILE] ... python pgrep [OPTION]... PATTERN [FILE] ... Search for PATTERN in each FILE or standard input and output a paragraph separated by separator. Example: python pgrep.py -i 'hello world' menu.h main.c OPTIONS: -c, --count Suppress normal output; instead print a count of matching lines for each input file. With the -v, --invert-match option, count non-matching lines. -e, --regexp=PATTERN Use pattern as the pattern; useful to protect patterns beginning with a -. -f, --file=FILE Obtain patterns from file, one per line. The empty file contains zero patterns, and therefore matches nothing. -h, --help Print this help -i, --ignore-case Ignore case distinctions in both the pattern and the input files. -l, --files-with-matches Suppress normal output; instead print the name of each input file from which output would normally have been printed. The scanning of every file will stop on the first match. -p, --separator=SEPARATOR Specify a separator. The default separator is '\n\s*\n'. -v, --invert-match Invert the sense of matching, to select non-matching parts.
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值