姓名:危文涛
学号:201821121048
班级:计算1812
一、实验环境介绍
操作系统:Microsoft Windows(版本:18363.657)
平台:Cygwin
用户名:危文涛
二、实验内容
- 使用
man
查询命令使用手册
- 基本命令使用
help:
ls -al:
- 剖析ps命令
运行man ps,将手册内容copy:
This manual page is part of the POSIX Programmer's Manual. The Linux
implementation of this interface may differ (consult the corresponding
Linux manual page for details of Linux behavior), or the interface may
not be implemented on Linux.
ps — report process status
ps [−aA] [−defl] [−g grouplist] [−G grouplist]
[−n namelist] [−o format]... [−p proclist] [−t termlist]
[−u userlist] [−U userlist]
The ps utility shall write information about processes, subject to
having appropriate privileges to obtain information about those pro‐
cesses.
ID as the current user and the same controlling terminal as the in‐
voker.
The ps utility shall conform to the Base Definitions volume of
POSIX.1‐2008, Section 12.2, Utility Syntax Guidelines.
nals. Implementations may omit session leaders from this
list.
contents of a full listing.)
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.
long listing.)
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.
in format. This is fully described in the STDOUT section.
Multiple −o options can be specified; the format specifica‐
tion shall be interpreted as the <space>-separated concate‐
nation 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>-separated list. Terminal identifiers shall be given
in an implementation-defined format. On XSI-conformant sys‐
tems, they shall be given in one of two forms: the device's
filename (for example, 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 lo‐
gin names are given in userlist. The application shall en‐
sure that the userlist is a single argument in the form of a
<blank> or <comma>-separated list. In the listing, the nu‐
merical 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:生成完整的列表。
返回结果每个字段的含义:
UID:用户ID
PID:进程ID
PPID:父进程ID
C:CPU占用资源百分比
STIME:系统启动时间
TTY:终端的次要装置号码
COMMAND:执行的命令
解释ps aux命令中参数的含义:
- 运行ps aux:
字段解释:
a:为终端相关的所有进程写入信息
u:以用户为主的格式来显示程序状况
x:显示所有程序,不以终端机来区分
PGID:进程组ID
COMMAND:所执行的指令
四、通过该实验产生新的疑问及解答
主要遇到三个问题:
1、进入cygwin后发现用户名的格式不符合要求,然后参照百度,在cygwin中输入mkpasswd -l > /etc/passwd 生成password文件,再在etc目录下
修改该文件中最后一行的三个用户名并保存,最后在home目录下添加一个用户名的文件夹即可。
2.输入man ps查询手册时显示没有ps的手册目录条,之后在网上下载了一个man的文件解压后添加到share目录下并把原来的man文件夹删除即可。
3.输入ps -ef命令后发现uid最后的一个字母消失,刚开始觉得可能是修改用户名的时候漏了一个字母,但后来发现并未遗漏,多次尝试修改之后没有变化,
个人认为是uid的字符串长度限制导致最后的一个字母被省去。
来源:https://www.cnblogs.com/numbed/p/12424109.html