姓名:张皓落
学号:201821121005
班级:计算1811
给出实验环境:
改名结果显示:
(1)man ps结果显示:
PROLOG
This manual page is part of the POSIX Programmer‘s Manual. The Cygwin
implementation of this interface may differ (consult the corresponding
Cygwin manual page for details of Cygwin behavior), or the interface
may not be implemented on Cygwin.
NAME
ps — report process status
SYNOPSIS
ps [−aA] [−defl] [−g grouplist] [−G grouplist]
[−n namelist] [−o format]... [−p proclist] [−t termlist]
[−u userlist] [−U userlist]
DESCRIPTION
The ps utility shall write information about processes, subject to
having appropriate privileges to obtain information about those pro‐
cesses.
By default, ps shall select all processes with the same effective user
ID as the current user and the same controlling terminal as the in‐
voker
(2)ps -ef结果显示:
zhanghaoluo@LAPTOP-JQPNDS08 ~
$ ps -ef
UID PID PPID TTY STIME COMMAND
zhanghao 286 276 pty0 19:35:26 /usr/bin/ps
zhanghao 275 1 ? 19:34:38 /usr/bin/mintty
zhanghao 276 275 pty0 19:34:39 /usr/bin/bash
对应解释如下:
e: 显示所有进程
f:形成全部进程的列表
UID: 进程的用户号ID号
PID: 进程ID
PPID: 父进程ID
TTY: 终端的次要装置号码(minor device number of tty)
STIME:系统启动的时间
COMMAND: 所执行的命令
(3)ps aux结果显示:
zhanghaoluo@LAPTOP-JQPNDS08 ~
$ ps aux
PID PPID PGID WINPID TTY UID STIME COMMAND
285 276 285 20284 pty0 197609 19:34:53 /usr/bin/ps
275 1 275 2692 ? 197609 19:34:38 /usr/bin/mintty
276 275 276 328 pty0 197609 19:34:39 /usr/bin/bash
对应解释:
a: 显示所有用户的所有进程(包括其它用户)
u:按用户名和启动时间的顺序来显示进程
x:显示无控制终端的进程
PGID: 进程组ID号
(4)ps axjf 结果显示:
zhanghaoluo@LAPTOP-JQPNDS08 ~
$ ps axjf
PID PPID PGID WINPID TTY UID STIME COMMAND
234 1 234 20488 ? 197609 20:32:10 /usr/bin/mintty
235 234 235 3376 pty0 197609 20:32:10 /usr/bin/bash
244 235 244 13884 pty0 197609 20:32:38 /usr/bin/ps
j :工作的格式 (jobs format)
f :做一个更为完整的输出
(5)ps tree 结果显示:
zhanghaoluo@LAPTOP-JQPNDS08 ~
$ ps tree
PID PPID PGID WINPID TTY UID STIME COMMAND
234 1 234 20488 ? 197609 20:32:10 /usr/bin/mintty
235 234 235 3376 pty0 197609 20:32:10 /usr/bin/bash
247 235 247 1260 pty0 197609 20:38:52 /usr/bin/ps
该结果是对于进程的结果进行树形显示
Q1:在一开始对于系统的改名时遇到问题,无法对名字进行正确的修改?
解决:在网上查找资料得知以下解决方式
(1)找到cygwin的etc目录中有一 个名为passwd的文件,若没有passwd文件,登进cygwin, 用命令mkpasswd -| > /etc/passwd生成对应的文件。
(2)打开passwd这个文件,把其中的windows(我的为24481)用户名换成用户名(我的为zhanghaoluo)(在第3行, 共3处都改过来)。
(3)在cygwin的home问件名改为新用户名(我的zhanghaoluo)
(4)启动cygwin进入以后,默认的用户名就换成了新用户名(我的zhanghaoluo)了
Q2:在执行man ps显示如下界面
解决:通过在之前的下载的安装包中,选择这三个包选择相应的版本重新安装后,得以解决问题。
原文:https://www.cnblogs.com/244Q/p/12422347.html