熟练Linux命令行操作
man
查询命令使用手册运行man ps
,将ps
使用方法拷贝过来
1 NAME 2 ps - report a snapshot of the current 3 processes. 4 5 SYNOPSIS 6 ps [options] 7 8 DESCRIPTION 9 ps displays information about a selection of 10 the active processes. If you want a 11 repetitive update of the selection and the 12 displayed information, use top(1) instead. 13 14 This version of ps accepts several kinds of 15 options: 16 17 1 UNIX options, which may be grouped and 18 must be preceded by a dash. 19 2 BSD options, which may be grouped and 20 must not be used with a dash. 21 3 GNU long options, which are preceded by 22 two dashes. 23 24 Options of different types may be freely 25 mixed, but conflicts can appear. There are 26 some synonymous options, which are 27 functionally identical, due to the many 28 standards and ps implementations that this ps 29 is compatible with. 30 31 Note that "ps -aux" is distinct from 32 "ps aux". The POSIX and UNIX standards 33 require that "ps -aux" print all processes 34 owned by a user named "x", as well as 35 printing all processes that would be selected 36 by the -a option. If the user named "x" does 37 not exist, this ps may interpret the command 38 as "ps aux" instead and print a warning. 39 This behavior is intended to aid in 40 transitioning old scripts and habits. It is 41 fragile, subject to change, and thus should 42 not be relied upon.
运行命令ps -ef
1 UID PID PPID C STIME TTY TIME CMD 2 root 1 0 0 13:04 ? 00:00:00 /init 3 root 7 1 0 13:04 tty1 00:00:00 /init 4 aalud 8 7 0 13:04 tty1 00:00:00 -bash 5 aalud 84 8 0 13:19 tty1 00:00:00 ps -ef
运行ps -aux
1 USER PID %CPU %MEM VSZ RSS TTY STAT START TIME COMMAND 2 root 1 0.0 0.0 8892 292 ? Ssl 13:04 0:00 /init 3 root 7 0.0 0.0 8900 208 tty1 Ss 13:04 0:00 /init 4 aalud 8 0.0 0.0 16792 3380 tty1 S 13:04 0:00 -bash 5 aalud 85 0.0 0.0 17648 2052 tty1 R 13:26 0:00 ps -aux
由于ubuntu是在该课程前就安装的,所以用户名是自己的ID。然后老师要求前缀要带自己姓名,所以就直接改了主机名,方法:计算机→属性→计算机名更改设置→更改→输入名→确认→重启电脑→修改生效。
原文:https://www.cnblogs.com/Diolee/p/12433847.html