zoukankan      html  css  js  c++  java
  • 查看进程

    查看进程

    ps aux|less

    一条命令产生一个进程

    USER        PID %CPU %MEM    VSZ   RSS TTY      STAT START   TIME COMMAND

    root          1  0.0  0.3 125348  3704 ?        Ss   17:44   0:01 /usr/lib/systemd/systemd --switched-root --system --deserialize 21

    root          2  0.0  0.0      0     0 ?        S    17:44   0:00 [kthreadd]

    root          3  0.0  0.0      0     0 ?        S    17:44   0:00 [ksoftirqd/0]

    root          5  0.0  0.0      0     0 ?        S<   17:44   0:00 [kworker/0:0H]

    root          6  0.0  0.0      0     0 ?        S    17:44   0:00 [kworker/u256:0]

    root          7  0.0  0.0      0     0 ?        S    17:44   0:00 [migration/0]

    root          8  0.0  0.0      0     0 ?        S    17:44   0:00 [rcu_bh]

    root          9  0.0  0.0      0     0 ?    

    从结果中过滤出(找出某条信息)用grep

    [root@localhost ~]# ps aux | grep gnome

    root       1357  0.0  0.3 315272  3832 ?        Sl   17:45   0:00 /usr/bin/gnome-keyring-daemon --daemonize --login

    root       1364  0.0  0.8 827092  8072 ?        Ssl  17:45   0:00 /usr/libexec/gnome-session-binary --session gnome-classic

    root       1526  0.0  0.0  51332   584 ?        Ss   17:45   0:00 /usr/bin/ssh-agent /bin/sh -c exec -l /bin/bash -c "env GNOME_SHELL_SESSION_MODE=classic gnome-session --session gnome-classic"

    杀程序,-9就是强制杀死

    kill -9

    kill -9 4643

    kill -9 firefox

    [root@localhost 桌面]# kill -9 4643

    [root@localhost 桌面]# pkill -9 firefox

    如果某个程序占用资源很多,先查查哪个程序,发现3231这个id的程序,所以杀了kill 3231

    [root@localhost /]# ps aux | grep txt

    root       3005  7.9  0.1 151300  1888 pts/0    T    07:54   1:07 vim aa.txt

    root       3028  0.0  0.3 152144  3012 pts/0    T    07:56   0:00 vim b.txt

    root       3035  0.0  0.2 151532  2348 pts/0    T    07:56   0:00 vim c.txt

    root       3231 17.7 51.6 665988 516544 pts/1   S+   08:03   1:01 vim /c.txt

    root       3309  0.0  0.0 112676   980 pts/0    R+   08:08   0:00 grep --color=auto txt

    [root@localhost /]# kill 3231

    [root@localhost /]#

     

    让firefox在后台运行,不影响进程,就用

    firefox &

    查看进程树

    pstree

    pstree root

    测试硬盘的写速度:(不过不够准确) bs=1G count=1意思是写1个为1G的block,如果bs=1G count=2就是2个1G的block,也就是2G

    if=input fale bs=block size

    dd if=/dev/zero of=/a.txt bs=1G count=1

    [root@localhost 桌面]# dd if=/dev/zero of=/a.txt bs=1G count=1

    记录了1+0 的读入

    记录了1+0 的写出

    1073741824字节(1.1 GB)已复制,44.8114 秒,24.0 MB/秒

    [root@localhost ~]# ll /a.txt

    -rw-r--r-- 2 root root 1.0G 10月 29 22:48 /a.txt

    [root@localhost ~]#

     

  • 相关阅读:
    要发布游戏啦,平台要 3000个6位不重复的验证码 看我怎么做!!!
    数字化婚姻配对尝试
    java 和 .NET 的 类继承方面 的不同
    Asp.Net Core 实现谷歌翻译ApI 免费版
    Asp.Net Core 全局模型验证
    Asp.Net Core 下 Newtonsoft.Json 转换字符串 null 替换成string.Empty
    Windows 10 远程连接出现函数错误 【这可能由于CredSSP加密Oracle修正】
    矫正系统时间
    linux 安装WildFly 及可能遇到的问题
    ubuntu 安装 jdk-7
  • 原文地址:https://www.cnblogs.com/jensenxie/p/7815287.html
Copyright © 2011-2022 走看看