OS第1次实验报告:熟悉使用Linux命令和剖析ps命令
- 姓名:祁翌炀
- 学号:201821121019
- 班级:计算1811
1. 实验环境介绍
给出实验环境:
- 操作系统:Linux kali Debian 8.x.64
- 平台:VMware 15
2. 常用命令使用
1、创建文件
2、删除、复制文件或者更改目录
3、修改文件里面内容
保存后存在
4、ping自己主机
3. 剖析ps命令
运行man ps
,将ps
使用方法拷贝过来,比如:
Usage:
ps [options]
ps [options]
Basic options:
-A, -e all processes
-a all with tty, except session leaders
a all with tty, including other users
-d all except session leaders
-N, --deselect negate selection
r only running processes
T all processes on this terminal
x processes without controlling ttys
-A, -e all processes
-a all with tty, except session leaders
a all with tty, including other users
-d all except session leaders
-N, --deselect negate selection
r only running processes
T all processes on this terminal
x processes without controlling ttys
Output formats:
-F extra full
-f full-format, including command lines
f, --forest ascii art process tree
-H show process hierarchy
-j jobs format
j BSD job control format
-l long format
l BSD long format
-M, Z add security data (for SELinux)
-O <format> preloaded with default columns
O <format> as -O, with BSD personality
-o, o, --format <format>
user-defined format
s signal format
u user-oriented format
v virtual memory format
X register format
-y do not show flags, show rss vs. addr (used with -l)
--context display security context (for SELinux)
--headers repeat header lines, one per page
-F extra full
-f full-format, including command lines
f, --forest ascii art process tree
-H show process hierarchy
-j jobs format
j BSD job control format
-l long format
l BSD long format
-M, Z add security data (for SELinux)
-O <format> preloaded with default columns
O <format> as -O, with BSD personality
-o, o, --format <format>
user-defined format
s signal format
u user-oriented format
v virtual memory format
X register format
-y do not show flags, show rss vs. addr (used with -l)
--context display security context (for SELinux)
--headers repeat header lines, one per page
Usage:
ps [options]
ps [options]
Selection by list:
-C <command> command name
-G, --Group <GID> real group id or name
-g, --group <group> session or effective group name
-p, p, --pid <PID> process id
--ppid <PID> parent process id
-q, q, --quick-pid <PID>
process id (quick mode)
-s, --sid <session> session id
-t, t, --tty <tty> terminal
-u, U, --user <UID> effective user id or name
-U, --User <UID> real user id or name
-C <command> command name
-G, --Group <GID> real group id or name
-g, --group <group> session or effective group name
-p, p, --pid <PID> process id
--ppid <PID> parent process id
-q, q, --quick-pid <PID>
process id (quick mode)
-s, --sid <session> session id
-t, t, --tty <tty> terminal
-u, U, --user <UID> effective user id or name
-U, --User <UID> real user id or name
The selection options take as their argument either:
a comma-separated list e.g. '-u root,nobody' or
a blank-separated list e.g. '-p 123 4567'
a comma-separated list e.g. '-u root,nobody' or
a blank-separated list e.g. '-p 123 4567'
运行 ps-ef
-e:显示所有进程
-f:显示完整的进程属性
UID:该进程所占用的UID
PID:进程的编号
PPID:进程的父级编号
C:占用了多少CPU
STIME:进程开始运行的时间(很多都是刚开机的时候就运行了)
TTY:运行此进程的终端类型
TIME:运行操作了多久(很多为0的是就绪中)其他有数字的为运行中
CMD:该进程所属的文件目录
2、运行 ps -aux
UESR:用户名
CPU:CPU占有率
MEM:内存占有率
VSZ:虚拟内存量
RSS:固定内存量
STAT:进程状态
START:进程开始时间
3、运行 ps -u root (我有两个账户 一个为我的名字 一个是根名字)
ps 就是显示进程
-u:user指定用户
root:为用户名
4. 通过该实验产生新的疑问及解答
1、我打man ps的时候出现了非常多的选项,就很多的参数,有些地方感觉重复,有些地方看的也不是很懂
但是我用ls --help的时候就非常清楚 man ls的时候就不是很清楚。估计是自己看的太少了。我一般查看帮助都是用的是--help但是ps 必须在后面加上已知参数才可以进行查看帮助
2、对于vim的编辑用法不是很了解,后面用:i插入 :q! 退出 :wq 保存并且退出。
3、对于ps运用的还是不够熟练,我试了很多的参数但是不知道有些是否能多参数进行运作,我利用了一下--help,发现他给的是简单介绍和List介绍。最后在--help all 找到了最为详细的操作类型以及整体的公式 为 ps -xxxx 这样类型的