• OS第1次实验报告:熟悉使用Linux命令和剖析ps命令


    姓名:张越

    班级:计算1811

    学号:201821121006

    1. 实验环境介绍

    给出实验环境:

    • 操作系统:ubuntu-18.04.4
    • 平台:虚拟机

    2. 常用命令使用

    1.sudo su(进入特权模式)

    2.ls(显示文件夹下文件)

    3.cd+文件名(打开文件)

    4.mkdir+文件名(创建文件)

    5.rmdir+文件名(删除文件)

    登录界面:

    常用的命令使用;

    3:剖析PS命令:

    man ps运行:执行结果如下:

    PS(1) User Commands PS(1)
    
    NAME
    ps - report a snapshot of the current processes.
    
    SYNOPSIS
    ps [options]
    
    DESCRIPTION
    ps displays information about a selection of the active processes. If
    you want a repetitive update of the selection and the displayed
    information, use top(1) instead.
    
    This version of ps accepts several kinds of options:
    
    1 UNIX options, which may be grouped and must be preceded by a dash.
    2 BSD options, which may be grouped and must not be used with a dash.
    3 GNU long options, which are preceded by two dashes
    

    执ps -ef指令,运行结果如下:

    root@yuezhang-virtual-machine:/home/yuezhang/Music# ps -ef
    UID         PID   PPID  C STIME TTY          TIME CMD
    root          1      0  0 01:23 ?        00:00:06 /sbin/init splash
    root          2      0  0 01:23 ?        00:00:00 [kthreadd]
    root          3      2  0 01:23 ?        00:00:00 [rcu_gp]
    root          4      2  0 01:23 ?        00:00:00 [rcu_par_gp]
    root          6      2  0 01:23 ?        00:00:00 [kworker/0:0H-kb]
    root          9      2  0 01:23 ?        00:00:00 [mm_percpu_wq]
    root         10      2  0 01:23 ?        00:00:00 [ksoftirqd/0]
    root         11      2  0 01:23 ?        00:00:01 [rcu_sched]
    root         12      2  0 01:23 ?        00:00:00 [migration/0]
    root         13      2  0 01:23 ?        00:00:00 [idle_inject/0]
    root         14      2  0 01:23 ?        00:00:00 [cpuhp/0]
    root         15      2  0 01:23 ?        00:00:00 [kdevtmpfs]
    root         16      2  0 01:23 ?        00:00:00 [netns]
    root         17      2  0 01:23 ?        00:00:00 [rcu_tasks_kthre]
    root         18      2  0 01:23 ?        00:00:00 [kauditd]
    root         19      2  0 01:23 ?        00:00:00 [khungtaskd]
    root         20      2  0 01:23 ?        00:00:00 [oom_reaper]
    root         21      2  0 01:23 ?        00:00:00 [writeback]
    root         22      2  0 01:23 ?        00:00:00 [kcompactd0]
    root         23      2  0 01:23 ?        00:00:00 [ksmd]
    root         24      2  0 01:23 ?        00:00:00 [khugepaged]
    root        116      2  0 01:23 ?        00:00:00 [kintegrityd]
    root        117      2  0 01:23 ?        00:00:00 [kblockd]
    root        118      2  0 01:23 ?        00:00:00 [blkcg_punt_bio]
    root        119      2  0 01:23 ?        00:00:00 [tpm_dev_wq]
    root        120      2  0 01:23 ?        00:00:00 [ata_sff]
    root        121      2  0 01:23 ?        00:00:00 [md]
    root        122      2  0 01:23 ?        00:00:00 [edac-poller]
    root        123      2  0 01:23 ?        00:00:00 [devfreq_wq]
    root        124      2  0 01:23 ?        00:00:00 [watchdogd]
    root        127      2  0 01:23 ?        00:00:00 [kswapd0]
    root        128      2  0 01:23 ?        00:00:00 [kworker/u257:0]
    root        129      2  0 01:23 ?        00:00:00 [ecryptfs-kthrea]
    root        132      2  0 01:23 ?        00:00:00 [kthrotld]
    root        133      2  0 01:23 ?        00:00:00 [irq/24-pciehp]
    root        134      2  0 01:23 ?        00:00:00 [irq/25-pciehp]
    root        135      2  0 01:23 ?        00:00:00 [irq/26-pciehp]
    root        136      2  0 01:23 ?        00:00:00 [irq/27-pciehp]
    root        137      2  0 01:23 ?        00:00:00 [irq/28-pciehp]
    root        138      2  0 01:23 ?        00:00:00 [irq/29-pciehp]
    root        139      2  0 01:23 ?        00:00:00 [irq/30-pciehp]
    root        140      2  0 01:23 ?        00:00:00 [irq/31-pciehp]
    root        141      2  0 01:23 ?        00:00:00 [irq/32-pciehp]
    

    执行ps -aux指令,结果如下:

    root@yuezhang-virtual-machine:/home/yuezhang/Music# ps -aux
    USER        PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND
    root          1  0.3  0.4 160060  8860 ?        Ss   01:23   0:06 /sbin/init splash
    root          2  0.0  0.0      0     0 ?        S    01:23   0:00 [kthreadd]
    root          3  0.0  0.0      0     0 ?        I<   01:23   0:00 [rcu_gp]
    root          4  0.0  0.0      0     0 ?        I<   01:23   0:00 [rcu_par_gp]
    root          6  0.0  0.0      0     0 ?        I<   01:23   0:00 [kworker/0:0H-kb]
    root          9  0.0  0.0      0     0 ?        I<   01:23   0:00 [mm_percpu_wq]
    root         10  0.0  0.0      0     0 ?        S    01:23   0:00 [ksoftirqd/0]
    root         11  0.1  0.0      0     0 ?        I    01:23   0:01 [rcu_sched]
    root         12  0.0  0.0      0     0 ?        S    01:23   0:00 [migration/0]
    root         13  0.0  0.0      0     0 ?        S    01:23   0:00 [idle_inject/0]
    root         14  0.0  0.0      0     0 ?        S    01:23   0:00 [cpuhp/0]
    root         15  0.0  0.0      0     0 ?        S    01:23   0:00 [kdevtmpfs]
    root         16  0.0  0.0      0     0 ?        I<   01:23   0:00 [netns]
    root         17  0.0  0.0      0     0 ?        S    01:23   0:00 [rcu_tasks_kthre]
    root         18  0.0  0.0      0     0 ?        S    01:23   0:00 [kauditd]
    root         19  0.0  0.0      0     0 ?        S    01:23   0:00 [khungtaskd]
    root         20  0.0  0.0      0     0 ?        S    01:23   0:00 [oom_reaper]
    root         21  0.0  0.0      0     0 ?        I<   01:23   0:00 [writeback]
    root         22  0.0  0.0      0     0 ?        S    01:23   0:00 [kcompactd0]
    root         23  0.0  0.0      0     0 ?        SN   01:23   0:00 [ksmd]
    root         24  0.0  0.0      0     0 ?        SN   01:23   0:00 [khugepaged]
    root        116  0.0  0.0      0     0 ?        I<   01:23   0:00 [kintegrityd]
    root        117  0.0  0.0      0     0 ?        I<   01:23   0:00 [kblockd]
    root        118  0.0  0.0      0     0 ?        I<   01:23   0:00 [blkcg_punt_bio]
    root        119  0.0  0.0      0     0 ?        I<   01:23   0:00 [tpm_dev_wq]
    root        120  0.0  0.0      0     0 ?        I<   01:23   0:00 [ata_sff]
    root        121  0.0  0.0      0     0 ?        I<   01:23   0:00 [md]
    root        122  0.0  0.0      0     0 ?        I<   01:23   0:00 [edac-poller]
    root        123  0.0  0.0      0     0 ?        I<   01:23   0:00 [devfreq_wq]
    root        124  0.0  0.0      0     0 ?        S    01:23   0:00 [watchdogd]
    root        127  0.0  0.0      0     0 ?        S    01:23   0:00 [kswapd0]
    root        128  0.0  0.0      0     0 ?        I<   01:23   0:00 [kworker/u257:0]
    root        129  0.0  0.0      0     0 ?        S    01:23   0:00 [ecryptfs-kthrea]
    root        132  0.0  0.0      0     0 ?        I<   01:23   0:00 [kthrotld]
    root        133  0.0  0.0      0     0 ?        S    01:23   0:00 [irq/24-pciehp]
    root        134  0.0  0.0      0     0 ?        S    01:23   0:00 [irq/25-pciehp]
    root        135  0.0  0.0      0     0 ?        S    01:23   0:00 [irq/26-pciehp]
    root        136  0.0  0.0      0     0 ?        S    01:23   0:00 [irq/27-pciehp]
    root        137  0.0  0.0      0     0 ?        S    01:23   0:00 [irq/28-pciehp]
    root        138  0.0  0.0      0     0 ?        S    01:23   0:00 [irq/29-pciehp]
    root        139  0.0  0.0      0     0 ?        S    01:23   0:00 [irq/30-pciehp]
    root        140  0.0  0.0      0     0 ?        S    01:23   0:00 [irq/31-pciehp]
    root        141  0.0  0.0      0     0 ?        S    01:23   0:00 [irq/32-pciehp]
    root        142  0.0  0.0      0     0 ?        S    01:23   0:00 [irq/33-pciehp]
    root        143  0.0  0.0      0     0 ?        S    01:23   0:00 [irq/34-pciehp]
    root        144  0.0  0.0      0     0 ?        S    01:23   0:00 [irq/35-pciehp]
    root        145  0.0  0.0      0     0 ?        S    01:23   0:00 [irq/36-pciehp]
    root        146  0.0  0.0      0     0 ?        S    01:23   0:00 [irq/37-pciehp]
    root        147  0.0  0.0      0     0 ?        S    01:23   0:00 [irq/38-pciehp]
    root        148  0.0  0.0      0     0 ?        S    01:23   0:00 [irq/39-pciehp]
    root        149  0.0  0.0      0     0 ?        S    01:23   0:00 [irq/40-pciehp]
    root        150  0.0  0.0      0     0 ?        S    01:23   0:00 [irq/41-pciehp]
    root        151  0.0  0.0      0     0 ?        S    01:23   0:00 [irq/42-pciehp]
    root        152  0.0  0.0      0     0 ?        S    01:23   0:00 [irq/43-pciehp]
    root        153  0.0  0.0      0     0 ?        S    01:23   0:00 [irq/44-pciehp]
    root        154  0.0  0.0      0     0 ?        S    01:23   0:00 [irq/45-pciehp]
    root        155  0.0  0.0      0     0 ?        S    01:23   0:00 [irq/46-pciehp]
    root        156  0.0  0.0      0     0 ?        S    01:23   0:00 [irq/47-pciehp]
    root        157  0.0  0.0      0     0 ?        S    01:23   0:00 [irq/48-pciehp]
    root        158  0.0  0.0      0     0 ?        S    01:23   0:00 [irq/49-pciehp]
    

     解释各个参数的意义:

    ps:查看进程命令

    -e:显示所有进程。

    -f:全格式。

    -h:不显示标题。

    -l:长格式。

    -w:宽输出。

    -a:显示终端上的所有进程,包括其他用户的进程。

    -r:只显示正在运行的进程。

    -x:显示没有控制终端的进程。

    -help:显示帮助信息。

    -version:显示该命令的版本信息。

    -ef 返回字段以及意义。

    UESR:用户名

    %CPU:CPU占用的百分比

    %MEM:该程序占用内存的百分比

    VSZ:占用虚拟内存量

    RSS:占用固定内存量

    STAT:进程的状态

    START:该进程被触发启动的时间

     

    UID         PID   PPID  C STIME TTY          TIME CMD
    

      

    UID 程序被该用户身份所拥有

    PID 这个程序的 ID

    PPID 是其上级父程序的ID

    C CPU使用的资源百分比

    STIME 系统启动时间

    TTY 登入者的终端机位置

    TIME 使用掉的CPU时间。

    CMD 所下达的指令,以及参数

    4. 通过该实验产生新的疑问及解答

    第一次使用虚拟机做实验,感觉不是很习惯,我也是第一次知道ubuntu中的文件复制跟windows系统是不通用的,后来下载了VMware tool才可以。

  • 相关阅读:
    Prestashop-1.6.1.6-zh_CN (Openlogic CentOS 7.2)
    青石B2C商城
    装ubuntu的坑
    欧式空间和欧式距离、曼哈顿距离
    卷积神经网络入门
    pointnet++论文的翻译
    度量空间
    ppt演讲者视图不可用的解决办法
    pointnet
    Your CPU supports instructions that this TensorFlow binary was not compiled to use: AVX2 AVX512F FMA
  • 原文地址:https://www.cnblogs.com/hltz/p/12434402.html
Copyright © 2020-2023  润新知