chenchuang 2020-03-05
班级:计算1811
姓名:罗廷杨
学号:201821121013
1.操作系统:Ubuntu 18.04.4 LTS
2.平台:虚拟机
1.pwd:查看当前所在目录
2.cd+路径:进入该路径
3.cd ..:返回上级
4.ls:查看当前目录下的文件
5.touch+文件名:创建文件
6.rm+文件名:删除文件
7.mkdir+文件夹名:创建文件夹
8.rmdir+文件夹名:删除文件夹
运行man ps
,将ps
部分使用方法拷贝过来:
EXAMPLES To see every process on the system using standard syntax: ps -e ps -ef ps -eF ps -ely To see every process on the system using BSD syntax: ps ax ps axu To print a process tree: ps -ejH ps axjf To get info about threads: ps -eLf ps axms To get security info: ps -eo euser,ruser,suser,fuser,f,comm,label ps axZ ps -eM To see every process running as root (real & effective ID) in user format: ps -U root -u root u To see every process with a user-defined format: ps -eo pid,tid,class,rtprio,ni,pri,psr,pcpu,stat,wchan:14,comm ps axo stat,euid,ruid,tty,tpgid,sess,pgrp,ppid,pid,pcpu,comm ps -Ao pid,tt,user,fname,tmout,f,wchan Print only the process IDs of syslogd: ps -C syslogd -o pid= Print only the name of PID 42: ps -q 42 -o comm=
ps命令的部分参数
SIMPLE PROCESS SELECTION a Lift the BSD-style "only yourself" restriction, which is imposed upon the set of all processes when some BSD-style (without "-") options are used or when the ps personality setting is BSD-like. The set of processes selected in this manner is in addition to the set of processes selected by other means. An alternate description is that this option causes ps to list all processes with a terminal (tty), or to list all processes when used together with the x option. -A Select all processes. Identical to -e. -a Select all processes except both session leaders (see getsid(2)) and processes not associated with a terminal. -d Select all processes except session leaders. --deselect Select all processes except those that fulfill the specified conditions (negates the selection). Identical to -N. -e Select all processes. Identical to -A. g Really all, even session leaders. This flag is obsolete and may be discontinued in a future release. It is normally implied by the a flag, and is only useful when operating in the sunos4 personality. -N Select all processes except those that fulfill the specified conditions (negates the selection). Identical to --deselect. T Select all processes associated with this terminal. Identical to the t option without any argument. r Restrict the selection to only running processes. x Lift the BSD-style "must have a tty" restriction, which is imposed upon the set of all processes when some BSD-style (without "-") options are used or when the ps personality setting is BSD-like. The set of processes selected in this manner is in addition to the set of processes selected by other means. An alternate description is that this option causes ps to list all processes owned by you (same EUID as ps), or to list all processes when used together with the a option.
ps
命令有很多参数,运行命令,比如ps -eF
,则系统返回如下结果:
:~$ ps -eF UID PID PPID C SZ RSS PSR STIME TTY TIME CMD root 1 0 0 39924 9104 0 20:35 ? 00:00:04 /sbin/init splash
解释命令中参数的含义:
-e:选择所有进程。与-A相同。
-F:输出额外完整的格式列表。
对字段的解释:
UID: 代表执行者身份
PID: 进程的ID号
PPID: 父进程的ID
C: CPU使用的资源百分比
SZ: 使用的内存大小
RSS: 该进程占用的固定的内存量 (Kbytes)
PSR: 当前程序状态寄存
STIME: 系统启动时间
TTY: 终端的次要装置号码,该进程是在终端机上面运作,若与终端机无关,则显示 ?。
TIME: 使用的 CPU 时间
CMD: 所下达的指令名称
运行命令ps -aux,则系统返回结果为:
:~$ ps -aux USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND root 1 0.0 0.4 159696 9104 ? Ss 20:35 0:04 /sbin/init splash
解释命令中参数的含义:
-a: 显示现行终端机下的所有程序,包括其他用户的程序
-u: 显示现行终端机下的所有程序,包括其他用户的程序
-x: 显示所有程序,不以终端机来区分
对字段的解释(上文解释过的字段不在解释):
USER: 进程拥有者
%CPU: 占用的 CPU 使用率
%MEM: 占用的记忆体使用率
VSZ: 占用的虚拟记忆体大小
RSS: 占用的记忆体大小
STAT: 该行程的状态,linux的进程有5种状态:
– D 不可中断 uninterruptible sleep (usually IO)
– R 运行 runnable (on run queue)
– S 中断 sleeping
– T 停止 traced or stopped
– Z 僵死 a defunct (”zombie”) process
– 注: 其它状态还包括W(无驻留页), <(高优先级进程), N(低优先级进程), L( 内存锁页).
START: 行程开始时间
COMMAND:所执行的指令
问题:在VMWare Workstation中,安装Ubuntu虚拟机后屏幕非常的小,可用性很差。
解决方法:安装VMWare Tools工具,先连接上CD/DVD,然后点击虚拟机,找到安装VMWare Tools工具,点击进行安装。此后在Ubuntu中就会出现VMWare Tools工具的安装包,然后利用终端进入对应的路径,对其进行解压安装,安装完成后就可以自动调整虚拟机的屏幕大小,而且可以利用复制粘贴与物理机实现文件的交互。