OS第1次实验报告:熟悉使用Linux命令和剖析ps命令
个人信息
- 姓名:程开
- 学号:201821121060
- 班级:计算1812
1. 实验环境介绍
- 操作系统:Windows 家庭中文版 1903
- 平台:Cygwin及cmd命令行
将Cygwin目录下的bin文件添加到环境变量Path下面
2. 常用命令使用
等等
3.剖析ps命令
SYNOPSIS ps [−aA] [−defl] [−g grouplist] [−G grouplist] [−n namelist] [−o format]... [−p proclist] [−t termlist] [−u userlist] [−U userlist]
−a Write information for all processes associated with terminals. Implementations may omit session leaders from this list.
Write information for processes whose session leaders are given in grouplist. The application shall ensure that the grouplist is a single argument in the form of a <blank> or
<comma>-separated list.
Write information for processes whose real group ID numbers are given in grouplist. The application shall ensure that the grouplist is a single argument in the form of a <blank> or
<comma>-separated list.
Specify the name of an alternative system namelist file in place of the default. The name of the default file and the format of a namelist file are unspecified.
shall be interpreted as the <space>-separated concatenation of all the format option-arguments.
Write information for processes whose process ID numbers are given in proclist. The application shall ensure that the proclist is a single argument in the form of a <blank> or
<comma>-separated list.
Write information for processes associated with terminals given in termlist. The application shall ensure that the termlist is a single argument in the form of a <blank> or <comma>-sep‐
arated list. Terminal identifiers shall be given in an implementation-defined format. On XSI-conformant systems, they shall be given in one of two forms: the device's filename (for ex‐
ample, tty04) or, if the device's filename starts with tty, just the identifier following the characters tty (for example, "04").
Write information for processes whose user ID numbers or login names are given in userlist. The application shall ensure that the userlist is a single argument in the form of a <blank>
or <comma>-separated list. In the listing, the numerical user ID shall be written unless the −f option is used, in which case the login name shall be written.
Write information for processes whose real user ID numbers or login names are given in userlist. The application shall ensure that the userlist is a single argument in the form of a
<blank> or <comma>-separated list.
命令ps -ef:显示所有进程信息,连同命令行
-e:显示所有进程
-f:全格式
ps -e 列出程序时,显示每个程序所使用的环境变量。
ps -f 用ASCII字符显示树状结构,表达程序间的相互关系
UID: 说明该程序被谁拥有
PID:就是指该程序的 ID
PPID: 就是指该程序父级程序的 ID
STIME: 程序的启动时间
TTY: 指的是登录终端
CMD: 下达的指令
D: 无法中断的休眠状态 (通常 IO 的进程)
R: 正在执行中
S: 静止状态
T: 暂停执行
Z: 不存在但暂时无法消除
W: 没有足够的记忆体分页可分配
<: 高优先序的行程
N: 低优先序的行程
L: 有记忆体分页分配并锁在记忆体内 (实时系统或捱A I/O)
START: 行程开始时间
命令 ps -aux:显示所有包含其他使用者的行程
-a:显示所有进程
-u :以用户为主的进程状态
x :通常与 a 这个参数一起使用,可列出较完整信息
命令ps -l:将目前属于您自己这次登入的 PID 与相关信息列示出来
ps d :显示所有进程,除了用户
l :较长、较详细的将该PID 的的信息列出
j :工作的格式 (jobs format)
g:过时,不在使用
-g:按进程或者效率把名字分组
p:按进程ID显示
4. 通过该实验产生新的疑问及解答
① 开始使用man ps命令提示"没有ps的手册页条目"
解决方法:再装一次cygwin,同时在包里面找到man-page导入就可以了
②ps命令能够支持的系统类型相当的多,所以他的参数很多,而且有没有加上 - 差很多,中间犯了一些错。